190075Sobrien@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2169689Skan@c 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. 390075Sobrien@c This is part of the GCC manual. 490075Sobrien@c For copying conditions, see the file gcc.texi. 590075Sobrien 690075Sobrien@ignore 7169689Skan@c man begin INCLUDE 8169689Skan@include gcc-vers.texi 9169689Skan@c man end 10169689Skan 1190075Sobrien@c man begin COPYRIGHT 12169689SkanCopyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 13169689Skan1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. 1490075Sobrien 1590075SobrienPermission is granted to copy, distribute and/or modify this document 16117395Skanunder the terms of the GNU Free Documentation License, Version 1.2 or 1790075Sobrienany later version published by the Free Software Foundation; with the 1890075SobrienInvariant Sections being ``GNU General Public License'' and ``Funding 1990075SobrienFree Software'', the Front-Cover texts being (a) (see below), and with 2090075Sobrienthe Back-Cover Texts being (b) (see below). A copy of the license is 2190075Sobrienincluded in the gfdl(7) man page. 2290075Sobrien 2390075Sobrien(a) The FSF's Front-Cover Text is: 2490075Sobrien 2590075Sobrien A GNU Manual 2690075Sobrien 2790075Sobrien(b) The FSF's Back-Cover Text is: 2890075Sobrien 2990075Sobrien You have freedom to copy and modify this GNU Manual, like GNU 3090075Sobrien software. Copies published by the Free Software Foundation raise 3190075Sobrien funds for GNU development. 3290075Sobrien@c man end 3390075Sobrien@c Set file name and title for the man page. 3490075Sobrien@setfilename gcc 3590075Sobrien@settitle GNU project C and C++ compiler 3690075Sobrien@c man begin SYNOPSIS 3790075Sobriengcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}] 3890075Sobrien [@option{-g}] [@option{-pg}] [@option{-O}@var{level}] 3990075Sobrien [@option{-W}@var{warn}@dots{}] [@option{-pedantic}] 4090075Sobrien [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}] 4190075Sobrien [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}] 4290075Sobrien [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}] 43169689Skan [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{} 4490075Sobrien 4590075SobrienOnly the most useful options are listed here; see below for the 4690075Sobrienremainder. @samp{g++} accepts mostly the same options as @samp{gcc}. 4790075Sobrien@c man end 4890075Sobrien@c man begin SEEALSO 4990075Sobriengpl(7), gfdl(7), fsf-funding(7), 50169689Skancpp(1), gcov(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1) 51169689Skanand the Info entries for @file{gcc}, @file{cpp}, @file{as}, 5290075Sobrien@file{ld}, @file{binutils} and @file{gdb}. 5390075Sobrien@c man end 5490075Sobrien@c man begin BUGS 5590075SobrienFor instructions on reporting bugs, see 56169689Skan@w{@uref{http://gcc.gnu.org/bugs.html}}. 5790075Sobrien@c man end 5890075Sobrien@c man begin AUTHOR 5990075SobrienSee the Info entry for @command{gcc}, or 6090075Sobrien@w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}}, 6190075Sobrienfor contributors to GCC@. 6290075Sobrien@c man end 6390075Sobrien@end ignore 6490075Sobrien 6590075Sobrien@node Invoking GCC 6690075Sobrien@chapter GCC Command Options 6790075Sobrien@cindex GCC command options 6890075Sobrien@cindex command options 6990075Sobrien@cindex options, GCC command 7090075Sobrien 7190075Sobrien@c man begin DESCRIPTION 7290075SobrienWhen you invoke GCC, it normally does preprocessing, compilation, 7390075Sobrienassembly and linking. The ``overall options'' allow you to stop this 7490075Sobrienprocess at an intermediate stage. For example, the @option{-c} option 7590075Sobriensays not to run the linker. Then the output consists of object files 7690075Sobrienoutput by the assembler. 7790075Sobrien 7890075SobrienOther options are passed on to one stage of processing. Some options 7990075Sobriencontrol the preprocessor and others the compiler itself. Yet other 8090075Sobrienoptions control the assembler and linker; most of these are not 8190075Sobriendocumented here, since you rarely need to use any of them. 8290075Sobrien 8390075Sobrien@cindex C compilation options 8490075SobrienMost of the command line options that you can use with GCC are useful 8590075Sobrienfor C programs; when an option is only useful with another language 8690075Sobrien(usually C++), the explanation says so explicitly. If the description 8790075Sobrienfor a particular option does not mention a source language, you can use 8890075Sobrienthat option with all supported languages. 8990075Sobrien 9090075Sobrien@cindex C++ compilation options 9190075Sobrien@xref{Invoking G++,,Compiling C++ Programs}, for a summary of special 9290075Sobrienoptions for compiling C++ programs. 9390075Sobrien 9490075Sobrien@cindex grouping options 9590075Sobrien@cindex options, grouping 9690075SobrienThe @command{gcc} program accepts options and file names as operands. Many 9790075Sobrienoptions have multi-letter names; therefore multiple single-letter options 9890075Sobrienmay @emph{not} be grouped: @option{-dr} is very different from @w{@samp{-d 9990075Sobrien-r}}. 10090075Sobrien 10190075Sobrien@cindex order of options 10290075Sobrien@cindex options, order 10390075SobrienYou can mix options and other arguments. For the most part, the order 10490075Sobrienyou use doesn't matter. Order does matter when you use several options 10590075Sobrienof the same kind; for example, if you specify @option{-L} more than once, 10690075Sobrienthe directories are searched in the order specified. 10790075Sobrien 10890075SobrienMany options have long names starting with @samp{-f} or with 109169689Skan@samp{-W}---for example, 110169689Skan@option{-fmove-loop-invariants}, @option{-Wformat} and so on. Most of 11190075Sobrienthese have both positive and negative forms; the negative form of 11290075Sobrien@option{-ffoo} would be @option{-fno-foo}. This manual documents 11390075Sobrienonly one of these two forms, whichever one is not the default. 11490075Sobrien 11590075Sobrien@c man end 11690075Sobrien 11790075Sobrien@xref{Option Index}, for an index to GCC's options. 11890075Sobrien 11990075Sobrien@menu 12090075Sobrien* Option Summary:: Brief list of all options, without explanations. 12190075Sobrien* Overall Options:: Controlling the kind of output: 12290075Sobrien an executable, object files, assembler files, 12390075Sobrien or preprocessed source. 12490075Sobrien* Invoking G++:: Compiling C++ programs. 12590075Sobrien* C Dialect Options:: Controlling the variant of C language compiled. 12690075Sobrien* C++ Dialect Options:: Variations on C++. 12790075Sobrien* Language Independent Options:: Controlling how diagnostics should be 12890075Sobrien formatted. 12990075Sobrien* Warning Options:: How picky should the compiler be? 13090075Sobrien* Debugging Options:: Symbol tables, measurements, and debugging dumps. 13190075Sobrien* Optimize Options:: How much optimization? 13290075Sobrien* Preprocessor Options:: Controlling header files and macro definitions. 13390075Sobrien Also, getting dependency information for Make. 13490075Sobrien* Assembler Options:: Passing options to the assembler. 13590075Sobrien* Link Options:: Specifying libraries and so on. 13690075Sobrien* Directory Options:: Where to find header files and libraries. 13790075Sobrien Where to find the compiler executable files. 13890075Sobrien* Spec Files:: How to pass switches to sub-processes. 13990075Sobrien* Target Options:: Running a cross-compiler, or an old version of GCC. 14090075Sobrien* Submodel Options:: Specifying minor hardware or convention variations, 14190075Sobrien such as 68010 vs 68020. 14290075Sobrien* Code Gen Options:: Specifying conventions for function calls, data layout 14390075Sobrien and register usage. 14490075Sobrien* Environment Variables:: Env vars that affect GCC. 145132718Skan* Precompiled Headers:: Compiling a header once, and using it many times. 14690075Sobrien* Running Protoize:: Automatically adding or removing function prototypes. 14790075Sobrien@end menu 14890075Sobrien 14990075Sobrien@c man begin OPTIONS 15090075Sobrien 15190075Sobrien@node Option Summary 15290075Sobrien@section Option Summary 15390075Sobrien 15490075SobrienHere is a summary of all the options, grouped by type. Explanations are 15590075Sobrienin the following sections. 15690075Sobrien 15790075Sobrien@table @emph 15890075Sobrien@item Overall Options 15990075Sobrien@xref{Overall Options,,Options Controlling the Kind of Output}. 160169689Skan@gccoptlist{-c -S -E -o @var{file} -combine -pipe -pass-exit-codes @gol 161169689Skan-x @var{language} -v -### --help --target-help --version @@@var{file}} 16290075Sobrien 16390075Sobrien@item C Language Options 16490075Sobrien@xref{C Dialect Options,,Options Controlling C Dialect}. 165169689Skan@gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol 166169689Skan-aux-info @var{filename} @gol 167261188Spfg@c APPLE LOCAL blocks 7205047 5811887 168261188Spfg-fno-asm -fno-blocks -fno-builtin -fno-builtin-@var{function} @gol 169169689Skan-fhosted -ffreestanding -fopenmp -fms-extensions @gol 17096263Sobrien-trigraphs -no-integrated-cpp -traditional -traditional-cpp @gol 171260074Spfg-fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol 172261188Spfg@c APPLE LOCAL nested functions 4357979 */ 173261188Spfg-fno-nested-functions @gol 17490075Sobrien-fsigned-bitfields -fsigned-char @gol 175259890Spfg@c APPLE LOCAL -Wnewline-eof 2001-08-23 --sts ** 176259890Spfg-Wnewline-eof (Apple compatible) @gol 177169689Skan-funsigned-bitfields -funsigned-char} 17890075Sobrien 17990075Sobrien@item C++ Language Options 18090075Sobrien@xref{C++ Dialect Options,,Options Controlling C++ Dialect}. 181117395Skan@gccoptlist{-fabi-version=@var{n} -fno-access-control -fcheck-new @gol 182169689Skan-fconserve-space -ffriend-injection @gol 18390075Sobrien-fno-elide-constructors @gol 184132718Skan-fno-enforce-eh-specs @gol 18590075Sobrien-ffor-scope -fno-for-scope -fno-gnu-keywords @gol 18690075Sobrien-fno-implicit-templates @gol 18790075Sobrien-fno-implicit-inline-templates @gol 18890075Sobrien-fno-implement-inlines -fms-extensions @gol 18990075Sobrien-fno-nonansi-builtins -fno-operator-names @gol 19090075Sobrien-fno-optional-diags -fpermissive @gol 19190075Sobrien-frepo -fno-rtti -fstats -ftemplate-depth-@var{n} @gol 192169689Skan-fno-threadsafe-statics -fuse-cxa-atexit -fno-weak -nostdinc++ @gol 193169689Skan-fno-default-inline -fvisibility-inlines-hidden @gol 194260074Spfg-fvisibility-ms-compat @gol 195169689Skan-Wabi -Wctor-dtor-privacy @gol 19690075Sobrien-Wnon-virtual-dtor -Wreorder @gol 197169689Skan-Weffc++ -Wno-deprecated -Wstrict-null-sentinel @gol 19890075Sobrien-Wno-non-template-friend -Wold-style-cast @gol 19990075Sobrien-Woverloaded-virtual -Wno-pmf-conversions @gol 200146895Skan-Wsign-promo} 20190075Sobrien 20290075Sobrien@item Language Independent Options 20390075Sobrien@xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}. 204132718Skan@gccoptlist{-fmessage-length=@var{n} @gol 205169689Skan-fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol 206169689Skan-fdiagnostics-show-option} 20790075Sobrien 20890075Sobrien@item Warning Options 20990075Sobrien@xref{Warning Options,,Options to Request or Suppress Warnings}. 210117395Skan@gccoptlist{-fsyntax-only -pedantic -pedantic-errors @gol 211169689Skan-w -Wextra -Wall -Waddress -Waggregate-return -Wno-attributes @gol 212169689Skan-Wc++-compat -Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment @gol 21390075Sobrien-Wconversion -Wno-deprecated-declarations @gol 214169689Skan-Wdisabled-optimization -Wno-div-by-zero -Wno-endif-labels @gol 215169689Skan-Werror -Werror=* -Werror-implicit-function-declaration @gol 216169689Skan-Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol 217132718Skan-Wno-format-extra-args -Wformat-nonliteral @gol 218132718Skan-Wformat-security -Wformat-y2k @gol 219132718Skan-Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol 220132718Skan-Wimport -Wno-import -Winit-self -Winline @gol 221169689Skan-Wno-int-to-pointer-cast @gol 222132718Skan-Wno-invalid-offsetof -Winvalid-pch @gol 223259405Spfg-Wlarger-than-@var{len} -Wframe-larger-than-@var{len} @gol 224259405Spfg-Wunsafe-loop-optimizations -Wlong-long @gol 225169689Skan-Wmain -Wmissing-braces -Wmissing-field-initializers @gol 226169689Skan-Wmissing-format-attribute -Wmissing-include-dirs @gol 227169689Skan-Wmissing-noreturn @gol 228261306Spfg@c APPLE LOCAL warn missing prototype 6261539 229261306Spfg-Wmissing-prototypes @gol 230260568Spfg@c APPLE LOCAL -Wmost 231260568Spfg-Wmost (APPLE ONLY) @gol 232169689Skan-Wno-multichar -Wnonnull -Wno-overflow @gol 233169689Skan-Woverlength-strings -Wpacked -Wpadded @gol 234169689Skan-Wparentheses -Wpointer-arith -Wno-pointer-to-int-cast @gol 235169689Skan-Wredundant-decls @gol 23690075Sobrien-Wreturn-type -Wsequence-point -Wshadow @gol 237169689Skan-Wsign-compare -Wstack-protector @gol 238169689Skan-Wstrict-aliasing -Wstrict-aliasing=2 @gol 239169689Skan-Wstrict-overflow -Wstrict-overflow=@var{n} @gol 240117395Skan-Wswitch -Wswitch-default -Wswitch-enum @gol 241117395Skan-Wsystem-headers -Wtrigraphs -Wundef -Wuninitialized @gol 242169689Skan-Wunknown-pragmas -Wno-pragmas -Wunreachable-code @gol 24390075Sobrien-Wunused -Wunused-function -Wunused-label -Wunused-parameter @gol 244259268Spfg-Wunused-value -Wunused-variable @gol 245259268Spfg-Wvariadic-macros -Wvla @gol 246169689Skan-Wvolatile-register-var -Wwrite-strings} 24790075Sobrien 24890075Sobrien@item C-only Warning Options 249117395Skan@gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol 250261306Spfg@c APPLE LOCAL warn missing prototype 6261539 251261306Spfg-Wnested-externs -Wold-style-definition @gol 252132718Skan-Wstrict-prototypes -Wtraditional @gol 253169689Skan-Wdeclaration-after-statement -Wpointer-sign} 25490075Sobrien 25590075Sobrien@item Debugging Options 25690075Sobrien@xref{Debugging Options,,Options for Debugging Your Program or GCC}. 257117395Skan@gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol 258169689Skan-fdump-noaddr -fdump-unnumbered -fdump-translation-unit@r{[}-@var{n}@r{]} @gol 25990075Sobrien-fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol 260169689Skan-fdump-ipa-all -fdump-ipa-cgraph @gol 261169689Skan-fdump-tree-all @gol 262117395Skan-fdump-tree-original@r{[}-@var{n}@r{]} @gol 263117395Skan-fdump-tree-optimized@r{[}-@var{n}@r{]} @gol 26490075Sobrien-fdump-tree-inlined@r{[}-@var{n}@r{]} @gol 265169689Skan-fdump-tree-cfg -fdump-tree-vcg -fdump-tree-alias @gol 266169689Skan-fdump-tree-ch @gol 267169689Skan-fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol 268169689Skan-fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol 269169689Skan-fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol 270169689Skan-fdump-tree-dom@r{[}-@var{n}@r{]} @gol 271169689Skan-fdump-tree-dse@r{[}-@var{n}@r{]} @gol 272169689Skan-fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol 273169689Skan-fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol 274169689Skan-fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol 275169689Skan-fdump-tree-nrv -fdump-tree-vect @gol 276169689Skan-fdump-tree-sink @gol 277169689Skan-fdump-tree-sra@r{[}-@var{n}@r{]} @gol 278169689Skan-fdump-tree-salias @gol 279169689Skan-fdump-tree-fre@r{[}-@var{n}@r{]} @gol 280169689Skan-fdump-tree-vrp@r{[}-@var{n}@r{]} @gol 281169689Skan-ftree-vectorizer-verbose=@var{n} @gol 282169689Skan-fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol 283132718Skan-feliminate-dwarf2-dups -feliminate-unused-debug-types @gol 284169689Skan-feliminate-unused-debug-symbols -femit-class-debug-always @gol 285169689Skan-fmem-report -fprofile-arcs @gol 286132718Skan-frandom-seed=@var{string} -fsched-verbose=@var{n} @gol 287169689Skan-ftest-coverage -ftime-report -fvar-tracking @gol 288132718Skan-g -g@var{level} -gcoff -gdwarf-2 @gol 28990075Sobrien-ggdb -gstabs -gstabs+ -gvms -gxcoff -gxcoff+ @gol 290259268Spfg-femit-struct-debug-baseonly -femit-struct-debug-reduced @gol 291259268Spfg-femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol 29290075Sobrien-p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol 29390075Sobrien-print-multi-directory -print-multi-lib @gol 29490075Sobrien-print-prog-name=@var{program} -print-search-dirs -Q @gol 29590075Sobrien-save-temps -time} 29690075Sobrien 29790075Sobrien@item Optimization Options 29890075Sobrien@xref{Optimize Options,,Options that Control Optimization}. 299117395Skan@gccoptlist{-falign-functions=@var{n} -falign-jumps=@var{n} @gol 30090075Sobrien-falign-labels=@var{n} -falign-loops=@var{n} @gol 301169689Skan-fbounds-check -fmudflap -fmudflapth -fmudflapir @gol 302132718Skan-fbranch-probabilities -fprofile-values -fvpt -fbranch-target-load-optimize @gol 303169689Skan-fbranch-target-load-optimize2 -fbtr-bb-exclusive @gol 304169689Skan-fcaller-saves -fcprop-registers -fcse-follow-jumps @gol 305169689Skan-fcse-skip-blocks -fcx-limited-range -fdata-sections @gol 306169689Skan-fdelayed-branch -fdelete-null-pointer-checks -fearly-inlining @gol 30790075Sobrien-fexpensive-optimizations -ffast-math -ffloat-store @gol 308169689Skan-fforce-addr -ffunction-sections @gol 309169689Skan-fgcse -fgcse-lm -fgcse-sm -fgcse-las -fgcse-after-reload @gol 310132718Skan-fcrossjumping -fif-conversion -fif-conversion2 @gol 311169689Skan-finline-functions -finline-functions-called-once @gol 312169689Skan-finline-limit=@var{n} -fkeep-inline-functions @gol 31390075Sobrien-fkeep-static-consts -fmerge-constants -fmerge-all-constants @gol 314169689Skan-fmodulo-sched -fno-branch-count-reg @gol 315169689Skan-fno-default-inline -fno-defer-pop -fmove-loop-invariants @gol 31690075Sobrien-fno-function-cse -fno-guess-branch-probability @gol 31790075Sobrien-fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol 318169689Skan-funsafe-math-optimizations -funsafe-loop-optimizations -ffinite-math-only @gol 319169689Skan-fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol 32090075Sobrien-fomit-frame-pointer -foptimize-register-move @gol 32190075Sobrien-foptimize-sibling-calls -fprefetch-loop-arrays @gol 322132718Skan-fprofile-generate -fprofile-use @gol 323169689Skan-fregmove -frename-registers @gol 324169689Skan-freorder-blocks -freorder-blocks-and-partition -freorder-functions @gol 325169689Skan-frerun-cse-after-loop @gol 326169689Skan-frounding-math -frtl-abstract-sequences @gol 327169689Skan-fschedule-insns -fschedule-insns2 @gol 328117395Skan-fno-sched-interblock -fno-sched-spec -fsched-spec-load @gol 329132718Skan-fsched-spec-load-dangerous @gol 330169689Skan-fsched-stalled-insns=@var{n} -fsched-stalled-insns-dep=@var{n} @gol 331132718Skan-fsched2-use-superblocks @gol 332169689Skan-fsched2-use-traces -fsee -freschedule-modulo-scheduled-loops @gol 333169689Skan-fsection-anchors -fsignaling-nans -fsingle-precision-constant @gol 334286713Spfg-fstack-protector -fstack-protector-all -fstack-protector-strong @gol 335169689Skan-fstrict-aliasing -fstrict-overflow -ftracer -fthread-jumps @gol 336132718Skan-funroll-all-loops -funroll-loops -fpeel-loops @gol 337169689Skan-fsplit-ivs-in-unroller -funswitch-loops @gol 338169689Skan-fvariable-expansion-in-unroller @gol 339169689Skan-ftree-pre -ftree-ccp -ftree-dce -ftree-loop-optimize @gol 340169689Skan-ftree-loop-linear -ftree-loop-im -ftree-loop-ivcanon -fivopts @gol 341169689Skan-ftree-dominator-opts -ftree-dse -ftree-copyrename -ftree-sink @gol 342169689Skan-ftree-ch -ftree-sra -ftree-ter -ftree-lrs -ftree-fre -ftree-vectorize @gol 343169689Skan-ftree-vect-loop-version -ftree-salias -fipa-pta -fweb @gol 344169689Skan-ftree-copy-prop -ftree-store-ccp -ftree-store-copy-prop -fwhole-program @gol 345132718Skan--param @var{name}=@var{value} 34690075Sobrien-O -O0 -O1 -O2 -O3 -Os} 34790075Sobrien 34890075Sobrien@item Preprocessor Options 34990075Sobrien@xref{Preprocessor Options,,Options Controlling the Preprocessor}. 350132718Skan@gccoptlist{-A@var{question}=@var{answer} @gol 351117395Skan-A-@var{question}@r{[}=@var{answer}@r{]} @gol 35290075Sobrien-C -dD -dI -dM -dN @gol 35390075Sobrien-D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol 35490075Sobrien-idirafter @var{dir} @gol 35590075Sobrien-include @var{file} -imacros @var{file} @gol 35690075Sobrien-iprefix @var{file} -iwithprefix @var{dir} @gol 35790075Sobrien-iwithprefixbefore @var{dir} -isystem @var{dir} @gol 358169689Skan-imultilib @var{dir} -isysroot @var{dir} @gol 359132718Skan-M -MM -MF -MG -MP -MQ -MT -nostdinc @gol 360132718Skan-P -fworking-directory -remap @gol 361132718Skan-trigraphs -undef -U@var{macro} -Wp,@var{option} @gol 362132718Skan-Xpreprocessor @var{option}} 36390075Sobrien 36490075Sobrien@item Assembler Option 36590075Sobrien@xref{Assembler Options,,Passing Options to the Assembler}. 366132718Skan@gccoptlist{-Wa,@var{option} -Xassembler @var{option}} 36790075Sobrien 36890075Sobrien@item Linker Options 36990075Sobrien@xref{Link Options,,Options for Linking}. 370117395Skan@gccoptlist{@var{object-file-name} -l@var{library} @gol 371169689Skan-nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol 37290075Sobrien-s -static -static-libgcc -shared -shared-libgcc -symbolic @gol 37390075Sobrien-Wl,@var{option} -Xlinker @var{option} @gol 37490075Sobrien-u @var{symbol}} 37590075Sobrien 37690075Sobrien@item Directory Options 37790075Sobrien@xref{Directory Options,,Options for Directory Search}. 378169689Skan@gccoptlist{-B@var{prefix} -I@var{dir} -iquote@var{dir} -L@var{dir} 379169689Skan-specs=@var{file} -I- --sysroot=@var{dir}} 38090075Sobrien 38190075Sobrien@item Target Options 38290075Sobrien@c I wrote this xref this way to avoid overfull hbox. -- rms 38390075Sobrien@xref{Target Options}. 384117395Skan@gccoptlist{-V @var{version} -b @var{machine}} 38590075Sobrien 38690075Sobrien@item Machine Dependent Options 38790075Sobrien@xref{Submodel Options,,Hardware Models and Configurations}. 388169689Skan@c This list is ordered alphanumerically by subsection name. 389169689Skan@c Try and put the significant identifier (CPU or system) first, 390169689Skan@c so users have a clue at guessing where the ones they want will be. 39190075Sobrien 392169689Skan@emph{ARC Options} 393169689Skan@gccoptlist{-EB -EL @gol 394169689Skan-mmangle-cpu -mcpu=@var{cpu} -mtext=@var{text-section} @gol 395169689Skan-mdata=@var{data-section} -mrodata=@var{readonly-data-section}} 39690075Sobrien 39790075Sobrien@emph{ARM Options} 398117395Skan@gccoptlist{-mapcs-frame -mno-apcs-frame @gol 399169689Skan-mabi=@var{name} @gol 40090075Sobrien-mapcs-stack-check -mno-apcs-stack-check @gol 40190075Sobrien-mapcs-float -mno-apcs-float @gol 40290075Sobrien-mapcs-reentrant -mno-apcs-reentrant @gol 40390075Sobrien-msched-prolog -mno-sched-prolog @gol 40490075Sobrien-mlittle-endian -mbig-endian -mwords-little-endian @gol 405169689Skan-mfloat-abi=@var{name} -msoft-float -mhard-float -mfpe @gol 40690075Sobrien-mthumb-interwork -mno-thumb-interwork @gol 407169689Skan-mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol 40890075Sobrien-mstructure-size-boundary=@var{n} @gol 40990075Sobrien-mabort-on-noreturn @gol 41090075Sobrien-mlong-calls -mno-long-calls @gol 41190075Sobrien-msingle-pic-base -mno-single-pic-base @gol 41290075Sobrien-mpic-register=@var{reg} @gol 41390075Sobrien-mnop-fun-dllimport @gol 414132718Skan-mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol 41590075Sobrien-mpoke-function-name @gol 41690075Sobrien-mthumb -marm @gol 41790075Sobrien-mtpcs-frame -mtpcs-leaf-frame @gol 418169689Skan-mcaller-super-interworking -mcallee-super-interworking @gol 419169689Skan-mtp=@var{name}} 42090075Sobrien 421169689Skan@emph{AVR Options} 422169689Skan@gccoptlist{-mmcu=@var{mcu} -msize -minit-stack=@var{n} -mno-interrupts @gol 423169689Skan-mcall-prologues -mno-tablejump -mtiny-stack -mint8} 42490075Sobrien 425169689Skan@emph{Blackfin Options} 426169689Skan@gccoptlist{-momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol 427169689Skan-mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol 428169689Skan-mlow-64k -mno-low64k -mid-shared-library @gol 429169689Skan-mno-id-shared-library -mshared-library-id=@var{n} @gol 430169689Skan-mlong-calls -mno-long-calls} 431169689Skan 432169689Skan@emph{CRIS Options} 433169689Skan@gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol 434169689Skan-mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol 435169689Skan-metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol 436169689Skan-mstack-align -mdata-align -mconst-align @gol 437169689Skan-m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol 438169689Skan-melf -maout -melinux -mlinux -sim -sim2 @gol 439169689Skan-mmul-bug-workaround -mno-mul-bug-workaround} 440169689Skan 441169689Skan@emph{CRX Options} 442169689Skan@gccoptlist{-mmac -mpush-args} 443169689Skan 444169689Skan@emph{Darwin Options} 445169689Skan@gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol 446169689Skan-arch_only -bind_at_load -bundle -bundle_loader @gol 447169689Skan-client_name -compatibility_version -current_version @gol 448169689Skan-dead_strip @gol 449169689Skan-dependency-file -dylib_file -dylinker_install_name @gol 450169689Skan-dynamic -dynamiclib -exported_symbols_list @gol 451169689Skan-filelist -flat_namespace -force_cpusubtype_ALL @gol 452169689Skan-force_flat_namespace -headerpad_max_install_names @gol 453169689Skan-image_base -init -install_name -keep_private_externs @gol 454169689Skan-multi_module -multiply_defined -multiply_defined_unused @gol 455169689Skan-noall_load -no_dead_strip_inits_and_terms @gol 456169689Skan-nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol 457169689Skan-pagezero_size -prebind -prebind_all_twolevel_modules @gol 458169689Skan-private_bundle -read_only_relocs -sectalign @gol 459169689Skan-sectobjectsymbols -whyload -seg1addr @gol 460169689Skan-sectcreate -sectobjectsymbols -sectorder @gol 461169689Skan-segaddr -segs_read_only_addr -segs_read_write_addr @gol 462169689Skan-seg_addr_table -seg_addr_table_filename -seglinkedit @gol 463169689Skan-segprot -segs_read_only_addr -segs_read_write_addr @gol 464169689Skan-single_module -static -sub_library -sub_umbrella @gol 465169689Skan-twolevel_namespace -umbrella -undefined @gol 466169689Skan-unexported_symbols_list -weak_reference_mismatches @gol 467169689Skan-whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol 468169689Skan-mkernel -mone-byte-bool} 469169689Skan 470169689Skan@emph{DEC Alpha Options} 471169689Skan@gccoptlist{-mno-fp-regs -msoft-float -malpha-as -mgas @gol 472169689Skan-mieee -mieee-with-inexact -mieee-conformant @gol 473169689Skan-mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol 474169689Skan-mtrap-precision=@var{mode} -mbuild-constants @gol 475169689Skan-mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol 476169689Skan-mbwx -mmax -mfix -mcix @gol 477169689Skan-mfloat-vax -mfloat-ieee @gol 478169689Skan-mexplicit-relocs -msmall-data -mlarge-data @gol 479169689Skan-msmall-text -mlarge-text @gol 480169689Skan-mmemory-latency=@var{time}} 481169689Skan 482169689Skan@emph{DEC Alpha/VMS Options} 483169689Skan@gccoptlist{-mvms-return-codes} 484169689Skan 485169689Skan@emph{FRV Options} 486169689Skan@gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol 487169689Skan-mhard-float -msoft-float @gol 488169689Skan-malloc-cc -mfixed-cc -mdword -mno-dword @gol 489169689Skan-mdouble -mno-double @gol 490169689Skan-mmedia -mno-media -mmuladd -mno-muladd @gol 491169689Skan-mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol 492169689Skan-mlinked-fp -mlong-calls -malign-labels @gol 493169689Skan-mlibrary-pic -macc-4 -macc-8 @gol 494169689Skan-mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol 495169689Skan-moptimize-membar -mno-optimize-membar @gol 496169689Skan-mscc -mno-scc -mcond-exec -mno-cond-exec @gol 497169689Skan-mvliw-branch -mno-vliw-branch @gol 498169689Skan-mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol 499169689Skan-mno-nested-cond-exec -mtomcat-stats @gol 500169689Skan-mTLS -mtls @gol 501169689Skan-mcpu=@var{cpu}} 502169689Skan 503169689Skan@emph{GNU/Linux Options} 504169689Skan@gccoptlist{-muclibc} 505169689Skan 506169689Skan@emph{H8/300 Options} 507169689Skan@gccoptlist{-mrelax -mh -ms -mn -mint32 -malign-300} 508169689Skan 509169689Skan@emph{HPPA Options} 510169689Skan@gccoptlist{-march=@var{architecture-type} @gol 511169689Skan-mbig-switch -mdisable-fpregs -mdisable-indexing @gol 512169689Skan-mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol 513169689Skan-mfixed-range=@var{register-range} @gol 514169689Skan-mjump-in-delay -mlinker-opt -mlong-calls @gol 515169689Skan-mlong-load-store -mno-big-switch -mno-disable-fpregs @gol 516169689Skan-mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol 517169689Skan-mno-jump-in-delay -mno-long-load-store @gol 518169689Skan-mno-portable-runtime -mno-soft-float @gol 519169689Skan-mno-space-regs -msoft-float -mpa-risc-1-0 @gol 520169689Skan-mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol 521169689Skan-mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol 522169689Skan-munix=@var{unix-std} -nolibdld -static -threads} 523169689Skan 524169689Skan@emph{i386 and x86-64 Options} 525169689Skan@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol 526169689Skan-mfpmath=@var{unit} @gol 527169689Skan-masm=@var{dialect} -mno-fancy-math-387 @gol 528169689Skan-mno-fp-ret-in-387 -msoft-float -msvr3-shlib @gol 529169689Skan-mno-wide-multiply -mrtd -malign-double @gol 530169689Skan-mpreferred-stack-boundary=@var{num} @gol 531255185Sjmg-mmmx -msse -msse2 -msse3 -mssse3 -msse4a -m3dnow -mpopcnt -mabm -maes @gol 532169689Skan-mthreads -mno-align-stringops -minline-all-stringops @gol 533169689Skan-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol 534169689Skan-m96bit-long-double -mregparm=@var{num} -msseregparm @gol 535169689Skan-mstackrealign @gol 536169689Skan-momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol 537169689Skan-mcmodel=@var{code-model} @gol 538169689Skan-m32 -m64 -mlarge-data-threshold=@var{num}} 539169689Skan 540169689Skan@emph{IA-64 Options} 541169689Skan@gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol 542169689Skan-mvolatile-asm-stop -mregister-names -mno-sdata @gol 543169689Skan-mconstant-gp -mauto-pic -minline-float-divide-min-latency @gol 544169689Skan-minline-float-divide-max-throughput @gol 545169689Skan-minline-int-divide-min-latency @gol 546169689Skan-minline-int-divide-max-throughput @gol 547169689Skan-minline-sqrt-min-latency -minline-sqrt-max-throughput @gol 548169689Skan-mno-dwarf2-asm -mearly-stop-bits @gol 549169689Skan-mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol 550169689Skan-mtune=@var{cpu-type} -mt -pthread -milp32 -mlp64 @gol 551169689Skan-mno-sched-br-data-spec -msched-ar-data-spec -mno-sched-control-spec @gol 552169689Skan-msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol 553169689Skan-msched-ldc -mno-sched-control-ldc -mno-sched-spec-verbose @gol 554169689Skan-mno-sched-prefer-non-data-spec-insns @gol 555169689Skan-mno-sched-prefer-non-control-spec-insns @gol 556169689Skan-mno-sched-count-spec-in-critical-path} 557169689Skan 55890075Sobrien@emph{M32R/D Options} 559132718Skan@gccoptlist{-m32r2 -m32rx -m32r @gol 560132718Skan-mdebug @gol 561132718Skan-malign-loops -mno-align-loops @gol 562132718Skan-missue-rate=@var{number} @gol 563132718Skan-mbranch-cost=@var{number} @gol 564132718Skan-mmodel=@var{code-size-model-type} @gol 565132718Skan-msdata=@var{sdata-type} @gol 566132718Skan-mno-flush-func -mflush-func=@var{name} @gol 567132718Skan-mno-flush-trap -mflush-trap=@var{number} @gol 568132718Skan-G @var{num}} 56990075Sobrien 570169689Skan@emph{M32C Options} 571169689Skan@gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}} 572169689Skan 573169689Skan@emph{M680x0 Options} 574169689Skan@gccoptlist{-m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol 575169689Skan-m68060 -mcpu32 -m5200 -mcfv4e -m68881 -mbitfield @gol 576169689Skan-mc68000 -mc68020 @gol 577169689Skan-mnobitfield -mrtd -mshort -msoft-float -mpcrel @gol 578169689Skan-malign-int -mstrict-align -msep-data -mno-sep-data @gol 579169689Skan-mshared-library-id=n -mid-shared-library -mno-id-shared-library} 580169689Skan 581169689Skan@emph{M68hc1x Options} 582169689Skan@gccoptlist{-m6811 -m6812 -m68hc11 -m68hc12 -m68hcs12 @gol 583169689Skan-mauto-incdec -minmax -mlong-calls -mshort @gol 584169689Skan-msoft-reg-count=@var{count}} 585169689Skan 586169689Skan@emph{MCore Options} 587169689Skan@gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol 588169689Skan-mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol 589169689Skan-m4byte-functions -mno-4byte-functions -mcallgraph-data @gol 590169689Skan-mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol 591169689Skan-mlittle-endian -mbig-endian -m210 -m340 -mstack-increment} 592169689Skan 593169689Skan@emph{MIPS Options} 594169689Skan@gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol 595169689Skan-mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips64 @gol 596169689Skan-mips16 -mno-mips16 -mabi=@var{abi} -mabicalls -mno-abicalls @gol 597169689Skan-mshared -mno-shared -mxgot -mno-xgot -mgp32 -mgp64 @gol 598169689Skan-mfp32 -mfp64 -mhard-float -msoft-float @gol 599169689Skan-msingle-float -mdouble-float -mdsp -mpaired-single -mips3d @gol 600169689Skan-mlong64 -mlong32 -msym32 -mno-sym32 @gol 601169689Skan-G@var{num} -membedded-data -mno-embedded-data @gol 602169689Skan-muninit-const-in-rodata -mno-uninit-const-in-rodata @gol 603169689Skan-msplit-addresses -mno-split-addresses @gol 604169689Skan-mexplicit-relocs -mno-explicit-relocs @gol 605169689Skan-mcheck-zero-division -mno-check-zero-division @gol 606169689Skan-mdivide-traps -mdivide-breaks @gol 607169689Skan-mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol 608169689Skan-mmad -mno-mad -mfused-madd -mno-fused-madd -nocpp @gol 609169689Skan-mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol 610169689Skan-mfix-vr4120 -mno-fix-vr4120 -mfix-vr4130 @gol 611169689Skan-mfix-sb1 -mno-fix-sb1 @gol 612169689Skan-mflush-func=@var{func} -mno-flush-func @gol 613169689Skan-mbranch-likely -mno-branch-likely @gol 614169689Skan-mfp-exceptions -mno-fp-exceptions @gol 615169689Skan-mvr4130-align -mno-vr4130-align} 616169689Skan 617169689Skan@emph{MMIX Options} 618169689Skan@gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol 619169689Skan-mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol 620169689Skan-melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol 621169689Skan-mno-base-addresses -msingle-exit -mno-single-exit} 622169689Skan 623169689Skan@emph{MN10300 Options} 624169689Skan@gccoptlist{-mmult-bug -mno-mult-bug @gol 625169689Skan-mam33 -mno-am33 @gol 626169689Skan-mam33-2 -mno-am33-2 @gol 627169689Skan-mreturn-pointer-on-d0 @gol 628169689Skan-mno-crt0 -mrelax} 629169689Skan 630169689Skan@emph{MT Options} 631169689Skan@gccoptlist{-mno-crt0 -mbacc -msim @gol 632169689Skan-march=@var{cpu-type} } 633169689Skan 634169689Skan@emph{PDP-11 Options} 635169689Skan@gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol 636169689Skan-mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol 637169689Skan-mint16 -mno-int32 -mfloat32 -mno-float64 @gol 638169689Skan-mfloat64 -mno-float32 -mabshi -mno-abshi @gol 639169689Skan-mbranch-expensive -mbranch-cheap @gol 640169689Skan-msplit -mno-split -munix-asm -mdec-asm} 641169689Skan 642169689Skan@emph{PowerPC Options} 643169689SkanSee RS/6000 and PowerPC Options. 644169689Skan 64590075Sobrien@emph{RS/6000 and PowerPC Options} 646117395Skan@gccoptlist{-mcpu=@var{cpu-type} @gol 64790075Sobrien-mtune=@var{cpu-type} @gol 64890075Sobrien-mpower -mno-power -mpower2 -mno-power2 @gol 64990075Sobrien-mpowerpc -mpowerpc64 -mno-powerpc @gol 650117395Skan-maltivec -mno-altivec @gol 65190075Sobrien-mpowerpc-gpopt -mno-powerpc-gpopt @gol 65290075Sobrien-mpowerpc-gfxopt -mno-powerpc-gfxopt @gol 653169689Skan-mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mfprnd -mno-fprnd @gol 65490075Sobrien-mnew-mnemonics -mold-mnemonics @gol 65596263Sobrien-mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol 656146895Skan-m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol 657132718Skan-malign-power -malign-natural @gol 65890075Sobrien-msoft-float -mhard-float -mmultiple -mno-multiple @gol 65990075Sobrien-mstring -mno-string -mupdate -mno-update @gol 66090075Sobrien-mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol 66190075Sobrien-mstrict-align -mno-strict-align -mrelocatable @gol 66290075Sobrien-mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol 663117395Skan-mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol 664169689Skan-mdynamic-no-pic -maltivec -mswdiv @gol 665132718Skan-mprioritize-restricted-insns=@var{priority} @gol 666132718Skan-msched-costly-dep=@var{dependence_type} @gol 667132718Skan-minsert-sched-nops=@var{scheme} @gol 668132718Skan-mcall-sysv -mcall-netbsd @gol 669117395Skan-maix-struct-return -msvr4-struct-return @gol 670169689Skan-mabi=@var{abi-type} -msecure-plt -mbss-plt @gol 671169689Skan-misel -mno-isel @gol 672117395Skan-misel=yes -misel=no @gol 673169689Skan-mspe -mno-spe @gol 674132718Skan-mspe=yes -mspe=no @gol 675169689Skan-mvrsave -mno-vrsave @gol 676169689Skan-mmulhw -mno-mulhw @gol 677169689Skan-mdlmzb -mno-dlmzb @gol 678169689Skan-mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol 67990075Sobrien-mprototype -mno-prototype @gol 680117395Skan-msim -mmvme -mads -myellowknife -memb -msdata @gol 681117395Skan-msdata=@var{opt} -mvxworks -mwindiss -G @var{num} -pthread} 68290075Sobrien 683169689Skan@emph{S/390 and zSeries Options} 684132718Skan@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol 685169689Skan-mhard-float -msoft-float -mlong-double-64 -mlong-double-128 @gol 686169689Skan-mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol 687169689Skan-msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol 688169689Skan-m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol 689169689Skan-mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol 690169689Skan-mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard} 69190075Sobrien 692169689Skan@emph{Score Options} 693169689Skan@gccoptlist{-meb -mel @gol 694169689Skan-mnhwloop @gol 695169689Skan-muls @gol 696169689Skan-mmac @gol 697169689Skan-mscore5 -mscore5u -mscore7 -mscore7d} 698169689Skan 69990075Sobrien@emph{SH Options} 700132718Skan@gccoptlist{-m1 -m2 -m2e -m3 -m3e @gol 70190075Sobrien-m4-nofpu -m4-single-only -m4-single -m4 @gol 702169689Skan-m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol 703117395Skan-m5-64media -m5-64media-nofpu @gol 704117395Skan-m5-32media -m5-32media-nofpu @gol 705117395Skan-m5-compact -m5-compact-nofpu @gol 70690075Sobrien-mb -ml -mdalign -mrelax @gol 707169689Skan-mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol 70890075Sobrien-mieee -misize -mpadstruct -mspace @gol 709169689Skan-mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol 710169689Skan-mdivsi3_libfunc=@var{name} @gol 711169689Skan-madjust-unroll -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol 712169689Skan -minvalid-symbols} 71390075Sobrien 714169689Skan@emph{SPARC Options} 715169689Skan@gccoptlist{-mcpu=@var{cpu-type} @gol 716169689Skan-mtune=@var{cpu-type} @gol 717169689Skan-mcmodel=@var{code-model} @gol 718169689Skan-m32 -m64 -mapp-regs -mno-app-regs @gol 719169689Skan-mfaster-structs -mno-faster-structs @gol 720169689Skan-mfpu -mno-fpu -mhard-float -msoft-float @gol 721169689Skan-mhard-quad-float -msoft-quad-float @gol 722169689Skan-mimpure-text -mno-impure-text -mlittle-endian @gol 723169689Skan-mstack-bias -mno-stack-bias @gol 724169689Skan-munaligned-doubles -mno-unaligned-doubles @gol 725169689Skan-mv8plus -mno-v8plus -mvis -mno-vis 726169689Skan-threads -pthreads -pthread} 727169689Skan 72890075Sobrien@emph{System V Options} 729117395Skan@gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}} 73090075Sobrien 73190075Sobrien@emph{TMS320C3x/C4x Options} 732117395Skan@gccoptlist{-mcpu=@var{cpu} -mbig -msmall -mregparm -mmemparm @gol 73390075Sobrien-mfast-fix -mmpyi -mbk -mti -mdp-isr-reload @gol 73490075Sobrien-mrpts=@var{count} -mrptb -mdb -mloop-unsigned @gol 73590075Sobrien-mparallel-insns -mparallel-mpy -mpreserve-float} 73690075Sobrien 73790075Sobrien@emph{V850 Options} 738117395Skan@gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol 73990075Sobrien-mprolog-function -mno-prolog-function -mspace @gol 74090075Sobrien-mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol 741117395Skan-mapp-regs -mno-app-regs @gol 742117395Skan-mdisable-callt -mno-disable-callt @gol 743132718Skan-mv850e1 @gol 744117395Skan-mv850e @gol 74590075Sobrien-mv850 -mbig-switch} 74690075Sobrien 747169689Skan@emph{VAX Options} 748169689Skan@gccoptlist{-mg -mgnu -munix} 74990075Sobrien 750169689Skan@emph{x86-64 Options} 751169689SkanSee i386 and x86-64 Options. 75290075Sobrien 75390075Sobrien@emph{Xstormy16 Options} 754117395Skan@gccoptlist{-msim} 75590075Sobrien 75690075Sobrien@emph{Xtensa Options} 757132718Skan@gccoptlist{-mconst16 -mno-const16 @gol 758117395Skan-mfused-madd -mno-fused-madd @gol 759117395Skan-mtext-section-literals -mno-text-section-literals @gol 760117395Skan-mtarget-align -mno-target-align @gol 761117395Skan-mlongcalls -mno-longcalls} 76290075Sobrien 763169689Skan@emph{zSeries Options} 764169689SkanSee S/390 and zSeries Options. 765117395Skan 76690075Sobrien@item Code Generation Options 76790075Sobrien@xref{Code Gen Options,,Options for Code Generation Conventions}. 768117395Skan@gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol 769117395Skan-ffixed-@var{reg} -fexceptions @gol 77090075Sobrien-fnon-call-exceptions -funwind-tables @gol 77190075Sobrien-fasynchronous-unwind-tables @gol 77290075Sobrien-finhibit-size-directive -finstrument-functions @gol 773259405Spfg-finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol 774259405Spfg-finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @gol 775132718Skan-fno-common -fno-ident @gol 776132718Skan-fpcc-struct-return -fpic -fPIC -fpie -fPIE @gol 777169689Skan-fno-jump-tables @gol 778169689Skan-freg-struct-return -fshort-enums @gol 779132718Skan-fshort-double -fshort-wchar @gol 780169689Skan-fverbose-asm -fpack-struct[=@var{n}] -fstack-check @gol 78190075Sobrien-fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol 78290075Sobrien-fargument-alias -fargument-noalias @gol 783169689Skan-fargument-noalias-global -fargument-noalias-anything 784169689Skan-fleading-underscore -ftls-model=@var{model} @gol 785169689Skan-ftrapv -fwrapv -fbounds-check @gol 786169689Skan-fvisibility} 78790075Sobrien@end table 78890075Sobrien 78990075Sobrien@menu 79090075Sobrien* Overall Options:: Controlling the kind of output: 79190075Sobrien an executable, object files, assembler files, 79290075Sobrien or preprocessed source. 79390075Sobrien* C Dialect Options:: Controlling the variant of C language compiled. 79490075Sobrien* C++ Dialect Options:: Variations on C++. 79590075Sobrien* Language Independent Options:: Controlling how diagnostics should be 79690075Sobrien formatted. 79790075Sobrien* Warning Options:: How picky should the compiler be? 79890075Sobrien* Debugging Options:: Symbol tables, measurements, and debugging dumps. 79990075Sobrien* Optimize Options:: How much optimization? 80090075Sobrien* Preprocessor Options:: Controlling header files and macro definitions. 80190075Sobrien Also, getting dependency information for Make. 80290075Sobrien* Assembler Options:: Passing options to the assembler. 80390075Sobrien* Link Options:: Specifying libraries and so on. 80490075Sobrien* Directory Options:: Where to find header files and libraries. 80590075Sobrien Where to find the compiler executable files. 80690075Sobrien* Spec Files:: How to pass switches to sub-processes. 80790075Sobrien* Target Options:: Running a cross-compiler, or an old version of GCC. 80890075Sobrien@end menu 80990075Sobrien 81090075Sobrien@node Overall Options 81190075Sobrien@section Options Controlling the Kind of Output 81290075Sobrien 81390075SobrienCompilation can involve up to four stages: preprocessing, compilation 814132718Skanproper, assembly and linking, always in that order. GCC is capable of 815132718Skanpreprocessing and compiling several files either into several 816132718Skanassembler input files, or into one assembler input file; then each 817132718Skanassembler input file produces an object file, and linking combines all 818132718Skanthe object files (those newly compiled, and those specified as input) 819132718Skaninto an executable file. 82090075Sobrien 82190075Sobrien@cindex file name suffix 82290075SobrienFor any given input file, the file name suffix determines what kind of 82390075Sobriencompilation is done: 82490075Sobrien 82590075Sobrien@table @gcctabopt 82690075Sobrien@item @var{file}.c 82790075SobrienC source code which must be preprocessed. 82890075Sobrien 82990075Sobrien@item @var{file}.i 83090075SobrienC source code which should not be preprocessed. 83190075Sobrien 83290075Sobrien@item @var{file}.ii 83390075SobrienC++ source code which should not be preprocessed. 83490075Sobrien 83590075Sobrien@item @var{file}.h 836220755SdimC, or C++ header file to be turned into a precompiled header. 83790075Sobrien 83890075Sobrien@item @var{file}.cc 83990075Sobrien@itemx @var{file}.cp 84090075Sobrien@itemx @var{file}.cxx 84190075Sobrien@itemx @var{file}.cpp 842132718Skan@itemx @var{file}.CPP 84390075Sobrien@itemx @var{file}.c++ 84490075Sobrien@itemx @var{file}.C 84590075SobrienC++ source code which must be preprocessed. Note that in @samp{.cxx}, 84690075Sobrienthe last two letters must both be literally @samp{x}. Likewise, 84790075Sobrien@samp{.C} refers to a literal capital C@. 84890075Sobrien 849132718Skan@item @var{file}.hh 850132718Skan@itemx @var{file}.H 851132718SkanC++ header file to be turned into a precompiled header. 852132718Skan 85390075Sobrien@item @var{file}.f 85490075Sobrien@itemx @var{file}.for 85590075Sobrien@itemx @var{file}.FOR 856169689SkanFixed form Fortran source code which should not be preprocessed. 85790075Sobrien 85890075Sobrien@item @var{file}.F 85990075Sobrien@itemx @var{file}.fpp 86090075Sobrien@itemx @var{file}.FPP 861169689SkanFixed form Fortran source code which must be preprocessed (with the traditional 86290075Sobrienpreprocessor). 86390075Sobrien 864169689Skan@item @var{file}.f90 865169689Skan@itemx @var{file}.f95 866169689SkanFree form Fortran source code which should not be preprocessed. 86790075Sobrien 868169689Skan@item @var{file}.F90 869169689Skan@itemx @var{file}.F95 870169689SkanFree form Fortran source code which must be preprocessed (with the 871169689Skantraditional preprocessor). 87290075Sobrien 87390075Sobrien@c FIXME: Descriptions of Java file types. 87490075Sobrien@c @var{file}.java 87590075Sobrien@c @var{file}.class 87690075Sobrien@c @var{file}.zip 87790075Sobrien@c @var{file}.jar 87890075Sobrien 87990075Sobrien@item @var{file}.ads 88090075SobrienAda source code file which contains a library unit declaration (a 88190075Sobriendeclaration of a package, subprogram, or generic, or a generic 88290075Sobrieninstantiation), or a library unit renaming declaration (a package, 88390075Sobriengeneric, or subprogram renaming declaration). Such files are also 88490075Sobriencalled @dfn{specs}. 88590075Sobrien 88690075Sobrien@itemx @var{file}.adb 88790075SobrienAda source code file containing a library unit body (a subprogram or 88890075Sobrienpackage body). Such files are also called @dfn{bodies}. 88990075Sobrien 89090075Sobrien@c GCC also knows about some suffixes for languages not yet included: 89190075Sobrien@c Pascal: 89290075Sobrien@c @var{file}.p 89390075Sobrien@c @var{file}.pas 894169689Skan@c Ratfor: 895169689Skan@c @var{file}.r 89690075Sobrien 89790075Sobrien@item @var{file}.s 89890075SobrienAssembler code. 89990075Sobrien 90090075Sobrien@item @var{file}.S 90190075SobrienAssembler code which must be preprocessed. 90290075Sobrien 90390075Sobrien@item @var{other} 90490075SobrienAn object file to be fed straight into linking. 90590075SobrienAny file name with no recognized suffix is treated this way. 90690075Sobrien@end table 90790075Sobrien 90890075Sobrien@opindex x 90990075SobrienYou can specify the input language explicitly with the @option{-x} option: 91090075Sobrien 91190075Sobrien@table @gcctabopt 91290075Sobrien@item -x @var{language} 91390075SobrienSpecify explicitly the @var{language} for the following input files 91490075Sobrien(rather than letting the compiler choose a default based on the file 91590075Sobrienname suffix). This option applies to all following input files until 91690075Sobrienthe next @option{-x} option. Possible values for @var{language} are: 917132718Skan@smallexample 918169689Skanc c-header c-cpp-output 919132718Skanc++ c++-header c++-cpp-output 92090075Sobrienassembler assembler-with-cpp 92190075Sobrienada 922169689Skanf95 f95-cpp-input 92390075Sobrienjava 924117395Skantreelang 925132718Skan@end smallexample 92690075Sobrien 92790075Sobrien@item -x none 92890075SobrienTurn off any specification of a language, so that subsequent files are 92990075Sobrienhandled according to their file name suffixes (as they are if @option{-x} 93090075Sobrienhas not been used at all). 93190075Sobrien 93290075Sobrien@item -pass-exit-codes 93390075Sobrien@opindex pass-exit-codes 93490075SobrienNormally the @command{gcc} program will exit with the code of 1 if any 93590075Sobrienphase of the compiler returns a non-success return code. If you specify 93690075Sobrien@option{-pass-exit-codes}, the @command{gcc} program will instead return with 93790075Sobriennumerically highest error produced by any phase that returned an error 938169689Skanindication. The C, C++, and Fortran frontends return 4, if an internal 939169689Skancompiler error is encountered. 94090075Sobrien@end table 94190075Sobrien 94290075SobrienIf you only want some of the stages of compilation, you can use 94390075Sobrien@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and 94490075Sobrienone of the options @option{-c}, @option{-S}, or @option{-E} to say where 94590075Sobrien@command{gcc} is to stop. Note that some combinations (for example, 94690075Sobrien@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all. 94790075Sobrien 94890075Sobrien@table @gcctabopt 94990075Sobrien@item -c 95090075Sobrien@opindex c 95190075SobrienCompile or assemble the source files, but do not link. The linking 95290075Sobrienstage simply is not done. The ultimate output is in the form of an 95390075Sobrienobject file for each source file. 95490075Sobrien 95590075SobrienBy default, the object file name for a source file is made by replacing 95690075Sobrienthe suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}. 95790075Sobrien 95890075SobrienUnrecognized input files, not requiring compilation or assembly, are 95990075Sobrienignored. 96090075Sobrien 96190075Sobrien@item -S 96290075Sobrien@opindex S 96390075SobrienStop after the stage of compilation proper; do not assemble. The output 96490075Sobrienis in the form of an assembler code file for each non-assembler input 96590075Sobrienfile specified. 96690075Sobrien 96790075SobrienBy default, the assembler file name for a source file is made by 96890075Sobrienreplacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}. 96990075Sobrien 97090075SobrienInput files that don't require compilation are ignored. 97190075Sobrien 97290075Sobrien@item -E 97390075Sobrien@opindex E 97490075SobrienStop after the preprocessing stage; do not run the compiler proper. The 97590075Sobrienoutput is in the form of preprocessed source code, which is sent to the 97690075Sobrienstandard output. 97790075Sobrien 97890075SobrienInput files which don't require preprocessing are ignored. 97990075Sobrien 98090075Sobrien@cindex output file option 98190075Sobrien@item -o @var{file} 98290075Sobrien@opindex o 98390075SobrienPlace output in file @var{file}. This applies regardless to whatever 98490075Sobriensort of output is being produced, whether it be an executable file, 98590075Sobrienan object file, an assembler file or preprocessed C code. 98690075Sobrien 987169689SkanIf @option{-o} is not specified, the default is to put an executable 988169689Skanfile in @file{a.out}, the object file for 989169689Skan@file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its 990169689Skanassembler file in @file{@var{source}.s}, a precompiled header file in 991169689Skan@file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on 992169689Skanstandard output. 99390075Sobrien 99490075Sobrien@item -v 99590075Sobrien@opindex v 99690075SobrienPrint (on standard error output) the commands executed to run the stages 99790075Sobrienof compilation. Also print the version number of the compiler driver 99890075Sobrienprogram and of the preprocessor and the compiler proper. 99990075Sobrien 100096263Sobrien@item -### 100196263Sobrien@opindex ### 100296263SobrienLike @option{-v} except the commands are not executed and all command 100396263Sobrienarguments are quoted. This is useful for shell scripts to capture the 100496263Sobriendriver-generated command lines. 100596263Sobrien 100690075Sobrien@item -pipe 100790075Sobrien@opindex pipe 100890075SobrienUse pipes rather than temporary files for communication between the 100990075Sobrienvarious stages of compilation. This fails to work on some systems where 101090075Sobrienthe assembler is unable to read from a pipe; but the GNU assembler has 101190075Sobrienno trouble. 101290075Sobrien 1013169689Skan@item -combine 1014169689Skan@opindex combine 1015169689SkanIf you are compiling multiple source files, this option tells the driver 1016169689Skanto pass all the source files to the compiler at once (for those 1017169689Skanlanguages for which the compiler can handle this). This will allow 1018169689Skanintermodule analysis (IMA) to be performed by the compiler. Currently the only 1019169689Skanlanguage for which this is supported is C@. If you pass source files for 1020169689Skanmultiple languages to the driver, using this option, the driver will invoke 1021169689Skanthe compiler(s) that support IMA once each, passing each compiler all the 1022169689Skansource files appropriate for it. For those languages that do not support 1023169689SkanIMA this option will be ignored, and the compiler will be invoked once for 1024169689Skaneach source file in that language. If you use this option in conjunction 1025169689Skanwith @option{-save-temps}, the compiler will generate multiple 1026169689Skanpre-processed files 1027169689Skan(one for each source file), but only one (combined) @file{.o} or 1028169689Skan@file{.s} file. 1029169689Skan 103090075Sobrien@item --help 103190075Sobrien@opindex help 103290075SobrienPrint (on the standard output) a description of the command line options 103390075Sobrienunderstood by @command{gcc}. If the @option{-v} option is also specified 103490075Sobrienthen @option{--help} will also be passed on to the various processes 103590075Sobrieninvoked by @command{gcc}, so that they can display the command line options 1036132718Skanthey accept. If the @option{-Wextra} option is also specified then command 103790075Sobrienline options which have no documentation associated with them will also 103890075Sobrienbe displayed. 103990075Sobrien 104090075Sobrien@item --target-help 104190075Sobrien@opindex target-help 104290075SobrienPrint (on the standard output) a description of target specific command 104390075Sobrienline options for each tool. 1044107590Sobrien 1045107590Sobrien@item --version 1046107590Sobrien@opindex version 1047169689SkanDisplay the version number and copyrights of the invoked GCC@. 1048169689Skan 1049169689Skan@include @value{srcdir}/../libiberty/at-file.texi 105090075Sobrien@end table 105190075Sobrien 105290075Sobrien@node Invoking G++ 105390075Sobrien@section Compiling C++ Programs 105490075Sobrien 105590075Sobrien@cindex suffixes for C++ source 105690075Sobrien@cindex C++ source file suffixes 105790075SobrienC++ source files conventionally use one of the suffixes @samp{.C}, 1058132718Skan@samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or 1059132718Skan@samp{.cxx}; C++ header files often use @samp{.hh} or @samp{.H}; and 106090075Sobrienpreprocessed C++ files use the suffix @samp{.ii}. GCC recognizes 106190075Sobrienfiles with these names and compiles them as C++ programs even if you 1062132718Skancall the compiler the same way as for compiling C programs (usually 1063132718Skanwith the name @command{gcc}). 106490075Sobrien 106590075Sobrien@findex g++ 106690075Sobrien@findex c++ 1067169689SkanHowever, the use of @command{gcc} does not add the C++ library. 1068169689Skan@command{g++} is a program that calls GCC and treats @samp{.c}, 1069169689Skan@samp{.h} and @samp{.i} files as C++ source files instead of C source 1070169689Skanfiles unless @option{-x} is used, and automatically specifies linking 1071169689Skanagainst the C++ library. This program is also useful when 1072169689Skanprecompiling a C header file with a @samp{.h} extension for use in C++ 1073169689Skancompilations. On many systems, @command{g++} is also installed with 1074169689Skanthe name @command{c++}. 107590075Sobrien 107690075Sobrien@cindex invoking @command{g++} 107790075SobrienWhen you compile C++ programs, you may specify many of the same 107890075Sobriencommand-line options that you use for compiling programs in any 107990075Sobrienlanguage; or command-line options meaningful for C and related 108090075Sobrienlanguages; or options that are meaningful only for C++ programs. 108190075Sobrien@xref{C Dialect Options,,Options Controlling C Dialect}, for 108290075Sobrienexplanations of options for languages related to C@. 108390075Sobrien@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for 108490075Sobrienexplanations of options that are meaningful only for C++ programs. 108590075Sobrien 108690075Sobrien@node C Dialect Options 108790075Sobrien@section Options Controlling C Dialect 108890075Sobrien@cindex dialect options 108990075Sobrien@cindex language dialect options 109090075Sobrien@cindex options, dialect 109190075Sobrien 109290075SobrienThe following options control the dialect of C (or languages derived 1093220755Sdimfrom C, such as C++) that the compiler accepts: 109490075Sobrien 109590075Sobrien@table @gcctabopt 109690075Sobrien@cindex ANSI support 109790075Sobrien@cindex ISO support 109890075Sobrien@item -ansi 109990075Sobrien@opindex ansi 1100117395SkanIn C mode, support all ISO C90 programs. In C++ mode, 110190075Sobrienremove GNU extensions that conflict with ISO C++. 110290075Sobrien 110390075SobrienThis turns off certain features of GCC that are incompatible with ISO 1104117395SkanC90 (when compiling C code), or of standard C++ (when compiling C++ code), 110590075Sobriensuch as the @code{asm} and @code{typeof} keywords, and 110690075Sobrienpredefined macros such as @code{unix} and @code{vax} that identify the 110790075Sobrientype of system you are using. It also enables the undesirable and 110890075Sobrienrarely used ISO trigraph feature. For the C compiler, 110990075Sobrienit disables recognition of C++ style @samp{//} comments as well as 111090075Sobrienthe @code{inline} keyword. 111190075Sobrien 111290075SobrienThe alternate keywords @code{__asm__}, @code{__extension__}, 111390075Sobrien@code{__inline__} and @code{__typeof__} continue to work despite 111490075Sobrien@option{-ansi}. You would not want to use them in an ISO C program, of 111590075Sobriencourse, but it is useful to put them in header files that might be included 111690075Sobrienin compilations done with @option{-ansi}. Alternate predefined macros 111790075Sobriensuch as @code{__unix__} and @code{__vax__} are also available, with or 111890075Sobrienwithout @option{-ansi}. 111990075Sobrien 112090075SobrienThe @option{-ansi} option does not cause non-ISO programs to be 112190075Sobrienrejected gratuitously. For that, @option{-pedantic} is required in 112290075Sobrienaddition to @option{-ansi}. @xref{Warning Options}. 112390075Sobrien 112490075SobrienThe macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi} 112590075Sobrienoption is used. Some header files may notice this macro and refrain 112690075Sobrienfrom declaring certain functions or defining certain macros that the 112790075SobrienISO standard doesn't call for; this is to avoid interfering with any 112890075Sobrienprograms that might use these names for other things. 112990075Sobrien 113090075SobrienFunctions which would normally be built in but do not have semantics 113190075Sobriendefined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in 113290075Sobrienfunctions with @option{-ansi} is used. @xref{Other Builtins,,Other 113390075Sobrienbuilt-in functions provided by GCC}, for details of the functions 113490075Sobrienaffected. 113590075Sobrien 113690075Sobrien@item -std= 113790075Sobrien@opindex std 113890075SobrienDetermine the language standard. This option is currently only 1139117395Skansupported when compiling C or C++. A value for this option must be 1140117395Skanprovided; possible values are 114190075Sobrien 114290075Sobrien@table @samp 114390075Sobrien@item c89 114490075Sobrien@itemx iso9899:1990 1145117395SkanISO C90 (same as @option{-ansi}). 114690075Sobrien 114790075Sobrien@item iso9899:199409 1148117395SkanISO C90 as modified in amendment 1. 114990075Sobrien 115090075Sobrien@item c99 115190075Sobrien@itemx c9x 115290075Sobrien@itemx iso9899:1999 115390075Sobrien@itemx iso9899:199x 115490075SobrienISO C99. Note that this standard is not yet fully supported; see 1155169689Skan@w{@uref{http://gcc.gnu.org/gcc-4.2/c99status.html}} for more information. The 115690075Sobriennames @samp{c9x} and @samp{iso9899:199x} are deprecated. 115790075Sobrien 115890075Sobrien@item gnu89 1159117395SkanDefault, ISO C90 plus GNU extensions (including some C99 features). 116090075Sobrien 116190075Sobrien@item gnu99 1162132718Skan@itemx gnu9x 116390075SobrienISO C99 plus GNU extensions. When ISO C99 is fully implemented in GCC, 116490075Sobrienthis will become the default. The name @samp{gnu9x} is deprecated. 116590075Sobrien 1166117395Skan@item c++98 1167117395SkanThe 1998 ISO C++ standard plus amendments. 1168117395Skan 1169117395Skan@item gnu++98 1170117395SkanThe same as @option{-std=c++98} plus GNU extensions. This is the 1171117395Skandefault for C++ code. 117290075Sobrien@end table 117390075Sobrien 117490075SobrienEven when this option is not specified, you can still use some of the 117590075Sobrienfeatures of newer standards in so far as they do not conflict with 117690075Sobrienprevious C standards. For example, you may use @code{__restrict__} even 117790075Sobrienwhen @option{-std=c99} is not specified. 117890075Sobrien 117990075SobrienThe @option{-std} options specifying some version of ISO C have the same 1180117395Skaneffects as @option{-ansi}, except that features that were not in ISO C90 118190075Sobrienbut are in the specified version (for example, @samp{//} comments and 118290075Sobrienthe @code{inline} keyword in ISO C99) are not disabled. 118390075Sobrien 118490075Sobrien@xref{Standards,,Language Standards Supported by GCC}, for details of 118590075Sobrienthese standard versions. 118690075Sobrien 1187169689Skan@item -fgnu89-inline 1188169689Skan@opindex fgnu89-inline 1189169689SkanThe option @option{-fgnu89-inline} tells GCC to use the traditional 1190169689SkanGNU semantics for @code{inline} functions when in C99 mode. 1191169689Skan@xref{Inline,,An Inline Function is As Fast As a Macro}. Using this 1192169689Skanoption is roughly equivalent to adding the @code{gnu_inline} function 1193169689Skanattribute to all inline functions (@pxref{Function Attributes}). 1194169689Skan 1195169689SkanThis option is accepted by GCC versions 4.1.3 and up. In GCC versions 1196169689Skanprior to 4.3, C99 inline semantics are not supported, and thus this 1197169689Skanoption is effectively assumed to be present regardless of whether or not 1198169689Skanit is specified; the only effect of specifying it explicitly is to 1199169689Skandisable warnings about using inline functions in C99 mode. Likewise, 1200169689Skanthe option @option{-fno-gnu89-inline} is not supported in versions of 1201169689SkanGCC before 4.3. It will be supported only in C99 or gnu99 mode, not in 1202169689SkanC89 or gnu89 mode. 1203169689Skan 1204169689SkanThe preprocesor macros @code{__GNUC_GNU_INLINE__} and 1205169689Skan@code{__GNUC_STDC_INLINE__} may be used to check which semantics are 1206169689Skanin effect for @code{inline} functions. @xref{Common Predefined 1207169689SkanMacros,,,cpp,The C Preprocessor}. 1208169689Skan 120990075Sobrien@item -aux-info @var{filename} 121090075Sobrien@opindex aux-info 121190075SobrienOutput to the given filename prototyped declarations for all functions 121290075Sobriendeclared and/or defined in a translation unit, including those in header 121390075Sobrienfiles. This option is silently ignored in any language other than C@. 121490075Sobrien 121590075SobrienBesides declarations, the file indicates, in comments, the origin of 121690075Sobrieneach declaration (source file and line), whether the declaration was 121790075Sobrienimplicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or 121890075Sobrien@samp{O} for old, respectively, in the first character after the line 121990075Sobriennumber and the colon), and whether it came from a declaration or a 122090075Sobriendefinition (@samp{C} or @samp{F}, respectively, in the following 122190075Sobriencharacter). In the case of function definitions, a K&R-style list of 122290075Sobrienarguments followed by their declarations is also provided, inside 122390075Sobriencomments, after the declaration. 122490075Sobrien 122590075Sobrien@item -fno-asm 122690075Sobrien@opindex fno-asm 122790075SobrienDo not recognize @code{asm}, @code{inline} or @code{typeof} as a 122890075Sobrienkeyword, so that code can use these words as identifiers. You can use 122990075Sobrienthe keywords @code{__asm__}, @code{__inline__} and @code{__typeof__} 123090075Sobrieninstead. @option{-ansi} implies @option{-fno-asm}. 123190075Sobrien 123290075SobrienIn C++, this switch only affects the @code{typeof} keyword, since 123390075Sobrien@code{asm} and @code{inline} are standard keywords. You may want to 123490075Sobrienuse the @option{-fno-gnu-keywords} flag instead, which has the same 123590075Sobrieneffect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this 123690075Sobrienswitch only affects the @code{asm} and @code{typeof} keywords, since 123790075Sobrien@code{inline} is a standard keyword in ISO C99. 123890075Sobrien 1239261188Spfg@c APPLE LOCAL begin blocks 7205047 5811887 1240261188Spfg@item -fno-blocks 1241261188Spfg@opindex fno-blocks 1242261188SpfgDisable the use of blocks. In @option{-std=c99} mode, blocks are 1243261188Spfgturned off by default. @option{-fblocks} can be used to re-enable the 1244261188Spfgfeature, if off. Runtime support for blocks first appeared in Mac OS 1245261188SpfgX 10.6. When targeting 10.6 (see @option{-mmacosx-version-min}) and 1246261188Spfglater, the extension is on by default. 1247261188Spfg@c APPLE LOCAL end blocks 7205047 5811887 1248261188Spfg 124990075Sobrien@item -fno-builtin 1250117395Skan@itemx -fno-builtin-@var{function} 125190075Sobrien@opindex fno-builtin 125290075Sobrien@cindex built-in functions 125390075SobrienDon't recognize built-in functions that do not begin with 125490075Sobrien@samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in 125590075Sobrienfunctions provided by GCC}, for details of the functions affected, 125690075Sobrienincluding those which are not built-in functions when @option{-ansi} or 125790075Sobrien@option{-std} options for strict ISO C conformance are used because they 125890075Sobriendo not have an ISO standard meaning. 125990075Sobrien 126090075SobrienGCC normally generates special code to handle certain built-in functions 126190075Sobrienmore efficiently; for instance, calls to @code{alloca} may become single 126290075Sobrieninstructions that adjust the stack directly, and calls to @code{memcpy} 126390075Sobrienmay become inline copy loops. The resulting code is often both smaller 126490075Sobrienand faster, but since the function calls no longer appear as such, you 126590075Sobriencannot set a breakpoint on those calls, nor can you change the behavior 1266169689Skanof the functions by linking with a different library. In addition, 1267169689Skanwhen a function is recognized as a built-in function, GCC may use 1268169689Skaninformation about that function to warn about problems with calls to 1269169689Skanthat function, or to generate more efficient code, even if the 1270169689Skanresulting code still contains calls to that function. For example, 1271169689Skanwarnings are given with @option{-Wformat} for bad calls to 1272169689Skan@code{printf}, when @code{printf} is built in, and @code{strlen} is 1273169689Skanknown not to modify global memory. 127490075Sobrien 1275117395SkanWith the @option{-fno-builtin-@var{function}} option 1276117395Skanonly the built-in function @var{function} is 127790075Sobriendisabled. @var{function} must not begin with @samp{__builtin_}. If a 127890075Sobrienfunction is named this is not built-in in this version of GCC, this 127990075Sobrienoption is ignored. There is no corresponding 128090075Sobrien@option{-fbuiltin-@var{function}} option; if you wish to enable 128190075Sobrienbuilt-in functions selectively when using @option{-fno-builtin} or 128290075Sobrien@option{-ffreestanding}, you may define macros such as: 128390075Sobrien 128490075Sobrien@smallexample 128590075Sobrien#define abs(n) __builtin_abs ((n)) 128690075Sobrien#define strcpy(d, s) __builtin_strcpy ((d), (s)) 128790075Sobrien@end smallexample 128890075Sobrien 128990075Sobrien@item -fhosted 129090075Sobrien@opindex fhosted 129190075Sobrien@cindex hosted environment 129290075Sobrien 129390075SobrienAssert that compilation takes place in a hosted environment. This implies 129490075Sobrien@option{-fbuiltin}. A hosted environment is one in which the 129590075Sobrienentire standard library is available, and in which @code{main} has a return 129690075Sobrientype of @code{int}. Examples are nearly everything except a kernel. 129790075SobrienThis is equivalent to @option{-fno-freestanding}. 129890075Sobrien 129990075Sobrien@item -ffreestanding 130090075Sobrien@opindex ffreestanding 130190075Sobrien@cindex hosted environment 130290075Sobrien 130390075SobrienAssert that compilation takes place in a freestanding environment. This 130490075Sobrienimplies @option{-fno-builtin}. A freestanding environment 130590075Sobrienis one in which the standard library may not exist, and program startup may 130690075Sobriennot necessarily be at @code{main}. The most obvious example is an OS kernel. 130790075SobrienThis is equivalent to @option{-fno-hosted}. 130890075Sobrien 130990075Sobrien@xref{Standards,,Language Standards Supported by GCC}, for details of 131090075Sobrienfreestanding and hosted environments. 131190075Sobrien 1312169689Skan@item -fopenmp 1313169689Skan@opindex fopenmp 1314169689Skan@cindex openmp parallel 1315169689SkanEnable handling of OpenMP directives @code{#pragma omp} in C/C++ and 1316169689Skan@code{!$omp} in Fortran. When @option{-fopenmp} is specified, the 1317169689Skancompiler generates parallel code according to the OpenMP Application 1318169689SkanProgram Interface v2.5 @w{@uref{http://www.openmp.org/}}. 1319169689Skan 1320117395Skan@item -fms-extensions 1321117395Skan@opindex fms-extensions 1322117395SkanAccept some non-standard constructs used in Microsoft header files. 1323117395Skan 1324169689SkanSome cases of unnamed fields in structures and unions are only 1325169689Skanaccepted with this option. @xref{Unnamed Fields,,Unnamed struct/union 1326169689Skanfields within structs/unions}, for details. 1327169689Skan 132890075Sobrien@item -trigraphs 132990075Sobrien@opindex trigraphs 133090075SobrienSupport ISO C trigraphs. The @option{-ansi} option (and @option{-std} 133190075Sobrienoptions for strict ISO C conformance) implies @option{-trigraphs}. 133290075Sobrien 133396263Sobrien@item -no-integrated-cpp 133496263Sobrien@opindex no-integrated-cpp 1335117395SkanPerforms a compilation in two passes: preprocessing and compiling. This 1336117395Skanoption allows a user supplied "cc1", "cc1plus", or "cc1obj" via the 1337169689Skan@option{-B} option. The user supplied compilation step can then add in 1338117395Skanan additional preprocessing step after normal preprocessing but before 1339169689Skancompiling. The default is to use the integrated cpp (internal cpp) 134096263Sobrien 1341117395SkanThe semantics of this option will change if "cc1", "cc1plus", and 1342117395Skan"cc1obj" are merged. 134396263Sobrien 134490075Sobrien@cindex traditional C language 134590075Sobrien@cindex C language, traditional 134690075Sobrien@item -traditional 1347117395Skan@itemx -traditional-cpp 1348117395Skan@opindex traditional-cpp 134990075Sobrien@opindex traditional 1350117395SkanFormerly, these options caused GCC to attempt to emulate a pre-standard 1351117395SkanC compiler. They are now only supported with the @option{-E} switch. 1352117395SkanThe preprocessor continues to support a pre-standard mode. See the GNU 1353117395SkanCPP manual for details. 135490075Sobrien 1355261188Spfg@c APPLE LOCAL begin nested functions 4357979 1356261188Spfg@item -fno-nested-functions 1357261188Spfg@opindex fno-nested-functions 1358261188SpfgDisable nested functions. This option is not supported for C++ or 1359261188SpfgObjective-C++. On FreeBSD, nested functions are disabled by default. 1360261188Spfg@c APPLE LOCAL end nested functions 4357979 1361261188Spfg 136290075Sobrien@item -fcond-mismatch 136390075Sobrien@opindex fcond-mismatch 136490075SobrienAllow conditional expressions with mismatched types in the second and 136590075Sobrienthird arguments. The value of such an expression is void. This option 136690075Sobrienis not supported for C++. 136790075Sobrien 1368260074Spfg@item -flax-vector-conversions 1369260074Spfg@opindex flax-vector-conversions 1370260074SpfgAllow implicit conversions between vectors with differing numbers of 1371260074Spfgelements and/or incompatible element types. This option should not be 1372260074Spfgused for new code. 1373260074Spfg 137490075Sobrien@item -funsigned-char 137590075Sobrien@opindex funsigned-char 137690075SobrienLet the type @code{char} be unsigned, like @code{unsigned char}. 137790075Sobrien 137890075SobrienEach kind of machine has a default for what @code{char} should 137990075Sobrienbe. It is either like @code{unsigned char} by default or like 138090075Sobrien@code{signed char} by default. 138190075Sobrien 138290075SobrienIdeally, a portable program should always use @code{signed char} or 138390075Sobrien@code{unsigned char} when it depends on the signedness of an object. 138490075SobrienBut many programs have been written to use plain @code{char} and 138590075Sobrienexpect it to be signed, or expect it to be unsigned, depending on the 138690075Sobrienmachines they were written for. This option, and its inverse, let you 138790075Sobrienmake such a program work with the opposite default. 138890075Sobrien 138990075SobrienThe type @code{char} is always a distinct type from each of 139090075Sobrien@code{signed char} or @code{unsigned char}, even though its behavior 139190075Sobrienis always just like one of those two. 139290075Sobrien 139390075Sobrien@item -fsigned-char 139490075Sobrien@opindex fsigned-char 139590075SobrienLet the type @code{char} be signed, like @code{signed char}. 139690075Sobrien 139790075SobrienNote that this is equivalent to @option{-fno-unsigned-char}, which is 139890075Sobrienthe negative form of @option{-funsigned-char}. Likewise, the option 139990075Sobrien@option{-fno-signed-char} is equivalent to @option{-funsigned-char}. 140090075Sobrien 140190075Sobrien@item -fsigned-bitfields 140290075Sobrien@itemx -funsigned-bitfields 140390075Sobrien@itemx -fno-signed-bitfields 140490075Sobrien@itemx -fno-unsigned-bitfields 140590075Sobrien@opindex fsigned-bitfields 140690075Sobrien@opindex funsigned-bitfields 140790075Sobrien@opindex fno-signed-bitfields 140890075Sobrien@opindex fno-unsigned-bitfields 140990075SobrienThese options control whether a bit-field is signed or unsigned, when the 141090075Sobriendeclaration does not use either @code{signed} or @code{unsigned}. By 141190075Sobriendefault, such a bit-field is signed, because this is consistent: the 141290075Sobrienbasic integer types such as @code{int} are signed types. 141390075Sobrien@end table 141490075Sobrien 141590075Sobrien@node C++ Dialect Options 141690075Sobrien@section Options Controlling C++ Dialect 141790075Sobrien 141890075Sobrien@cindex compiler options, C++ 141990075Sobrien@cindex C++ options, command line 142090075Sobrien@cindex options, C++ 142190075SobrienThis section describes the command-line options that are only meaningful 142290075Sobrienfor C++ programs; but you can also use most of the GNU compiler options 142390075Sobrienregardless of what language your program is in. For example, you 142490075Sobrienmight compile a file @code{firstClass.C} like this: 142590075Sobrien 1426132718Skan@smallexample 142790075Sobrieng++ -g -frepo -O -c firstClass.C 1428132718Skan@end smallexample 142990075Sobrien 143090075Sobrien@noindent 143190075SobrienIn this example, only @option{-frepo} is an option meant 143290075Sobrienonly for C++ programs; you can use the other options with any 143390075Sobrienlanguage supported by GCC@. 143490075Sobrien 143590075SobrienHere is a list of options that are @emph{only} for compiling C++ programs: 143690075Sobrien 143790075Sobrien@table @gcctabopt 1438117395Skan 1439117395Skan@item -fabi-version=@var{n} 1440117395Skan@opindex fabi-version 1441169689SkanUse version @var{n} of the C++ ABI@. Version 2 is the version of the 1442132718SkanC++ ABI that first appeared in G++ 3.4. Version 1 is the version of 1443132718Skanthe C++ ABI that first appeared in G++ 3.2. Version 0 will always be 1444132718Skanthe version that conforms most closely to the C++ ABI specification. 1445132718SkanTherefore, the ABI obtained using version 0 will change as ABI bugs 1446132718Skanare fixed. 1447117395Skan 1448132718SkanThe default is version 2. 1449117395Skan 145090075Sobrien@item -fno-access-control 145190075Sobrien@opindex fno-access-control 145290075SobrienTurn off all access checking. This switch is mainly useful for working 145390075Sobrienaround bugs in the access control code. 145490075Sobrien 145590075Sobrien@item -fcheck-new 145690075Sobrien@opindex fcheck-new 145790075SobrienCheck that the pointer returned by @code{operator new} is non-null 1458117395Skanbefore attempting to modify the storage allocated. This check is 1459117395Skannormally unnecessary because the C++ standard specifies that 1460117395Skan@code{operator new} will only return @code{0} if it is declared 1461117395Skan@samp{throw()}, in which case the compiler will always check the 1462117395Skanreturn value even without this option. In all other cases, when 1463117395Skan@code{operator new} has a non-empty exception specification, memory 1464117395Skanexhaustion is signalled by throwing @code{std::bad_alloc}. See also 1465117395Skan@samp{new (nothrow)}. 146690075Sobrien 146790075Sobrien@item -fconserve-space 146890075Sobrien@opindex fconserve-space 146990075SobrienPut uninitialized or runtime-initialized global variables into the 147090075Sobriencommon segment, as C does. This saves space in the executable at the 147190075Sobriencost of not diagnosing duplicate definitions. If you compile with this 147290075Sobrienflag and your program mysteriously crashes after @code{main()} has 147390075Sobriencompleted, you may have an object that is being destroyed twice because 147490075Sobrientwo definitions were merged. 147590075Sobrien 147690075SobrienThis option is no longer useful on most targets, now that support has 147790075Sobrienbeen added for putting variables into BSS without making them common. 147890075Sobrien 1479169689Skan@item -ffriend-injection 1480169689Skan@opindex ffriend-injection 1481169689SkanInject friend functions into the enclosing namespace, so that they are 1482169689Skanvisible outside the scope of the class in which they are declared. 1483169689SkanFriend functions were documented to work this way in the old Annotated 1484169689SkanC++ Reference Manual, and versions of G++ before 4.1 always worked 1485169689Skanthat way. However, in ISO C++ a friend function which is not declared 1486169689Skanin an enclosing scope can only be found using argument dependent 1487169689Skanlookup. This option causes friends to be injected as they were in 1488169689Skanearlier releases. 148990075Sobrien 1490169689SkanThis option is for compatibility, and may be removed in a future 1491169689Skanrelease of G++. 149290075Sobrien 149390075Sobrien@item -fno-elide-constructors 149490075Sobrien@opindex fno-elide-constructors 149590075SobrienThe C++ standard allows an implementation to omit creating a temporary 149690075Sobrienwhich is only used to initialize another object of the same type. 149790075SobrienSpecifying this option disables that optimization, and forces G++ to 149890075Sobriencall the copy constructor in all cases. 149990075Sobrien 150090075Sobrien@item -fno-enforce-eh-specs 150190075Sobrien@opindex fno-enforce-eh-specs 1502169689SkanDon't generate code to check for violation of exception specifications 1503169689Skanat runtime. This option violates the C++ standard, but may be useful 1504169689Skanfor reducing code size in production builds, much like defining 1505169689Skan@samp{NDEBUG}. This does not give user code permission to throw 1506169689Skanexceptions in violation of the exception specifications; the compiler 1507169689Skanwill still optimize based on the specifications, so throwing an 1508169689Skanunexpected exception will result in undefined behavior. 150990075Sobrien 151090075Sobrien@item -ffor-scope 151190075Sobrien@itemx -fno-for-scope 151290075Sobrien@opindex ffor-scope 151390075Sobrien@opindex fno-for-scope 151490075SobrienIf @option{-ffor-scope} is specified, the scope of variables declared in 151590075Sobriena @i{for-init-statement} is limited to the @samp{for} loop itself, 151690075Sobrienas specified by the C++ standard. 151790075SobrienIf @option{-fno-for-scope} is specified, the scope of variables declared in 151890075Sobriena @i{for-init-statement} extends to the end of the enclosing scope, 151990075Sobrienas was the case in old versions of G++, and other (traditional) 152090075Sobrienimplementations of C++. 152190075Sobrien 152290075SobrienThe default if neither flag is given to follow the standard, 152390075Sobrienbut to allow and give a warning for old-style code that would 152490075Sobrienotherwise be invalid, or have different behavior. 152590075Sobrien 152690075Sobrien@item -fno-gnu-keywords 152790075Sobrien@opindex fno-gnu-keywords 152890075SobrienDo not recognize @code{typeof} as a keyword, so that code can use this 152990075Sobrienword as an identifier. You can use the keyword @code{__typeof__} instead. 153090075Sobrien@option{-ansi} implies @option{-fno-gnu-keywords}. 153190075Sobrien 153290075Sobrien@item -fno-implicit-templates 153390075Sobrien@opindex fno-implicit-templates 153490075SobrienNever emit code for non-inline templates which are instantiated 153590075Sobrienimplicitly (i.e.@: by use); only emit code for explicit instantiations. 153690075Sobrien@xref{Template Instantiation}, for more information. 153790075Sobrien 153890075Sobrien@item -fno-implicit-inline-templates 153990075Sobrien@opindex fno-implicit-inline-templates 154090075SobrienDon't emit code for implicit instantiations of inline templates, either. 154190075SobrienThe default is to handle inlines differently so that compiles with and 154290075Sobrienwithout optimization will need the same set of explicit instantiations. 154390075Sobrien 154490075Sobrien@item -fno-implement-inlines 154590075Sobrien@opindex fno-implement-inlines 154690075SobrienTo save space, do not emit out-of-line copies of inline functions 154790075Sobriencontrolled by @samp{#pragma implementation}. This will cause linker 154890075Sobrienerrors if these functions are not inlined everywhere they are called. 154990075Sobrien 155090075Sobrien@item -fms-extensions 155190075Sobrien@opindex fms-extensions 155290075SobrienDisable pedantic warnings about constructs used in MFC, such as implicit 155390075Sobrienint and getting a pointer to member function via non-standard syntax. 155490075Sobrien 155590075Sobrien@item -fno-nonansi-builtins 155690075Sobrien@opindex fno-nonansi-builtins 155790075SobrienDisable built-in declarations of functions that are not mandated by 155890075SobrienANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit}, 155990075Sobrien@code{index}, @code{bzero}, @code{conjf}, and other related functions. 156090075Sobrien 156190075Sobrien@item -fno-operator-names 156290075Sobrien@opindex fno-operator-names 156390075SobrienDo not treat the operator name keywords @code{and}, @code{bitand}, 156490075Sobrien@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as 156590075Sobriensynonyms as keywords. 156690075Sobrien 156790075Sobrien@item -fno-optional-diags 156890075Sobrien@opindex fno-optional-diags 156990075SobrienDisable diagnostics that the standard says a compiler does not need to 157090075Sobrienissue. Currently, the only such diagnostic issued by G++ is the one for 157190075Sobriena name having multiple meanings within a class. 157290075Sobrien 157390075Sobrien@item -fpermissive 157490075Sobrien@opindex fpermissive 1575117395SkanDowngrade some diagnostics about nonconformant code from errors to 1576117395Skanwarnings. Thus, using @option{-fpermissive} will allow some 1577117395Skannonconforming code to compile. 157890075Sobrien 157990075Sobrien@item -frepo 158090075Sobrien@opindex frepo 158190075SobrienEnable automatic template instantiation at link time. This option also 158290075Sobrienimplies @option{-fno-implicit-templates}. @xref{Template 158390075SobrienInstantiation}, for more information. 158490075Sobrien 158590075Sobrien@item -fno-rtti 158690075Sobrien@opindex fno-rtti 158790075SobrienDisable generation of information about every class with virtual 158890075Sobrienfunctions for use by the C++ runtime type identification features 158990075Sobrien(@samp{dynamic_cast} and @samp{typeid}). If you don't use those parts 159090075Sobrienof the language, you can save some space by using this flag. Note that 159190075Sobrienexception handling uses the same information, but it will generate it as 1592169689Skanneeded. The @samp{dynamic_cast} operator can still be used for casts that 1593169689Skando not require runtime type information, i.e. casts to @code{void *} or to 1594169689Skanunambiguous base classes. 159590075Sobrien 159690075Sobrien@item -fstats 159790075Sobrien@opindex fstats 159890075SobrienEmit statistics about front-end processing at the end of the compilation. 159990075SobrienThis information is generally only useful to the G++ development team. 160090075Sobrien 160190075Sobrien@item -ftemplate-depth-@var{n} 160290075Sobrien@opindex ftemplate-depth 160390075SobrienSet the maximum instantiation depth for template classes to @var{n}. 160490075SobrienA limit on the template instantiation depth is needed to detect 160590075Sobrienendless recursions during template class instantiation. ANSI/ISO C++ 160690075Sobrienconforming programs must not rely on a maximum depth greater than 17. 160790075Sobrien 1608169689Skan@item -fno-threadsafe-statics 1609169689Skan@opindex fno-threadsafe-statics 1610169689SkanDo not emit the extra code to use the routines specified in the C++ 1611169689SkanABI for thread-safe initialization of local statics. You can use this 1612169689Skanoption to reduce code size slightly in code that doesn't need to be 1613169689Skanthread-safe. 1614169689Skan 161590075Sobrien@item -fuse-cxa-atexit 161690075Sobrien@opindex fuse-cxa-atexit 161790075SobrienRegister destructors for objects with static storage duration with the 161890075Sobrien@code{__cxa_atexit} function rather than the @code{atexit} function. 161990075SobrienThis option is required for fully standards-compliant handling of static 162090075Sobriendestructors, but will only work if your C library supports 162190075Sobrien@code{__cxa_atexit}. 162290075Sobrien 1623169689Skan@item -fno-use-cxa-get-exception-ptr 1624169689Skan@opindex fno-use-cxa-get-exception-ptr 1625169689SkanDon't use the @code{__cxa_get_exception_ptr} runtime routine. This 1626169689Skanwill cause @code{std::uncaught_exception} to be incorrect, but is necessary 1627169689Skanif the runtime routine is not available. 1628169689Skan 1629169689Skan@item -fvisibility-inlines-hidden 1630169689Skan@opindex fvisibility-inlines-hidden 1631169689SkanThis switch declares that the user does not attempt to compare 1632169689Skanpointers to inline methods where the addresses of the two functions 1633169689Skanwere taken in different shared objects. 1634169689Skan 1635169689SkanThe effect of this is that GCC may, effectively, mark inline methods with 1636169689Skan@code{__attribute__ ((visibility ("hidden")))} so that they do not 1637169689Skanappear in the export table of a DSO and do not require a PLT indirection 1638169689Skanwhen used within the DSO@. Enabling this option can have a dramatic effect 1639169689Skanon load and link times of a DSO as it massively reduces the size of the 1640169689Skandynamic export table when the library makes heavy use of templates. 1641169689Skan 1642169689SkanThe behaviour of this switch is not quite the same as marking the 1643169689Skanmethods as hidden directly, because it does not affect static variables 1644169689Skanlocal to the function or cause the compiler to deduce that 1645169689Skanthe function is defined in only one shared object. 1646169689Skan 1647169689SkanYou may mark a method as having a visibility explicitly to negate the 1648169689Skaneffect of the switch for that method. For example, if you do want to 1649169689Skancompare pointers to a particular inline method, you might mark it as 1650169689Skanhaving default visibility. Marking the enclosing class with explicit 1651169689Skanvisibility will have no effect. 1652169689Skan 1653169689SkanExplicitly instantiated inline methods are unaffected by this option 1654169689Skanas their linkage might otherwise cross a shared library boundary. 1655169689Skan@xref{Template Instantiation}. 1656169689Skan 1657260074Spfg@item -fvisibility-ms-compat 1658260074Spfg@opindex fvisibility-ms-compat 1659260074SpfgThis flag attempts to use visibility settings to make GCC's C++ 1660260074Spfglinkage model compatible with that of Microsoft Visual Studio. 1661260074Spfg 1662260074SpfgThe flag makes these changes to GCC's linkage model: 1663260074Spfg 1664260074Spfg@enumerate 1665260074Spfg@item 1666260074SpfgIt sets the default visibility to @code{hidden}, like 1667260074Spfg@option{-fvisibility=hidden}. 1668260074Spfg 1669260074Spfg@item 1670260074SpfgTypes, but not their members, are not hidden by default. 1671260074Spfg 1672260074Spfg@item 1673260074SpfgThe One Definition Rule is relaxed for types without explicit 1674260074Spfgvisibility specifications which are defined in more than one different 1675260074Spfgshared object: those declarations are permitted if they would have 1676260074Spfgbeen permitted when this option was not used. 1677260074Spfg@end enumerate 1678260074Spfg 1679260074SpfgIn new code it is better to use @option{-fvisibility=hidden} and 1680260074Spfgexport those classes which are intended to be externally visible. 1681260074SpfgUnfortunately it is possible for code to rely, perhaps accidentally, 1682260074Spfgon the Visual Studio behaviour. 1683260074Spfg 1684260074SpfgAmong the consequences of these changes are that static data members 1685260074Spfgof the same type with the same name but defined in different shared 1686260074Spfgobjects will be different, so changing one will not change the other; 1687260074Spfgand that pointers to function members defined in different shared 1688260074Spfgobjects may not compare equal. When this flag is given, it is a 1689260074Spfgviolation of the ODR to define types with the same name differently. 1690260074Spfg 169190075Sobrien@item -fno-weak 169290075Sobrien@opindex fno-weak 169390075SobrienDo not use weak symbol support, even if it is provided by the linker. 169490075SobrienBy default, G++ will use weak symbols if they are available. This 169590075Sobrienoption exists only for testing, and should not be used by end-users; 169690075Sobrienit will result in inferior code and has no benefits. This option may 169790075Sobrienbe removed in a future release of G++. 169890075Sobrien 169990075Sobrien@item -nostdinc++ 170090075Sobrien@opindex nostdinc++ 170190075SobrienDo not search for header files in the standard directories specific to 170290075SobrienC++, but do still search the other standard directories. (This option 170390075Sobrienis used when building the C++ library.) 170490075Sobrien@end table 170590075Sobrien 170690075SobrienIn addition, these optimization, warning, and code generation options 170790075Sobrienhave meanings only for C++ programs: 170890075Sobrien 170990075Sobrien@table @gcctabopt 171090075Sobrien@item -fno-default-inline 171190075Sobrien@opindex fno-default-inline 171290075SobrienDo not assume @samp{inline} for functions defined inside a class scope. 171390075Sobrien@xref{Optimize Options,,Options That Control Optimization}. Note that these 171490075Sobrienfunctions will have linkage like inline functions; they just won't be 171590075Sobrieninlined by default. 171690075Sobrien 1717102780Skan@item -Wabi @r{(C++ only)} 1718102780Skan@opindex Wabi 1719102780SkanWarn when G++ generates code that is probably not compatible with the 1720169689Skanvendor-neutral C++ ABI@. Although an effort has been made to warn about 1721132718Skanall such cases, there are probably some cases that are not warned about, 1722102780Skaneven though G++ is generating incompatible code. There may also be 1723102780Skancases where warnings are emitted even though the code that is generated 1724102780Skanwill be compatible. 1725102780Skan 1726102780SkanYou should rewrite your code to avoid these warnings if you are 1727102780Skanconcerned about the fact that code generated by G++ may not be binary 1728102780Skancompatible with code generated by other compilers. 1729102780Skan 1730117395SkanThe known incompatibilities at this point include: 1731102780Skan 1732102780Skan@itemize @bullet 1733102780Skan 1734102780Skan@item 1735102780SkanIncorrect handling of tail-padding for bit-fields. G++ may attempt to 1736102780Skanpack data into the same byte as a base class. For example: 1737102780Skan 1738102780Skan@smallexample 1739102780Skanstruct A @{ virtual void f(); int f1 : 1; @}; 1740102780Skanstruct B : public A @{ int f2 : 1; @}; 1741102780Skan@end smallexample 1742102780Skan 1743102780Skan@noindent 1744102780SkanIn this case, G++ will place @code{B::f2} into the same byte 1745132718Skanas@code{A::f1}; other compilers will not. You can avoid this problem 1746102780Skanby explicitly padding @code{A} so that its size is a multiple of the 1747102780Skanbyte size on your platform; that will cause G++ and other compilers to 1748102780Skanlayout @code{B} identically. 1749102780Skan 1750102780Skan@item 1751102780SkanIncorrect handling of tail-padding for virtual bases. G++ does not use 1752102780Skantail padding when laying out virtual bases. For example: 1753102780Skan 1754102780Skan@smallexample 1755102780Skanstruct A @{ virtual void f(); char c1; @}; 1756102780Skanstruct B @{ B(); char c2; @}; 1757102780Skanstruct C : public A, public virtual B @{@}; 1758102780Skan@end smallexample 1759102780Skan 1760102780Skan@noindent 1761102780SkanIn this case, G++ will not place @code{B} into the tail-padding for 1762102780Skan@code{A}; other compilers will. You can avoid this problem by 1763102780Skanexplicitly padding @code{A} so that its size is a multiple of its 1764102780Skanalignment (ignoring virtual base classes); that will cause G++ and other 1765102780Skancompilers to layout @code{C} identically. 1766102780Skan 1767117395Skan@item 1768117395SkanIncorrect handling of bit-fields with declared widths greater than that 1769117395Skanof their underlying types, when the bit-fields appear in a union. For 1770117395Skanexample: 1771117395Skan 1772117395Skan@smallexample 1773117395Skanunion U @{ int i : 4096; @}; 1774117395Skan@end smallexample 1775117395Skan 1776117395Skan@noindent 1777117395SkanAssuming that an @code{int} does not have 4096 bits, G++ will make the 1778117395Skanunion too small by the number of bits in an @code{int}. 1779117395Skan 1780117395Skan@item 1781117395SkanEmpty classes can be placed at incorrect offsets. For example: 1782132718Skan 1783117395Skan@smallexample 1784117395Skanstruct A @{@}; 1785117395Skan 1786117395Skanstruct B @{ 1787117395Skan A a; 1788117395Skan virtual void f (); 1789117395Skan@}; 1790117395Skan 1791117395Skanstruct C : public B, public A @{@}; 1792117395Skan@end smallexample 1793117395Skan 1794117395Skan@noindent 1795117395SkanG++ will place the @code{A} base class of @code{C} at a nonzero offset; 1796117395Skanit should be placed at offset zero. G++ mistakenly believes that the 1797117395Skan@code{A} data member of @code{B} is already at offset zero. 1798117395Skan 1799117395Skan@item 1800117395SkanNames of template functions whose types involve @code{typename} or 1801117395Skantemplate template parameters can be mangled incorrectly. 1802117395Skan 1803117395Skan@smallexample 1804117395Skantemplate <typename Q> 1805117395Skanvoid f(typename Q::X) @{@} 1806117395Skan 1807117395Skantemplate <template <typename> class Q> 1808117395Skanvoid f(typename Q<int>::X) @{@} 1809117395Skan@end smallexample 1810117395Skan 1811117395Skan@noindent 1812117395SkanInstantiations of these templates may be mangled incorrectly. 1813117395Skan 1814102780Skan@end itemize 1815102780Skan 181690075Sobrien@item -Wctor-dtor-privacy @r{(C++ only)} 181790075Sobrien@opindex Wctor-dtor-privacy 1818119256SkanWarn when a class seems unusable because all the constructors or 1819119256Skandestructors in that class are private, and it has neither friends nor 1820132718Skanpublic static member functions. 182190075Sobrien 182290075Sobrien@item -Wnon-virtual-dtor @r{(C++ only)} 182390075Sobrien@opindex Wnon-virtual-dtor 1824119256SkanWarn when a class appears to be polymorphic, thereby requiring a virtual 1825169689Skandestructor, yet it declares a non-virtual one. This warning is also 1826169689Skanenabled if -Weffc++ is specified. 182790075Sobrien 182890075Sobrien@item -Wreorder @r{(C++ only)} 182990075Sobrien@opindex Wreorder 183090075Sobrien@cindex reordering, warning 183190075Sobrien@cindex warning for reordering of member initializers 183290075SobrienWarn when the order of member initializers given in the code does not 183390075Sobrienmatch the order in which they must be executed. For instance: 183490075Sobrien 183590075Sobrien@smallexample 183690075Sobrienstruct A @{ 183790075Sobrien int i; 183890075Sobrien int j; 183990075Sobrien A(): j (0), i (1) @{ @} 184090075Sobrien@}; 184190075Sobrien@end smallexample 184290075Sobrien 1843119256SkanThe compiler will rearrange the member initializers for @samp{i} 1844119256Skanand @samp{j} to match the declaration order of the members, emitting 1845119256Skana warning to that effect. This warning is enabled by @option{-Wall}. 184690075Sobrien@end table 184790075Sobrien 184890075SobrienThe following @option{-W@dots{}} options are not affected by @option{-Wall}. 184990075Sobrien 185090075Sobrien@table @gcctabopt 185190075Sobrien@item -Weffc++ @r{(C++ only)} 185290075Sobrien@opindex Weffc++ 185396263SobrienWarn about violations of the following style guidelines from Scott Meyers' 185496263Sobrien@cite{Effective C++} book: 185590075Sobrien 185696263Sobrien@itemize @bullet 185796263Sobrien@item 185896263SobrienItem 11: Define a copy constructor and an assignment operator for classes 185996263Sobrienwith dynamically allocated memory. 186096263Sobrien 186196263Sobrien@item 186296263SobrienItem 12: Prefer initialization to assignment in constructors. 186396263Sobrien 186496263Sobrien@item 186596263SobrienItem 14: Make destructors virtual in base classes. 186696263Sobrien 186796263Sobrien@item 186896263SobrienItem 15: Have @code{operator=} return a reference to @code{*this}. 186996263Sobrien 187096263Sobrien@item 187196263SobrienItem 23: Don't try to return a reference when you must return an object. 187296263Sobrien 187396263Sobrien@end itemize 187496263Sobrien 1875132718SkanAlso warn about violations of the following style guidelines from 1876119256SkanScott Meyers' @cite{More Effective C++} book: 187796263Sobrien 187896263Sobrien@itemize @bullet 187996263Sobrien@item 188096263SobrienItem 6: Distinguish between prefix and postfix forms of increment and 188196263Sobriendecrement operators. 188296263Sobrien 188396263Sobrien@item 188496263SobrienItem 7: Never overload @code{&&}, @code{||}, or @code{,}. 188596263Sobrien 188696263Sobrien@end itemize 188796263Sobrien 1888119256SkanWhen selecting this option, be aware that the standard library 1889119256Skanheaders do not obey all of these guidelines; use @samp{grep -v} 189096263Sobriento filter out those warnings. 189196263Sobrien 189290075Sobrien@item -Wno-deprecated @r{(C++ only)} 189390075Sobrien@opindex Wno-deprecated 189490075SobrienDo not warn about usage of deprecated features. @xref{Deprecated Features}. 189590075Sobrien 1896169689Skan@item -Wstrict-null-sentinel @r{(C++ only)} 1897169689Skan@opindex Wstrict-null-sentinel 1898169689SkanWarn also about the use of an uncasted @code{NULL} as sentinel. When 1899169689Skancompiling only with GCC this is a valid sentinel, as @code{NULL} is defined 1900169689Skanto @code{__null}. Although it is a null pointer constant not a null pointer, 1901169689Skanit is guaranteed to of the same size as a pointer. But this use is 1902169689Skannot portable across different compilers. 1903169689Skan 190490075Sobrien@item -Wno-non-template-friend @r{(C++ only)} 190590075Sobrien@opindex Wno-non-template-friend 190690075SobrienDisable warnings when non-templatized friend functions are declared 1907119256Skanwithin a template. Since the advent of explicit template specification 190890075Sobriensupport in G++, if the name of the friend is an unqualified-id (i.e., 190990075Sobrien@samp{friend foo(int)}), the C++ language specification demands that the 191090075Sobrienfriend declare or define an ordinary, nontemplate function. (Section 191190075Sobrien14.5.3). Before G++ implemented explicit specification, unqualified-ids 191290075Sobriencould be interpreted as a particular specialization of a templatized 191390075Sobrienfunction. Because this non-conforming behavior is no longer the default 191490075Sobrienbehavior for G++, @option{-Wnon-template-friend} allows the compiler to 1915119256Skancheck existing code for potential trouble spots and is on by default. 191690075SobrienThis new compiler behavior can be turned off with 191790075Sobrien@option{-Wno-non-template-friend} which keeps the conformant compiler code 191890075Sobrienbut disables the helpful warning. 191990075Sobrien 192090075Sobrien@item -Wold-style-cast @r{(C++ only)} 192190075Sobrien@opindex Wold-style-cast 192290075SobrienWarn if an old-style (C-style) cast to a non-void type is used within 1923169689Skana C++ program. The new-style casts (@samp{dynamic_cast}, 1924169689Skan@samp{static_cast}, @samp{reinterpret_cast}, and @samp{const_cast}) are 1925169689Skanless vulnerable to unintended effects and much easier to search for. 192690075Sobrien 192790075Sobrien@item -Woverloaded-virtual @r{(C++ only)} 192890075Sobrien@opindex Woverloaded-virtual 192990075Sobrien@cindex overloaded virtual fn, warning 193090075Sobrien@cindex warning for overloaded virtual fn 193190075SobrienWarn when a function declaration hides virtual functions from a 193290075Sobrienbase class. For example, in: 193390075Sobrien 193490075Sobrien@smallexample 193590075Sobrienstruct A @{ 193690075Sobrien virtual void f(); 193790075Sobrien@}; 193890075Sobrien 193990075Sobrienstruct B: public A @{ 194090075Sobrien void f(int); 194190075Sobrien@}; 194290075Sobrien@end smallexample 194390075Sobrien 194490075Sobrienthe @code{A} class version of @code{f} is hidden in @code{B}, and code 1945119256Skanlike: 194690075Sobrien 194790075Sobrien@smallexample 194890075SobrienB* b; 194990075Sobrienb->f(); 195090075Sobrien@end smallexample 195190075Sobrien 195290075Sobrienwill fail to compile. 195390075Sobrien 195490075Sobrien@item -Wno-pmf-conversions @r{(C++ only)} 195590075Sobrien@opindex Wno-pmf-conversions 195690075SobrienDisable the diagnostic for converting a bound pointer to member function 195790075Sobriento a plain pointer. 195890075Sobrien 195990075Sobrien@item -Wsign-promo @r{(C++ only)} 196090075Sobrien@opindex Wsign-promo 196190075SobrienWarn when overload resolution chooses a promotion from unsigned or 1962132718Skanenumerated type to a signed type, over a conversion to an unsigned type of 196390075Sobrienthe same size. Previous versions of G++ would try to preserve 196490075Sobrienunsignedness, but the standard mandates the current behavior. 196590075Sobrien 196690075Sobrien@smallexample 196790075Sobrienstruct A @{ 196890075Sobrien operator int (); 196990075Sobrien A& operator = (int); 197090075Sobrien@}; 197190075Sobrien 197290075Sobrienmain () 197390075Sobrien@{ 197490075Sobrien A a,b; 197590075Sobrien a = b; 197690075Sobrien@} 197790075Sobrien@end smallexample 197890075Sobrien 197990075SobrienIn this example, G++ will synthesize a default @samp{A& operator = 198090075Sobrien(const A&);}, while cfront will use the user-defined @samp{operator =}. 198190075Sobrien@end table 198290075Sobrien 198390075Sobrien@node Language Independent Options 198490075Sobrien@section Options to Control Diagnostic Messages Formatting 198590075Sobrien@cindex options to control diagnostics formatting 198690075Sobrien@cindex diagnostic messages 198790075Sobrien@cindex message formatting 198890075Sobrien 198990075SobrienTraditionally, diagnostic messages have been formatted irrespective of 199090075Sobrienthe output device's aspect (e.g.@: its width, @dots{}). The options described 199190075Sobrienbelow can be used to control the diagnostic messages formatting 199290075Sobrienalgorithm, e.g.@: how many characters per line, how often source location 199390075Sobrieninformation should be reported. Right now, only the C++ front end can 199490075Sobrienhonor these options. However it is expected, in the near future, that 199590075Sobrienthe remaining front ends would be able to digest them correctly. 199690075Sobrien 199790075Sobrien@table @gcctabopt 199890075Sobrien@item -fmessage-length=@var{n} 199990075Sobrien@opindex fmessage-length 200090075SobrienTry to format error messages so that they fit on lines of about @var{n} 200190075Sobriencharacters. The default is 72 characters for @command{g++} and 0 for the rest of 200290075Sobrienthe front ends supported by GCC@. If @var{n} is zero, then no 200390075Sobrienline-wrapping will be done; each error message will appear on a single 200490075Sobrienline. 200590075Sobrien 200690075Sobrien@opindex fdiagnostics-show-location 200790075Sobrien@item -fdiagnostics-show-location=once 200890075SobrienOnly meaningful in line-wrapping mode. Instructs the diagnostic messages 200990075Sobrienreporter to emit @emph{once} source location information; that is, in 201090075Sobriencase the message is too long to fit on a single physical line and has to 201190075Sobrienbe wrapped, the source location won't be emitted (as prefix) again, 201290075Sobrienover and over, in subsequent continuation lines. This is the default 201390075Sobrienbehavior. 201490075Sobrien 201590075Sobrien@item -fdiagnostics-show-location=every-line 201690075SobrienOnly meaningful in line-wrapping mode. Instructs the diagnostic 201790075Sobrienmessages reporter to emit the same source location information (as 201890075Sobrienprefix) for physical lines that result from the process of breaking 201990075Sobriena message which is too long to fit on a single line. 202090075Sobrien 2021169689Skan@item -fdiagnostics-show-option 2022169689Skan@opindex fdiagnostics-show-option 2023169689SkanThis option instructs the diagnostic machinery to add text to each 2024169689Skandiagnostic emitted, which indicates which command line option directly 2025169689Skancontrols that diagnostic, when such an option is known to the 2026169689Skandiagnostic machinery. 2027169689Skan 202890075Sobrien@end table 202990075Sobrien 203090075Sobrien@node Warning Options 203190075Sobrien@section Options to Request or Suppress Warnings 203290075Sobrien@cindex options to control warnings 203390075Sobrien@cindex warning messages 203490075Sobrien@cindex messages, warning 203590075Sobrien@cindex suppressing warnings 203690075Sobrien 203790075SobrienWarnings are diagnostic messages that report constructions which 203890075Sobrienare not inherently erroneous but which are risky or suggest there 203990075Sobrienmay have been an error. 204090075Sobrien 204190075SobrienYou can request many specific warnings with options beginning @samp{-W}, 204290075Sobrienfor example @option{-Wimplicit} to request warnings on implicit 204390075Sobriendeclarations. Each of these specific warning options also has a 204490075Sobriennegative form beginning @samp{-Wno-} to turn off warnings; 204590075Sobrienfor example, @option{-Wno-implicit}. This manual lists only one of the 204690075Sobrientwo forms, whichever is not the default. 204790075Sobrien 204896263SobrienThe following options control the amount and kinds of warnings produced 204996263Sobrienby GCC; for further, language-specific options also refer to 2050220755Sdim@ref{C++ Dialect Options}. 205190075Sobrien 205290075Sobrien@table @gcctabopt 205390075Sobrien@cindex syntax checking 205490075Sobrien@item -fsyntax-only 205590075Sobrien@opindex fsyntax-only 205690075SobrienCheck the code for syntax errors, but don't do anything beyond that. 205790075Sobrien 205890075Sobrien@item -pedantic 205990075Sobrien@opindex pedantic 206090075SobrienIssue all the warnings demanded by strict ISO C and ISO C++; 206190075Sobrienreject all programs that use forbidden extensions, and some other 206290075Sobrienprograms that do not follow ISO C and ISO C++. For ISO C, follows the 206390075Sobrienversion of the ISO C standard specified by any @option{-std} option used. 206490075Sobrien 206590075SobrienValid ISO C and ISO C++ programs should compile properly with or without 206690075Sobrienthis option (though a rare few will require @option{-ansi} or a 206790075Sobrien@option{-std} option specifying the required version of ISO C)@. However, 206890075Sobrienwithout this option, certain GNU extensions and traditional C and C++ 206990075Sobrienfeatures are supported as well. With this option, they are rejected. 207090075Sobrien 207190075Sobrien@option{-pedantic} does not cause warning messages for use of the 207290075Sobrienalternate keywords whose names begin and end with @samp{__}. Pedantic 207390075Sobrienwarnings are also disabled in the expression that follows 207490075Sobrien@code{__extension__}. However, only system header files should use 207590075Sobrienthese escape routes; application programs should avoid them. 207690075Sobrien@xref{Alternate Keywords}. 207790075Sobrien 207890075SobrienSome users try to use @option{-pedantic} to check programs for strict ISO 207990075SobrienC conformance. They soon find that it does not do quite what they want: 208090075Sobrienit finds some non-ISO practices, but not all---only those for which 208190075SobrienISO C @emph{requires} a diagnostic, and some others for which 208290075Sobriendiagnostics have been added. 208390075Sobrien 208490075SobrienA feature to report any failure to conform to ISO C might be useful in 208590075Sobriensome instances, but would require considerable additional work and would 208690075Sobrienbe quite different from @option{-pedantic}. We don't have plans to 208790075Sobriensupport such a feature in the near future. 208890075Sobrien 208990075SobrienWhere the standard specified with @option{-std} represents a GNU 209090075Sobrienextended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a 209190075Sobriencorresponding @dfn{base standard}, the version of ISO C on which the GNU 209290075Sobrienextended dialect is based. Warnings from @option{-pedantic} are given 209390075Sobrienwhere they are required by the base standard. (It would not make sense 209490075Sobrienfor such warnings to be given only for features not in the specified GNU 209590075SobrienC dialect, since by definition the GNU dialects of C include all 209690075Sobrienfeatures the compiler supports with the given option, and there would be 209790075Sobriennothing to warn about.) 209890075Sobrien 209990075Sobrien@item -pedantic-errors 210090075Sobrien@opindex pedantic-errors 210190075SobrienLike @option{-pedantic}, except that errors are produced rather than 210290075Sobrienwarnings. 210390075Sobrien 210490075Sobrien@item -w 210590075Sobrien@opindex w 210690075SobrienInhibit all warning messages. 210790075Sobrien 210890075Sobrien@item -Wno-import 210990075Sobrien@opindex Wno-import 211090075SobrienInhibit warning messages about the use of @samp{#import}. 211190075Sobrien 2112259890Spfg@c APPLE LOCAL begin -Wnewline-eof 2001-08-23 --sts ** 2113259890Spfg@item -Wnewline-eof 2114259890Spfg@opindex Wnewline-eof 2115259890SpfgWarn about files missing a newline at the end of the file. (Apple compatible) 2116259890Spfg@c APPLE LOCAL end -Wnewline-eof 2001-08-23 --sts ** 2117259890Spfg 211890075Sobrien@item -Wchar-subscripts 211990075Sobrien@opindex Wchar-subscripts 212090075SobrienWarn if an array subscript has type @code{char}. This is a common cause 212190075Sobrienof error, as programmers often forget that this type is signed on some 212290075Sobrienmachines. 2123169689SkanThis warning is enabled by @option{-Wall}. 212490075Sobrien 212590075Sobrien@item -Wcomment 212690075Sobrien@opindex Wcomment 212790075SobrienWarn whenever a comment-start sequence @samp{/*} appears in a @samp{/*} 212890075Sobriencomment, or whenever a Backslash-Newline appears in a @samp{//} comment. 2129169689SkanThis warning is enabled by @option{-Wall}. 213090075Sobrien 2131169689Skan@item -Wfatal-errors 2132169689Skan@opindex Wfatal-errors 2133169689SkanThis option causes the compiler to abort compilation on the first error 2134169689Skanoccurred rather than trying to keep going and printing further error 2135169689Skanmessages. 2136169689Skan 213790075Sobrien@item -Wformat 213890075Sobrien@opindex Wformat 2139169689Skan@opindex ffreestanding 2140169689Skan@opindex fno-builtin 214190075SobrienCheck calls to @code{printf} and @code{scanf}, etc., to make sure that 214290075Sobrienthe arguments supplied have types appropriate to the format string 214390075Sobrienspecified, and that the conversions specified in the format string make 214490075Sobriensense. This includes standard functions, and others specified by format 214590075Sobrienattributes (@pxref{Function Attributes}), in the @code{printf}, 214690075Sobrien@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension, 2147169689Skannot in the C standard) families (or other target-specific families). 2148169689SkanWhich functions are checked without format attributes having been 2149169689Skanspecified depends on the standard version selected, and such checks of 2150169689Skanfunctions without the attribute specified are disabled by 2151169689Skan@option{-ffreestanding} or @option{-fno-builtin}. 215290075Sobrien 215390075SobrienThe formats are checked against the format features supported by GNU 2154117395Skanlibc version 2.2. These include all ISO C90 and C99 features, as well 215590075Sobrienas features from the Single Unix Specification and some BSD and GNU 215690075Sobrienextensions. Other library implementations may not support all these 215790075Sobrienfeatures; GCC does not support warning about features that go beyond a 215890075Sobrienparticular library's limitations. However, if @option{-pedantic} is used 215990075Sobrienwith @option{-Wformat}, warnings will be given about format features not 216090075Sobrienin the selected standard version (but not for @code{strfmon} formats, 216190075Sobriensince those are not in any version of the C standard). @xref{C Dialect 216290075SobrienOptions,,Options Controlling C Dialect}. 216390075Sobrien 2164117395SkanSince @option{-Wformat} also checks for null format arguments for 2165117395Skanseveral functions, @option{-Wformat} also implies @option{-Wnonnull}. 2166117395Skan 216790075Sobrien@option{-Wformat} is included in @option{-Wall}. For more control over some 2168132718Skanaspects of format checking, the options @option{-Wformat-y2k}, 2169117395Skan@option{-Wno-format-extra-args}, @option{-Wno-format-zero-length}, 2170117395Skan@option{-Wformat-nonliteral}, @option{-Wformat-security}, and 2171117395Skan@option{-Wformat=2} are available, but are not included in @option{-Wall}. 217290075Sobrien 2173132718Skan@item -Wformat-y2k 2174132718Skan@opindex Wformat-y2k 2175132718SkanIf @option{-Wformat} is specified, also warn about @code{strftime} 217690075Sobrienformats which may yield only a two-digit year. 217790075Sobrien 217890075Sobrien@item -Wno-format-extra-args 217990075Sobrien@opindex Wno-format-extra-args 218090075SobrienIf @option{-Wformat} is specified, do not warn about excess arguments to a 218190075Sobrien@code{printf} or @code{scanf} format function. The C standard specifies 218290075Sobrienthat such arguments are ignored. 218390075Sobrien 218490075SobrienWhere the unused arguments lie between used arguments that are 218590075Sobrienspecified with @samp{$} operand number specifications, normally 218690075Sobrienwarnings are still given, since the implementation could not know what 218790075Sobrientype to pass to @code{va_arg} to skip the unused arguments. However, 218890075Sobrienin the case of @code{scanf} formats, this option will suppress the 218990075Sobrienwarning if the unused arguments are all pointers, since the Single 219090075SobrienUnix Specification says that such unused arguments are allowed. 219190075Sobrien 2192117395Skan@item -Wno-format-zero-length 2193117395Skan@opindex Wno-format-zero-length 2194117395SkanIf @option{-Wformat} is specified, do not warn about zero-length formats. 2195117395SkanThe C standard specifies that zero-length formats are allowed. 2196117395Skan 219790075Sobrien@item -Wformat-nonliteral 219890075Sobrien@opindex Wformat-nonliteral 219990075SobrienIf @option{-Wformat} is specified, also warn if the format string is not a 220090075Sobrienstring literal and so cannot be checked, unless the format function 220190075Sobrientakes its format arguments as a @code{va_list}. 220290075Sobrien 220390075Sobrien@item -Wformat-security 220490075Sobrien@opindex Wformat-security 220590075SobrienIf @option{-Wformat} is specified, also warn about uses of format 220690075Sobrienfunctions that represent possible security problems. At present, this 220790075Sobrienwarns about calls to @code{printf} and @code{scanf} functions where the 220890075Sobrienformat string is not a string literal and there are no format arguments, 220990075Sobrienas in @code{printf (foo);}. This may be a security hole if the format 221090075Sobrienstring came from untrusted input and contains @samp{%n}. (This is 221190075Sobriencurrently a subset of what @option{-Wformat-nonliteral} warns about, but 221290075Sobrienin future warnings may be added to @option{-Wformat-security} that are not 221390075Sobrienincluded in @option{-Wformat-nonliteral}.) 221490075Sobrien 221590075Sobrien@item -Wformat=2 221690075Sobrien@opindex Wformat=2 221790075SobrienEnable @option{-Wformat} plus format checks not included in 221890075Sobrien@option{-Wformat}. Currently equivalent to @samp{-Wformat 2219132718Skan-Wformat-nonliteral -Wformat-security -Wformat-y2k}. 222090075Sobrien 2221117395Skan@item -Wnonnull 2222117395Skan@opindex Wnonnull 2223132718SkanWarn about passing a null pointer for arguments marked as 2224117395Skanrequiring a non-null value by the @code{nonnull} function attribute. 2225117395Skan 2226117395Skan@option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It 2227117395Skancan be disabled with the @option{-Wno-nonnull} option. 2228117395Skan 2229220755Sdim@item -Winit-self @r{(C and C++ only)} 2230132718Skan@opindex Winit-self 2231132718SkanWarn about uninitialized variables which are initialized with themselves. 2232132718SkanNote this option can only be used with the @option{-Wuninitialized} option, 2233132718Skanwhich in turn only works with @option{-O1} and above. 2234132718Skan 2235132718SkanFor example, GCC will warn about @code{i} being uninitialized in the 2236132718Skanfollowing snippet only when @option{-Winit-self} has been specified: 2237132718Skan@smallexample 2238132718Skan@group 2239132718Skanint f() 2240132718Skan@{ 2241132718Skan int i = i; 2242132718Skan return i; 2243132718Skan@} 2244132718Skan@end group 2245132718Skan@end smallexample 2246132718Skan 224790075Sobrien@item -Wimplicit-int 224890075Sobrien@opindex Wimplicit-int 224990075SobrienWarn when a declaration does not specify a type. 2250169689SkanThis warning is enabled by @option{-Wall}. 225190075Sobrien 225290075Sobrien@item -Wimplicit-function-declaration 225390075Sobrien@itemx -Werror-implicit-function-declaration 225490075Sobrien@opindex Wimplicit-function-declaration 225590075Sobrien@opindex Werror-implicit-function-declaration 225690075SobrienGive a warning (or error) whenever a function is used before being 2257169689Skandeclared. The form @option{-Wno-error-implicit-function-declaration} 2258169689Skanis not supported. 2259169689SkanThis warning is enabled by @option{-Wall} (as a warning, not an error). 226090075Sobrien 226190075Sobrien@item -Wimplicit 226290075Sobrien@opindex Wimplicit 226390075SobrienSame as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}. 2264169689SkanThis warning is enabled by @option{-Wall}. 226590075Sobrien 226690075Sobrien@item -Wmain 226790075Sobrien@opindex Wmain 226890075SobrienWarn if the type of @samp{main} is suspicious. @samp{main} should be a 226990075Sobrienfunction with external linkage, returning int, taking either zero 227090075Sobrienarguments, two, or three arguments of appropriate types. 2271169689SkanThis warning is enabled by @option{-Wall}. 227290075Sobrien 227390075Sobrien@item -Wmissing-braces 227490075Sobrien@opindex Wmissing-braces 227590075SobrienWarn if an aggregate or union initializer is not fully bracketed. In 227690075Sobrienthe following example, the initializer for @samp{a} is not fully 227790075Sobrienbracketed, but that for @samp{b} is fully bracketed. 227890075Sobrien 227990075Sobrien@smallexample 228090075Sobrienint a[2][2] = @{ 0, 1, 2, 3 @}; 228190075Sobrienint b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @}; 228290075Sobrien@end smallexample 228390075Sobrien 2284169689SkanThis warning is enabled by @option{-Wall}. 2285169689Skan 2286220755Sdim@item -Wmissing-include-dirs @r{(C and C++ only)} 2287169689Skan@opindex Wmissing-include-dirs 2288169689SkanWarn if a user-supplied include directory does not exist. 2289169689Skan 229090075Sobrien@item -Wparentheses 229190075Sobrien@opindex Wparentheses 229290075SobrienWarn if parentheses are omitted in certain contexts, such 229390075Sobrienas when there is an assignment in a context where a truth value 229490075Sobrienis expected, or when operators are nested whose precedence people 2295259268Spfgoften get confused about. 229690075Sobrien 2297169689SkanAlso warn if a comparison like @samp{x<=y<=z} appears; this is 2298169689Skanequivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different 2299169689Skaninterpretation from that of ordinary mathematical notation. 2300169689Skan 230190075SobrienAlso warn about constructions where there may be confusion to which 230290075Sobrien@code{if} statement an @code{else} branch belongs. Here is an example of 230390075Sobriensuch a case: 230490075Sobrien 230590075Sobrien@smallexample 230690075Sobrien@group 230790075Sobrien@{ 230890075Sobrien if (a) 230990075Sobrien if (b) 231090075Sobrien foo (); 231190075Sobrien else 231290075Sobrien bar (); 231390075Sobrien@} 231490075Sobrien@end group 231590075Sobrien@end smallexample 231690075Sobrien 2317259268SpfgIn C/C++, every @code{else} branch belongs to the innermost possible 2318259268Spfg@code{if} statement, which in this example is @code{if (b)}. This is 2319259268Spfgoften not what the programmer expected, as illustrated in the above 2320259268Spfgexample by indentation the programmer chose. When there is the 2321259268Spfgpotential for this confusion, GCC will issue a warning when this flag 2322259268Spfgis specified. To eliminate the warning, add explicit braces around 2323259268Spfgthe innermost @code{if} statement so there is no way the @code{else} 2324259268Spfgcould belong to the enclosing @code{if}. The resulting code would 2325259268Spfglook like this: 232690075Sobrien 232790075Sobrien@smallexample 232890075Sobrien@group 232990075Sobrien@{ 233090075Sobrien if (a) 233190075Sobrien @{ 233290075Sobrien if (b) 233390075Sobrien foo (); 233490075Sobrien else 233590075Sobrien bar (); 233690075Sobrien @} 233790075Sobrien@} 233890075Sobrien@end group 233990075Sobrien@end smallexample 234090075Sobrien 2341169689SkanThis warning is enabled by @option{-Wall}. 2342169689Skan 234390075Sobrien@item -Wsequence-point 234490075Sobrien@opindex Wsequence-point 234590075SobrienWarn about code that may have undefined semantics because of violations 2346169689Skanof sequence point rules in the C and C++ standards. 234790075Sobrien 2348169689SkanThe C and C++ standards defines the order in which expressions in a C/C++ 2349169689Skanprogram are evaluated in terms of @dfn{sequence points}, which represent 2350169689Skana partial ordering between the execution of parts of the program: those 2351169689Skanexecuted before the sequence point, and those executed after it. These 2352169689Skanoccur after the evaluation of a full expression (one which is not part 2353169689Skanof a larger expression), after the evaluation of the first operand of a 235490075Sobrien@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a 235590075Sobrienfunction is called (but after the evaluation of its arguments and the 235690075Sobrienexpression denoting the called function), and in certain other places. 235790075SobrienOther than as expressed by the sequence point rules, the order of 235890075Sobrienevaluation of subexpressions of an expression is not specified. All 235990075Sobrienthese rules describe only a partial order rather than a total order, 236090075Sobriensince, for example, if two functions are called within one expression 236190075Sobrienwith no sequence point between them, the order in which the functions 236290075Sobrienare called is not specified. However, the standards committee have 236390075Sobrienruled that function calls do not overlap. 236490075Sobrien 236590075SobrienIt is not specified when between sequence points modifications to the 236690075Sobrienvalues of objects take effect. Programs whose behavior depends on this 2367169689Skanhave undefined behavior; the C and C++ standards specify that ``Between 2368169689Skanthe previous and next sequence point an object shall have its stored 2369169689Skanvalue modified at most once by the evaluation of an expression. 2370169689SkanFurthermore, the prior value shall be read only to determine the value 2371169689Skanto be stored.''. If a program breaks these rules, the results on any 237290075Sobrienparticular implementation are entirely unpredictable. 237390075Sobrien 237490075SobrienExamples of code with undefined behavior are @code{a = a++;}, @code{a[n] 237590075Sobrien= b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not 237690075Sobriendiagnosed by this option, and it may give an occasional false positive 237790075Sobrienresult, but in general it has been found fairly effective at detecting 237890075Sobrienthis sort of problem in programs. 237990075Sobrien 2380169689SkanThe standard is worded confusingly, therefore there is some debate 238190075Sobrienover the precise meaning of the sequence point rules in subtle cases. 238290075SobrienLinks to discussions of the problem, including proposed formal 2383132718Skandefinitions, may be found on the GCC readings page, at 238490075Sobrien@w{@uref{http://gcc.gnu.org/readings.html}}. 238590075Sobrien 2386169689SkanThis warning is enabled by @option{-Wall} for C and C++. 2387169689Skan 238890075Sobrien@item -Wreturn-type 238990075Sobrien@opindex Wreturn-type 239090075SobrienWarn whenever a function is defined with a return-type that defaults to 239190075Sobrien@code{int}. Also warn about any @code{return} statement with no 239290075Sobrienreturn-value in a function whose return-type is not @code{void}. 239390075Sobrien 2394169689SkanFor C, also warn if the return type of a function has a type qualifier 2395169689Skansuch as @code{const}. Such a type qualifier has no effect, since the 2396169689Skanvalue returned by a function is not an lvalue. ISO C prohibits 2397169689Skanqualified @code{void} return types on function definitions, so such 2398169689Skanreturn types always receive a warning even without this option. 2399169689Skan 240090075SobrienFor C++, a function without return type always produces a diagnostic 240190075Sobrienmessage, even when @option{-Wno-return-type} is specified. The only 240290075Sobrienexceptions are @samp{main} and functions defined in system headers. 240390075Sobrien 2404169689SkanThis warning is enabled by @option{-Wall}. 2405169689Skan 240690075Sobrien@item -Wswitch 240790075Sobrien@opindex Wswitch 2408132718SkanWarn whenever a @code{switch} statement has an index of enumerated type 240990075Sobrienand lacks a @code{case} for one or more of the named codes of that 241090075Sobrienenumeration. (The presence of a @code{default} label prevents this 241190075Sobrienwarning.) @code{case} labels outside the enumeration range also 241290075Sobrienprovoke warnings when this option is used. 2413169689SkanThis warning is enabled by @option{-Wall}. 241490075Sobrien 2415117395Skan@item -Wswitch-default 2416117395Skan@opindex Wswitch-switch 2417117395SkanWarn whenever a @code{switch} statement does not have a @code{default} 2418117395Skancase. 2419117395Skan 2420117395Skan@item -Wswitch-enum 2421117395Skan@opindex Wswitch-enum 2422132718SkanWarn whenever a @code{switch} statement has an index of enumerated type 2423117395Skanand lacks a @code{case} for one or more of the named codes of that 2424117395Skanenumeration. @code{case} labels outside the enumeration range also 2425117395Skanprovoke warnings when this option is used. 2426117395Skan 242790075Sobrien@item -Wtrigraphs 242890075Sobrien@opindex Wtrigraphs 242990075SobrienWarn if any trigraphs are encountered that might change the meaning of 243090075Sobrienthe program (trigraphs within comments are not warned about). 2431169689SkanThis warning is enabled by @option{-Wall}. 243290075Sobrien 243390075Sobrien@item -Wunused-function 243490075Sobrien@opindex Wunused-function 243590075SobrienWarn whenever a static function is declared but not defined or a 2436169689Skannon-inline static function is unused. 2437169689SkanThis warning is enabled by @option{-Wall}. 243890075Sobrien 243990075Sobrien@item -Wunused-label 244090075Sobrien@opindex Wunused-label 244190075SobrienWarn whenever a label is declared but not used. 2442169689SkanThis warning is enabled by @option{-Wall}. 244390075Sobrien 244490075SobrienTo suppress this warning use the @samp{unused} attribute 244590075Sobrien(@pxref{Variable Attributes}). 244690075Sobrien 244790075Sobrien@item -Wunused-parameter 244890075Sobrien@opindex Wunused-parameter 244990075SobrienWarn whenever a function parameter is unused aside from its declaration. 245090075Sobrien 245190075SobrienTo suppress this warning use the @samp{unused} attribute 245290075Sobrien(@pxref{Variable Attributes}). 245390075Sobrien 245490075Sobrien@item -Wunused-variable 245590075Sobrien@opindex Wunused-variable 245690075SobrienWarn whenever a local variable or non-constant static variable is unused 2457169689Skanaside from its declaration. 2458169689SkanThis warning is enabled by @option{-Wall}. 245990075Sobrien 246090075SobrienTo suppress this warning use the @samp{unused} attribute 246190075Sobrien(@pxref{Variable Attributes}). 246290075Sobrien 246390075Sobrien@item -Wunused-value 246490075Sobrien@opindex Wunused-value 246590075SobrienWarn whenever a statement computes a result that is explicitly not used. 2466169689SkanThis warning is enabled by @option{-Wall}. 246790075Sobrien 246890075SobrienTo suppress this warning cast the expression to @samp{void}. 246990075Sobrien 247090075Sobrien@item -Wunused 247190075Sobrien@opindex Wunused 2472117395SkanAll the above @option{-Wunused} options combined. 247390075Sobrien 247490075SobrienIn order to get a warning about an unused function parameter, you must 2475132718Skaneither specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies 2476132718Skan@samp{-Wunused}), or separately specify @option{-Wunused-parameter}. 247790075Sobrien 247890075Sobrien@item -Wuninitialized 247990075Sobrien@opindex Wuninitialized 248090075SobrienWarn if an automatic variable is used without first being initialized or 248190075Sobrienif a variable may be clobbered by a @code{setjmp} call. 248290075Sobrien 248390075SobrienThese warnings are possible only in optimizing compilation, 248490075Sobrienbecause they require data flow information that is computed only 2485169689Skanwhen optimizing. If you do not specify @option{-O}, you will not get 2486169689Skanthese warnings. Instead, GCC will issue a warning about @option{-Wuninitialized} 2487169689Skanrequiring @option{-O}. 248890075Sobrien 2489132718SkanIf you want to warn about code which uses the uninitialized value of the 2490132718Skanvariable in its own initializer, use the @option{-Winit-self} option. 2491132718Skan 2492169689SkanThese warnings occur for individual uninitialized or clobbered 2493169689Skanelements of structure, union or array variables as well as for 2494169689Skanvariables which are uninitialized or clobbered as a whole. They do 2495169689Skannot occur for variables or elements declared @code{volatile}. Because 2496169689Skanthese warnings depend on optimization, the exact variables or elements 2497169689Skanfor which there are warnings will depend on the precise optimization 2498169689Skanoptions and version of GCC used. 249990075Sobrien 250090075SobrienNote that there may be no warning about a variable that is used only 250190075Sobriento compute a value that itself is never used, because such 250290075Sobriencomputations may be deleted by data flow analysis before the warnings 250390075Sobrienare printed. 250490075Sobrien 250590075SobrienThese warnings are made optional because GCC is not smart 250690075Sobrienenough to see all the reasons why the code might be correct 250790075Sobriendespite appearing to have an error. Here is one example of how 250890075Sobrienthis can happen: 250990075Sobrien 251090075Sobrien@smallexample 251190075Sobrien@group 251290075Sobrien@{ 251390075Sobrien int x; 251490075Sobrien switch (y) 251590075Sobrien @{ 251690075Sobrien case 1: x = 1; 251790075Sobrien break; 251890075Sobrien case 2: x = 4; 251990075Sobrien break; 252090075Sobrien case 3: x = 5; 252190075Sobrien @} 252290075Sobrien foo (x); 252390075Sobrien@} 252490075Sobrien@end group 252590075Sobrien@end smallexample 252690075Sobrien 252790075Sobrien@noindent 252890075SobrienIf the value of @code{y} is always 1, 2 or 3, then @code{x} is 252990075Sobrienalways initialized, but GCC doesn't know this. Here is 253090075Sobrienanother common case: 253190075Sobrien 253290075Sobrien@smallexample 253390075Sobrien@{ 253490075Sobrien int save_y; 253590075Sobrien if (change_y) save_y = y, y = new_y; 253690075Sobrien @dots{} 253790075Sobrien if (change_y) y = save_y; 253890075Sobrien@} 253990075Sobrien@end smallexample 254090075Sobrien 254190075Sobrien@noindent 254290075SobrienThis has no bug because @code{save_y} is used only if it is set. 254390075Sobrien 254490075Sobrien@cindex @code{longjmp} warnings 254590075SobrienThis option also warns when a non-volatile automatic variable might be 254690075Sobrienchanged by a call to @code{longjmp}. These warnings as well are possible 254790075Sobrienonly in optimizing compilation. 254890075Sobrien 254990075SobrienThe compiler sees only the calls to @code{setjmp}. It cannot know 255090075Sobrienwhere @code{longjmp} will be called; in fact, a signal handler could 255190075Sobriencall it at any point in the code. As a result, you may get a warning 255290075Sobrieneven when there is in fact no problem because @code{longjmp} cannot 255390075Sobrienin fact be called at the place which would cause a problem. 255490075Sobrien 255590075SobrienSome spurious warnings can be avoided if you declare all the functions 255690075Sobrienyou use that never return as @code{noreturn}. @xref{Function 255790075SobrienAttributes}. 255890075Sobrien 2559169689SkanThis warning is enabled by @option{-Wall}. 2560169689Skan 256190075Sobrien@item -Wunknown-pragmas 256290075Sobrien@opindex Wunknown-pragmas 256390075Sobrien@cindex warning for unknown pragmas 256490075Sobrien@cindex unknown pragmas, warning 256590075Sobrien@cindex pragmas, warning of unknown 256690075SobrienWarn when a #pragma directive is encountered which is not understood by 256790075SobrienGCC@. If this command line option is used, warnings will even be issued 256890075Sobrienfor unknown pragmas in system header files. This is not the case if 256990075Sobrienthe warnings were only enabled by the @option{-Wall} command line option. 257090075Sobrien 2571169689Skan@item -Wno-pragmas 2572169689Skan@opindex Wno-pragmas 2573169689Skan@opindex Wpragmas 2574169689SkanDo not warn about misuses of pragmas, such as incorrect parameters, 2575169689Skaninvalid syntax, or conflicts between pragmas. See also 2576169689Skan@samp{-Wunknown-pragmas}. 2577169689Skan 2578117395Skan@item -Wstrict-aliasing 2579117395Skan@opindex Wstrict-aliasing 2580117395SkanThis option is only active when @option{-fstrict-aliasing} is active. 2581117395SkanIt warns about code which might break the strict aliasing rules that the 2582169689Skancompiler is using for optimization. The warning does not catch all 2583169689Skancases, but does attempt to catch the more common pitfalls. It is 2584117395Skanincluded in @option{-Wall}. 2585259405SpfgIt is equivalent to -Wstrict-aliasing=3 2586117395Skan 2587259405Spfg@item -Wstrict-aliasing=n 2588259405Spfg@opindex Wstrict-aliasing=n 2589169689SkanThis option is only active when @option{-fstrict-aliasing} is active. 2590169689SkanIt warns about code which might break the strict aliasing rules that the 2591259405Spfgcompiler is using for optimization. 2592259405SpfgHigher levels correspond to higher accuracy (fewer false positives). 2593259405SpfgHigher levels also correspond to more effort, similar to the way -O works. 2594259405Spfg@option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=n}, 2595259405Spfgwith n=3. 2596169689Skan 2597259405SpfgLevel 1: Most aggressive, quick, least accurate. 2598259405SpfgPossibly useful when higher levels 2599259405Spfgdo not warn but -fstrict-aliasing still breaks the code, as it has very few 2600259405Spfgfalse negatives. However, it has many false positives. 2601259405SpfgWarns for all pointer conversions between possibly incompatible types, 2602259405Spfgeven if never dereferenced. Runs in the frontend only. 2603259405Spfg 2604259405SpfgLevel 2: Aggressive, quick, not too precise. 2605259405SpfgMay still have many false positives (not as many as level 1 though), 2606259405Spfgand few false negatives (but possibly more than level 1). 2607259405SpfgUnlike level 1, it only warns when an address is taken. Warns about 2608259405Spfgincomplete types. Runs in the frontend only. 2609259405Spfg 2610259405SpfgLevel 3 (default for @option{-Wstrict-aliasing}): 2611259405SpfgShould have very few false positives and few false 2612259405Spfgnegatives. Slightly slower than levels 1 or 2 when optimization is enabled. 2613259405SpfgTakes care of the common punn+dereference pattern in the frontend: 2614259405Spfg@code{*(int*)&some_float}. 2615259405SpfgIf optimization is enabled, it also runs in the backend, where it deals 2616259405Spfgwith multiple statement cases using flow-sensitive points-to information. 2617259405SpfgOnly warns when the converted pointer is dereferenced. 2618259405SpfgDoes not warn about incomplete types. 2619259405Spfg 2620169689Skan@item -Wstrict-overflow 2621169689Skan@item -Wstrict-overflow=@var{n} 2622169689Skan@opindex Wstrict-overflow 2623169689SkanThis option is only active when @option{-fstrict-overflow} is active. 2624169689SkanIt warns about cases where the compiler optimizes based on the 2625169689Skanassumption that signed overflow does not occur. Note that it does not 2626169689Skanwarn about all cases where the code might overflow: it only warns 2627169689Skanabout cases where the compiler implements some optimization. Thus 2628169689Skanthis warning depends on the optimization level. 2629169689Skan 2630169689SkanAn optimization which assumes that signed overflow does not occur is 2631169689Skanperfectly safe if the values of the variables involved are such that 2632169689Skanoverflow never does, in fact, occur. Therefore this warning can 2633169689Skaneasily give a false positive: a warning about code which is not 2634169689Skanactually a problem. To help focus on important issues, several 2635169689Skanwarning levels are defined. No warnings are issued for the use of 2636169689Skanundefined signed overflow when estimating how many iterations a loop 2637169689Skanwill require, in particular when determining whether a loop will be 2638169689Skanexecuted at all. 2639169689Skan 2640169689Skan@table @option 2641169689Skan@item -Wstrict-overflow=1 2642169689SkanWarn about cases which are both questionable and easy to avoid. For 2643169689Skanexample: @code{x + 1 > x}; with @option{-fstrict-overflow}, the 2644169689Skancompiler will simplify this to @code{1}. This level of 2645169689Skan@option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels 2646169689Skanare not, and must be explicitly requested. 2647169689Skan 2648169689Skan@item -Wstrict-overflow=2 2649169689SkanAlso warn about other cases where a comparison is simplified to a 2650169689Skanconstant. For example: @code{abs (x) >= 0}. This can only be 2651169689Skansimplified when @option{-fstrict-overflow} is in effect, because 2652169689Skan@code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than 2653169689Skanzero. @option{-Wstrict-overflow} (with no level) is the same as 2654169689Skan@option{-Wstrict-overflow=2}. 2655169689Skan 2656169689Skan@item -Wstrict-overflow=3 2657169689SkanAlso warn about other cases where a comparison is simplified. For 2658169689Skanexample: @code{x + 1 > 1} will be simplified to @code{x > 0}. 2659169689Skan 2660169689Skan@item -Wstrict-overflow=4 2661169689SkanAlso warn about other simplifications not covered by the above cases. 2662169689SkanFor example: @code{(x * 10) / 5} will be simplified to @code{x * 2}. 2663169689Skan 2664169689Skan@item -Wstrict-overflow=5 2665169689SkanAlso warn about cases where the compiler reduces the magnitude of a 2666169689Skanconstant involved in a comparison. For example: @code{x + 2 > y} will 2667169689Skanbe simplified to @code{x + 1 >= y}. This is reported only at the 2668169689Skanhighest warning level because this simplification applies to many 2669169689Skancomparisons, so this warning level will give a very large number of 2670169689Skanfalse positives. 2671169689Skan@end table 2672169689Skan 267390075Sobrien@item -Wall 267490075Sobrien@opindex Wall 267590075SobrienAll of the above @samp{-W} options combined. This enables all the 267690075Sobrienwarnings about constructions that some users consider questionable, and 267790075Sobrienthat are easy to avoid (or modify to prevent the warning), even in 2678117395Skanconjunction with macros. This also enables some language-specific 2679220755Sdimwarnings described in @ref{C++ Dialect Options}. 2680260568Spfg@c APPLE LOCAL begin -Wmost 2681260568Spfg@item -Wmost 2682260568Spfg@opindex Wmost 2683260568SpfgThis is equivalent to -Wall -Wno-parentheses. (Apple compatible) 268490075Sobrien@end table 2685260568Spfg@c APPLE LOCAL end -Wmost 268690075Sobrien 268790075SobrienThe following @option{-W@dots{}} options are not implied by @option{-Wall}. 268890075SobrienSome of them warn about constructions that users generally do not 268990075Sobrienconsider questionable, but which occasionally you might wish to check 269090075Sobrienfor; others warn about constructions that are necessary or hard to avoid 269190075Sobrienin some cases, and there is no simple way to modify the code to suppress 269290075Sobrienthe warning. 269390075Sobrien 269490075Sobrien@table @gcctabopt 2695132718Skan@item -Wextra 269690075Sobrien@opindex W 2697132718Skan@opindex Wextra 2698132718Skan(This option used to be called @option{-W}. The older name is still 2699132718Skansupported, but the newer name is more descriptive.) Print extra warning 2700132718Skanmessages for these events: 270190075Sobrien 270290075Sobrien@itemize @bullet 270390075Sobrien@item 270490075SobrienA function can return either with or without a value. (Falling 270590075Sobrienoff the end of the function body is considered returning without 270690075Sobriena value.) For example, this function would evoke such a 270790075Sobrienwarning: 270890075Sobrien 270990075Sobrien@smallexample 271090075Sobrien@group 271190075Sobrienfoo (a) 271290075Sobrien@{ 271390075Sobrien if (a > 0) 271490075Sobrien return a; 271590075Sobrien@} 271690075Sobrien@end group 271790075Sobrien@end smallexample 271890075Sobrien 271990075Sobrien@item 272090075SobrienAn expression-statement or the left-hand side of a comma expression 272190075Sobriencontains no side effects. 272290075SobrienTo suppress the warning, cast the unused expression to void. 272390075SobrienFor example, an expression such as @samp{x[i,j]} will cause a warning, 272490075Sobrienbut @samp{x[(void)i,j]} will not. 272590075Sobrien 272690075Sobrien@item 2727119256SkanAn unsigned value is compared against zero with @samp{<} or @samp{>=}. 272890075Sobrien 272990075Sobrien@item 273090075SobrienStorage-class specifiers like @code{static} are not the first things in 273190075Sobriena declaration. According to the C Standard, this usage is obsolescent. 273290075Sobrien 273390075Sobrien@item 273490075SobrienIf @option{-Wall} or @option{-Wunused} is also specified, warn about unused 273590075Sobrienarguments. 273690075Sobrien 273790075Sobrien@item 273890075SobrienA comparison between signed and unsigned values could produce an 273990075Sobrienincorrect result when the signed value is converted to unsigned. 274090075Sobrien(But don't warn if @option{-Wno-sign-compare} is also specified.) 274190075Sobrien 274290075Sobrien@item 274390075SobrienAn aggregate has an initializer which does not initialize all members. 2744169689SkanThis warning can be independently controlled by 2745169689Skan@option{-Wmissing-field-initializers}. 274690075Sobrien 2747169689Skan@item 2748169689SkanAn initialized field without side effects is overridden when using 2749169689Skandesignated initializers (@pxref{Designated Inits, , Designated 2750169689SkanInitializers}). This warning can be independently controlled by 2751169689Skan@option{-Woverride-init}. 2752132718Skan 2753132718Skan@item 2754132718SkanA function parameter is declared without a type specifier in K&R-style 2755132718Skanfunctions: 2756132718Skan 2757132718Skan@smallexample 2758132718Skanvoid foo(bar) @{ @} 2759132718Skan@end smallexample 2760132718Skan 2761132718Skan@item 2762132718SkanAn empty body occurs in an @samp{if} or @samp{else} statement. 2763132718Skan 2764132718Skan@item 2765132718SkanA pointer is compared against integer zero with @samp{<}, @samp{<=}, 2766132718Skan@samp{>}, or @samp{>=}. 2767132718Skan 2768132718Skan@item 2769132718SkanA variable might be changed by @samp{longjmp} or @samp{vfork}. 2770132718Skan 2771132718Skan@item @r{(C++ only)} 2772132718SkanAn enumerator and a non-enumerator both appear in a conditional expression. 2773132718Skan 2774132718Skan@item @r{(C++ only)} 2775132718SkanA non-static reference or non-static @samp{const} member appears in a 2776132718Skanclass without constructors. 2777132718Skan 2778132718Skan@item @r{(C++ only)} 2779132718SkanAmbiguous virtual bases. 2780132718Skan 2781132718Skan@item @r{(C++ only)} 2782132718SkanSubscripting an array which has been declared @samp{register}. 2783132718Skan 2784132718Skan@item @r{(C++ only)} 2785132718SkanTaking the address of a variable which has been declared @samp{register}. 2786132718Skan 2787132718Skan@item @r{(C++ only)} 2788132718SkanA base class is not initialized in a derived class' copy constructor. 278990075Sobrien@end itemize 279090075Sobrien 2791117395Skan@item -Wno-div-by-zero 2792117395Skan@opindex Wno-div-by-zero 2793117395Skan@opindex Wdiv-by-zero 2794117395SkanDo not warn about compile-time integer division by zero. Floating point 2795117395Skandivision by zero is not warned about, as it can be a legitimate way of 2796117395Skanobtaining infinities and NaNs. 2797117395Skan 2798117395Skan@item -Wsystem-headers 2799117395Skan@opindex Wsystem-headers 2800117395Skan@cindex warnings from system headers 2801117395Skan@cindex system headers, warnings from 2802117395SkanPrint warning messages for constructs found in system header files. 2803117395SkanWarnings from system headers are normally suppressed, on the assumption 2804117395Skanthat they usually do not indicate real problems and would only make the 2805117395Skancompiler output harder to read. Using this command line option tells 2806117395SkanGCC to emit warnings from system headers as if they occurred in user 2807117395Skancode. However, note that using @option{-Wall} in conjunction with this 2808117395Skanoption will @emph{not} warn about unknown pragmas in system 2809117395Skanheaders---for that, @option{-Wunknown-pragmas} must also be used. 2810117395Skan 281190075Sobrien@item -Wfloat-equal 281290075Sobrien@opindex Wfloat-equal 281390075SobrienWarn if floating point values are used in equality comparisons. 281490075Sobrien 281590075SobrienThe idea behind this is that sometimes it is convenient (for the 281690075Sobrienprogrammer) to consider floating-point values as approximations to 281790075Sobrieninfinitely precise real numbers. If you are doing this, then you need 2818117395Skanto compute (by analyzing the code, or in some other way) the maximum or 281990075Sobrienlikely maximum error that the computation introduces, and allow for it 282090075Sobrienwhen performing comparisons (and when producing output, but that's a 282190075Sobriendifferent problem). In particular, instead of testing for equality, you 282290075Sobrienwould check to see whether the two values have ranges that overlap; and 282390075Sobrienthis is done with the relational operators, so equality comparisons are 282490075Sobrienprobably mistaken. 282590075Sobrien 282690075Sobrien@item -Wtraditional @r{(C only)} 282790075Sobrien@opindex Wtraditional 282890075SobrienWarn about certain constructs that behave differently in traditional and 282990075SobrienISO C@. Also warn about ISO C constructs that have no traditional C 283090075Sobrienequivalent, and/or problematic constructs which should be avoided. 283190075Sobrien 283290075Sobrien@itemize @bullet 283390075Sobrien@item 283490075SobrienMacro parameters that appear within string literals in the macro body. 283590075SobrienIn traditional C macro replacement takes place within string literals, 283690075Sobrienbut does not in ISO C@. 283790075Sobrien 283890075Sobrien@item 283990075SobrienIn traditional C, some preprocessor directives did not exist. 284090075SobrienTraditional preprocessors would only consider a line to be a directive 284190075Sobrienif the @samp{#} appeared in column 1 on the line. Therefore 284290075Sobrien@option{-Wtraditional} warns about directives that traditional C 284390075Sobrienunderstands but would ignore because the @samp{#} does not appear as the 284490075Sobrienfirst character on the line. It also suggests you hide directives like 284590075Sobrien@samp{#pragma} not understood by traditional C by indenting them. Some 284690075Sobrientraditional implementations would not recognize @samp{#elif}, so it 284790075Sobriensuggests avoiding it altogether. 284890075Sobrien 284990075Sobrien@item 285090075SobrienA function-like macro that appears without arguments. 285190075Sobrien 285290075Sobrien@item 285390075SobrienThe unary plus operator. 285490075Sobrien 285590075Sobrien@item 285690075SobrienThe @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point 285790075Sobrienconstant suffixes. (Traditional C does support the @samp{L} suffix on integer 285890075Sobrienconstants.) Note, these suffixes appear in macros defined in the system 285990075Sobrienheaders of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}. 286090075SobrienUse of these macros in user code might normally lead to spurious 2861132718Skanwarnings, however GCC's integrated preprocessor has enough context to 286290075Sobrienavoid warning in these cases. 286390075Sobrien 286490075Sobrien@item 286590075SobrienA function declared external in one block and then used after the end of 286690075Sobrienthe block. 286790075Sobrien 286890075Sobrien@item 286990075SobrienA @code{switch} statement has an operand of type @code{long}. 287090075Sobrien 287190075Sobrien@item 287290075SobrienA non-@code{static} function declaration follows a @code{static} one. 287390075SobrienThis construct is not accepted by some traditional C compilers. 287490075Sobrien 287590075Sobrien@item 287690075SobrienThe ISO type of an integer constant has a different width or 287790075Sobriensignedness from its traditional type. This warning is only issued if 287890075Sobrienthe base of the constant is ten. I.e.@: hexadecimal or octal values, which 287990075Sobrientypically represent bit patterns, are not warned about. 288090075Sobrien 288190075Sobrien@item 288290075SobrienUsage of ISO string concatenation is detected. 288390075Sobrien 288490075Sobrien@item 288590075SobrienInitialization of automatic aggregates. 288690075Sobrien 288790075Sobrien@item 288890075SobrienIdentifier conflicts with labels. Traditional C lacks a separate 288990075Sobriennamespace for labels. 289090075Sobrien 289190075Sobrien@item 289290075SobrienInitialization of unions. If the initializer is zero, the warning is 289390075Sobrienomitted. This is done under the assumption that the zero initializer in 289490075Sobrienuser code appears conditioned on e.g.@: @code{__STDC__} to avoid missing 289590075Sobrieninitializer warnings and relies on default initialization to zero in the 289690075Sobrientraditional C case. 289790075Sobrien 289890075Sobrien@item 289990075SobrienConversions by prototypes between fixed/floating point values and vice 290090075Sobrienversa. The absence of these prototypes when compiling with traditional 290190075SobrienC would cause serious problems. This is a subset of the possible 290290075Sobrienconversion warnings, for the full set use @option{-Wconversion}. 2903117395Skan 2904117395Skan@item 2905117395SkanUse of ISO C style function definitions. This warning intentionally is 2906117395Skan@emph{not} issued for prototype declarations or variadic functions 2907117395Skanbecause these ISO C features will appear in your code when using 2908117395Skanlibiberty's traditional C compatibility macros, @code{PARAMS} and 2909117395Skan@code{VPARAMS}. This warning is also bypassed for nested functions 2910132718Skanbecause that feature is already a GCC extension and thus not relevant to 2911117395Skantraditional C compatibility. 291290075Sobrien@end itemize 291390075Sobrien 2914132718Skan@item -Wdeclaration-after-statement @r{(C only)} 2915132718Skan@opindex Wdeclaration-after-statement 2916132718SkanWarn when a declaration is found after a statement in a block. This 2917132718Skanconstruct, known from C++, was introduced with ISO C99 and is by default 2918132718Skanallowed in GCC@. It is not supported by ISO C90 and was not supported by 2919132718SkanGCC versions before GCC 3.0. @xref{Mixed Declarations}. 2920132718Skan 292190075Sobrien@item -Wundef 292290075Sobrien@opindex Wundef 292390075SobrienWarn if an undefined identifier is evaluated in an @samp{#if} directive. 292490075Sobrien 2925169689Skan@item -Wno-endif-labels 2926169689Skan@opindex Wno-endif-labels 2927117395Skan@opindex Wendif-labels 2928169689SkanDo not warn whenever an @samp{#else} or an @samp{#endif} are followed by text. 2929117395Skan 293090075Sobrien@item -Wshadow 293190075Sobrien@opindex Wshadow 293290075SobrienWarn whenever a local variable shadows another local variable, parameter or 293390075Sobrienglobal variable or whenever a built-in function is shadowed. 293490075Sobrien 293590075Sobrien@item -Wlarger-than-@var{len} 293690075Sobrien@opindex Wlarger-than 293790075SobrienWarn whenever an object of larger than @var{len} bytes is defined. 293890075Sobrien 2939259405Spfg@item -Wframe-larger-than-@var{len} 2940259405Spfg@opindex Wframe-larger-than 2941259405SpfgWarn whenever the frame size of a function is larger than @var{len} bytes. 2942259405Spfg 2943169689Skan@item -Wunsafe-loop-optimizations 2944169689Skan@opindex Wunsafe-loop-optimizations 2945169689SkanWarn if the loop cannot be optimized because the compiler could not 2946169689Skanassume anything on the bounds of the loop indices. With 2947169689Skan@option{-funsafe-loop-optimizations} warn if the compiler made 2948169689Skansuch assumptions. 2949169689Skan 295090075Sobrien@item -Wpointer-arith 295190075Sobrien@opindex Wpointer-arith 295290075SobrienWarn about anything that depends on the ``size of'' a function type or 295390075Sobrienof @code{void}. GNU C assigns these types a size of 1, for 295490075Sobrienconvenience in calculations with @code{void *} pointers and pointers 295590075Sobriento functions. 295690075Sobrien 295790075Sobrien@item -Wbad-function-cast @r{(C only)} 295890075Sobrien@opindex Wbad-function-cast 295990075SobrienWarn whenever a function call is cast to a non-matching type. 296090075SobrienFor example, warn if @code{int malloc()} is cast to @code{anything *}. 296190075Sobrien 2962169689Skan@item -Wc++-compat 2963169689SkanWarn about ISO C constructs that are outside of the common subset of 2964169689SkanISO C and ISO C++, e.g.@: request for implicit conversion from 2965169689Skan@code{void *} to a pointer to non-@code{void} type. 2966169689Skan 296790075Sobrien@item -Wcast-qual 296890075Sobrien@opindex Wcast-qual 296990075SobrienWarn whenever a pointer is cast so as to remove a type qualifier from 297090075Sobrienthe target type. For example, warn if a @code{const char *} is cast 297190075Sobriento an ordinary @code{char *}. 297290075Sobrien 297390075Sobrien@item -Wcast-align 297490075Sobrien@opindex Wcast-align 297590075SobrienWarn whenever a pointer is cast such that the required alignment of the 297690075Sobrientarget is increased. For example, warn if a @code{char *} is cast to 297790075Sobrienan @code{int *} on machines where integers can only be accessed at 297890075Sobrientwo- or four-byte boundaries. 297990075Sobrien 298090075Sobrien@item -Wwrite-strings 298190075Sobrien@opindex Wwrite-strings 298290075SobrienWhen compiling C, give string constants the type @code{const 298390075Sobrienchar[@var{length}]} so that 298490075Sobriencopying the address of one into a non-@code{const} @code{char *} 298590075Sobrienpointer will get a warning; when compiling C++, warn about the 2986169689Skandeprecated conversion from string literals to @code{char *}. This 2987169689Skanwarning, by default, is enabled for C++ programs. 298890075SobrienThese warnings will help you find at 298990075Sobriencompile time code that can try to write into a string constant, but 299090075Sobrienonly if you have been very careful about using @code{const} in 299190075Sobriendeclarations and prototypes. Otherwise, it will just be a nuisance; 299290075Sobrienthis is why we did not make @option{-Wall} request these warnings. 299390075Sobrien 299490075Sobrien@item -Wconversion 299590075Sobrien@opindex Wconversion 299690075SobrienWarn if a prototype causes a type conversion that is different from what 299790075Sobrienwould happen to the same argument in the absence of a prototype. This 299890075Sobrienincludes conversions of fixed point to floating and vice versa, and 299990075Sobrienconversions changing the width or signedness of a fixed point argument 300090075Sobrienexcept when the same as the default promotion. 300190075Sobrien 300290075SobrienAlso, warn if a negative integer constant expression is implicitly 300390075Sobrienconverted to an unsigned type. For example, warn about the assignment 300490075Sobrien@code{x = -1} if @code{x} is unsigned. But do not warn about explicit 300590075Sobriencasts like @code{(unsigned) -1}. 300690075Sobrien 300790075Sobrien@item -Wsign-compare 300890075Sobrien@opindex Wsign-compare 300990075Sobrien@cindex warning for comparison of signed and unsigned values 301090075Sobrien@cindex comparison of signed and unsigned values, warning 301190075Sobrien@cindex signed and unsigned values, comparison warning 301290075SobrienWarn when a comparison between signed and unsigned values could produce 301390075Sobrienan incorrect result when the signed value is converted to unsigned. 3014132718SkanThis warning is also enabled by @option{-Wextra}; to get the other warnings 3015132718Skanof @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}. 301690075Sobrien 3017169689Skan@item -Waddress 3018169689Skan@opindex Waddress 3019169689Skan@opindex Wno-address 3020169689SkanWarn about suspicious uses of memory addresses. These include using 3021169689Skanthe address of a function in a conditional expression, such as 3022169689Skan@code{void func(void); if (func)}, and comparisons against the memory 3023169689Skanaddress of a string literal, such as @code{if (x == "abc")}. Such 3024169689Skanuses typically indicate a programmer error: the address of a function 3025169689Skanalways evaluates to true, so their use in a conditional usually 3026169689Skanindicate that the programmer forgot the parentheses in a function 3027169689Skancall; and comparisons against string literals result in unspecified 3028169689Skanbehavior and are not portable in C, so they usually indicate that the 3029169689Skanprogrammer intended to use @code{strcmp}. This warning is enabled by 3030169689Skan@option{-Wall}. 3031169689Skan 303290075Sobrien@item -Waggregate-return 303390075Sobrien@opindex Waggregate-return 303490075SobrienWarn if any functions that return structures or unions are defined or 303590075Sobriencalled. (In languages where you can return an array, this also elicits 303690075Sobriena warning.) 303790075Sobrien 3038169689Skan@item -Wno-attributes 3039169689Skan@opindex Wno-attributes 3040169689Skan@opindex Wattributes 3041169689SkanDo not warn if an unexpected @code{__attribute__} is used, such as 3042169689Skanunrecognized attributes, function attributes applied to variables, 3043169689Skanetc. This will not stop errors for incorrect use of supported 3044169689Skanattributes. 3045169689Skan 304690075Sobrien@item -Wstrict-prototypes @r{(C only)} 304790075Sobrien@opindex Wstrict-prototypes 304890075SobrienWarn if a function is declared or defined without specifying the 304990075Sobrienargument types. (An old-style function definition is permitted without 305090075Sobriena warning if preceded by a declaration which specifies the argument 305190075Sobrientypes.) 305290075Sobrien 3053132718Skan@item -Wold-style-definition @r{(C only)} 3054132718Skan@opindex Wold-style-definition 3055132718SkanWarn if an old-style function definition is used. A warning is given 3056132718Skaneven if there is a previous prototype. 3057132718Skan 3058261306Spfg@c APPLE LOCAL warn missing prototype 6261539 3059261306Spfg@item -Wmissing-prototypes 306090075Sobrien@opindex Wmissing-prototypes 306190075SobrienWarn if a global function is defined without a previous prototype 306290075Sobriendeclaration. This warning is issued even if the definition itself 306390075Sobrienprovides a prototype. The aim is to detect global functions that fail 306490075Sobriento be declared in header files. 306590075Sobrien 3066117395Skan@item -Wmissing-declarations @r{(C only)} 306790075Sobrien@opindex Wmissing-declarations 306890075SobrienWarn if a global function is defined without a previous declaration. 306990075SobrienDo so even if the definition itself provides a prototype. 307090075SobrienUse this option to detect global functions that are not declared in 307190075Sobrienheader files. 307290075Sobrien 3073169689Skan@item -Wmissing-field-initializers 3074169689Skan@opindex Wmissing-field-initializers 3075169689Skan@opindex W 3076169689Skan@opindex Wextra 3077169689SkanWarn if a structure's initializer has some fields missing. For 3078169689Skanexample, the following code would cause such a warning, because 3079169689Skan@code{x.h} is implicitly zero: 3080169689Skan 3081169689Skan@smallexample 3082169689Skanstruct s @{ int f, g, h; @}; 3083169689Skanstruct s x = @{ 3, 4 @}; 3084169689Skan@end smallexample 3085169689Skan 3086169689SkanThis option does not warn about designated initializers, so the following 3087169689Skanmodification would not trigger a warning: 3088169689Skan 3089169689Skan@smallexample 3090169689Skanstruct s @{ int f, g, h; @}; 3091169689Skanstruct s x = @{ .f = 3, .g = 4 @}; 3092169689Skan@end smallexample 3093169689Skan 3094169689SkanThis warning is included in @option{-Wextra}. To get other @option{-Wextra} 3095169689Skanwarnings without this one, use @samp{-Wextra -Wno-missing-field-initializers}. 3096169689Skan 309790075Sobrien@item -Wmissing-noreturn 309890075Sobrien@opindex Wmissing-noreturn 309990075SobrienWarn about functions which might be candidates for attribute @code{noreturn}. 310090075SobrienNote these are only possible candidates, not absolute ones. Care should 310190075Sobrienbe taken to manually verify functions actually do not ever return before 310290075Sobrienadding the @code{noreturn} attribute, otherwise subtle code generation 310390075Sobrienbugs could be introduced. You will not get a warning for @code{main} in 310490075Sobrienhosted C environments. 310590075Sobrien 310690075Sobrien@item -Wmissing-format-attribute 310790075Sobrien@opindex Wmissing-format-attribute 310890075Sobrien@opindex Wformat 3109169689SkanWarn about function pointers which might be candidates for @code{format} 3110169689Skanattributes. Note these are only possible candidates, not absolute ones. 3111169689SkanGCC will guess that function pointers with @code{format} attributes that 3112169689Skanare used in assignment, initialization, parameter passing or return 3113169689Skanstatements should have a corresponding @code{format} attribute in the 3114169689Skanresulting type. I.e.@: the left-hand side of the assignment or 3115169689Skaninitialization, the type of the parameter variable, or the return type 3116169689Skanof the containing function respectively should also have a @code{format} 3117169689Skanattribute to avoid the warning. 3118169689Skan 3119169689SkanGCC will also warn about function definitions which might be 3120169689Skancandidates for @code{format} attributes. Again, these are only 3121169689Skanpossible candidates. GCC will guess that @code{format} attributes 3122169689Skanmight be appropriate for any function that calls a function like 3123169689Skan@code{vprintf} or @code{vscanf}, but this might not always be the 312490075Sobriencase, and some functions for which @code{format} attributes are 3125169689Skanappropriate may not be detected. 312690075Sobrien 3127117395Skan@item -Wno-multichar 3128117395Skan@opindex Wno-multichar 3129117395Skan@opindex Wmultichar 3130117395SkanDo not warn if a multicharacter constant (@samp{'FOOF'}) is used. 3131117395SkanUsually they indicate a typo in the user's code, as they have 3132117395Skanimplementation-defined values, and should not be used in portable code. 3133117395Skan 3134169689Skan@item -Wnormalized=<none|id|nfc|nfkc> 3135169689Skan@opindex Wnormalized 3136169689Skan@cindex NFC 3137169689Skan@cindex NFKC 3138169689Skan@cindex character set, input normalization 3139169689SkanIn ISO C and ISO C++, two identifiers are different if they are 3140169689Skandifferent sequences of characters. However, sometimes when characters 3141169689Skanoutside the basic ASCII character set are used, you can have two 3142169689Skandifferent character sequences that look the same. To avoid confusion, 3143169689Skanthe ISO 10646 standard sets out some @dfn{normalization rules} which 3144169689Skanwhen applied ensure that two sequences that look the same are turned into 3145169689Skanthe same sequence. GCC can warn you if you are using identifiers which 3146169689Skanhave not been normalized; this option controls that warning. 3147169689Skan 3148169689SkanThere are four levels of warning that GCC supports. The default is 3149169689Skan@option{-Wnormalized=nfc}, which warns about any identifier which is 3150169689Skannot in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the 3151169689Skanrecommended form for most uses. 3152169689Skan 3153169689SkanUnfortunately, there are some characters which ISO C and ISO C++ allow 3154169689Skanin identifiers that when turned into NFC aren't allowable as 3155169689Skanidentifiers. That is, there's no way to use these symbols in portable 3156169689SkanISO C or C++ and have all your identifiers in NFC. 3157169689Skan@option{-Wnormalized=id} suppresses the warning for these characters. 3158169689SkanIt is hoped that future versions of the standards involved will correct 3159169689Skanthis, which is why this option is not the default. 3160169689Skan 3161169689SkanYou can switch the warning off for all characters by writing 3162169689Skan@option{-Wnormalized=none}. You would only want to do this if you 3163169689Skanwere using some other normalization scheme (like ``D''), because 3164169689Skanotherwise you can easily create bugs that are literally impossible to see. 3165169689Skan 3166169689SkanSome characters in ISO 10646 have distinct meanings but look identical 3167169689Skanin some fonts or display methodologies, especially once formatting has 3168169689Skanbeen applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL 3169169689SkanLETTER N'', will display just like a regular @code{n} which has been 3170169689Skanplaced in a superscript. ISO 10646 defines the @dfn{NFKC} 3171169689Skannormalization scheme to convert all these into a standard form as 3172169689Skanwell, and GCC will warn if your code is not in NFKC if you use 3173169689Skan@option{-Wnormalized=nfkc}. This warning is comparable to warning 3174169689Skanabout every identifier that contains the letter O because it might be 3175169689Skanconfused with the digit 0, and so is not the default, but may be 3176169689Skanuseful as a local coding convention if the programming environment is 3177169689Skanunable to be fixed to display these characters distinctly. 3178169689Skan 317990075Sobrien@item -Wno-deprecated-declarations 318090075Sobrien@opindex Wno-deprecated-declarations 3181169689SkanDo not warn about uses of functions (@pxref{Function Attributes}), 3182169689Skanvariables (@pxref{Variable Attributes}), and types (@pxref{Type 3183169689SkanAttributes}) marked as deprecated by using the @code{deprecated} 3184169689Skanattribute. 318590075Sobrien 3186169689Skan@item -Wno-overflow 3187169689Skan@opindex Wno-overflow 3188169689SkanDo not warn about compile-time overflow in constant expressions. 3189169689Skan 3190169689Skan@item -Woverride-init 3191169689Skan@opindex Woverride-init 3192169689Skan@opindex W 3193169689Skan@opindex Wextra 3194169689SkanWarn if an initialized field without side effects is overridden when 3195169689Skanusing designated initializers (@pxref{Designated Inits, , Designated 3196169689SkanInitializers}). 3197169689Skan 3198169689SkanThis warning is included in @option{-Wextra}. To get other 3199169689Skan@option{-Wextra} warnings without this one, use @samp{-Wextra 3200169689Skan-Wno-override-init}. 3201169689Skan 320290075Sobrien@item -Wpacked 320390075Sobrien@opindex Wpacked 320490075SobrienWarn if a structure is given the packed attribute, but the packed 320590075Sobrienattribute has no effect on the layout or size of the structure. 320690075SobrienSuch structures may be mis-aligned for little benefit. For 320790075Sobrieninstance, in this code, the variable @code{f.x} in @code{struct bar} 320890075Sobrienwill be misaligned even though @code{struct bar} does not itself 320990075Sobrienhave the packed attribute: 321090075Sobrien 321190075Sobrien@smallexample 321290075Sobrien@group 321390075Sobrienstruct foo @{ 321490075Sobrien int x; 321590075Sobrien char a, b, c, d; 321690075Sobrien@} __attribute__((packed)); 321790075Sobrienstruct bar @{ 321890075Sobrien char z; 321990075Sobrien struct foo f; 322090075Sobrien@}; 322190075Sobrien@end group 322290075Sobrien@end smallexample 322390075Sobrien 322490075Sobrien@item -Wpadded 322590075Sobrien@opindex Wpadded 322690075SobrienWarn if padding is included in a structure, either to align an element 322790075Sobrienof the structure or to align the whole structure. Sometimes when this 322890075Sobrienhappens it is possible to rearrange the fields of the structure to 322990075Sobrienreduce the padding and so make the structure smaller. 323090075Sobrien 323190075Sobrien@item -Wredundant-decls 323290075Sobrien@opindex Wredundant-decls 323390075SobrienWarn if anything is declared more than once in the same scope, even in 323490075Sobriencases where multiple declaration is valid and changes nothing. 323590075Sobrien 323690075Sobrien@item -Wnested-externs @r{(C only)} 323790075Sobrien@opindex Wnested-externs 323890075SobrienWarn if an @code{extern} declaration is encountered within a function. 323990075Sobrien 324090075Sobrien@item -Wunreachable-code 324190075Sobrien@opindex Wunreachable-code 324290075SobrienWarn if the compiler detects that code will never be executed. 324390075Sobrien 324490075SobrienThis option is intended to warn when the compiler detects that at 324590075Sobrienleast a whole line of source code will never be executed, because 324690075Sobriensome condition is never satisfied or because it is after a 324790075Sobrienprocedure that never returns. 324890075Sobrien 324990075SobrienIt is possible for this option to produce a warning even though there 325090075Sobrienare circumstances under which part of the affected line can be executed, 325190075Sobrienso care should be taken when removing apparently-unreachable code. 325290075Sobrien 325390075SobrienFor instance, when a function is inlined, a warning may mean that the 325490075Sobrienline is unreachable in only one inlined copy of the function. 325590075Sobrien 325690075SobrienThis option is not made part of @option{-Wall} because in a debugging 325790075Sobrienversion of a program there is often substantial code which checks 325890075Sobriencorrect functioning of the program and is, hopefully, unreachable 325990075Sobrienbecause the program does work. Another common use of unreachable 326090075Sobriencode is to provide behavior which is selectable at compile-time. 326190075Sobrien 326290075Sobrien@item -Winline 326390075Sobrien@opindex Winline 326490075SobrienWarn if a function can not be inlined and it was declared as inline. 3265117395SkanEven with this option, the compiler will not warn about failures to 3266132718Skaninline functions declared in system headers. 326790075Sobrien 3268117395SkanThe compiler uses a variety of heuristics to determine whether or not 3269117395Skanto inline a function. For example, the compiler takes into account 3270169689Skanthe size of the function being inlined and the amount of inlining 3271117395Skanthat has already been done in the current function. Therefore, 3272117395Skanseemingly insignificant changes in the source program can cause the 3273117395Skanwarnings produced by @option{-Winline} to appear or disappear. 3274117395Skan 3275132718Skan@item -Wno-invalid-offsetof @r{(C++ only)} 3276132718Skan@opindex Wno-invalid-offsetof 3277132718SkanSuppress warnings from applying the @samp{offsetof} macro to a non-POD 3278132718Skantype. According to the 1998 ISO C++ standard, applying @samp{offsetof} 3279132718Skanto a non-POD type is undefined. In existing C++ implementations, 3280132718Skanhowever, @samp{offsetof} typically gives meaningful results even when 3281132718Skanapplied to certain kinds of non-POD types. (Such as a simple 3282132718Skan@samp{struct} that fails to be a POD type only by virtue of having a 3283132718Skanconstructor.) This flag is for users who are aware that they are 3284132718Skanwriting nonportable code and who have deliberately chosen to ignore the 3285132718Skanwarning about it. 3286132718Skan 3287132718SkanThe restrictions on @samp{offsetof} may be relaxed in a future version 3288132718Skanof the C++ standard. 3289132718Skan 3290169689Skan@item -Wno-int-to-pointer-cast @r{(C only)} 3291169689Skan@opindex Wno-int-to-pointer-cast 3292169689SkanSuppress warnings from casts to pointer type of an integer of a 3293169689Skandifferent size. 3294169689Skan 3295169689Skan@item -Wno-pointer-to-int-cast @r{(C only)} 3296169689Skan@opindex Wno-pointer-to-int-cast 3297169689SkanSuppress warnings from casts from a pointer to an integer type of a 3298169689Skandifferent size. 3299169689Skan 3300132718Skan@item -Winvalid-pch 3301132718Skan@opindex Winvalid-pch 3302132718SkanWarn if a precompiled header (@pxref{Precompiled Headers}) is found in 3303132718Skanthe search path but can't be used. 3304132718Skan 330590075Sobrien@item -Wlong-long 330690075Sobrien@opindex Wlong-long 330790075Sobrien@opindex Wno-long-long 330890075SobrienWarn if @samp{long long} type is used. This is default. To inhibit 330990075Sobrienthe warning messages, use @option{-Wno-long-long}. Flags 331090075Sobrien@option{-Wlong-long} and @option{-Wno-long-long} are taken into account 331190075Sobrienonly when @option{-pedantic} flag is used. 331290075Sobrien 3313169689Skan@item -Wvariadic-macros 3314169689Skan@opindex Wvariadic-macros 3315169689Skan@opindex Wno-variadic-macros 3316169689SkanWarn if variadic macros are used in pedantic ISO C90 mode, or the GNU 3317169689Skanalternate syntax when in pedantic ISO C99 mode. This is default. 3318169689SkanTo inhibit the warning messages, use @option{-Wno-variadic-macros}. 3319169689Skan 3320259268Spfg@item -Wvla 3321259268Spfg@opindex Wvla 3322259268Spfg@opindex Wno-vla 3323259268SpfgWarn if variable length array is used in the code. 3324259268Spfg@option{-Wno-vla} will prevent the @option{-pedantic} warning of 3325259268Spfgthe variable length array. 3326259268Spfg 3327169689Skan@item -Wvolatile-register-var 3328169689Skan@opindex Wvolatile-register-var 3329169689Skan@opindex Wno-volatile-register-var 3330169689SkanWarn if a register variable is declared volatile. The volatile 3331169689Skanmodifier does not inhibit all optimizations that may eliminate reads 3332169689Skanand/or writes to register variables. 3333169689Skan 333490075Sobrien@item -Wdisabled-optimization 333590075Sobrien@opindex Wdisabled-optimization 333690075SobrienWarn if a requested optimization pass is disabled. This warning does 333790075Sobriennot generally indicate that there is anything wrong with your code; it 333890075Sobrienmerely indicates that GCC's optimizers were unable to handle the code 333990075Sobrieneffectively. Often, the problem is that your code is too big or too 334090075Sobriencomplex; GCC will refuse to optimize programs when the optimization 334190075Sobrienitself is likely to take inordinate amounts of time. 334290075Sobrien 3343169689Skan@item -Wpointer-sign 3344169689Skan@opindex Wpointer-sign 3345169689Skan@opindex Wno-pointer-sign 3346169689SkanWarn for pointer argument passing or assignment with different signedness. 3347220755SdimThis option is only supported for C. It is implied by @option{-Wall} 3348220755Sdimand by @option{-pedantic}, which can be disabled with 3349169689Skan@option{-Wno-pointer-sign}. 3350169689Skan 335190075Sobrien@item -Werror 335290075Sobrien@opindex Werror 335390075SobrienMake all warnings into errors. 3354169689Skan 3355169689Skan@item -Werror= 3356169689Skan@opindex Werror= 3357169689SkanMake the specified warning into an errors. The specifier for a 3358169689Skanwarning is appended, for example @option{-Werror=switch} turns the 3359169689Skanwarnings controlled by @option{-Wswitch} into errors. This switch 3360169689Skantakes a negative form, to be used to negate @option{-Werror} for 3361169689Skanspecific warnings, for example @option{-Wno-error=switch} makes 3362169689Skan@option{-Wswitch} warnings not be errors, even when @option{-Werror} 3363169689Skanis in effect. You can use the @option{-fdiagnostics-show-option} 3364169689Skanoption to have each controllable warning amended with the option which 3365169689Skancontrols it, to determine what to use with this option. 3366169689Skan 3367169689SkanNote that specifying @option{-Werror=}@var{foo} automatically implies 3368169689Skan@option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not 3369169689Skanimply anything. 3370169689Skan 3371169689Skan@item -Wstack-protector 3372169689Skan@opindex Wstack-protector 3373169689SkanThis option is only active when @option{-fstack-protector} is active. It 3374169689Skanwarns about functions that will not be protected against stack smashing. 3375169689Skan 3376169689Skan@item -Woverlength-strings 3377169689Skan@opindex Woverlength-strings 3378169689SkanWarn about string constants which are longer than the ``minimum 3379169689Skanmaximum'' length specified in the C standard. Modern compilers 3380169689Skangenerally allow string constants which are much longer than the 3381169689Skanstandard's minimum limit, but very portable programs should avoid 3382169689Skanusing longer strings. 3383169689Skan 3384169689SkanThe limit applies @emph{after} string constant concatenation, and does 3385169689Skannot count the trailing NUL@. In C89, the limit was 509 characters; in 3386169689SkanC99, it was raised to 4095. C++98 does not specify a normative 3387169689Skanminimum maximum, so we do not diagnose overlength strings in C++@. 3388169689Skan 3389169689SkanThis option is implied by @option{-pedantic}, and can be disabled with 3390169689Skan@option{-Wno-overlength-strings}. 339190075Sobrien@end table 339290075Sobrien 339390075Sobrien@node Debugging Options 339490075Sobrien@section Options for Debugging Your Program or GCC 339590075Sobrien@cindex options, debugging 339690075Sobrien@cindex debugging information options 339790075Sobrien 339890075SobrienGCC has various special options that are used for debugging 339990075Sobrieneither your program or GCC: 340090075Sobrien 340190075Sobrien@table @gcctabopt 340290075Sobrien@item -g 340390075Sobrien@opindex g 340490075SobrienProduce debugging information in the operating system's native format 3405169689Skan(stabs, COFF, XCOFF, or DWARF 2)@. GDB can work with this debugging 340690075Sobrieninformation. 340790075Sobrien 340890075SobrienOn most systems that use stabs format, @option{-g} enables use of extra 340990075Sobriendebugging information that only GDB can use; this extra information 341090075Sobrienmakes debugging work better in GDB but will probably make other debuggers 341190075Sobriencrash or 341290075Sobrienrefuse to read the program. If you want to control for certain whether 341390075Sobriento generate the extra information, use @option{-gstabs+}, @option{-gstabs}, 3414132718Skan@option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below). 341590075Sobrien 3416169689SkanGCC allows you to use @option{-g} with 341790075Sobrien@option{-O}. The shortcuts taken by optimized code may occasionally 341890075Sobrienproduce surprising results: some variables you declared may not exist 341990075Sobrienat all; flow of control may briefly move where you did not expect it; 342090075Sobriensome statements may not be executed because they compute constant 342190075Sobrienresults or their values were already at hand; some statements may 342290075Sobrienexecute in different places because they were moved out of loops. 342390075Sobrien 342490075SobrienNevertheless it proves possible to debug optimized output. This makes 342590075Sobrienit reasonable to use the optimizer for programs that might have bugs. 342690075Sobrien 342790075SobrienThe following options are useful when GCC is generated with the 342890075Sobriencapability for more than one debugging format. 342990075Sobrien 343090075Sobrien@item -ggdb 343190075Sobrien@opindex ggdb 343290075SobrienProduce debugging information for use by GDB@. This means to use the 343390075Sobrienmost expressive format available (DWARF 2, stabs, or the native format 343490075Sobrienif neither of those are supported), including GDB extensions if at all 343590075Sobrienpossible. 343690075Sobrien 343790075Sobrien@item -gstabs 343890075Sobrien@opindex gstabs 343990075SobrienProduce debugging information in stabs format (if that is supported), 344090075Sobrienwithout GDB extensions. This is the format used by DBX on most BSD 344190075Sobriensystems. On MIPS, Alpha and System V Release 4 systems this option 344290075Sobrienproduces stabs debugging output which is not understood by DBX or SDB@. 344390075SobrienOn System V Release 4 systems this option requires the GNU assembler. 344490075Sobrien 3445132718Skan@item -feliminate-unused-debug-symbols 3446132718Skan@opindex feliminate-unused-debug-symbols 3447132718SkanProduce debugging information in stabs format (if that is supported), 3448132718Skanfor only symbols that are actually used. 3449132718Skan 3450169689Skan@item -femit-class-debug-always 3451169689SkanInstead of emitting debugging information for a C++ class in only one 3452169689Skanobject file, emit it in all object files using the class. This option 3453169689Skanshould be used only with debuggers that are unable to handle the way GCC 3454169689Skannormally emits debugging information for classes because using this 3455169689Skanoption will increase the size of debugging information by as much as a 3456169689Skanfactor of two. 3457169689Skan 345890075Sobrien@item -gstabs+ 345990075Sobrien@opindex gstabs+ 346090075SobrienProduce debugging information in stabs format (if that is supported), 346190075Sobrienusing GNU extensions understood only by the GNU debugger (GDB)@. The 346290075Sobrienuse of these extensions is likely to make other debuggers crash or 346390075Sobrienrefuse to read the program. 346490075Sobrien 346590075Sobrien@item -gcoff 346690075Sobrien@opindex gcoff 346790075SobrienProduce debugging information in COFF format (if that is supported). 346890075SobrienThis is the format used by SDB on most System V systems prior to 346990075SobrienSystem V Release 4. 347090075Sobrien 347190075Sobrien@item -gxcoff 347290075Sobrien@opindex gxcoff 347390075SobrienProduce debugging information in XCOFF format (if that is supported). 347490075SobrienThis is the format used by the DBX debugger on IBM RS/6000 systems. 347590075Sobrien 347690075Sobrien@item -gxcoff+ 347790075Sobrien@opindex gxcoff+ 347890075SobrienProduce debugging information in XCOFF format (if that is supported), 347990075Sobrienusing GNU extensions understood only by the GNU debugger (GDB)@. The 348090075Sobrienuse of these extensions is likely to make other debuggers crash or 348190075Sobrienrefuse to read the program, and may cause assemblers other than the GNU 348290075Sobrienassembler (GAS) to fail with an error. 348390075Sobrien 348490075Sobrien@item -gdwarf-2 348590075Sobrien@opindex gdwarf-2 348690075SobrienProduce debugging information in DWARF version 2 format (if that is 3487169689Skansupported). This is the format used by DBX on IRIX 6. With this 3488169689Skanoption, GCC uses features of DWARF version 3 when they are useful; 3489169689Skanversion 3 is upward compatible with version 2, but may still cause 3490169689Skanproblems for older debuggers. 349190075Sobrien 349290075Sobrien@item -gvms 349390075Sobrien@opindex gvms 349490075SobrienProduce debugging information in VMS debug format (if that is 349590075Sobriensupported). This is the format used by DEBUG on VMS systems. 349690075Sobrien 349790075Sobrien@item -g@var{level} 349890075Sobrien@itemx -ggdb@var{level} 349990075Sobrien@itemx -gstabs@var{level} 350090075Sobrien@itemx -gcoff@var{level} 350190075Sobrien@itemx -gxcoff@var{level} 350290075Sobrien@itemx -gvms@var{level} 350390075SobrienRequest debugging information and also use @var{level} to specify how 350490075Sobrienmuch information. The default level is 2. 350590075Sobrien 350690075SobrienLevel 1 produces minimal information, enough for making backtraces in 350790075Sobrienparts of the program that you don't plan to debug. This includes 350890075Sobriendescriptions of functions and external variables, but no information 350990075Sobrienabout local variables and no line numbers. 351090075Sobrien 351190075SobrienLevel 3 includes extra information, such as all the macro definitions 351290075Sobrienpresent in the program. Some debuggers support macro expansion when 351390075Sobrienyou use @option{-g3}. 351490075Sobrien 3515169689Skan@option{-gdwarf-2} does not accept a concatenated debug level, because 3516169689SkanGCC used to support an option @option{-gdwarf} that meant to generate 3517169689Skandebug information in version 1 of the DWARF format (which is very 3518169689Skandifferent from version 2), and it would have been too confusing. That 3519169689Skandebug format is long obsolete, but the option cannot be changed now. 3520169689SkanInstead use an additional @option{-g@var{level}} option to change the 3521169689Skandebug level for DWARF2. 352296263Sobrien 3523117395Skan@item -feliminate-dwarf2-dups 3524117395Skan@opindex feliminate-dwarf2-dups 3525117395SkanCompress DWARF2 debugging information by eliminating duplicated 3526117395Skaninformation about each symbol. This option only makes sense when 3527117395Skangenerating DWARF2 debugging information with @option{-gdwarf-2}. 3528117395Skan 3529259268Spfg@item -femit-struct-debug-baseonly 3530259268SpfgEmit debug information for struct-like types 3531259268Spfgonly when the base name of the compilation source file 3532259268Spfgmatches the base name of file in which the struct was defined. 3533259268Spfg 3534259268SpfgThis option substantially reduces the size of debugging information, 3535259268Spfgbut at significant potential loss in type information to the debugger. 3536259268SpfgSee @option{-femit-struct-debug-reduced} for a less aggressive option. 3537259268SpfgSee @option{-femit-struct-debug-detailed} for more detailed control. 3538259268Spfg 3539259268SpfgThis option works only with DWARF 2. 3540259268Spfg 3541259268Spfg@item -femit-struct-debug-reduced 3542259268SpfgEmit debug information for struct-like types 3543259268Spfgonly when the base name of the compilation source file 3544259268Spfgmatches the base name of file in which the type was defined, 3545259268Spfgunless the struct is a template or defined in a system header. 3546259268Spfg 3547259268SpfgThis option significantly reduces the size of debugging information, 3548259268Spfgwith some potential loss in type information to the debugger. 3549259268SpfgSee @option{-femit-struct-debug-baseonly} for a more aggressive option. 3550259268SpfgSee @option{-femit-struct-debug-detailed} for more detailed control. 3551259268Spfg 3552259268SpfgThis option works only with DWARF 2. 3553259268Spfg 3554259268Spfg@item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} 3555259268SpfgSpecify the struct-like types 3556259268Spfgfor which the compiler will generate debug information. 3557259268SpfgThe intent is to reduce duplicate struct debug information 3558259268Spfgbetween different object files within the same program. 3559259268Spfg 3560259268SpfgThis option is a detailed version of 3561259268Spfg@option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly}, 3562259268Spfgwhich will serve for most needs. 3563259268Spfg 3564259268SpfgA specification has the syntax 3565259268Spfg[@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none}) 3566259268Spfg 3567259268SpfgThe optional first word limits the specification to 3568259268Spfgstructs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}). 3569259268SpfgA struct type is used directly when it is the type of a variable, member. 3570259268SpfgIndirect uses arise through pointers to structs. 3571259268SpfgThat is, when use of an incomplete struct would be legal, the use is indirect. 3572259268SpfgAn example is 3573259268Spfg@samp{struct one direct; struct two * indirect;}. 3574259268Spfg 3575259268SpfgThe optional second word limits the specification to 3576259268Spfgordinary structs (@samp{ord:}) or generic structs (@samp{gen:}). 3577259268SpfgGeneric structs are a bit complicated to explain. 3578259268SpfgFor C++, these are non-explicit specializations of template classes, 3579259268Spfgor non-template classes within the above. 3580259268SpfgOther programming languages have generics, 3581259268Spfgbut @samp{-femit-struct-debug-detailed} does not yet implement them. 3582259268Spfg 3583259268SpfgThe third word specifies the source files for those 3584259268Spfgstructs for which the compiler will emit debug information. 3585259268SpfgThe values @samp{none} and @samp{any} have the normal meaning. 3586259268SpfgThe value @samp{base} means that 3587259268Spfgthe base of name of the file in which the type declaration appears 3588259268Spfgmust match the base of the name of the main compilation file. 3589259268SpfgIn practice, this means that 3590259268Spfgtypes declared in @file{foo.c} and @file{foo.h} will have debug information, 3591259268Spfgbut types declared in other header will not. 3592259268SpfgThe value @samp{sys} means those types satisfying @samp{base} 3593259268Spfgor declared in system or compiler headers. 3594259268Spfg 3595259268SpfgYou may need to experiment to determine the best settings for your application. 3596259268Spfg 3597259268SpfgThe default is @samp{-femit-struct-debug-detailed=all}. 3598259268Spfg 3599259268SpfgThis option works only with DWARF 2. 3600259268Spfg 3601117395Skan@cindex @command{prof} 360290075Sobrien@item -p 360390075Sobrien@opindex p 360490075SobrienGenerate extra code to write profile information suitable for the 3605117395Skananalysis program @command{prof}. You must use this option when compiling 360690075Sobrienthe source files you want data about, and you must also use it when 360790075Sobrienlinking. 360890075Sobrien 3609117395Skan@cindex @command{gprof} 361090075Sobrien@item -pg 361190075Sobrien@opindex pg 361290075SobrienGenerate extra code to write profile information suitable for the 3613117395Skananalysis program @command{gprof}. You must use this option when compiling 361490075Sobrienthe source files you want data about, and you must also use it when 361590075Sobrienlinking. 361690075Sobrien 361790075Sobrien@item -Q 361890075Sobrien@opindex Q 361990075SobrienMakes the compiler print out each function name as it is compiled, and 362090075Sobrienprint some statistics about each pass when it finishes. 362190075Sobrien 362290075Sobrien@item -ftime-report 362390075Sobrien@opindex ftime-report 362490075SobrienMakes the compiler print some statistics about the time consumed by each 362590075Sobrienpass when it finishes. 362690075Sobrien 362790075Sobrien@item -fmem-report 362890075Sobrien@opindex fmem-report 362990075SobrienMakes the compiler print some statistics about permanent memory 363090075Sobrienallocation when it finishes. 363190075Sobrien 363290075Sobrien@item -fprofile-arcs 363390075Sobrien@opindex fprofile-arcs 3634132718SkanAdd code so that program flow @dfn{arcs} are instrumented. During 3635132718Skanexecution the program records how many times each branch and call is 3636132718Skanexecuted and how many times it is taken or returns. When the compiled 3637132718Skanprogram exits it saves this data to a file called 3638169689Skan@file{@var{auxname}.gcda} for each source file. The data may be used for 3639132718Skanprofile-directed optimizations (@option{-fbranch-probabilities}), or for 3640169689Skantest coverage analysis (@option{-ftest-coverage}). Each object file's 3641132718Skan@var{auxname} is generated from the name of the output file, if 3642132718Skanexplicitly specified and it is not the final executable, otherwise it is 3643169689Skanthe basename of the source file. In both cases any suffix is removed 3644169689Skan(e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or 3645132718Skan@file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}). 3646169689Skan@xref{Cross-profiling}. 364790075Sobrien 3648169689Skan@cindex @command{gcov} 3649169689Skan@item --coverage 3650169689Skan@opindex coverage 3651169689Skan 3652169689SkanThis option is used to compile and link code instrumented for coverage 3653169689Skananalysis. The option is a synonym for @option{-fprofile-arcs} 3654169689Skan@option{-ftest-coverage} (when compiling) and @option{-lgcov} (when 3655169689Skanlinking). See the documentation for those options for more details. 3656169689Skan 3657132718Skan@itemize 3658132718Skan 3659132718Skan@item 3660132718SkanCompile the source files with @option{-fprofile-arcs} plus optimization 3661169689Skanand code generation options. For test coverage analysis, use the 3662169689Skanadditional @option{-ftest-coverage} option. You do not need to profile 3663132718Skanevery source file in a program. 3664132718Skan 3665132718Skan@item 3666132718SkanLink your object files with @option{-lgcov} or @option{-fprofile-arcs} 3667132718Skan(the latter implies the former). 3668132718Skan 3669132718Skan@item 3670132718SkanRun the program on a representative workload to generate the arc profile 3671169689Skaninformation. This may be repeated any number of times. You can run 3672132718Skanconcurrent instances of your program, and provided that the file system 3673169689Skansupports locking, the data files will be correctly updated. Also 3674132718Skan@code{fork} calls are detected and correctly handled (double counting 3675132718Skanwill not happen). 3676132718Skan 3677132718Skan@item 3678132718SkanFor profile-directed optimizations, compile the source files again with 3679132718Skanthe same optimization and code generation options plus 368090075Sobrien@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that 368190075SobrienControl Optimization}). 368290075Sobrien 3683132718Skan@item 3684132718SkanFor test coverage analysis, use @command{gcov} to produce human readable 3685169689Skaninformation from the @file{.gcno} and @file{.gcda} files. Refer to the 3686132718Skan@command{gcov} documentation for further information. 368790075Sobrien 3688132718Skan@end itemize 3689132718Skan 369090075SobrienWith @option{-fprofile-arcs}, for each function of your program GCC 369190075Sobriencreates a program flow graph, then finds a spanning tree for the graph. 369290075SobrienOnly arcs that are not on the spanning tree have to be instrumented: the 369390075Sobriencompiler adds code to count the number of times that these arcs are 369490075Sobrienexecuted. When an arc is the only exit or only entrance to a block, the 369590075Sobrieninstrumentation code can be added to the block; otherwise, a new basic 369690075Sobrienblock must be created to hold the instrumentation code. 369790075Sobrien 369890075Sobrien@need 2000 369990075Sobrien@item -ftest-coverage 370090075Sobrien@opindex ftest-coverage 3701132718SkanProduce a notes file that the @command{gcov} code-coverage utility 3702132718Skan(@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to 3703169689Skanshow program coverage. Each source file's note file is called 3704169689Skan@file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option 3705132718Skanabove for a description of @var{auxname} and instructions on how to 3706169689Skangenerate test coverage data. Coverage data will match the source files 3707132718Skanmore closely, if you do not optimize. 370890075Sobrien 370990075Sobrien@item -d@var{letters} 3710169689Skan@item -fdump-rtl-@var{pass} 371190075Sobrien@opindex d 371290075SobrienSays to make debugging dumps during compilation at times specified by 3713169689Skan@var{letters}. This is used for debugging the RTL-based passes of the 3714169689Skancompiler. The file names for most of the dumps are made by appending a 3715169689Skanpass number and a word to the @var{dumpname}. @var{dumpname} is generated 3716169689Skanfrom the name of the output file, if explicitly specified and it is not 3717260139Spfgan executable, otherwise it is the basename of the source file. These 3718260139Spfgswitches may have different effects when @option{-E} is used for 3719260139Spfgpreprocessing. 372090075Sobrien 3721169689SkanMost debug dumps can be enabled either passing a letter to the @option{-d} 3722169689Skanoption, or with a long @option{-fdump-rtl} switch; here are the possible 3723169689Skanletters for use in @var{letters} and @var{pass}, and their meanings: 3724169689Skan 3725169689Skan@table @gcctabopt 3726169689Skan@item -dA 372790075Sobrien@opindex dA 372890075SobrienAnnotate the assembler output with miscellaneous debugging information. 3729169689Skan 3730169689Skan@item -dB 3731169689Skan@itemx -fdump-rtl-bbro 373290075Sobrien@opindex dB 3733169689Skan@opindex fdump-rtl-bbro 3734169689SkanDump after block reordering, to @file{@var{file}.148r.bbro}. 3735169689Skan 3736169689Skan@item -dc 3737169689Skan@itemx -fdump-rtl-combine 373890075Sobrien@opindex dc 3739169689Skan@opindex fdump-rtl-combine 3740169689SkanDump after instruction combination, to the file @file{@var{file}.129r.combine}. 3741169689Skan 3742169689Skan@item -dC 3743169689Skan@itemx -fdump-rtl-ce1 3744169689Skan@itemx -fdump-rtl-ce2 374590075Sobrien@opindex dC 3746169689Skan@opindex fdump-rtl-ce1 3747169689Skan@opindex fdump-rtl-ce2 3748169689Skan@option{-dC} and @option{-fdump-rtl-ce1} enable dumping after the 3749169689Skanfirst if conversion, to the file @file{@var{file}.117r.ce1}. @option{-dC} 3750169689Skanand @option{-fdump-rtl-ce2} enable dumping after the second if 3751169689Skanconversion, to the file @file{@var{file}.130r.ce2}. 3752169689Skan 3753169689Skan@item -dd 3754169689Skan@itemx -fdump-rtl-btl 3755169689Skan@itemx -fdump-rtl-dbr 375690075Sobrien@opindex dd 3757169689Skan@opindex fdump-rtl-btl 3758169689Skan@opindex fdump-rtl-dbr 3759169689Skan@option{-dd} and @option{-fdump-rtl-btl} enable dumping after branch 3760169689Skantarget load optimization, to @file{@var{file}.31.btl}. @option{-dd} 3761169689Skanand @option{-fdump-rtl-dbr} enable dumping after delayed branch 3762169689Skanscheduling, to @file{@var{file}.36.dbr}. 3763169689Skan 3764169689Skan@item -dD 376590075Sobrien@opindex dD 376690075SobrienDump all macro definitions, at the end of preprocessing, in addition to 376790075Sobriennormal output. 3768169689Skan 3769169689Skan@item -dE 3770169689Skan@itemx -fdump-rtl-ce3 377190075Sobrien@opindex dE 3772169689Skan@opindex fdump-rtl-ce3 3773169689SkanDump after the third if conversion, to @file{@var{file}.146r.ce3}. 3774169689Skan 3775169689Skan@item -df 3776169689Skan@itemx -fdump-rtl-cfg 3777169689Skan@itemx -fdump-rtl-life 377890075Sobrien@opindex df 3779169689Skan@opindex fdump-rtl-cfg 3780169689Skan@opindex fdump-rtl-life 3781169689Skan@option{-df} and @option{-fdump-rtl-cfg} enable dumping after control 3782169689Skanand data flow analysis, to @file{@var{file}.116r.cfg}. @option{-df} 3783169689Skanand @option{-fdump-rtl-cfg} enable dumping dump after life analysis, 3784169689Skanto @file{@var{file}.128r.life1} and @file{@var{file}.135r.life2}. 3785169689Skan 3786169689Skan@item -dg 3787169689Skan@itemx -fdump-rtl-greg 378890075Sobrien@opindex dg 3789169689Skan@opindex fdump-rtl-greg 3790169689SkanDump after global register allocation, to @file{@var{file}.139r.greg}. 3791169689Skan 3792169689Skan@item -dG 3793169689Skan@itemx -fdump-rtl-gcse 3794169689Skan@itemx -fdump-rtl-bypass 3795117395Skan@opindex dG 3796169689Skan@opindex fdump-rtl-gcse 3797169689Skan@opindex fdump-rtl-bypass 3798169689Skan@option{-dG} and @option{-fdump-rtl-gcse} enable dumping after GCSE, to 3799169689Skan@file{@var{file}.114r.gcse}. @option{-dG} and @option{-fdump-rtl-bypass} 3800169689Skanenable dumping after jump bypassing and control flow optimizations, to 3801169689Skan@file{@var{file}.115r.bypass}. 3802169689Skan 3803169689Skan@item -dh 3804169689Skan@itemx -fdump-rtl-eh 380590075Sobrien@opindex dh 3806169689Skan@opindex fdump-rtl-eh 3807169689SkanDump after finalization of EH handling code, to @file{@var{file}.02.eh}. 3808169689Skan 3809169689Skan@item -di 3810169689Skan@itemx -fdump-rtl-sibling 381190075Sobrien@opindex di 3812169689Skan@opindex fdump-rtl-sibling 3813169689SkanDump after sibling call optimizations, to @file{@var{file}.106r.sibling}. 3814169689Skan 3815169689Skan@item -dj 3816169689Skan@itemx -fdump-rtl-jump 381790075Sobrien@opindex dj 3818169689Skan@opindex fdump-rtl-jump 3819169689SkanDump after the first jump optimization, to @file{@var{file}.112r.jump}. 3820169689Skan 3821169689Skan@item -dk 3822169689Skan@itemx -fdump-rtl-stack 382390075Sobrien@opindex dk 3824169689Skan@opindex fdump-rtl-stack 3825169689SkanDump after conversion from registers to stack, to @file{@var{file}.152r.stack}. 3826169689Skan 3827169689Skan@item -dl 3828169689Skan@itemx -fdump-rtl-lreg 382990075Sobrien@opindex dl 3830169689Skan@opindex fdump-rtl-lreg 3831169689SkanDump after local register allocation, to @file{@var{file}.138r.lreg}. 3832169689Skan 3833169689Skan@item -dL 3834169689Skan@itemx -fdump-rtl-loop2 383590075Sobrien@opindex dL 3836169689Skan@opindex fdump-rtl-loop2 3837169689Skan@option{-dL} and @option{-fdump-rtl-loop2} enable dumping after the 3838169689Skanloop optimization pass, to @file{@var{file}.119r.loop2}, 3839169689Skan@file{@var{file}.120r.loop2_init}, 3840169689Skan@file{@var{file}.121r.loop2_invariant}, and 3841169689Skan@file{@var{file}.125r.loop2_done}. 3842169689Skan 3843169689Skan@item -dm 3844169689Skan@itemx -fdump-rtl-sms 3845169689Skan@opindex dm 3846169689Skan@opindex fdump-rtl-sms 3847169689SkanDump after modulo scheduling, to @file{@var{file}.136r.sms}. 3848169689Skan 3849169689Skan@item -dM 3850169689Skan@itemx -fdump-rtl-mach 385190075Sobrien@opindex dM 3852169689Skan@opindex fdump-rtl-mach 3853117395SkanDump after performing the machine dependent reorganization pass, to 3854260139Spfg@file{@var{file}.155r.mach} if that pass exists. 3855169689Skan 3856169689Skan@item -dn 3857169689Skan@itemx -fdump-rtl-rnreg 385890075Sobrien@opindex dn 3859169689Skan@opindex fdump-rtl-rnreg 3860169689SkanDump after register renumbering, to @file{@var{file}.147r.rnreg}. 3861169689Skan 3862169689Skan@item -dN 3863169689Skan@itemx -fdump-rtl-regmove 386490075Sobrien@opindex dN 3865169689Skan@opindex fdump-rtl-regmove 3866169689SkanDump after the register move pass, to @file{@var{file}.132r.regmove}. 3867169689Skan 3868169689Skan@item -do 3869169689Skan@itemx -fdump-rtl-postreload 3870117395Skan@opindex do 3871169689Skan@opindex fdump-rtl-postreload 3872169689SkanDump after post-reload optimizations, to @file{@var{file}.24.postreload}. 3873169689Skan 3874169689Skan@item -dr 3875169689Skan@itemx -fdump-rtl-expand 387690075Sobrien@opindex dr 3877169689Skan@opindex fdump-rtl-expand 3878169689SkanDump after RTL generation, to @file{@var{file}.104r.expand}. 3879169689Skan 3880169689Skan@item -dR 3881169689Skan@itemx -fdump-rtl-sched2 388290075Sobrien@opindex dR 3883169689Skan@opindex fdump-rtl-sched2 3884169689SkanDump after the second scheduling pass, to @file{@var{file}.150r.sched2}. 3885169689Skan 3886169689Skan@item -ds 3887169689Skan@itemx -fdump-rtl-cse 388890075Sobrien@opindex ds 3889169689Skan@opindex fdump-rtl-cse 389090075SobrienDump after CSE (including the jump optimization that sometimes follows 3891169689SkanCSE), to @file{@var{file}.113r.cse}. 3892169689Skan 3893169689Skan@item -dS 3894169689Skan@itemx -fdump-rtl-sched 389590075Sobrien@opindex dS 3896169689Skan@opindex fdump-rtl-sched 3897169689SkanDump after the first scheduling pass, to @file{@var{file}.21.sched}. 3898169689Skan 3899169689Skan@item -dt 3900169689Skan@itemx -fdump-rtl-cse2 390190075Sobrien@opindex dt 3902169689Skan@opindex fdump-rtl-cse2 390390075SobrienDump after the second CSE pass (including the jump optimization that 3904169689Skansometimes follows CSE), to @file{@var{file}.127r.cse2}. 3905169689Skan 3906169689Skan@item -dT 3907169689Skan@itemx -fdump-rtl-tracer 3908117395Skan@opindex dT 3909169689Skan@opindex fdump-rtl-tracer 3910169689SkanDump after running tracer, to @file{@var{file}.118r.tracer}. 3911169689Skan 3912169689Skan@item -dV 3913169689Skan@itemx -fdump-rtl-vpt 3914169689Skan@itemx -fdump-rtl-vartrack 3915132718Skan@opindex dV 3916169689Skan@opindex fdump-rtl-vpt 3917169689Skan@opindex fdump-rtl-vartrack 3918169689Skan@option{-dV} and @option{-fdump-rtl-vpt} enable dumping after the value 3919169689Skanprofile transformations, to @file{@var{file}.10.vpt}. @option{-dV} 3920169689Skanand @option{-fdump-rtl-vartrack} enable dumping after variable tracking, 3921169689Skanto @file{@var{file}.154r.vartrack}. 3922169689Skan 3923169689Skan@item -dw 3924169689Skan@itemx -fdump-rtl-flow2 392590075Sobrien@opindex dw 3926169689Skan@opindex fdump-rtl-flow2 3927169689SkanDump after the second flow pass, to @file{@var{file}.142r.flow2}. 3928169689Skan 3929169689Skan@item -dz 3930169689Skan@itemx -fdump-rtl-peephole2 393190075Sobrien@opindex dz 3932169689Skan@opindex fdump-rtl-peephole2 3933169689SkanDump after the peephole pass, to @file{@var{file}.145r.peephole2}. 3934169689Skan 3935169689Skan@item -dZ 3936169689Skan@itemx -fdump-rtl-web 3937132718Skan@opindex dZ 3938169689Skan@opindex fdump-rtl-web 3939169689SkanDump after live range splitting, to @file{@var{file}.126r.web}. 3940169689Skan 3941169689Skan@item -da 3942169689Skan@itemx -fdump-rtl-all 394390075Sobrien@opindex da 3944169689Skan@opindex fdump-rtl-all 394590075SobrienProduce all the dumps listed above. 3946169689Skan 3947169689Skan@item -dH 3948132718Skan@opindex dH 3949132718SkanProduce a core dump whenever an error occurs. 3950169689Skan 3951169689Skan@item -dm 395290075Sobrien@opindex dm 395390075SobrienPrint statistics on memory usage, at the end of the run, to 395490075Sobrienstandard error. 3955169689Skan 3956169689Skan@item -dp 395790075Sobrien@opindex dp 395890075SobrienAnnotate the assembler output with a comment indicating which 395990075Sobrienpattern and alternative was used. The length of each instruction is 396090075Sobrienalso printed. 3961169689Skan 3962169689Skan@item -dP 396390075Sobrien@opindex dP 396490075SobrienDump the RTL in the assembler output as a comment before each instruction. 396590075SobrienAlso turns on @option{-dp} annotation. 3966169689Skan 3967169689Skan@item -dv 396890075Sobrien@opindex dv 3969169689SkanFor each of the other indicated dump files (either with @option{-d} or 3970169689Skan@option{-fdump-rtl-@var{pass}}), dump a representation of the control flow 3971169689Skangraph suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}. 3972169689Skan 3973169689Skan@item -dx 397490075Sobrien@opindex dx 397590075SobrienJust generate RTL for a function instead of compiling it. Usually used 3976169689Skanwith @samp{r} (@option{-fdump-rtl-expand}). 3977169689Skan 3978169689Skan@item -dy 397990075Sobrien@opindex dy 398090075SobrienDump debugging information during parsing, to standard error. 398190075Sobrien@end table 398290075Sobrien 3983169689Skan@item -fdump-noaddr 3984169689Skan@opindex fdump-noaddr 3985169689SkanWhen doing debugging dumps (see @option{-d} option above), suppress 3986169689Skanaddress output. This makes it more feasible to use diff on debugging 3987169689Skandumps for compiler invocations with different compiler binaries and/or 3988169689Skandifferent text / bss / data / heap / stack / dso start locations. 3989169689Skan 399090075Sobrien@item -fdump-unnumbered 399190075Sobrien@opindex fdump-unnumbered 399290075SobrienWhen doing debugging dumps (see @option{-d} option above), suppress instruction 3993169689Skannumbers, line number note and address output. This makes it more feasible to 399490075Sobrienuse diff on debugging dumps for compiler invocations with different 399590075Sobrienoptions, in particular with and without @option{-g}. 399690075Sobrien 3997169689Skan@item -fdump-translation-unit @r{(C++ only)} 3998169689Skan@itemx -fdump-translation-unit-@var{options} @r{(C++ only)} 399990075Sobrien@opindex fdump-translation-unit 400090075SobrienDump a representation of the tree structure for the entire translation 400190075Sobrienunit to a file. The file name is made by appending @file{.tu} to the 400290075Sobriensource file name. If the @samp{-@var{options}} form is used, @var{options} 400390075Sobriencontrols the details of the dump as described for the 400490075Sobrien@option{-fdump-tree} options. 400590075Sobrien 400690075Sobrien@item -fdump-class-hierarchy @r{(C++ only)} 400790075Sobrien@itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)} 400890075Sobrien@opindex fdump-class-hierarchy 400990075SobrienDump a representation of each class's hierarchy and virtual function 401090075Sobrientable layout to a file. The file name is made by appending @file{.class} 401190075Sobriento the source file name. If the @samp{-@var{options}} form is used, 401290075Sobrien@var{options} controls the details of the dump as described for the 401390075Sobrien@option{-fdump-tree} options. 401490075Sobrien 4015169689Skan@item -fdump-ipa-@var{switch} 4016169689Skan@opindex fdump-ipa 4017169689SkanControl the dumping at various stages of inter-procedural analysis 4018169689Skanlanguage tree to a file. The file name is generated by appending a switch 4019169689Skanspecific suffix to the source file name. The following dumps are possible: 4020169689Skan 4021169689Skan@table @samp 4022169689Skan@item all 4023169689SkanEnables all inter-procedural analysis dumps; currently the only produced 4024169689Skandump is the @samp{cgraph} dump. 4025169689Skan 4026169689Skan@item cgraph 4027169689SkanDumps information about call-graph optimization, unused function removal, 4028169689Skanand inlining decisions. 4029169689Skan@end table 4030169689Skan 4031169689Skan@item -fdump-tree-@var{switch} 4032169689Skan@itemx -fdump-tree-@var{switch}-@var{options} 403390075Sobrien@opindex fdump-tree 403490075SobrienControl the dumping at various stages of processing the intermediate 403590075Sobrienlanguage tree to a file. The file name is generated by appending a switch 403690075Sobrienspecific suffix to the source file name. If the @samp{-@var{options}} 403790075Sobrienform is used, @var{options} is a list of @samp{-} separated options that 4038169689Skancontrol the details of the dump. Not all options are applicable to all 4039169689Skandumps, those which are not meaningful will be ignored. The following 404090075Sobrienoptions are available 404190075Sobrien 404290075Sobrien@table @samp 404390075Sobrien@item address 404490075SobrienPrint the address of each node. Usually this is not meaningful as it 4045169689Skanchanges according to the environment and source file. Its primary use 404690075Sobrienis for tying up a dump file with a debug environment. 404790075Sobrien@item slim 404890075SobrienInhibit dumping of members of a scope or body of a function merely 4049169689Skanbecause that scope has been reached. Only dump such items when they 4050169689Skanare directly reachable by some other path. When dumping pretty-printed 4051169689Skantrees, this option inhibits dumping the bodies of control structures. 4052169689Skan@item raw 4053169689SkanPrint a raw representation of the tree. By default, trees are 4054169689Skanpretty-printed into a C-like representation. 4055169689Skan@item details 4056169689SkanEnable more detailed dumps (not honored by every dump option). 4057169689Skan@item stats 4058169689SkanEnable dumping various statistics about the pass (not honored by every dump 4059169689Skanoption). 4060169689Skan@item blocks 4061169689SkanEnable showing basic block boundaries (disabled in raw dumps). 4062169689Skan@item vops 4063169689SkanEnable showing virtual operands for every statement. 4064169689Skan@item lineno 4065169689SkanEnable showing line numbers for statements. 4066169689Skan@item uid 4067169689SkanEnable showing the unique ID (@code{DECL_UID}) for each variable. 406890075Sobrien@item all 4069169689SkanTurn on all options, except @option{raw}, @option{slim} and @option{lineno}. 407090075Sobrien@end table 407190075Sobrien 407290075SobrienThe following tree dumps are possible: 407390075Sobrien@table @samp 4074169689Skan 407590075Sobrien@item original 407690075SobrienDump before any tree based optimization, to @file{@var{file}.original}. 4077169689Skan 407890075Sobrien@item optimized 407990075SobrienDump after all tree based optimization, to @file{@var{file}.optimized}. 4080169689Skan 408190075Sobrien@item inlined 408290075SobrienDump after function inlining, to @file{@var{file}.inlined}. 4083169689Skan 4084169689Skan@item gimple 4085169689Skan@opindex fdump-tree-gimple 4086169689SkanDump each function before and after the gimplification pass to a file. The 4087169689Skanfile name is made by appending @file{.gimple} to the source file name. 4088169689Skan 4089169689Skan@item cfg 4090169689Skan@opindex fdump-tree-cfg 4091169689SkanDump the control flow graph of each function to a file. The file name is 4092169689Skanmade by appending @file{.cfg} to the source file name. 4093169689Skan 4094169689Skan@item vcg 4095169689Skan@opindex fdump-tree-vcg 4096169689SkanDump the control flow graph of each function to a file in VCG format. The 4097169689Skanfile name is made by appending @file{.vcg} to the source file name. Note 4098169689Skanthat if the file contains more than one function, the generated file cannot 4099169689Skanbe used directly by VCG@. You will need to cut and paste each function's 4100169689Skangraph into its own separate file first. 4101169689Skan 4102169689Skan@item ch 4103169689Skan@opindex fdump-tree-ch 4104169689SkanDump each function after copying loop headers. The file name is made by 4105169689Skanappending @file{.ch} to the source file name. 4106169689Skan 4107169689Skan@item ssa 4108169689Skan@opindex fdump-tree-ssa 4109169689SkanDump SSA related information to a file. The file name is made by appending 4110169689Skan@file{.ssa} to the source file name. 4111169689Skan 4112169689Skan@item salias 4113169689Skan@opindex fdump-tree-salias 4114169689SkanDump structure aliasing variable information to a file. This file name 4115169689Skanis made by appending @file{.salias} to the source file name. 4116169689Skan 4117169689Skan@item alias 4118169689Skan@opindex fdump-tree-alias 4119169689SkanDump aliasing information for each function. The file name is made by 4120169689Skanappending @file{.alias} to the source file name. 4121169689Skan 4122169689Skan@item ccp 4123169689Skan@opindex fdump-tree-ccp 4124169689SkanDump each function after CCP@. The file name is made by appending 4125169689Skan@file{.ccp} to the source file name. 4126169689Skan 4127169689Skan@item storeccp 4128169689Skan@opindex fdump-tree-storeccp 4129169689SkanDump each function after STORE-CCP. The file name is made by appending 4130169689Skan@file{.storeccp} to the source file name. 4131169689Skan 4132169689Skan@item pre 4133169689Skan@opindex fdump-tree-pre 4134169689SkanDump trees after partial redundancy elimination. The file name is made 4135169689Skanby appending @file{.pre} to the source file name. 4136169689Skan 4137169689Skan@item fre 4138169689Skan@opindex fdump-tree-fre 4139169689SkanDump trees after full redundancy elimination. The file name is made 4140169689Skanby appending @file{.fre} to the source file name. 4141169689Skan 4142169689Skan@item copyprop 4143169689Skan@opindex fdump-tree-copyprop 4144169689SkanDump trees after copy propagation. The file name is made 4145169689Skanby appending @file{.copyprop} to the source file name. 4146169689Skan 4147169689Skan@item store_copyprop 4148169689Skan@opindex fdump-tree-store_copyprop 4149169689SkanDump trees after store copy-propagation. The file name is made 4150169689Skanby appending @file{.store_copyprop} to the source file name. 4151169689Skan 4152169689Skan@item dce 4153169689Skan@opindex fdump-tree-dce 4154169689SkanDump each function after dead code elimination. The file name is made by 4155169689Skanappending @file{.dce} to the source file name. 4156169689Skan 4157169689Skan@item mudflap 4158169689Skan@opindex fdump-tree-mudflap 4159169689SkanDump each function after adding mudflap instrumentation. The file name is 4160169689Skanmade by appending @file{.mudflap} to the source file name. 4161169689Skan 4162169689Skan@item sra 4163169689Skan@opindex fdump-tree-sra 4164169689SkanDump each function after performing scalar replacement of aggregates. The 4165169689Skanfile name is made by appending @file{.sra} to the source file name. 4166169689Skan 4167169689Skan@item sink 4168169689Skan@opindex fdump-tree-sink 4169169689SkanDump each function after performing code sinking. The file name is made 4170169689Skanby appending @file{.sink} to the source file name. 4171169689Skan 4172169689Skan@item dom 4173169689Skan@opindex fdump-tree-dom 4174169689SkanDump each function after applying dominator tree optimizations. The file 4175169689Skanname is made by appending @file{.dom} to the source file name. 4176169689Skan 4177169689Skan@item dse 4178169689Skan@opindex fdump-tree-dse 4179169689SkanDump each function after applying dead store elimination. The file 4180169689Skanname is made by appending @file{.dse} to the source file name. 4181169689Skan 4182169689Skan@item phiopt 4183169689Skan@opindex fdump-tree-phiopt 4184169689SkanDump each function after optimizing PHI nodes into straightline code. The file 4185169689Skanname is made by appending @file{.phiopt} to the source file name. 4186169689Skan 4187169689Skan@item forwprop 4188169689Skan@opindex fdump-tree-forwprop 4189169689SkanDump each function after forward propagating single use variables. The file 4190169689Skanname is made by appending @file{.forwprop} to the source file name. 4191169689Skan 4192169689Skan@item copyrename 4193169689Skan@opindex fdump-tree-copyrename 4194169689SkanDump each function after applying the copy rename optimization. The file 4195169689Skanname is made by appending @file{.copyrename} to the source file name. 4196169689Skan 4197169689Skan@item nrv 4198169689Skan@opindex fdump-tree-nrv 4199169689SkanDump each function after applying the named return value optimization on 4200169689Skangeneric trees. The file name is made by appending @file{.nrv} to the source 4201169689Skanfile name. 4202169689Skan 4203169689Skan@item vect 4204169689Skan@opindex fdump-tree-vect 4205169689SkanDump each function after applying vectorization of loops. The file name is 4206169689Skanmade by appending @file{.vect} to the source file name. 4207169689Skan 4208169689Skan@item vrp 4209169689Skan@opindex fdump-tree-vrp 4210169689SkanDump each function after Value Range Propagation (VRP). The file name 4211169689Skanis made by appending @file{.vrp} to the source file name. 4212169689Skan 4213169689Skan@item all 4214169689Skan@opindex fdump-tree-all 4215169689SkanEnable all the available tree dumps with the flags provided in this option. 421690075Sobrien@end table 421790075Sobrien 4218169689Skan@item -ftree-vectorizer-verbose=@var{n} 4219169689Skan@opindex ftree-vectorizer-verbose 4220169689SkanThis option controls the amount of debugging output the vectorizer prints. 4221169689SkanThis information is written to standard error, unless 4222169689Skan@option{-fdump-tree-all} or @option{-fdump-tree-vect} is specified, 4223169689Skanin which case it is output to the usual dump listing file, @file{.vect}. 4224169689SkanFor @var{n}=0 no diagnostic information is reported. 4225169689SkanIf @var{n}=1 the vectorizer reports each loop that got vectorized, 4226169689Skanand the total number of loops that got vectorized. 4227169689SkanIf @var{n}=2 the vectorizer also reports non-vectorized loops that passed 4228169689Skanthe first analysis phase (vect_analyze_loop_form) - i.e. countable, 4229169689Skaninner-most, single-bb, single-entry/exit loops. This is the same verbosity 4230169689Skanlevel that @option{-fdump-tree-vect-stats} uses. 4231169689SkanHigher verbosity levels mean either more information dumped for each 4232169689Skanreported loop, or same amount of information reported for more loops: 4233169689SkanIf @var{n}=3, alignment related information is added to the reports. 4234169689SkanIf @var{n}=4, data-references related information (e.g. memory dependences, 4235169689Skanmemory access-patterns) is added to the reports. 4236169689SkanIf @var{n}=5, the vectorizer reports also non-vectorized inner-most loops 4237169689Skanthat did not pass the first analysis phase (i.e. may not be countable, or 4238169689Skanmay have complicated control-flow). 4239169689SkanIf @var{n}=6, the vectorizer reports also non-vectorized nested loops. 4240169689SkanFor @var{n}=7, all the information the vectorizer generates during its 4241169689Skananalysis and transformation is reported. This is the same verbosity level 4242169689Skanthat @option{-fdump-tree-vect-details} uses. 4243169689Skan 4244117395Skan@item -frandom-seed=@var{string} 4245117395Skan@opindex frandom-string 4246117395SkanThis option provides a seed that GCC uses when it would otherwise use 4247132718Skanrandom numbers. It is used to generate certain symbol names 4248169689Skanthat have to be different in every compiled file. It is also used to 4249132718Skanplace unique stamps in coverage data files and the object files that 4250169689Skanproduce them. You can use the @option{-frandom-seed} option to produce 4251132718Skanreproducibly identical object files. 4252117395Skan 4253117395SkanThe @var{string} should be different for every file you compile. 4254117395Skan 4255107590Sobrien@item -fsched-verbose=@var{n} 4256107590Sobrien@opindex fsched-verbose 4257107590SobrienOn targets that use instruction scheduling, this option controls the 4258107590Sobrienamount of debugging output the scheduler prints. This information is 4259107590Sobrienwritten to standard error, unless @option{-dS} or @option{-dR} is 4260107590Sobrienspecified, in which case it is output to the usual dump 4261107590Sobrienlisting file, @file{.sched} or @file{.sched2} respectively. However 4262107590Sobrienfor @var{n} greater than nine, the output is always printed to standard 4263107590Sobrienerror. 4264107590Sobrien 4265107590SobrienFor @var{n} greater than zero, @option{-fsched-verbose} outputs the 4266107590Sobriensame information as @option{-dRS}. For @var{n} greater than one, it 4267107590Sobrienalso output basic block probabilities, detailed ready list information 4268107590Sobrienand unit/insn info. For @var{n} greater than two, it includes RTL 4269107590Sobrienat abort point, control-flow and regions info. And for @var{n} over 4270107590Sobrienfour, @option{-fsched-verbose} also includes dependence info. 4271107590Sobrien 427290075Sobrien@item -save-temps 427390075Sobrien@opindex save-temps 427490075SobrienStore the usual ``temporary'' intermediate files permanently; place them 427590075Sobrienin the current directory and name them based on the source file. Thus, 427690075Sobriencompiling @file{foo.c} with @samp{-c -save-temps} would produce files 427790075Sobrien@file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a 427890075Sobrienpreprocessed @file{foo.i} output file even though the compiler now 427990075Sobriennormally uses an integrated preprocessor. 428090075Sobrien 4281169689SkanWhen used in combination with the @option{-x} command line option, 4282169689Skan@option{-save-temps} is sensible enough to avoid over writing an 4283169689Skaninput source file with the same extension as an intermediate file. 4284169689SkanThe corresponding intermediate file may be obtained by renaming the 4285169689Skansource file before using @option{-save-temps}. 4286169689Skan 428790075Sobrien@item -time 428890075Sobrien@opindex time 428990075SobrienReport the CPU time taken by each subprocess in the compilation 429090075Sobriensequence. For C source files, this is the compiler proper and assembler 429190075Sobrien(plus the linker if linking is done). The output looks like this: 429290075Sobrien 429390075Sobrien@smallexample 429490075Sobrien# cc1 0.12 0.01 429590075Sobrien# as 0.00 0.01 429690075Sobrien@end smallexample 429790075Sobrien 4298169689SkanThe first number on each line is the ``user time'', that is time spent 4299169689Skanexecuting the program itself. The second number is ``system time'', 430090075Sobrientime spent executing operating system routines on behalf of the program. 430190075SobrienBoth numbers are in seconds. 430290075Sobrien 4303169689Skan@item -fvar-tracking 4304169689Skan@opindex fvar-tracking 4305169689SkanRun variable tracking pass. It computes where variables are stored at each 4306169689Skanposition in code. Better debugging information is then generated 4307169689Skan(if the debugging information format supports this information). 4308169689Skan 4309169689SkanIt is enabled by default when compiling with optimization (@option{-Os}, 4310169689Skan@option{-O}, @option{-O2}, ...), debugging information (@option{-g}) and 4311169689Skanthe debug info format supports it. 4312169689Skan 431390075Sobrien@item -print-file-name=@var{library} 431490075Sobrien@opindex print-file-name 431590075SobrienPrint the full absolute name of the library file @var{library} that 431690075Sobrienwould be used when linking---and don't do anything else. With this 431790075Sobrienoption, GCC does not compile or link anything; it just prints the 431890075Sobrienfile name. 431990075Sobrien 432090075Sobrien@item -print-multi-directory 432190075Sobrien@opindex print-multi-directory 432290075SobrienPrint the directory name corresponding to the multilib selected by any 432390075Sobrienother switches present in the command line. This directory is supposed 432490075Sobriento exist in @env{GCC_EXEC_PREFIX}. 432590075Sobrien 432690075Sobrien@item -print-multi-lib 432790075Sobrien@opindex print-multi-lib 432890075SobrienPrint the mapping from multilib directory names to compiler switches 432990075Sobrienthat enable them. The directory name is separated from the switches by 433090075Sobrien@samp{;}, and each switch starts with an @samp{@@} instead of the 433190075Sobrien@samp{-}, without spaces between multiple switches. This is supposed to 433290075Sobrienease shell-processing. 433390075Sobrien 433490075Sobrien@item -print-prog-name=@var{program} 433590075Sobrien@opindex print-prog-name 433690075SobrienLike @option{-print-file-name}, but searches for a program such as @samp{cpp}. 433790075Sobrien 433890075Sobrien@item -print-libgcc-file-name 433990075Sobrien@opindex print-libgcc-file-name 434090075SobrienSame as @option{-print-file-name=libgcc.a}. 434190075Sobrien 434290075SobrienThis is useful when you use @option{-nostdlib} or @option{-nodefaultlibs} 434390075Sobrienbut you do want to link with @file{libgcc.a}. You can do 434490075Sobrien 4345132718Skan@smallexample 434690075Sobriengcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name` 4347132718Skan@end smallexample 434890075Sobrien 434990075Sobrien@item -print-search-dirs 435090075Sobrien@opindex print-search-dirs 435190075SobrienPrint the name of the configured installation directory and a list of 4352132718Skanprogram and library directories @command{gcc} will search---and don't do anything else. 435390075Sobrien 4354132718SkanThis is useful when @command{gcc} prints the error message 435590075Sobrien@samp{installation problem, cannot exec cpp0: No such file or directory}. 435690075SobrienTo resolve this you either need to put @file{cpp0} and the other compiler 4357132718Skancomponents where @command{gcc} expects to find them, or you can set the environment 435890075Sobrienvariable @env{GCC_EXEC_PREFIX} to the directory where you installed them. 4359169689SkanDon't forget the trailing @samp{/}. 436090075Sobrien@xref{Environment Variables}. 436190075Sobrien 436290075Sobrien@item -dumpmachine 436390075Sobrien@opindex dumpmachine 436490075SobrienPrint the compiler's target machine (for example, 436590075Sobrien@samp{i686-pc-linux-gnu})---and don't do anything else. 436690075Sobrien 436790075Sobrien@item -dumpversion 436890075Sobrien@opindex dumpversion 436990075SobrienPrint the compiler version (for example, @samp{3.0})---and don't do 437090075Sobrienanything else. 437190075Sobrien 437290075Sobrien@item -dumpspecs 437390075Sobrien@opindex dumpspecs 437490075SobrienPrint the compiler's built-in specs---and don't do anything else. (This 437590075Sobrienis used when GCC itself is being built.) @xref{Spec Files}. 4376132718Skan 4377132718Skan@item -feliminate-unused-debug-types 4378132718Skan@opindex feliminate-unused-debug-types 4379132718SkanNormally, when producing DWARF2 output, GCC will emit debugging 4380132718Skaninformation for all types declared in a compilation 4381132718Skanunit, regardless of whether or not they are actually used 4382132718Skanin that compilation unit. Sometimes this is useful, such as 4383132718Skanif, in the debugger, you want to cast a value to a type that is 4384132718Skannot actually used in your program (but is declared). More often, 4385132718Skanhowever, this results in a significant amount of wasted space. 4386132718SkanWith this option, GCC will avoid producing debug symbol output 4387132718Skanfor types that are nowhere used in the source file being compiled. 438890075Sobrien@end table 438990075Sobrien 439090075Sobrien@node Optimize Options 439190075Sobrien@section Options That Control Optimization 439290075Sobrien@cindex optimize options 439390075Sobrien@cindex options, optimization 439490075Sobrien 4395117395SkanThese options control various sorts of optimizations. 439690075Sobrien 4397117395SkanWithout any optimization option, the compiler's goal is to reduce the 4398117395Skancost of compilation and to make debugging produce the expected 4399117395Skanresults. Statements are independent: if you stop the program with a 4400117395Skanbreakpoint between statements, you can then assign a new value to any 4401117395Skanvariable or change the program counter to any other statement in the 4402117395Skanfunction and get exactly the results you would expect from the source 4403117395Skancode. 4404117395Skan 4405117395SkanTurning on optimization flags makes the compiler attempt to improve 4406117395Skanthe performance and/or code size at the expense of compilation time 4407117395Skanand possibly the ability to debug the program. 4408117395Skan 4409132718SkanThe compiler performs optimization based on the knowledge it has of 4410169689Skanthe program. Optimization levels @option{-O} and above, in 4411169689Skanparticular, enable @emph{unit-at-a-time} mode, which allows the 4412169689Skancompiler to consider information gained from later functions in 4413169689Skanthe file when compiling a function. Compiling multiple files at 4414169689Skanonce to a single output file in @emph{unit-at-a-time} mode allows 4415132718Skanthe compiler to use information gained from all of the files when 4416132718Skancompiling each of them. 4417132718Skan 4418117395SkanNot all optimizations are controlled directly by a flag. Only 4419117395Skanoptimizations that have a flag are listed. 4420117395Skan 442190075Sobrien@table @gcctabopt 442290075Sobrien@item -O 442390075Sobrien@itemx -O1 442490075Sobrien@opindex O 442590075Sobrien@opindex O1 442690075SobrienOptimize. Optimizing compilation takes somewhat more time, and a lot 442790075Sobrienmore memory for a large function. 442890075Sobrien 442990075SobrienWith @option{-O}, the compiler tries to reduce code size and execution 443090075Sobrientime, without performing any optimizations that take a great deal of 443190075Sobriencompilation time. 443290075Sobrien 4433132718Skan@option{-O} turns on the following optimization flags: 4434117395Skan@gccoptlist{-fdefer-pop @gol 4435169689Skan-fdelayed-branch @gol 4436169689Skan-fguess-branch-probability @gol 4437169689Skan-fcprop-registers @gol 4438117395Skan-fif-conversion @gol 4439117395Skan-fif-conversion2 @gol 4440169689Skan-ftree-ccp @gol 4441169689Skan-ftree-dce @gol 4442169689Skan-ftree-dominator-opts @gol 4443169689Skan-ftree-dse @gol 4444169689Skan-ftree-ter @gol 4445169689Skan-ftree-lrs @gol 4446169689Skan-ftree-sra @gol 4447169689Skan-ftree-copyrename @gol 4448169689Skan-ftree-fre @gol 4449169689Skan-ftree-ch @gol 4450169689Skan-funit-at-a-time @gol 4451169689Skan-fmerge-constants} 4452117395Skan 4453117395Skan@option{-O} also turns on @option{-fomit-frame-pointer} on machines 4454117395Skanwhere doing so does not interfere with debugging. 4455117395Skan 445690075Sobrien@item -O2 445790075Sobrien@opindex O2 445890075SobrienOptimize even more. GCC performs nearly all supported optimizations 445990075Sobrienthat do not involve a space-speed tradeoff. The compiler does not 446090075Sobrienperform loop unrolling or function inlining when you specify @option{-O2}. 446190075SobrienAs compared to @option{-O}, this option increases both compilation time 446290075Sobrienand the performance of the generated code. 446390075Sobrien 4464117395Skan@option{-O2} turns on all optimization flags specified by @option{-O}. It 4465117395Skanalso turns on the following optimization flags: 4466169689Skan@gccoptlist{-fthread-jumps @gol 4467169689Skan-fcrossjumping @gol 4468117395Skan-foptimize-sibling-calls @gol 4469117395Skan-fcse-follow-jumps -fcse-skip-blocks @gol 4470169689Skan-fgcse -fgcse-lm @gol 4471117395Skan-fexpensive-optimizations @gol 4472169689Skan-frerun-cse-after-loop @gol 4473169689Skan-fcaller-saves @gol 4474169689Skan-fpeephole2 @gol 4475117395Skan-fschedule-insns -fschedule-insns2 @gol 4476132718Skan-fsched-interblock -fsched-spec @gol 4477169689Skan-fregmove @gol 4478169689Skan-fstrict-aliasing -fstrict-overflow @gol 4479169689Skan-fdelete-null-pointer-checks @gol 4480117395Skan-freorder-blocks -freorder-functions @gol 4481117395Skan-falign-functions -falign-jumps @gol 4482132718Skan-falign-loops -falign-labels @gol 4483169689Skan-ftree-vrp @gol 4484169689Skan-ftree-pre} 448590075Sobrien 448690075SobrienPlease note the warning under @option{-fgcse} about 448790075Sobrieninvoking @option{-O2} on programs that use computed gotos. 448890075Sobrien 4489169689Skan@option{-O2} doesn't turn on @option{-ftree-vrp} for the Ada compiler. 4490169689SkanThis option must be explicitly specified on the command line to be 4491169689Skanenabled for the Ada compiler. 4492169689Skan 449390075Sobrien@item -O3 449490075Sobrien@opindex O3 449590075SobrienOptimize yet more. @option{-O3} turns on all optimizations specified by 4496132718Skan@option{-O2} and also turns on the @option{-finline-functions}, 4497169689Skan@option{-funswitch-loops} and @option{-fgcse-after-reload} options. 449890075Sobrien 449990075Sobrien@item -O0 450090075Sobrien@opindex O0 4501117395SkanDo not optimize. This is the default. 450290075Sobrien 450390075Sobrien@item -Os 450490075Sobrien@opindex Os 450590075SobrienOptimize for size. @option{-Os} enables all @option{-O2} optimizations that 450690075Sobriendo not typically increase code size. It also performs further 450790075Sobrienoptimizations designed to reduce code size. 450890075Sobrien 4509117395Skan@option{-Os} disables the following optimization flags: 4510117395Skan@gccoptlist{-falign-functions -falign-jumps -falign-loops @gol 4511169689Skan-falign-labels -freorder-blocks -freorder-blocks-and-partition @gol 4512169689Skan-fprefetch-loop-arrays -ftree-vect-loop-version} 4513117395Skan 451490075SobrienIf you use multiple @option{-O} options, with or without level numbers, 451590075Sobrienthe last such option is the one that is effective. 451690075Sobrien@end table 451790075Sobrien 451890075SobrienOptions of the form @option{-f@var{flag}} specify machine-independent 451990075Sobrienflags. Most flags have both positive and negative forms; the negative 4520117395Skanform of @option{-ffoo} would be @option{-fno-foo}. In the table 4521117395Skanbelow, only one of the forms is listed---the one you typically will 4522117395Skanuse. You can figure out the other form by either removing @samp{no-} 4523117395Skanor adding it. 452490075Sobrien 4525117395SkanThe following options control specific optimizations. They are either 4526117395Skanactivated by @option{-O} options or are related to ones that are. You 4527117395Skancan use the following flags in the rare cases when ``fine-tuning'' of 4528117395Skanoptimizations to be performed is desired. 4529117395Skan 453090075Sobrien@table @gcctabopt 453190075Sobrien@item -fno-default-inline 453290075Sobrien@opindex fno-default-inline 453390075SobrienDo not make member functions inline by default merely because they are 453490075Sobriendefined inside the class scope (C++ only). Otherwise, when you specify 453590075Sobrien@w{@option{-O}}, member functions defined inside class scope are compiled 453690075Sobrieninline by default; i.e., you don't need to add @samp{inline} in front of 453790075Sobrienthe member function name. 453890075Sobrien 453990075Sobrien@item -fno-defer-pop 454090075Sobrien@opindex fno-defer-pop 454190075SobrienAlways pop the arguments to each function call as soon as that function 454290075Sobrienreturns. For machines which must pop arguments after a function call, 454390075Sobrienthe compiler normally lets arguments accumulate on the stack for several 454490075Sobrienfunction calls and pops them all at once. 454590075Sobrien 4546117395SkanDisabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4547117395Skan 454890075Sobrien@item -fforce-mem 454990075Sobrien@opindex fforce-mem 455090075SobrienForce memory operands to be copied into registers before doing 455190075Sobrienarithmetic on them. This produces better code by making all memory 455290075Sobrienreferences potential common subexpressions. When they are not common 455390075Sobriensubexpressions, instruction combination should eliminate the separate 4554169689Skanregister-load. This option is now a nop and will be removed in 4.3. 455590075Sobrien 455690075Sobrien@item -fforce-addr 455790075Sobrien@opindex fforce-addr 455890075SobrienForce memory address constants to be copied into registers before 4559169689Skandoing arithmetic on them. 456090075Sobrien 456190075Sobrien@item -fomit-frame-pointer 456290075Sobrien@opindex fomit-frame-pointer 456390075SobrienDon't keep the frame pointer in a register for functions that 456490075Sobriendon't need one. This avoids the instructions to save, set up and 456590075Sobrienrestore frame pointers; it also makes an extra register available 456690075Sobrienin many functions. @strong{It also makes debugging impossible on 456790075Sobriensome machines.} 456890075Sobrien 456990075SobrienOn some machines, such as the VAX, this flag has no effect, because 457090075Sobrienthe standard calling sequence automatically handles the frame pointer 457190075Sobrienand nothing is saved by pretending it doesn't exist. The 457290075Sobrienmachine-description macro @code{FRAME_POINTER_REQUIRED} controls 457390075Sobrienwhether a target machine supports this flag. @xref{Registers,,Register 457490075SobrienUsage, gccint, GNU Compiler Collection (GCC) Internals}. 457590075Sobrien 4576117395SkanEnabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4577117395Skan 457890075Sobrien@item -foptimize-sibling-calls 457990075Sobrien@opindex foptimize-sibling-calls 458090075SobrienOptimize sibling and tail recursive calls. 458190075Sobrien 4582117395SkanEnabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 458390075Sobrien 458490075Sobrien@item -fno-inline 458590075Sobrien@opindex fno-inline 458690075SobrienDon't pay attention to the @code{inline} keyword. Normally this option 458790075Sobrienis used to keep the compiler from expanding any functions inline. 458890075SobrienNote that if you are not optimizing, no functions can be expanded inline. 458990075Sobrien 459090075Sobrien@item -finline-functions 459190075Sobrien@opindex finline-functions 459290075SobrienIntegrate all simple functions into their callers. The compiler 459390075Sobrienheuristically decides which functions are simple enough to be worth 459490075Sobrienintegrating in this way. 459590075Sobrien 459690075SobrienIf all calls to a given function are integrated, and the function is 459790075Sobriendeclared @code{static}, then the function is normally not output as 459890075Sobrienassembler code in its own right. 459990075Sobrien 4600117395SkanEnabled at level @option{-O3}. 4601117395Skan 4602169689Skan@item -finline-functions-called-once 4603169689Skan@opindex finline-functions-called-once 4604169689SkanConsider all @code{static} functions called once for inlining into their 4605169689Skancaller even if they are not marked @code{inline}. If a call to a given 4606169689Skanfunction is integrated, then the function is not output as assembler code 4607169689Skanin its own right. 4608169689Skan 4609169689SkanEnabled if @option{-funit-at-a-time} is enabled. 4610169689Skan 4611169689Skan@item -fearly-inlining 4612169689Skan@opindex fearly-inlining 4613169689SkanInline functions marked by @code{always_inline} and functions whose body seems 4614169689Skansmaller than the function call overhead early before doing 4615169689Skan@option{-fprofile-generate} instrumentation and real inlining pass. Doing so 4616169689Skanmakes profiling significantly cheaper and usually inlining faster on programs 4617169689Skanhaving large chains of nested wrapper functions. 4618169689Skan 4619169689SkanEnabled by default. 4620169689Skan 462190075Sobrien@item -finline-limit=@var{n} 462290075Sobrien@opindex finline-limit 4623132718SkanBy default, GCC limits the size of functions that can be inlined. This flag 462490075Sobrienallows the control of this limit for functions that are explicitly marked as 4625117395Skaninline (i.e., marked with the inline keyword or defined within the class 462690075Sobriendefinition in c++). @var{n} is the size of functions that can be inlined in 462790075Sobriennumber of pseudo instructions (not counting parameter handling). The default 462890075Sobrienvalue of @var{n} is 600. 462990075SobrienIncreasing this value can result in more inlined code at 463090075Sobrienthe cost of compilation time and memory consumption. Decreasing usually makes 463190075Sobrienthe compilation faster and less code will be inlined (which presumably 463290075Sobrienmeans slower programs). This option is particularly useful for programs that 463390075Sobrienuse inlining heavily such as those based on recursive templates with C++. 463490075Sobrien 4635117395SkanInlining is actually controlled by a number of parameters, which may be 4636117395Skanspecified individually by using @option{--param @var{name}=@var{value}}. 4637132718SkanThe @option{-finline-limit=@var{n}} option sets some of these parameters 4638117395Skanas follows: 4639117395Skan 4640119256Skan@table @gcctabopt 4641169689Skan@item max-inline-insns-single 4642169689Skan is set to @var{n}/2. 4643169689Skan@item max-inline-insns-auto 4644169689Skan is set to @var{n}/2. 4645169689Skan@item min-inline-insns 4646169689Skan is set to 130 or @var{n}/4, whichever is smaller. 4647169689Skan@item max-inline-insns-rtl 4648169689Skan is set to @var{n}. 4649119256Skan@end table 4650117395Skan 4651132718SkanSee below for a documentation of the individual 4652117395Skanparameters controlling inlining. 4653117395Skan 465490075Sobrien@emph{Note:} pseudo instruction represents, in this particular context, an 4655169689Skanabstract measurement of function's size. In no way does it represent a count 465690075Sobrienof assembly instructions and as such its exact meaning might change from one 465790075Sobrienrelease to an another. 465890075Sobrien 465990075Sobrien@item -fkeep-inline-functions 466090075Sobrien@opindex fkeep-inline-functions 4661169689SkanIn C, emit @code{static} functions that are declared @code{inline} 4662169689Skaninto the object file, even if the function has been inlined into all 4663169689Skanof its callers. This switch does not affect functions using the 4664169689Skan@code{extern inline} extension in GNU C@. In C++, emit any and all 4665169689Skaninline functions into the object file. 466690075Sobrien 466790075Sobrien@item -fkeep-static-consts 466890075Sobrien@opindex fkeep-static-consts 466990075SobrienEmit variables declared @code{static const} when optimization isn't turned 467090075Sobrienon, even if the variables aren't referenced. 467190075Sobrien 467290075SobrienGCC enables this option by default. If you want to force the compiler to 467390075Sobriencheck if the variable was referenced, regardless of whether or not 467490075Sobrienoptimization is turned on, use the @option{-fno-keep-static-consts} option. 467590075Sobrien 467690075Sobrien@item -fmerge-constants 467790075SobrienAttempt to merge identical constants (string constants and floating point 4678117395Skanconstants) across compilation units. 467990075Sobrien 4680117395SkanThis option is the default for optimized compilation if the assembler and 4681117395Skanlinker support it. Use @option{-fno-merge-constants} to inhibit this 4682117395Skanbehavior. 468390075Sobrien 4684117395SkanEnabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4685117395Skan 468690075Sobrien@item -fmerge-all-constants 468790075SobrienAttempt to merge identical constants and identical variables. 468890075Sobrien 468990075SobrienThis option implies @option{-fmerge-constants}. In addition to 4690169689Skan@option{-fmerge-constants} this considers e.g.@: even constant initialized 469190075Sobrienarrays or initialized constant variables with integral or floating point 469290075Sobrientypes. Languages like C or C++ require each non-automatic variable to 469390075Sobrienhave distinct location, so using this option will result in non-conforming 469490075Sobrienbehavior. 469590075Sobrien 4696169689Skan@item -fmodulo-sched 4697169689Skan@opindex fmodulo-sched 4698169689SkanPerform swing modulo scheduling immediately before the first scheduling 4699169689Skanpass. This pass looks at innermost loops and reorders their 4700169689Skaninstructions by overlapping different iterations. 4701132718Skan 4702107590Sobrien@item -fno-branch-count-reg 4703107590Sobrien@opindex fno-branch-count-reg 4704107590SobrienDo not use ``decrement and branch'' instructions on a count register, 4705107590Sobrienbut instead generate a sequence of instructions that decrement a 4706107590Sobrienregister, compare it against zero, then branch based upon the result. 4707107590SobrienThis option is only meaningful on architectures that support such 4708107590Sobrieninstructions, which include x86, PowerPC, IA-64 and S/390. 4709107590Sobrien 4710169689SkanThe default is @option{-fbranch-count-reg}. 4711117395Skan 471290075Sobrien@item -fno-function-cse 471390075Sobrien@opindex fno-function-cse 471490075SobrienDo not put function addresses in registers; make each instruction that 471590075Sobriencalls a constant function contain the function's address explicitly. 471690075Sobrien 471790075SobrienThis option results in less efficient code, but some strange hacks 471890075Sobrienthat alter the assembler output may be confused by the optimizations 471990075Sobrienperformed when this option is not used. 472090075Sobrien 4721117395SkanThe default is @option{-ffunction-cse} 472290075Sobrien 4723117395Skan@item -fno-zero-initialized-in-bss 4724117395Skan@opindex fno-zero-initialized-in-bss 4725117395SkanIf the target supports a BSS section, GCC by default puts variables that 4726117395Skanare initialized to zero into BSS@. This can save space in the resulting 4727117395Skancode. 472890075Sobrien 4729117395SkanThis option turns off this behavior because some programs explicitly 4730117395Skanrely on variables going to the data section. E.g., so that the 4731117395Skanresulting executable can find the beginning of that section and/or make 4732117395Skanassumptions based on that. 473390075Sobrien 4734117395SkanThe default is @option{-fzero-initialized-in-bss}. 473590075Sobrien 4736169689Skan@item -fbounds-check 4737169689Skan@opindex fbounds-check 4738169689SkanFor front-ends that support it, generate additional code to check that 4739169689Skanindices used to access arrays are within the declared range. This is 4740169689Skancurrently only supported by the Java and Fortran front-ends, where 4741169689Skanthis option defaults to true and false respectively. 474290075Sobrien 4743169689Skan@item -fmudflap -fmudflapth -fmudflapir 4744169689Skan@opindex fmudflap 4745169689Skan@opindex fmudflapth 4746169689Skan@opindex fmudflapir 4747169689Skan@cindex bounds checking 4748169689Skan@cindex mudflap 4749169689SkanFor front-ends that support it (C and C++), instrument all risky 4750169689Skanpointer/array dereferencing operations, some standard library 4751169689Skanstring/heap functions, and some other associated constructs with 4752169689Skanrange/validity tests. Modules so instrumented should be immune to 4753169689Skanbuffer overflows, invalid heap use, and some other classes of C/C++ 4754169689Skanprogramming errors. The instrumentation relies on a separate runtime 4755169689Skanlibrary (@file{libmudflap}), which will be linked into a program if 4756169689Skan@option{-fmudflap} is given at link time. Run-time behavior of the 4757169689Skaninstrumented program is controlled by the @env{MUDFLAP_OPTIONS} 4758169689Skanenvironment variable. See @code{env MUDFLAP_OPTIONS=-help a.out} 4759169689Skanfor its options. 4760117395Skan 4761169689SkanUse @option{-fmudflapth} instead of @option{-fmudflap} to compile and to 4762169689Skanlink if your program is multi-threaded. Use @option{-fmudflapir}, in 4763169689Skanaddition to @option{-fmudflap} or @option{-fmudflapth}, if 4764169689Skaninstrumentation should ignore pointer reads. This produces less 4765169689Skaninstrumentation (and therefore faster execution) and still provides 4766169689Skansome protection against outright memory corrupting writes, but allows 4767169689Skanerroneously read data to propagate within a program. 4768169689Skan 476990075Sobrien@item -fthread-jumps 477090075Sobrien@opindex fthread-jumps 477190075SobrienPerform optimizations where we check to see if a jump branches to a 477290075Sobrienlocation where another comparison subsumed by the first is found. If 477390075Sobrienso, the first branch is redirected to either the destination of the 477490075Sobriensecond branch or a point immediately following it, depending on whether 477590075Sobrienthe condition is known to be true or false. 477690075Sobrien 4777169689SkanEnabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4778117395Skan 477990075Sobrien@item -fcse-follow-jumps 478090075Sobrien@opindex fcse-follow-jumps 478190075SobrienIn common subexpression elimination, scan through jump instructions 478290075Sobrienwhen the target of the jump is not reached by any other path. For 478390075Sobrienexample, when CSE encounters an @code{if} statement with an 478490075Sobrien@code{else} clause, CSE will follow the jump when the condition 478590075Sobrientested is false. 478690075Sobrien 4787117395SkanEnabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4788117395Skan 478990075Sobrien@item -fcse-skip-blocks 479090075Sobrien@opindex fcse-skip-blocks 479190075SobrienThis is similar to @option{-fcse-follow-jumps}, but causes CSE to 479290075Sobrienfollow jumps which conditionally skip over blocks. When CSE 479390075Sobrienencounters a simple @code{if} statement with no else clause, 479490075Sobrien@option{-fcse-skip-blocks} causes CSE to follow the jump around the 479590075Sobrienbody of the @code{if}. 479690075Sobrien 4797117395SkanEnabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4798117395Skan 479990075Sobrien@item -frerun-cse-after-loop 480090075Sobrien@opindex frerun-cse-after-loop 480190075SobrienRe-run common subexpression elimination after loop optimizations has been 480290075Sobrienperformed. 480390075Sobrien 4804117395SkanEnabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4805117395Skan 480690075Sobrien@item -fgcse 480790075Sobrien@opindex fgcse 480890075SobrienPerform a global common subexpression elimination pass. 480990075SobrienThis pass also performs global constant and copy propagation. 481090075Sobrien 481190075Sobrien@emph{Note:} When compiling a program using computed gotos, a GCC 481290075Sobrienextension, you may get better runtime performance if you disable 4813117395Skanthe global common subexpression elimination pass by adding 481490075Sobrien@option{-fno-gcse} to the command line. 481590075Sobrien 4816117395SkanEnabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4817117395Skan 481890075Sobrien@item -fgcse-lm 481990075Sobrien@opindex fgcse-lm 482090075SobrienWhen @option{-fgcse-lm} is enabled, global common subexpression elimination will 482190075Sobrienattempt to move loads which are only killed by stores into themselves. This 482290075Sobrienallows a loop containing a load/store sequence to be changed to a load outside 482390075Sobrienthe loop, and a copy/store within the loop. 482490075Sobrien 4825117395SkanEnabled by default when gcse is enabled. 4826117395Skan 482790075Sobrien@item -fgcse-sm 482890075Sobrien@opindex fgcse-sm 4829132718SkanWhen @option{-fgcse-sm} is enabled, a store motion pass is run after 4830132718Skanglobal common subexpression elimination. This pass will attempt to move 4831132718Skanstores out of loops. When used in conjunction with @option{-fgcse-lm}, 4832132718Skanloops containing a load/store sequence can be changed to a load before 4833132718Skanthe loop and a store after the loop. 483490075Sobrien 4835169689SkanNot enabled at any optimization level. 4836117395Skan 4837132718Skan@item -fgcse-las 4838132718Skan@opindex fgcse-las 4839132718SkanWhen @option{-fgcse-las} is enabled, the global common subexpression 4840132718Skanelimination pass eliminates redundant loads that come after stores to the 4841132718Skansame memory location (both partial and full redundancies). 4842132718Skan 4843169689SkanNot enabled at any optimization level. 4844132718Skan 4845169689Skan@item -fgcse-after-reload 4846169689Skan@opindex fgcse-after-reload 4847169689SkanWhen @option{-fgcse-after-reload} is enabled, a redundant load elimination 4848169689Skanpass is performed after reload. The purpose of this pass is to cleanup 4849169689Skanredundant spilling. 4850117395Skan 4851169689Skan@item -funsafe-loop-optimizations 4852169689Skan@opindex funsafe-loop-optimizations 4853169689SkanIf given, the loop optimizer will assume that loop indices do not 4854169689Skanoverflow, and that the loops with nontrivial exit condition are not 4855169689Skaninfinite. This enables a wider range of loop optimizations even if 4856169689Skanthe loop optimizer itself cannot prove that these assumptions are valid. 4857169689SkanUsing @option{-Wunsafe-loop-optimizations}, the compiler will warn you 4858169689Skanif it finds this kind of loop. 4859117395Skan 4860117395Skan@item -fcrossjumping 4861117395Skan@opindex crossjumping 4862169689SkanPerform cross-jumping transformation. This transformation unifies equivalent code and save code size. The 4863117395Skanresulting code may or may not perform better than without cross-jumping. 4864117395Skan 4865169689SkanEnabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4866117395Skan 4867117395Skan@item -fif-conversion 4868117395Skan@opindex if-conversion 4869117395SkanAttempt to transform conditional jumps into branch-less equivalents. This 4870117395Skaninclude use of conditional moves, min, max, set flags and abs instructions, and 4871117395Skansome tricks doable by standard arithmetics. The use of conditional execution 4872117395Skanon chips where it is available is controlled by @code{if-conversion2}. 4873117395Skan 4874117395SkanEnabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4875117395Skan 4876117395Skan@item -fif-conversion2 4877117395Skan@opindex if-conversion2 4878117395SkanUse conditional execution (where available) to transform conditional jumps into 4879117395Skanbranch-less equivalents. 4880117395Skan 4881117395SkanEnabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4882117395Skan 488390075Sobrien@item -fdelete-null-pointer-checks 488490075Sobrien@opindex fdelete-null-pointer-checks 488590075SobrienUse global dataflow analysis to identify and eliminate useless checks 488690075Sobrienfor null pointers. The compiler assumes that dereferencing a null 488790075Sobrienpointer would have halted the program. If a pointer is checked after 488890075Sobrienit has already been dereferenced, it cannot be null. 488990075Sobrien 489090075SobrienIn some environments, this assumption is not true, and programs can 489190075Sobriensafely dereference null pointers. Use 489290075Sobrien@option{-fno-delete-null-pointer-checks} to disable this optimization 489390075Sobrienfor programs which depend on that behavior. 489490075Sobrien 4895117395SkanEnabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4896117395Skan 489790075Sobrien@item -fexpensive-optimizations 489890075Sobrien@opindex fexpensive-optimizations 489990075SobrienPerform a number of minor optimizations that are relatively expensive. 490090075Sobrien 4901117395SkanEnabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4902117395Skan 490390075Sobrien@item -foptimize-register-move 490490075Sobrien@itemx -fregmove 490590075Sobrien@opindex foptimize-register-move 490690075Sobrien@opindex fregmove 490790075SobrienAttempt to reassign register numbers in move instructions and as 490890075Sobrienoperands of other simple instructions in order to maximize the amount of 490990075Sobrienregister tying. This is especially helpful on machines with two-operand 4910117395Skaninstructions. 491190075Sobrien 491290075SobrienNote @option{-fregmove} and @option{-foptimize-register-move} are the same 491390075Sobrienoptimization. 491490075Sobrien 4915117395SkanEnabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4916117395Skan 491790075Sobrien@item -fdelayed-branch 491890075Sobrien@opindex fdelayed-branch 491990075SobrienIf supported for the target machine, attempt to reorder instructions 492090075Sobriento exploit instruction slots available after delayed branch 492190075Sobrieninstructions. 492290075Sobrien 4923117395SkanEnabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4924117395Skan 492590075Sobrien@item -fschedule-insns 492690075Sobrien@opindex fschedule-insns 492790075SobrienIf supported for the target machine, attempt to reorder instructions to 492890075Sobrieneliminate execution stalls due to required data being unavailable. This 492990075Sobrienhelps machines that have slow floating point or memory load instructions 493090075Sobrienby allowing other instructions to be issued until the result of the load 493190075Sobrienor floating point instruction is required. 493290075Sobrien 4933117395SkanEnabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4934117395Skan 493590075Sobrien@item -fschedule-insns2 493690075Sobrien@opindex fschedule-insns2 493790075SobrienSimilar to @option{-fschedule-insns}, but requests an additional pass of 493890075Sobrieninstruction scheduling after register allocation has been done. This is 493990075Sobrienespecially useful on machines with a relatively small number of 494090075Sobrienregisters and where memory load instructions take more than one cycle. 494190075Sobrien 4942117395SkanEnabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4943117395Skan 4944107590Sobrien@item -fno-sched-interblock 4945107590Sobrien@opindex fno-sched-interblock 4946107590SobrienDon't schedule instructions across basic blocks. This is normally 4947107590Sobrienenabled by default when scheduling before register allocation, i.e.@: 4948107590Sobrienwith @option{-fschedule-insns} or at @option{-O2} or higher. 4949107590Sobrien 4950107590Sobrien@item -fno-sched-spec 4951107590Sobrien@opindex fno-sched-spec 4952107590SobrienDon't allow speculative motion of non-load instructions. This is normally 4953107590Sobrienenabled by default when scheduling before register allocation, i.e.@: 4954107590Sobrienwith @option{-fschedule-insns} or at @option{-O2} or higher. 4955107590Sobrien 4956107590Sobrien@item -fsched-spec-load 4957107590Sobrien@opindex fsched-spec-load 4958107590SobrienAllow speculative motion of some load instructions. This only makes 4959107590Sobriensense when scheduling before register allocation, i.e.@: with 4960107590Sobrien@option{-fschedule-insns} or at @option{-O2} or higher. 4961107590Sobrien 4962107590Sobrien@item -fsched-spec-load-dangerous 4963107590Sobrien@opindex fsched-spec-load-dangerous 4964107590SobrienAllow speculative motion of more load instructions. This only makes 4965107590Sobriensense when scheduling before register allocation, i.e.@: with 4966107590Sobrien@option{-fschedule-insns} or at @option{-O2} or higher. 4967107590Sobrien 4968132718Skan@item -fsched-stalled-insns=@var{n} 4969132718Skan@opindex fsched-stalled-insns 4970132718SkanDefine how many insns (if any) can be moved prematurely from the queue 4971132718Skanof stalled insns into the ready list, during the second scheduling pass. 4972132718Skan 4973132718Skan@item -fsched-stalled-insns-dep=@var{n} 4974132718Skan@opindex fsched-stalled-insns-dep 4975132718SkanDefine how many insn groups (cycles) will be examined for a dependency 4976132718Skanon a stalled insn that is candidate for premature removal from the queue 4977132718Skanof stalled insns. Has an effect only during the second scheduling pass, 4978132718Skanand only if @option{-fsched-stalled-insns} is used and its value is not zero. 4979132718Skan 4980132718Skan@item -fsched2-use-superblocks 4981132718Skan@opindex fsched2-use-superblocks 4982132718SkanWhen scheduling after register allocation, do use superblock scheduling 4983132718Skanalgorithm. Superblock scheduling allows motion across basic block boundaries 4984132718Skanresulting on faster schedules. This option is experimental, as not all machine 4985132718Skandescriptions used by GCC model the CPU closely enough to avoid unreliable 4986132718Skanresults from the algorithm. 4987132718Skan 4988132718SkanThis only makes sense when scheduling after register allocation, i.e.@: with 4989132718Skan@option{-fschedule-insns2} or at @option{-O2} or higher. 4990132718Skan 4991132718Skan@item -fsched2-use-traces 4992132718Skan@opindex fsched2-use-traces 4993132718SkanUse @option{-fsched2-use-superblocks} algorithm when scheduling after register 4994132718Skanallocation and additionally perform code duplication in order to increase the 4995132718Skansize of superblocks using tracer pass. See @option{-ftracer} for details on 4996132718Skantrace formation. 4997132718Skan 4998132718SkanThis mode should produce faster but significantly longer programs. Also 4999169689Skanwithout @option{-fbranch-probabilities} the traces constructed may not 5000169689Skanmatch the reality and hurt the performance. This only makes 5001132718Skansense when scheduling after register allocation, i.e.@: with 5002132718Skan@option{-fschedule-insns2} or at @option{-O2} or higher. 5003132718Skan 5004169689Skan@item -fsee 5005169689Skan@opindex fsee 5006169689SkanEliminates redundant extension instructions and move the non redundant 5007169689Skanones to optimal placement using LCM. 5008169689Skan 5009169689Skan@item -freschedule-modulo-scheduled-loops 5010169689Skan@opindex fscheduling-in-modulo-scheduled-loops 5011169689SkanThe modulo scheduling comes before the traditional scheduling, if a loop was modulo scheduled 5012169689Skanwe may want to prevent the later scheduling passes from changing its schedule, we use this 5013169689Skanoption to control that. 5014169689Skan 501590075Sobrien@item -fcaller-saves 501690075Sobrien@opindex fcaller-saves 501790075SobrienEnable values to be allocated in registers that will be clobbered by 501890075Sobrienfunction calls, by emitting extra instructions to save and restore the 501990075Sobrienregisters around such calls. Such allocation is done only when it 502090075Sobrienseems to result in better code than would otherwise be produced. 502190075Sobrien 502290075SobrienThis option is always enabled by default on certain machines, usually 502390075Sobrienthose which have no call-preserved registers to use instead. 502490075Sobrien 5025117395SkanEnabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 502690075Sobrien 5027169689Skan@item -ftree-pre 5028169689SkanPerform Partial Redundancy Elimination (PRE) on trees. This flag is 5029169689Skanenabled by default at @option{-O2} and @option{-O3}. 503090075Sobrien 5031169689Skan@item -ftree-fre 5032169689SkanPerform Full Redundancy Elimination (FRE) on trees. The difference 5033169689Skanbetween FRE and PRE is that FRE only considers expressions 5034169689Skanthat are computed on all paths leading to the redundant computation. 5035169689SkanThis analysis faster than PRE, though it exposes fewer redundancies. 5036169689SkanThis flag is enabled by default at @option{-O} and higher. 503790075Sobrien 5038169689Skan@item -ftree-copy-prop 5039169689SkanPerform copy propagation on trees. This pass eliminates unnecessary 5040169689Skancopy operations. This flag is enabled by default at @option{-O} and 5041169689Skanhigher. 504290075Sobrien 5043169689Skan@item -ftree-store-copy-prop 5044169689SkanPerform copy propagation of memory loads and stores. This pass 5045169689Skaneliminates unnecessary copy operations in memory references 5046169689Skan(structures, global variables, arrays, etc). This flag is enabled by 5047169689Skandefault at @option{-O2} and higher. 5048169689Skan 5049169689Skan@item -ftree-salias 5050169689SkanPerform structural alias analysis on trees. This flag 5051169689Skanis enabled by default at @option{-O} and higher. 5052169689Skan 5053169689Skan@item -fipa-pta 5054169689SkanPerform interprocedural pointer analysis. 5055169689Skan 5056169689Skan@item -ftree-sink 5057169689SkanPerform forward store motion on trees. This flag is 5058169689Skanenabled by default at @option{-O} and higher. 5059169689Skan 5060169689Skan@item -ftree-ccp 5061169689SkanPerform sparse conditional constant propagation (CCP) on trees. This 5062169689Skanpass only operates on local scalar variables and is enabled by default 5063169689Skanat @option{-O} and higher. 5064169689Skan 5065169689Skan@item -ftree-store-ccp 5066169689SkanPerform sparse conditional constant propagation (CCP) on trees. This 5067169689Skanpass operates on both local scalar variables and memory stores and 5068169689Skanloads (global variables, structures, arrays, etc). This flag is 5069169689Skanenabled by default at @option{-O2} and higher. 5070169689Skan 5071169689Skan@item -ftree-dce 5072169689SkanPerform dead code elimination (DCE) on trees. This flag is enabled by 5073169689Skandefault at @option{-O} and higher. 5074169689Skan 5075169689Skan@item -ftree-dominator-opts 5076169689SkanPerform a variety of simple scalar cleanups (constant/copy 5077169689Skanpropagation, redundancy elimination, range propagation and expression 5078169689Skansimplification) based on a dominator tree traversal. This also 5079169689Skanperforms jump threading (to reduce jumps to jumps). This flag is 5080169689Skanenabled by default at @option{-O} and higher. 5081169689Skan 5082169689Skan@item -ftree-ch 5083169689SkanPerform loop header copying on trees. This is beneficial since it increases 5084169689Skaneffectiveness of code motion optimizations. It also saves one jump. This flag 5085169689Skanis enabled by default at @option{-O} and higher. It is not enabled 5086169689Skanfor @option{-Os}, since it usually increases code size. 5087169689Skan 5088169689Skan@item -ftree-loop-optimize 5089169689SkanPerform loop optimizations on trees. This flag is enabled by default 5090169689Skanat @option{-O} and higher. 5091169689Skan 5092169689Skan@item -ftree-loop-linear 5093169689SkanPerform linear loop transformations on tree. This flag can improve cache 5094169689Skanperformance and allow further loop optimizations to take place. 5095169689Skan 5096169689Skan@item -ftree-loop-im 5097169689SkanPerform loop invariant motion on trees. This pass moves only invariants that 5098169689Skanwould be hard to handle at RTL level (function calls, operations that expand to 5099169689Skannontrivial sequences of insns). With @option{-funswitch-loops} it also moves 5100169689Skanoperands of conditions that are invariant out of the loop, so that we can use 5101169689Skanjust trivial invariantness analysis in loop unswitching. The pass also includes 5102169689Skanstore motion. 5103169689Skan 5104169689Skan@item -ftree-loop-ivcanon 5105169689SkanCreate a canonical counter for number of iterations in the loop for that 5106169689Skandetermining number of iterations requires complicated analysis. Later 5107169689Skanoptimizations then may determine the number easily. Useful especially 5108169689Skanin connection with unrolling. 5109169689Skan 5110169689Skan@item -fivopts 5111169689SkanPerform induction variable optimizations (strength reduction, induction 5112169689Skanvariable merging and induction variable elimination) on trees. 5113169689Skan 5114169689Skan@item -ftree-sra 5115169689SkanPerform scalar replacement of aggregates. This pass replaces structure 5116169689Skanreferences with scalars to prevent committing structures to memory too 5117169689Skanearly. This flag is enabled by default at @option{-O} and higher. 5118169689Skan 5119169689Skan@item -ftree-copyrename 5120169689SkanPerform copy renaming on trees. This pass attempts to rename compiler 5121169689Skantemporaries to other variables at copy locations, usually resulting in 5122169689Skanvariable names which more closely resemble the original variables. This flag 5123169689Skanis enabled by default at @option{-O} and higher. 5124169689Skan 5125169689Skan@item -ftree-ter 5126169689SkanPerform temporary expression replacement during the SSA->normal phase. Single 5127169689Skanuse/single def temporaries are replaced at their use location with their 5128169689Skandefining expression. This results in non-GIMPLE code, but gives the expanders 5129169689Skanmuch more complex trees to work on resulting in better RTL generation. This is 5130169689Skanenabled by default at @option{-O} and higher. 5131169689Skan 5132169689Skan@item -ftree-lrs 5133169689SkanPerform live range splitting during the SSA->normal phase. Distinct live 5134169689Skanranges of a variable are split into unique variables, allowing for better 5135169689Skanoptimization later. This is enabled by default at @option{-O} and higher. 5136169689Skan 5137169689Skan@item -ftree-vectorize 5138169689SkanPerform loop vectorization on trees. 5139169689Skan 5140169689Skan@item -ftree-vect-loop-version 5141169689Skan@opindex ftree-vect-loop-version 5142169689SkanPerform loop versioning when doing loop vectorization on trees. When a loop 5143169689Skanappears to be vectorizable except that data alignment or data dependence cannot 5144169689Skanbe determined at compile time then vectorized and non-vectorized versions of 5145169689Skanthe loop are generated along with runtime checks for alignment or dependence 5146169689Skanto control which version is executed. This option is enabled by default 5147169689Skanexcept at level @option{-Os} where it is disabled. 5148169689Skan 5149169689Skan@item -ftree-vrp 5150169689SkanPerform Value Range Propagation on trees. This is similar to the 5151169689Skanconstant propagation pass, but instead of values, ranges of values are 5152169689Skanpropagated. This allows the optimizers to remove unnecessary range 5153169689Skanchecks like array bound checks and null pointer checks. This is 5154169689Skanenabled by default at @option{-O2} and higher. Null pointer check 5155169689Skanelimination is only done if @option{-fdelete-null-pointer-checks} is 5156169689Skanenabled. 5157169689Skan 5158169689Skan@item -ftracer 5159169689Skan@opindex ftracer 5160169689SkanPerform tail duplication to enlarge superblock size. This transformation 5161169689Skansimplifies the control flow of the function allowing other optimizations to do 5162169689Skanbetter job. 5163169689Skan 5164169689Skan@item -funroll-loops 5165169689Skan@opindex funroll-loops 5166169689SkanUnroll loops whose number of iterations can be determined at compile 5167169689Skantime or upon entry to the loop. @option{-funroll-loops} implies 5168169689Skan@option{-frerun-cse-after-loop}. This option makes code larger, 5169169689Skanand may or may not make it run faster. 5170169689Skan 5171169689Skan@item -funroll-all-loops 5172169689Skan@opindex funroll-all-loops 5173169689SkanUnroll all loops, even if their number of iterations is uncertain when 5174169689Skanthe loop is entered. This usually makes programs run more slowly. 5175169689Skan@option{-funroll-all-loops} implies the same options as 5176169689Skan@option{-funroll-loops}, 5177169689Skan 5178169689Skan@item -fsplit-ivs-in-unroller 5179169689Skan@opindex fsplit-ivs-in-unroller 5180169689SkanEnables expressing of values of induction variables in later iterations 5181169689Skanof the unrolled loop using the value in the first iteration. This breaks 5182169689Skanlong dependency chains, thus improving efficiency of the scheduling passes. 5183169689Skan 5184169689SkanCombination of @option{-fweb} and CSE is often sufficient to obtain the 5185169689Skansame effect. However in cases the loop body is more complicated than 5186169689Skana single basic block, this is not reliable. It also does not work at all 5187169689Skanon some of the architectures due to restrictions in the CSE pass. 5188169689Skan 5189169689SkanThis optimization is enabled by default. 5190169689Skan 5191169689Skan@item -fvariable-expansion-in-unroller 5192169689Skan@opindex fvariable-expansion-in-unroller 5193169689SkanWith this option, the compiler will create multiple copies of some 5194169689Skanlocal variables when unrolling a loop which can result in superior code. 5195169689Skan 5196169689Skan@item -fprefetch-loop-arrays 5197169689Skan@opindex fprefetch-loop-arrays 5198169689SkanIf supported by the target machine, generate instructions to prefetch 5199169689Skanmemory to improve the performance of loops that access large arrays. 5200169689Skan 5201169689SkanThis option may generate better or worse code; results are highly 520290075Sobriendependent on the structure of loops within the source code. 520390075Sobrien 5204169689SkanDisabled at level @option{-Os}. 520590075Sobrien 520690075Sobrien@item -fno-peephole 520790075Sobrien@itemx -fno-peephole2 520890075Sobrien@opindex fno-peephole 520990075Sobrien@opindex fno-peephole2 521090075SobrienDisable any machine-specific peephole optimizations. The difference 521190075Sobrienbetween @option{-fno-peephole} and @option{-fno-peephole2} is in how they 521290075Sobrienare implemented in the compiler; some targets use one, some use the 521390075Sobrienother, a few use both. 521490075Sobrien 5215117395Skan@option{-fpeephole} is enabled by default. 5216117395Skan@option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 5217117395Skan 521890075Sobrien@item -fno-guess-branch-probability 521990075Sobrien@opindex fno-guess-branch-probability 5220169689SkanDo not guess branch probabilities using heuristics. 522190075Sobrien 5222169689SkanGCC will use heuristics to guess branch probabilities if they are 5223169689Skannot provided by profiling feedback (@option{-fprofile-arcs}). These 5224169689Skanheuristics are based on the control flow graph. If some branch probabilities 5225169689Skanare specified by @samp{__builtin_expect}, then the heuristics will be 5226169689Skanused to guess branch probabilities for the rest of the control flow graph, 5227169689Skantaking the @samp{__builtin_expect} info into account. The interactions 5228169689Skanbetween the heuristics and @samp{__builtin_expect} can be complex, and in 5229169689Skansome cases, it may be useful to disable the heuristics so that the effects 5230169689Skanof @samp{__builtin_expect} are easier to understand. 523190075Sobrien 5232117395SkanThe default is @option{-fguess-branch-probability} at levels 5233117395Skan@option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 5234117395Skan 5235117395Skan@item -freorder-blocks 5236117395Skan@opindex freorder-blocks 5237117395SkanReorder basic blocks in the compiled function in order to reduce number of 5238117395Skantaken branches and improve code locality. 5239117395Skan 5240117395SkanEnabled at levels @option{-O2}, @option{-O3}. 5241117395Skan 5242169689Skan@item -freorder-blocks-and-partition 5243169689Skan@opindex freorder-blocks-and-partition 5244169689SkanIn addition to reordering basic blocks in the compiled function, in order 5245169689Skanto reduce number of taken branches, partitions hot and cold basic blocks 5246169689Skaninto separate sections of the assembly and .o files, to improve 5247169689Skanpaging and cache locality performance. 5248169689Skan 5249169689SkanThis optimization is automatically turned off in the presence of 5250169689Skanexception handling, for linkonce sections, for functions with a user-defined 5251169689Skansection attribute and on any architecture that does not support named 5252169689Skansections. 5253169689Skan 5254117395Skan@item -freorder-functions 5255117395Skan@opindex freorder-functions 5256169689SkanReorder functions in the object file in order to 5257169689Skanimprove code locality. This is implemented by using special 5258146895Skansubsections @code{.text.hot} for most frequently executed functions and 5259146895Skan@code{.text.unlikely} for unlikely executed functions. Reordering is done by 5260117395Skanthe linker so object file format must support named sections and linker must 5261117395Skanplace them in a reasonable way. 5262117395Skan 5263117395SkanAlso profile feedback must be available in to make this option effective. See 5264117395Skan@option{-fprofile-arcs} for details. 5265117395Skan 5266117395SkanEnabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 5267117395Skan 526890075Sobrien@item -fstrict-aliasing 526990075Sobrien@opindex fstrict-aliasing 527090075SobrienAllows the compiler to assume the strictest aliasing rules applicable to 527190075Sobrienthe language being compiled. For C (and C++), this activates 527290075Sobrienoptimizations based on the type of expressions. In particular, an 527390075Sobrienobject of one type is assumed never to reside at the same address as an 527490075Sobrienobject of a different type, unless the types are almost the same. For 527590075Sobrienexample, an @code{unsigned int} can alias an @code{int}, but not a 527690075Sobrien@code{void*} or a @code{double}. A character type may alias any other 527790075Sobrientype. 527890075Sobrien 527990075SobrienPay special attention to code like this: 5280132718Skan@smallexample 528190075Sobrienunion a_union @{ 528290075Sobrien int i; 528390075Sobrien double d; 528490075Sobrien@}; 528590075Sobrien 528690075Sobrienint f() @{ 528790075Sobrien a_union t; 528890075Sobrien t.d = 3.0; 528990075Sobrien return t.i; 529090075Sobrien@} 5291132718Skan@end smallexample 529290075SobrienThe practice of reading from a different union member than the one most 529390075Sobrienrecently written to (called ``type-punning'') is common. Even with 529490075Sobrien@option{-fstrict-aliasing}, type-punning is allowed, provided the memory 529590075Sobrienis accessed through the union type. So, the code above will work as 529690075Sobrienexpected. However, this code might not: 5297132718Skan@smallexample 529890075Sobrienint f() @{ 529990075Sobrien a_union t; 530090075Sobrien int* ip; 530190075Sobrien t.d = 3.0; 530290075Sobrien ip = &t.i; 530390075Sobrien return *ip; 530490075Sobrien@} 5305132718Skan@end smallexample 530690075Sobrien 530790075SobrienEvery language that wishes to perform language-specific alias analysis 530890075Sobrienshould define a function that computes, given an @code{tree} 530990075Sobriennode, an alias set for the node. Nodes in different alias sets are not 531090075Sobrienallowed to alias. For an example, see the C front-end function 531190075Sobrien@code{c_get_alias_set}. 531290075Sobrien 5313117395SkanEnabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 5314117395Skan 5315169689Skan@item -fstrict-overflow 5316169689Skan@opindex fstrict-overflow 5317169689SkanAllow the compiler to assume strict signed overflow rules, depending 5318169689Skanon the language being compiled. For C (and C++) this means that 5319169689Skanoverflow when doing arithmetic with signed numbers is undefined, which 5320169689Skanmeans that the compiler may assume that it will not happen. This 5321169689Skanpermits various optimizations. For example, the compiler will assume 5322169689Skanthat an expression like @code{i + 10 > i} will always be true for 5323169689Skansigned @code{i}. This assumption is only valid if signed overflow is 5324169689Skanundefined, as the expression is false if @code{i + 10} overflows when 5325169689Skanusing twos complement arithmetic. When this option is in effect any 5326169689Skanattempt to determine whether an operation on signed numbers will 5327169689Skanoverflow must be written carefully to not actually involve overflow. 5328169689Skan 5329169689SkanSee also the @option{-fwrapv} option. Using @option{-fwrapv} means 5330169689Skanthat signed overflow is fully defined: it wraps. When 5331169689Skan@option{-fwrapv} is used, there is no difference between 5332169689Skan@option{-fstrict-overflow} and @option{-fno-strict-overflow}. With 5333169689Skan@option{-fwrapv} certain types of overflow are permitted. For 5334169689Skanexample, if the compiler gets an overflow when doing arithmetic on 5335169689Skanconstants, the overflowed value can still be used with 5336169689Skan@option{-fwrapv}, but not otherwise. 5337169689Skan 5338169689SkanThe @option{-fstrict-overflow} option is enabled at levels 5339169689Skan@option{-O2}, @option{-O3}, @option{-Os}. 5340169689Skan 534190075Sobrien@item -falign-functions 534290075Sobrien@itemx -falign-functions=@var{n} 534390075Sobrien@opindex falign-functions 534490075SobrienAlign the start of functions to the next power-of-two greater than 534590075Sobrien@var{n}, skipping up to @var{n} bytes. For instance, 534690075Sobrien@option{-falign-functions=32} aligns functions to the next 32-byte 534790075Sobrienboundary, but @option{-falign-functions=24} would align to the next 534890075Sobrien32-byte boundary only if this can be done by skipping 23 bytes or less. 534990075Sobrien 535090075Sobrien@option{-fno-align-functions} and @option{-falign-functions=1} are 535190075Sobrienequivalent and mean that functions will not be aligned. 535290075Sobrien 535390075SobrienSome assemblers only support this flag when @var{n} is a power of two; 535490075Sobrienin that case, it is rounded up. 535590075Sobrien 5356117395SkanIf @var{n} is not specified or is zero, use a machine-dependent default. 535790075Sobrien 5358117395SkanEnabled at levels @option{-O2}, @option{-O3}. 5359117395Skan 536090075Sobrien@item -falign-labels 536190075Sobrien@itemx -falign-labels=@var{n} 536290075Sobrien@opindex falign-labels 536390075SobrienAlign all branch targets to a power-of-two boundary, skipping up to 536490075Sobrien@var{n} bytes like @option{-falign-functions}. This option can easily 536590075Sobrienmake code slower, because it must insert dummy operations for when the 536690075Sobrienbranch target is reached in the usual flow of the code. 536790075Sobrien 5368117395Skan@option{-fno-align-labels} and @option{-falign-labels=1} are 5369117395Skanequivalent and mean that labels will not be aligned. 5370117395Skan 537190075SobrienIf @option{-falign-loops} or @option{-falign-jumps} are applicable and 537290075Sobrienare greater than this value, then their values are used instead. 537390075Sobrien 5374117395SkanIf @var{n} is not specified or is zero, use a machine-dependent default 5375117395Skanwhich is very likely to be @samp{1}, meaning no alignment. 537690075Sobrien 5377117395SkanEnabled at levels @option{-O2}, @option{-O3}. 5378117395Skan 537990075Sobrien@item -falign-loops 538090075Sobrien@itemx -falign-loops=@var{n} 538190075Sobrien@opindex falign-loops 538290075SobrienAlign loops to a power-of-two boundary, skipping up to @var{n} bytes 538390075Sobrienlike @option{-falign-functions}. The hope is that the loop will be 538490075Sobrienexecuted many times, which will make up for any execution of the dummy 538590075Sobrienoperations. 538690075Sobrien 5387117395Skan@option{-fno-align-loops} and @option{-falign-loops=1} are 5388117395Skanequivalent and mean that loops will not be aligned. 538990075Sobrien 5390117395SkanIf @var{n} is not specified or is zero, use a machine-dependent default. 5391117395Skan 5392117395SkanEnabled at levels @option{-O2}, @option{-O3}. 5393117395Skan 539490075Sobrien@item -falign-jumps 539590075Sobrien@itemx -falign-jumps=@var{n} 539690075Sobrien@opindex falign-jumps 539790075SobrienAlign branch targets to a power-of-two boundary, for branch targets 539890075Sobrienwhere the targets can only be reached by jumping, skipping up to @var{n} 539990075Sobrienbytes like @option{-falign-functions}. In this case, no dummy operations 540090075Sobrienneed be executed. 540190075Sobrien 5402117395Skan@option{-fno-align-jumps} and @option{-falign-jumps=1} are 5403117395Skanequivalent and mean that loops will not be aligned. 540490075Sobrien 5405117395SkanIf @var{n} is not specified or is zero, use a machine-dependent default. 5406117395Skan 5407117395SkanEnabled at levels @option{-O2}, @option{-O3}. 5408117395Skan 5409169689Skan@item -funit-at-a-time 5410169689Skan@opindex funit-at-a-time 5411169689SkanParse the whole compilation unit before starting to produce code. 5412169689SkanThis allows some extra optimizations to take place but consumes 5413169689Skanmore memory (in general). There are some compatibility issues 5414169689Skanwith @emph{unit-at-a-time} mode: 5415169689Skan@itemize @bullet 5416169689Skan@item 5417169689Skanenabling @emph{unit-at-a-time} mode may change the order 5418169689Skanin which functions, variables, and top-level @code{asm} statements 5419169689Skanare emitted, and will likely break code relying on some particular 5420169689Skanordering. The majority of such top-level @code{asm} statements, 5421169689Skanthough, can be replaced by @code{section} attributes. The 5422169689Skan@option{fno-toplevel-reorder} option may be used to keep the ordering 5423169689Skanused in the input file, at the cost of some optimizations. 5424117395Skan 5425169689Skan@item 5426169689Skan@emph{unit-at-a-time} mode removes unreferenced static variables 5427169689Skanand functions. This may result in undefined references 5428169689Skanwhen an @code{asm} statement refers directly to variables or functions 5429169689Skanthat are otherwise unused. In that case either the variable/function 5430169689Skanshall be listed as an operand of the @code{asm} statement operand or, 5431169689Skanin the case of top-level @code{asm} statements the attribute @code{used} 5432169689Skanshall be used on the declaration. 5433169689Skan 5434169689Skan@item 5435169689SkanStatic functions now can use non-standard passing conventions that 5436169689Skanmay break @code{asm} statements calling functions directly. Again, 5437169689Skanattribute @code{used} will prevent this behavior. 5438169689Skan@end itemize 5439169689Skan 5440169689SkanAs a temporary workaround, @option{-fno-unit-at-a-time} can be used, 5441169689Skanbut this scheme may not be supported by future releases of GCC@. 5442169689Skan 5443169689SkanEnabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 5444169689Skan 5445169689Skan@item -fno-toplevel-reorder 5446169689SkanDo not reorder top-level functions, variables, and @code{asm} 5447169689Skanstatements. Output them in the same order that they appear in the 5448169689Skaninput file. When this option is used, unreferenced static variables 5449169689Skanwill not be removed. This option is intended to support existing code 5450169689Skanwhich relies on a particular ordering. For new code, it is better to 5451169689Skanuse attributes. 5452169689Skan 5453132718Skan@item -fweb 5454132718Skan@opindex fweb 5455132718SkanConstructs webs as commonly used for register allocation purposes and assign 5456132718Skaneach web individual pseudo register. This allows the register allocation pass 5457132718Skanto operate on pseudos directly, but also strengthens several other optimization 5458132718Skanpasses, such as CSE, loop optimizer and trivial dead code remover. It can, 5459132718Skanhowever, make debugging impossible, since variables will no longer stay in a 5460132718Skan``home register''. 5461132718Skan 5462169689SkanEnabled by default with @option{-funroll-loops}. 5463117395Skan 5464169689Skan@item -fwhole-program 5465169689Skan@opindex fwhole-program 5466169689SkanAssume that the current compilation unit represents whole program being 5467169689Skancompiled. All public functions and variables with the exception of @code{main} 5468169689Skanand those merged by attribute @code{externally_visible} become static functions 5469169689Skanand in a affect gets more aggressively optimized by interprocedural optimizers. 5470169689SkanWhile this option is equivalent to proper use of @code{static} keyword for 5471169689Skanprograms consisting of single file, in combination with option 5472169689Skan@option{--combine} this flag can be used to compile most of smaller scale C 5473169689Skanprograms since the functions and variables become local for the whole combined 5474169689Skancompilation unit, not for the single source file itself. 5475169689Skan 5476169689Skan 5477117395Skan@item -fno-cprop-registers 5478117395Skan@opindex fno-cprop-registers 5479117395SkanAfter register allocation and post-register allocation instruction splitting, 5480117395Skanwe perform a copy-propagation pass to try to reduce scheduling dependencies 5481117395Skanand occasionally eliminate the copy. 5482117395Skan 5483117395SkanDisabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 5484117395Skan 5485132718Skan@item -fprofile-generate 5486132718Skan@opindex fprofile-generate 5487132718Skan 5488132718SkanEnable options usually used for instrumenting application to produce 5489132718Skanprofile useful for later recompilation with profile feedback based 5490169689Skanoptimization. You must use @option{-fprofile-generate} both when 5491132718Skancompiling and when linking your program. 5492132718Skan 5493132718SkanThe following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}. 5494132718Skan 5495132718Skan@item -fprofile-use 5496132718Skan@opindex fprofile-use 5497132718SkanEnable profile feedback directed optimizations, and optimizations 5498132718Skangenerally profitable only with profile feedback available. 5499132718Skan 5500169689SkanThe following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt}, 5501169689Skan@code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer} 5502132718Skan 5503117395Skan@end table 5504117395Skan 5505117395SkanThe following options control compiler behavior regarding floating 5506117395Skanpoint arithmetic. These options trade off between speed and 5507117395Skancorrectness. All must be specifically enabled. 5508117395Skan 5509117395Skan@table @gcctabopt 5510117395Skan@item -ffloat-store 5511117395Skan@opindex ffloat-store 5512117395SkanDo not store floating point variables in registers, and inhibit other 5513117395Skanoptions that might change whether a floating point value is taken from a 5514117395Skanregister or memory. 5515117395Skan 5516117395Skan@cindex floating point precision 5517117395SkanThis option prevents undesirable excess precision on machines such as 5518117395Skanthe 68000 where the floating registers (of the 68881) keep more 5519117395Skanprecision than a @code{double} is supposed to have. Similarly for the 5520117395Skanx86 architecture. For most programs, the excess precision does only 5521117395Skangood, but a few programs rely on the precise definition of IEEE floating 5522117395Skanpoint. Use @option{-ffloat-store} for such programs, after modifying 5523117395Skanthem to store all pertinent intermediate computations into variables. 5524117395Skan 5525117395Skan@item -ffast-math 5526117395Skan@opindex ffast-math 5527117395SkanSets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, @* 5528132718Skan@option{-fno-trapping-math}, @option{-ffinite-math-only}, 5529169689Skan@option{-fno-rounding-math}, @option{-fno-signaling-nans} 5530169689Skanand @option{fcx-limited-range}. 5531117395Skan 5532117395SkanThis option causes the preprocessor macro @code{__FAST_MATH__} to be defined. 5533117395Skan 5534117395SkanThis option should never be turned on by any @option{-O} option since 5535117395Skanit can result in incorrect output for programs which depend on 5536117395Skanan exact implementation of IEEE or ISO rules/specifications for 5537117395Skanmath functions. 5538117395Skan 5539117395Skan@item -fno-math-errno 5540117395Skan@opindex fno-math-errno 5541117395SkanDo not set ERRNO after calling math functions that are executed 5542117395Skanwith a single instruction, e.g., sqrt. A program that relies on 5543117395SkanIEEE exceptions for math error handling may want to use this flag 5544117395Skanfor speed while maintaining IEEE arithmetic compatibility. 5545117395Skan 5546117395SkanThis option should never be turned on by any @option{-O} option since 5547117395Skanit can result in incorrect output for programs which depend on 5548117395Skanan exact implementation of IEEE or ISO rules/specifications for 5549117395Skanmath functions. 5550117395Skan 5551117395SkanThe default is @option{-fmath-errno}. 5552117395Skan 5553181540SdasOn Darwin and FreeBSD systems, the math library never sets @code{errno}. 5554181540SdasThere is therefore 5555169689Skanno reason for the compiler to consider the possibility that it might, 5556169689Skanand @option{-fno-math-errno} is the default. 5557169689Skan 5558117395Skan@item -funsafe-math-optimizations 5559117395Skan@opindex funsafe-math-optimizations 5560117395SkanAllow optimizations for floating-point arithmetic that (a) assume 5561117395Skanthat arguments and results are valid and (b) may violate IEEE or 5562117395SkanANSI standards. When used at link-time, it may include libraries 5563117395Skanor startup files that change the default FPU control word or other 5564117395Skansimilar optimizations. 5565117395Skan 5566117395SkanThis option should never be turned on by any @option{-O} option since 5567117395Skanit can result in incorrect output for programs which depend on 5568117395Skanan exact implementation of IEEE or ISO rules/specifications for 5569117395Skanmath functions. 5570117395Skan 5571117395SkanThe default is @option{-fno-unsafe-math-optimizations}. 5572117395Skan 5573117395Skan@item -ffinite-math-only 5574117395Skan@opindex ffinite-math-only 5575117395SkanAllow optimizations for floating-point arithmetic that assume 5576117395Skanthat arguments and results are not NaNs or +-Infs. 5577117395Skan 5578117395SkanThis option should never be turned on by any @option{-O} option since 5579117395Skanit can result in incorrect output for programs which depend on 5580117395Skanan exact implementation of IEEE or ISO rules/specifications. 5581117395Skan 5582117395SkanThe default is @option{-fno-finite-math-only}. 5583117395Skan 5584117395Skan@item -fno-trapping-math 5585117395Skan@opindex fno-trapping-math 5586117395SkanCompile code assuming that floating-point operations cannot generate 5587117395Skanuser-visible traps. These traps include division by zero, overflow, 5588117395Skanunderflow, inexact result and invalid operation. This option implies 5589117395Skan@option{-fno-signaling-nans}. Setting this option may allow faster 5590117395Skancode if one relies on ``non-stop'' IEEE arithmetic, for example. 5591117395Skan 5592117395SkanThis option should never be turned on by any @option{-O} option since 5593117395Skanit can result in incorrect output for programs which depend on 5594117395Skanan exact implementation of IEEE or ISO rules/specifications for 5595117395Skanmath functions. 5596117395Skan 5597117395SkanThe default is @option{-ftrapping-math}. 5598117395Skan 5599132718Skan@item -frounding-math 5600132718Skan@opindex frounding-math 5601132718SkanDisable transformations and optimizations that assume default floating 5602132718Skanpoint rounding behavior. This is round-to-zero for all floating point 5603132718Skanto integer conversions, and round-to-nearest for all other arithmetic 5604132718Skantruncations. This option should be specified for programs that change 5605132718Skanthe FP rounding mode dynamically, or that may be executed with a 5606132718Skannon-default rounding mode. This option disables constant folding of 5607132718Skanfloating point expressions at compile-time (which may be affected by 5608132718Skanrounding mode) and arithmetic transformations that are unsafe in the 5609132718Skanpresence of sign-dependent rounding modes. 5610132718Skan 5611132718SkanThe default is @option{-fno-rounding-math}. 5612132718Skan 5613132718SkanThis option is experimental and does not currently guarantee to 5614132718Skandisable all GCC optimizations that are affected by rounding mode. 5615132718SkanFuture versions of GCC may provide finer control of this setting 5616132718Skanusing C99's @code{FENV_ACCESS} pragma. This command line option 5617132718Skanwill be used to specify the default state for @code{FENV_ACCESS}. 5618132718Skan 5619169689Skan@item -frtl-abstract-sequences 5620169689Skan@opindex frtl-abstract-sequences 5621169689SkanIt is a size optimization method. This option is to find identical 5622169689Skansequences of code, which can be turned into pseudo-procedures and 5623169689Skanthen replace all occurrences with calls to the newly created 5624169689Skansubroutine. It is kind of an opposite of @option{-finline-functions}. 5625169689SkanThis optimization runs at RTL level. 5626169689Skan 5627117395Skan@item -fsignaling-nans 5628117395Skan@opindex fsignaling-nans 5629117395SkanCompile code assuming that IEEE signaling NaNs may generate user-visible 5630117395Skantraps during floating-point operations. Setting this option disables 5631117395Skanoptimizations that may change the number of exceptions visible with 5632117395Skansignaling NaNs. This option implies @option{-ftrapping-math}. 5633117395Skan 5634117395SkanThis option causes the preprocessor macro @code{__SUPPORT_SNAN__} to 5635117395Skanbe defined. 5636117395Skan 5637117395SkanThe default is @option{-fno-signaling-nans}. 5638117395Skan 5639117395SkanThis option is experimental and does not currently guarantee to 5640117395Skandisable all GCC optimizations that affect signaling NaN behavior. 5641117395Skan 5642117395Skan@item -fsingle-precision-constant 5643117395Skan@opindex fsingle-precision-constant 5644117395SkanTreat floating point constant as single precision constant instead of 5645117395Skanimplicitly converting it to double precision constant. 5646117395Skan 5647169689Skan@item -fcx-limited-range 5648169689Skan@itemx -fno-cx-limited-range 5649169689Skan@opindex fcx-limited-range 5650169689Skan@opindex fno-cx-limited-range 5651169689SkanWhen enabled, this option states that a range reduction step is not 5652169689Skanneeded when performing complex division. The default is 5653169689Skan@option{-fno-cx-limited-range}, but is enabled by @option{-ffast-math}. 5654117395Skan 5655169689SkanThis option controls the default setting of the ISO C99 5656169689Skan@code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to 5657169689Skanall languages. 5658169689Skan 5659117395Skan@end table 5660117395Skan 5661117395SkanThe following options control optimizations that may improve 5662117395Skanperformance, but are not enabled by any @option{-O} options. This 5663117395Skansection includes experimental options that may produce broken code. 5664117395Skan 5665117395Skan@table @gcctabopt 5666117395Skan@item -fbranch-probabilities 5667117395Skan@opindex fbranch-probabilities 5668117395SkanAfter running a program compiled with @option{-fprofile-arcs} 5669117395Skan(@pxref{Debugging Options,, Options for Debugging Your Program or 5670117395Skan@command{gcc}}), you can compile it a second time using 5671117395Skan@option{-fbranch-probabilities}, to improve optimizations based on 5672117395Skanthe number of times each branch was taken. When the program 5673117395Skancompiled with @option{-fprofile-arcs} exits it saves arc execution 5674132718Skancounts to a file called @file{@var{sourcename}.gcda} for each source 5675117395Skanfile The information in this data file is very dependent on the 5676117395Skanstructure of the generated code, so you must use the same source code 5677117395Skanand the same optimization options for both compilations. 5678117395Skan 5679132718SkanWith @option{-fbranch-probabilities}, GCC puts a 5680117395Skan@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}. 5681117395SkanThese can be used to improve optimization. Currently, they are only 5682117395Skanused in one place: in @file{reorg.c}, instead of guessing which path a 5683117395Skanbranch is mostly to take, the @samp{REG_BR_PROB} values are used to 5684117395Skanexactly determine which path is taken more often. 5685117395Skan 5686132718Skan@item -fprofile-values 5687132718Skan@opindex fprofile-values 5688132718SkanIf combined with @option{-fprofile-arcs}, it adds code so that some 5689132718Skandata about values of expressions in the program is gathered. 5690132718Skan 5691132718SkanWith @option{-fbranch-probabilities}, it reads back the data gathered 5692132718Skanfrom profiling values of expressions and adds @samp{REG_VALUE_PROFILE} 5693132718Skannotes to instructions for their later usage in optimizations. 5694132718Skan 5695169689SkanEnabled with @option{-fprofile-generate} and @option{-fprofile-use}. 5696169689Skan 5697132718Skan@item -fvpt 5698132718Skan@opindex fvpt 5699132718SkanIf combined with @option{-fprofile-arcs}, it instructs the compiler to add 5700132718Skana code to gather information about values of expressions. 5701132718Skan 5702132718SkanWith @option{-fbranch-probabilities}, it reads back the data gathered 5703132718Skanand actually performs the optimizations based on them. 5704132718SkanCurrently the optimizations include specialization of division operation 5705132718Skanusing the knowledge about the value of the denominator. 5706132718Skan 5707169689Skan@item -frename-registers 5708169689Skan@opindex frename-registers 5709169689SkanAttempt to avoid false dependencies in scheduled code by making use 5710169689Skanof registers left over after register allocation. This optimization 5711169689Skanwill most benefit processors with lots of registers. Depending on the 5712169689Skandebug information format adopted by the target, however, it can 5713169689Skanmake debugging impossible, since variables will no longer stay in 5714169689Skana ``home register''. 5715117395Skan 5716169689SkanEnabled by default with @option{-funroll-loops}. 5717169689Skan 5718117395Skan@item -ftracer 5719117395Skan@opindex ftracer 5720169689SkanPerform tail duplication to enlarge superblock size. This transformation 5721117395Skansimplifies the control flow of the function allowing other optimizations to do 5722117395Skanbetter job. 5723117395Skan 5724169689SkanEnabled with @option{-fprofile-use}. 5725132718Skan 5726117395Skan@item -funroll-loops 5727117395Skan@opindex funroll-loops 5728132718SkanUnroll loops whose number of iterations can be determined at compile time or 5729132718Skanupon entry to the loop. @option{-funroll-loops} implies 5730169689Skan@option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}. 5731169689SkanIt also turns on complete loop peeling (i.e.@: complete removal of loops with 5732169689Skansmall constant number of iterations). This option makes code larger, and may 5733169689Skanor may not make it run faster. 5734117395Skan 5735169689SkanEnabled with @option{-fprofile-use}. 5736169689Skan 5737117395Skan@item -funroll-all-loops 5738117395Skan@opindex funroll-all-loops 5739117395SkanUnroll all loops, even if their number of iterations is uncertain when 5740117395Skanthe loop is entered. This usually makes programs run more slowly. 5741117395Skan@option{-funroll-all-loops} implies the same options as 5742132718Skan@option{-funroll-loops}. 5743117395Skan 5744132718Skan@item -fpeel-loops 5745132718Skan@opindex fpeel-loops 5746132718SkanPeels the loops for that there is enough information that they do not 5747132718Skanroll much (from profile feedback). It also turns on complete loop peeling 5748169689Skan(i.e.@: complete removal of loops with small constant number of iterations). 5749132718Skan 5750169689SkanEnabled with @option{-fprofile-use}. 5751132718Skan 5752169689Skan@item -fmove-loop-invariants 5753169689Skan@opindex fmove-loop-invariants 5754169689SkanEnables the loop invariant motion pass in the RTL loop optimizer. Enabled 5755169689Skanat level @option{-O1} 5756132718Skan 5757132718Skan@item -funswitch-loops 5758132718Skan@opindex funswitch-loops 5759132718SkanMove branches with loop invariant conditions out of the loop, with duplicates 5760132718Skanof the loop on both branches (modified according to result of the condition). 5761132718Skan 5762117395Skan@item -ffunction-sections 5763117395Skan@itemx -fdata-sections 5764117395Skan@opindex ffunction-sections 5765117395Skan@opindex fdata-sections 5766117395SkanPlace each function or data item into its own section in the output 5767117395Skanfile if the target supports arbitrary sections. The name of the 5768117395Skanfunction or the name of the data item determines the section's name 5769117395Skanin the output file. 5770117395Skan 5771117395SkanUse these options on systems where the linker can perform optimizations 5772117395Skanto improve locality of reference in the instruction space. Most systems 5773117395Skanusing the ELF object format and SPARC processors running Solaris 2 have 5774117395Skanlinkers with such optimizations. AIX may have these optimizations in 5775117395Skanthe future. 5776117395Skan 5777117395SkanOnly use these options when there are significant benefits from doing 5778117395Skanso. When you specify these options, the assembler and linker will 5779117395Skancreate larger object and executable files and will also be slower. 5780117395SkanYou will not be able to use @code{gprof} on all systems if you 5781117395Skanspecify this option and you may have problems with debugging if 5782117395Skanyou specify both this option and @option{-g}. 5783117395Skan 5784132718Skan@item -fbranch-target-load-optimize 5785132718Skan@opindex fbranch-target-load-optimize 5786132718SkanPerform branch target register load optimization before prologue / epilogue 5787132718Skanthreading. 5788132718SkanThe use of target registers can typically be exposed only during reload, 5789132718Skanthus hoisting loads out of loops and doing inter-block scheduling needs 5790132718Skana separate optimization pass. 579190075Sobrien 5792132718Skan@item -fbranch-target-load-optimize2 5793132718Skan@opindex fbranch-target-load-optimize2 5794132718SkanPerform branch target register load optimization after prologue / epilogue 5795132718Skanthreading. 579690075Sobrien 5797169689Skan@item -fbtr-bb-exclusive 5798169689Skan@opindex fbtr-bb-exclusive 5799169689SkanWhen performing branch target register load optimization, don't reuse 5800169689Skanbranch target registers in within any basic block. 5801169689Skan 5802169689Skan@item -fstack-protector 5803169689SkanEmit extra code to check for buffer overflows, such as stack smashing 5804169689Skanattacks. This is done by adding a guard variable to functions with 5805169689Skanvulnerable objects. This includes functions that call alloca, and 5806169689Skanfunctions with buffers larger than 8 bytes. The guards are initialized 5807169689Skanwhen a function is entered and then checked when the function exits. 5808169689SkanIf a guard check fails, an error message is printed and the program exits. 5809169689Skan 5810169689Skan@item -fstack-protector-all 5811169689SkanLike @option{-fstack-protector} except that all functions are protected. 5812169689Skan 5813286713Spfg@item -fstack-protector-strong 5814286713SpfgLike @option{-fstack-protector} but includes additional functions to 5815286713Spfgbe protected --- those that have local array definitions, or have 5816286713Spfgreferences to local frame addresses. 5817286713Spfg 5818169689Skan@item -fsection-anchors 5819169689Skan@opindex fsection-anchors 5820169689SkanTry to reduce the number of symbolic address calculations by using 5821169689Skanshared ``anchor'' symbols to address nearby objects. This transformation 5822169689Skancan help to reduce the number of GOT entries and GOT accesses on some 5823169689Skantargets. 5824169689Skan 5825169689SkanFor example, the implementation of the following function @code{foo}: 5826169689Skan 5827169689Skan@smallexample 5828169689Skanstatic int a, b, c; 5829169689Skanint foo (void) @{ return a + b + c; @} 5830169689Skan@end smallexample 5831169689Skan 5832169689Skanwould usually calculate the addresses of all three variables, but if you 5833169689Skancompile it with @option{-fsection-anchors}, it will access the variables 5834169689Skanfrom a common anchor point instead. The effect is similar to the 5835169689Skanfollowing pseudocode (which isn't valid C): 5836169689Skan 5837169689Skan@smallexample 5838169689Skanint foo (void) 5839169689Skan@{ 5840169689Skan register int *xr = &x; 5841169689Skan return xr[&a - &x] + xr[&b - &x] + xr[&c - &x]; 5842169689Skan@} 5843169689Skan@end smallexample 5844169689Skan 5845169689SkanNot all targets support this option. 5846169689Skan 584790075Sobrien@item --param @var{name}=@var{value} 584890075Sobrien@opindex param 584990075SobrienIn some places, GCC uses various constants to control the amount of 585090075Sobrienoptimization that is done. For example, GCC will not inline functions 585190075Sobrienthat contain more that a certain number of instructions. You can 585290075Sobriencontrol some of these constants on the command-line using the 585390075Sobrien@option{--param} option. 585490075Sobrien 5855132718SkanThe names of specific parameters, and the meaning of the values, are 5856132718Skantied to the internals of the compiler, and are subject to change 5857132718Skanwithout notice in future releases. 5858132718Skan 585990075SobrienIn each case, the @var{value} is an integer. The allowable choices for 586090075Sobrien@var{name} are given in the following table: 586190075Sobrien 586290075Sobrien@table @gcctabopt 5863169689Skan@item salias-max-implicit-fields 5864169689SkanThe maximum number of fields in a variable without direct 5865169689Skanstructure accesses for which structure aliasing will consider trying 5866169689Skanto track each field. The default is 5 5867169689Skan 5868169689Skan@item salias-max-array-elements 5869169689SkanThe maximum number of elements an array can have and its elements 5870169689Skanstill be tracked individually by structure aliasing. The default is 4 5871169689Skan 5872169689Skan@item sra-max-structure-size 5873169689SkanThe maximum structure size, in bytes, at which the scalar replacement 5874169689Skanof aggregates (SRA) optimization will perform block copies. The 5875169689Skandefault value, 0, implies that GCC will select the most appropriate 5876169689Skansize itself. 5877169689Skan 5878169689Skan@item sra-field-structure-ratio 5879169689SkanThe threshold ratio (as a percentage) between instantiated fields and 5880169689Skanthe complete structure size. We say that if the ratio of the number 5881169689Skanof bytes in instantiated fields to the number of bytes in the complete 5882169689Skanstructure exceeds this parameter, then block copies are not used. The 5883169689Skandefault is 75. 5884169689Skan 5885117395Skan@item max-crossjump-edges 5886117395SkanThe maximum number of incoming edges to consider for crossjumping. 5887117395SkanThe algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in 5888117395Skanthe number of edges incoming to each block. Increasing values mean 5889117395Skanmore aggressive optimization, making the compile time increase with 5890117395Skanprobably small improvement in executable size. 5891117395Skan 5892169689Skan@item min-crossjump-insns 5893169689SkanThe minimum number of instructions which must be matched at the end 5894169689Skanof two blocks before crossjumping will be performed on them. This 5895169689Skanvalue is ignored in the case where all instructions in the block being 5896169689Skancrossjumped from are matched. The default value is 5. 5897169689Skan 5898169689Skan@item max-grow-copy-bb-insns 5899169689SkanThe maximum code size expansion factor when copying basic blocks 5900169689Skaninstead of jumping. The expansion is relative to a jump instruction. 5901169689SkanThe default value is 8. 5902169689Skan 5903169689Skan@item max-goto-duplication-insns 5904169689SkanThe maximum number of instructions to duplicate to a block that jumps 5905169689Skanto a computed goto. To avoid @math{O(N^2)} behavior in a number of 5906169689Skanpasses, GCC factors computed gotos early in the compilation process, 5907169689Skanand unfactors them as late as possible. Only computed jumps at the 5908169689Skanend of a basic blocks with no more than max-goto-duplication-insns are 5909169689Skanunfactored. The default value is 8. 5910169689Skan 591190075Sobrien@item max-delay-slot-insn-search 591290075SobrienThe maximum number of instructions to consider when looking for an 591390075Sobrieninstruction to fill a delay slot. If more than this arbitrary number of 591490075Sobrieninstructions is searched, the time savings from filling the delay slot 591590075Sobrienwill be minimal so stop searching. Increasing values mean more 591690075Sobrienaggressive optimization, making the compile time increase with probably 591790075Sobriensmall improvement in executable run time. 591890075Sobrien 591990075Sobrien@item max-delay-slot-live-search 592090075SobrienWhen trying to fill delay slots, the maximum number of instructions to 592190075Sobrienconsider when searching for a block with valid live register 592290075Sobrieninformation. Increasing this arbitrarily chosen value means more 592390075Sobrienaggressive optimization, increasing the compile time. This parameter 592490075Sobrienshould be removed when the delay slot code is rewritten to maintain the 592590075Sobriencontrol-flow graph. 592690075Sobrien 592790075Sobrien@item max-gcse-memory 592890075SobrienThe approximate maximum amount of memory that will be allocated in 592990075Sobrienorder to perform the global common subexpression elimination 593090075Sobrienoptimization. If more memory than specified is required, the 593190075Sobrienoptimization will not be done. 593290075Sobrien 593390075Sobrien@item max-gcse-passes 5934169689SkanThe maximum number of passes of GCSE to run. The default is 1. 593590075Sobrien 593690075Sobrien@item max-pending-list-length 593790075SobrienThe maximum number of pending dependencies scheduling will allow 593890075Sobrienbefore flushing the current state and starting over. Large functions 593990075Sobrienwith few branches or calls can create excessively large lists which 594090075Sobrienneedlessly consume memory and resources. 594190075Sobrien 5942117395Skan@item max-inline-insns-single 5943117395SkanSeveral parameters control the tree inliner used in gcc. 5944132718SkanThis number sets the maximum number of instructions (counted in GCC's 5945132718Skaninternal representation) in a single function that the tree inliner 5946117395Skanwill consider for inlining. This only affects functions declared 5947117395Skaninline and methods implemented in a class declaration (C++). 5948169689SkanThe default value is 450. 5949117395Skan 5950117395Skan@item max-inline-insns-auto 5951117395SkanWhen you use @option{-finline-functions} (included in @option{-O3}), 5952117395Skana lot of functions that would otherwise not be considered for inlining 5953117395Skanby the compiler will be investigated. To those functions, a different 5954117395Skan(more restrictive) limit compared to functions declared inline can 5955117395Skanbe applied. 5956169689SkanThe default value is 90. 5957117395Skan 5958132718Skan@item large-function-insns 5959169689SkanThe limit specifying really large functions. For functions larger than this 5960169689Skanlimit after inlining inlining is constrained by 5961169689Skan@option{--param large-function-growth}. This parameter is useful primarily 5962169689Skanto avoid extreme compilation time caused by non-linear algorithms used by the 5963169689Skanbackend. 5964132718SkanThis parameter is ignored when @option{-funit-at-a-time} is not used. 5965169689SkanThe default value is 2700. 596690075Sobrien 5967132718Skan@item large-function-growth 5968132718SkanSpecifies maximal growth of large function caused by inlining in percents. 5969132718SkanThis parameter is ignored when @option{-funit-at-a-time} is not used. 5970169689SkanThe default value is 100 which limits large function growth to 2.0 times 5971169689Skanthe original size. 5972117395Skan 5973169689Skan@item large-unit-insns 5974169689SkanThe limit specifying large translation unit. Growth caused by inlining of 5975169689Skanunits larger than this limit is limited by @option{--param inline-unit-growth}. 5976169689SkanFor small units this might be too tight (consider unit consisting of function A 5977169689Skanthat is inline and B that just calls A three time. If B is small relative to 5978169689SkanA, the growth of unit is 300\% and yet such inlining is very sane. For very 5979169689Skanlarge units consisting of small inlininable functions however the overall unit 5980169689Skangrowth limit is needed to avoid exponential explosion of code size. Thus for 5981169689Skansmaller units, the size is increased to @option{--param large-unit-insns} 5982169689Skanbefore applying @option{--param inline-unit-growth}. The default is 10000 5983169689Skan 5984132718Skan@item inline-unit-growth 5985132718SkanSpecifies maximal overall growth of the compilation unit caused by inlining. 5986132718SkanThis parameter is ignored when @option{-funit-at-a-time} is not used. 5987169689SkanThe default value is 50 which limits unit growth to 1.5 times the original 5988169689Skansize. 5989117395Skan 5990169689Skan@item max-inline-insns-recursive 5991169689Skan@itemx max-inline-insns-recursive-auto 5992169689SkanSpecifies maximum number of instructions out-of-line copy of self recursive inline 5993169689Skanfunction can grow into by performing recursive inlining. 5994117395Skan 5995169689SkanFor functions declared inline @option{--param max-inline-insns-recursive} is 5996169689Skantaken into account. For function not declared inline, recursive inlining 5997169689Skanhappens only when @option{-finline-functions} (included in @option{-O3}) is 5998169689Skanenabled and @option{--param max-inline-insns-recursive-auto} is used. The 5999169689Skandefault value is 450. 6000169689Skan 6001169689Skan@item max-inline-recursive-depth 6002169689Skan@itemx max-inline-recursive-depth-auto 6003169689SkanSpecifies maximum recursion depth used by the recursive inlining. 6004169689Skan 6005169689SkanFor functions declared inline @option{--param max-inline-recursive-depth} is 6006169689Skantaken into account. For function not declared inline, recursive inlining 6007169689Skanhappens only when @option{-finline-functions} (included in @option{-O3}) is 6008169689Skanenabled and @option{--param max-inline-recursive-depth-auto} is used. The 6009169689Skandefault value is 450. 6010169689Skan 6011169689Skan@item min-inline-recursive-probability 6012169689SkanRecursive inlining is profitable only for function having deep recursion 6013169689Skanin average and can hurt for function having little recursion depth by 6014169689Skanincreasing the prologue size or complexity of function body to other 6015169689Skanoptimizers. 6016169689Skan 6017169689SkanWhen profile feedback is available (see @option{-fprofile-generate}) the actual 6018169689Skanrecursion depth can be guessed from probability that function will recurse via 6019169689Skangiven call expression. This parameter limits inlining only to call expression 6020169689Skanwhose probability exceeds given threshold (in percents). The default value is 6021169689Skan10. 6022169689Skan 6023169689Skan@item inline-call-cost 6024169689SkanSpecify cost of call instruction relative to simple arithmetics operations 6025169689Skan(having cost of 1). Increasing this cost disqualifies inlining of non-leaf 6026169689Skanfunctions and at the same time increases size of leaf function that is believed to 6027169689Skanreduce function size by being inlined. In effect it increases amount of 6028169689Skaninlining for code having large abstraction penalty (many functions that just 6029169689Skanpass the arguments to other functions) and decrease inlining for code with low 6030169689Skanabstraction penalty. The default value is 16. 6031169689Skan 6032117395Skan@item max-unrolled-insns 6033117395SkanThe maximum number of instructions that a loop should have if that loop 6034117395Skanis unrolled, and if the loop is unrolled, it determines how many times 6035117395Skanthe loop code is unrolled. 6036117395Skan 6037132718Skan@item max-average-unrolled-insns 6038132718SkanThe maximum number of instructions biased by probabilities of their execution 6039132718Skanthat a loop should have if that loop is unrolled, and if the loop is unrolled, 6040132718Skanit determines how many times the loop code is unrolled. 6041132718Skan 6042132718Skan@item max-unroll-times 6043132718SkanThe maximum number of unrollings of a single loop. 6044132718Skan 6045132718Skan@item max-peeled-insns 6046132718SkanThe maximum number of instructions that a loop should have if that loop 6047132718Skanis peeled, and if the loop is peeled, it determines how many times 6048132718Skanthe loop code is peeled. 6049132718Skan 6050132718Skan@item max-peel-times 6051132718SkanThe maximum number of peelings of a single loop. 6052132718Skan 6053132718Skan@item max-completely-peeled-insns 6054132718SkanThe maximum number of insns of a completely peeled loop. 6055132718Skan 6056132718Skan@item max-completely-peel-times 6057132718SkanThe maximum number of iterations of a loop to be suitable for complete peeling. 6058132718Skan 6059132718Skan@item max-unswitch-insns 6060132718SkanThe maximum number of insns of an unswitched loop. 6061132718Skan 6062132718Skan@item max-unswitch-level 6063132718SkanThe maximum number of branches unswitched in a single loop. 6064132718Skan 6065169689Skan@item lim-expensive 6066169689SkanThe minimum cost of an expensive expression in the loop invariant motion. 6067169689Skan 6068169689Skan@item iv-consider-all-candidates-bound 6069169689SkanBound on number of candidates for induction variables below that 6070169689Skanall candidates are considered for each use in induction variable 6071169689Skanoptimizations. Only the most relevant candidates are considered 6072169689Skanif there are more candidates, to avoid quadratic time complexity. 6073169689Skan 6074169689Skan@item iv-max-considered-uses 6075169689SkanThe induction variable optimizations give up on loops that contain more 6076169689Skaninduction variable uses. 6077169689Skan 6078169689Skan@item iv-always-prune-cand-set-bound 6079169689SkanIf number of candidates in the set is smaller than this value, 6080169689Skanwe always try to remove unnecessary ivs from the set during its 6081169689Skanoptimization when a new iv is added to the set. 6082169689Skan 6083169689Skan@item scev-max-expr-size 6084169689SkanBound on size of expressions used in the scalar evolutions analyzer. 6085169689SkanLarge expressions slow the analyzer. 6086169689Skan 6087169689Skan@item vect-max-version-checks 6088169689SkanThe maximum number of runtime checks that can be performed when doing 6089169689Skanloop versioning in the vectorizer. See option ftree-vect-loop-version 6090169689Skanfor more information. 6091169689Skan 6092169689Skan@item max-iterations-to-track 6093169689Skan 6094169689SkanThe maximum number of iterations of a loop the brute force algorithm 6095169689Skanfor analysis of # of iterations of the loop tries to evaluate. 6096169689Skan 6097117395Skan@item hot-bb-count-fraction 6098117395SkanSelect fraction of the maximal count of repetitions of basic block in program 6099117395Skangiven basic block needs to have to be considered hot. 6100117395Skan 6101117395Skan@item hot-bb-frequency-fraction 6102117395SkanSelect fraction of the maximal frequency of executions of basic block in 6103117395Skanfunction given basic block needs to have to be considered hot 6104117395Skan 6105169689Skan@item max-predicted-iterations 6106169689SkanThe maximum number of loop iterations we predict statically. This is useful 6107169689Skanin cases where function contain single loop with known bound and other loop 6108169689Skanwith unknown. We predict the known number of iterations correctly, while 6109169689Skanthe unknown number of iterations average to roughly 10. This means that the 6110169689Skanloop without bounds would appear artificially cold relative to the other one. 6111169689Skan 6112117395Skan@item tracer-dynamic-coverage 6113117395Skan@itemx tracer-dynamic-coverage-feedback 6114117395Skan 6115117395SkanThis value is used to limit superblock formation once the given percentage of 6116117395Skanexecuted instructions is covered. This limits unnecessary code size 6117117395Skanexpansion. 6118117395Skan 6119117395SkanThe @option{tracer-dynamic-coverage-feedback} is used only when profile 6120117395Skanfeedback is available. The real profiles (as opposed to statically estimated 6121117395Skanones) are much less balanced allowing the threshold to be larger value. 6122117395Skan 6123117395Skan@item tracer-max-code-growth 6124117395SkanStop tail duplication once code growth has reached given percentage. This is 6125117395Skanrather hokey argument, as most of the duplicates will be eliminated later in 6126117395Skancross jumping, so it may be set to much higher values than is the desired code 6127117395Skangrowth. 6128117395Skan 6129117395Skan@item tracer-min-branch-ratio 6130117395Skan 6131117395SkanStop reverse growth when the reverse probability of best edge is less than this 6132117395Skanthreshold (in percent). 6133117395Skan 6134117395Skan@item tracer-min-branch-ratio 6135117395Skan@itemx tracer-min-branch-ratio-feedback 6136117395Skan 6137117395SkanStop forward growth if the best edge do have probability lower than this 6138117395Skanthreshold. 6139117395Skan 6140117395SkanSimilarly to @option{tracer-dynamic-coverage} two values are present, one for 6141117395Skancompilation for profile feedback and one for compilation without. The value 6142117395Skanfor compilation with profile feedback needs to be more conservative (higher) in 6143117395Skanorder to make tracer effective. 6144117395Skan 6145132718Skan@item max-cse-path-length 6146132718Skan 6147169689SkanMaximum number of basic blocks on path that cse considers. The default is 10. 6148132718Skan 6149169689Skan@item max-cse-insns 6150169689SkanThe maximum instructions CSE process before flushing. The default is 1000. 6151146895Skan 6152169689Skan@item global-var-threshold 6153146895Skan 6154169689SkanCounts the number of function calls (@var{n}) and the number of 6155169689Skancall-clobbered variables (@var{v}). If @var{n}x@var{v} is larger than this limit, a 6156169689Skansingle artificial variable will be created to represent all the 6157169689Skancall-clobbered variables at function call sites. This artificial 6158169689Skanvariable will then be made to alias every call-clobbered variable. 6159169689Skan(done as @code{int * size_t} on the host machine; beware overflow). 6160169689Skan 6161169689Skan@item max-aliased-vops 6162169689Skan 6163169689SkanMaximum number of virtual operands allowed to represent aliases 6164169689Skanbefore triggering the alias grouping heuristic. Alias grouping 6165169689Skanreduces compile times and memory consumption needed for aliasing at 6166169689Skanthe expense of precision loss in alias information. 6167169689Skan 6168117395Skan@item ggc-min-expand 6169117395Skan 6170117395SkanGCC uses a garbage collector to manage its own memory allocation. This 6171117395Skanparameter specifies the minimum percentage by which the garbage 6172117395Skancollector's heap should be allowed to expand between collections. 6173117395SkanTuning this may improve compilation speed; it has no effect on code 6174117395Skangeneration. 6175117395Skan 6176117395SkanThe default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when 6177169689SkanRAM >= 1GB@. If @code{getrlimit} is available, the notion of "RAM" is 6178169689Skanthe smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If 6179117395SkanGCC is not able to calculate RAM on a particular platform, the lower 6180117395Skanbound of 30% is used. Setting this parameter and 6181117395Skan@option{ggc-min-heapsize} to zero causes a full collection to occur at 6182117395Skanevery opportunity. This is extremely slow, but can be useful for 6183117395Skandebugging. 6184117395Skan 6185117395Skan@item ggc-min-heapsize 6186117395Skan 6187117395SkanMinimum size of the garbage collector's heap before it begins bothering 6188117395Skanto collect garbage. The first collection occurs after the heap expands 6189117395Skanby @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again, 6190117395Skantuning this may improve compilation speed, and has no effect on code 6191117395Skangeneration. 6192117395Skan 6193169689SkanThe default is the smaller of RAM/8, RLIMIT_RSS, or a limit which 6194169689Skantries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but 6195169689Skanwith a lower bound of 4096 (four megabytes) and an upper bound of 6196169689Skan131072 (128 megabytes). If GCC is not able to calculate RAM on a 6197169689Skanparticular platform, the lower bound is used. Setting this parameter 6198169689Skanvery large effectively disables garbage collection. Setting this 6199169689Skanparameter and @option{ggc-min-expand} to zero causes a full collection 6200169689Skanto occur at every opportunity. 6201117395Skan 6202132718Skan@item max-reload-search-insns 6203132718SkanThe maximum number of instruction reload should look backward for equivalent 6204132718Skanregister. Increasing values mean more aggressive optimization, making the 6205132718Skancompile time increase with probably slightly better performance. The default 6206132718Skanvalue is 100. 6207132718Skan 6208169689Skan@item max-cselib-memory-locations 6209169689SkanThe maximum number of memory locations cselib should take into account. 6210132718SkanIncreasing values mean more aggressive optimization, making the compile time 6211132718Skanincrease with probably slightly better performance. The default value is 500. 6212132718Skan 6213169689Skan@item max-flow-memory-locations 6214169689SkanSimilar as @option{max-cselib-memory-locations} but for dataflow liveness. 6215169689SkanThe default value is 100. 6216169689Skan 6217132718Skan@item reorder-blocks-duplicate 6218132718Skan@itemx reorder-blocks-duplicate-feedback 6219132718Skan 6220132718SkanUsed by basic block reordering pass to decide whether to use unconditional 6221132718Skanbranch or duplicate the code on its destination. Code is duplicated when its 6222132718Skanestimated size is smaller than this value multiplied by the estimated size of 6223132718Skanunconditional jump in the hot spots of the program. 6224132718Skan 6225132718SkanThe @option{reorder-block-duplicate-feedback} is used only when profile 6226132718Skanfeedback is available and may be set to higher values than 6227132718Skan@option{reorder-block-duplicate} since information about the hot spots is more 6228132718Skanaccurate. 6229169689Skan 6230169689Skan@item max-sched-ready-insns 6231169689SkanThe maximum number of instructions ready to be issued the scheduler should 6232169689Skanconsider at any given time during the first scheduling pass. Increasing 6233169689Skanvalues mean more thorough searches, making the compilation time increase 6234169689Skanwith probably little benefit. The default value is 100. 6235169689Skan 6236169689Skan@item max-sched-region-blocks 6237169689SkanThe maximum number of blocks in a region to be considered for 6238169689Skaninterblock scheduling. The default value is 10. 6239169689Skan 6240169689Skan@item max-sched-region-insns 6241169689SkanThe maximum number of insns in a region to be considered for 6242169689Skaninterblock scheduling. The default value is 100. 6243169689Skan 6244169689Skan@item min-spec-prob 6245169689SkanThe minimum probability (in percents) of reaching a source block 6246169689Skanfor interblock speculative scheduling. The default value is 40. 6247169689Skan 6248169689Skan@item max-sched-extend-regions-iters 6249169689SkanThe maximum number of iterations through CFG to extend regions. 6250169689Skan0 - disable region extension, 6251169689SkanN - do at most N iterations. 6252169689SkanThe default value is 0. 6253169689Skan 6254169689Skan@item max-sched-insn-conflict-delay 6255169689SkanThe maximum conflict delay for an insn to be considered for speculative motion. 6256169689SkanThe default value is 3. 6257169689Skan 6258169689Skan@item sched-spec-prob-cutoff 6259169689SkanThe minimal probability of speculation success (in percents), so that 6260169689Skanspeculative insn will be scheduled. 6261169689SkanThe default value is 40. 6262169689Skan 6263169689Skan@item max-last-value-rtl 6264169689Skan 6265169689SkanThe maximum size measured as number of RTLs that can be recorded in an expression 6266169689Skanin combiner for a pseudo register as last known value of that register. The default 6267169689Skanis 10000. 6268169689Skan 6269169689Skan@item integer-share-limit 6270169689SkanSmall integer constants can use a shared data structure, reducing the 6271169689Skancompiler's memory usage and increasing its speed. This sets the maximum 6272169689Skanvalue of a shared integer constant's. The default value is 256. 6273169689Skan 6274169689Skan@item min-virtual-mappings 6275169689SkanSpecifies the minimum number of virtual mappings in the incremental 6276169689SkanSSA updater that should be registered to trigger the virtual mappings 6277169689Skanheuristic defined by virtual-mappings-ratio. The default value is 6278169689Skan100. 6279169689Skan 6280169689Skan@item virtual-mappings-ratio 6281169689SkanIf the number of virtual mappings is virtual-mappings-ratio bigger 6282169689Skanthan the number of virtual symbols to be updated, then the incremental 6283169689SkanSSA updater switches to a full update for those symbols. The default 6284169689Skanratio is 3. 6285169689Skan 6286169689Skan@item ssp-buffer-size 6287169689SkanThe minimum size of buffers (i.e. arrays) that will receive stack smashing 6288169689Skanprotection when @option{-fstack-protection} is used. 6289169689Skan 6290169689Skan@item max-jump-thread-duplication-stmts 6291169689SkanMaximum number of statements allowed in a block that needs to be 6292169689Skanduplicated when threading jumps. 6293169689Skan 6294169689Skan@item max-fields-for-field-sensitive 6295169689SkanMaximum number of fields in a structure we will treat in 6296169689Skana field sensitive manner during pointer analysis. 6297169689Skan 629890075Sobrien@end table 629990075Sobrien@end table 630090075Sobrien 630190075Sobrien@node Preprocessor Options 630290075Sobrien@section Options Controlling the Preprocessor 630390075Sobrien@cindex preprocessor options 630490075Sobrien@cindex options, preprocessor 630590075Sobrien 630690075SobrienThese options control the C preprocessor, which is run on each C source 630790075Sobrienfile before actual compilation. 630890075Sobrien 630990075SobrienIf you use the @option{-E} option, nothing is done except preprocessing. 631090075SobrienSome of these options make sense only together with @option{-E} because 631190075Sobrienthey cause the preprocessor output to be unsuitable for actual 631290075Sobriencompilation. 631390075Sobrien 6314132718Skan@table @gcctabopt 631596263Sobrien@opindex Wp 631696263SobrienYou can use @option{-Wp,@var{option}} to bypass the compiler driver 631796263Sobrienand pass @var{option} directly through to the preprocessor. If 631896263Sobrien@var{option} contains commas, it is split into multiple options at the 631996263Sobriencommas. However, many options are modified, translated or interpreted 632096263Sobrienby the compiler driver before being passed to the preprocessor, and 632196263Sobrien@option{-Wp} forcibly bypasses this phase. The preprocessor's direct 632296263Sobrieninterface is undocumented and subject to change, so whenever possible 632396263Sobrienyou should avoid using @option{-Wp} and let the driver handle the 632496263Sobrienoptions instead. 632590075Sobrien 6326132718Skan@item -Xpreprocessor @var{option} 6327132718Skan@opindex preprocessor 6328132718SkanPass @var{option} as an option to the preprocessor. You can use this to 6329132718Skansupply system-specific preprocessor options which GCC does not know how to 6330132718Skanrecognize. 6331132718Skan 6332132718SkanIf you want to pass an option that takes an argument, you must use 6333132718Skan@option{-Xpreprocessor} twice, once for the option and once for the argument. 6334132718Skan@end table 6335132718Skan 633696263Sobrien@include cppopts.texi 633790075Sobrien 633890075Sobrien@node Assembler Options 633990075Sobrien@section Passing Options to the Assembler 634090075Sobrien 634190075Sobrien@c prevent bad page break with this line 634290075SobrienYou can pass options to the assembler. 634390075Sobrien 634490075Sobrien@table @gcctabopt 634590075Sobrien@item -Wa,@var{option} 634690075Sobrien@opindex Wa 634790075SobrienPass @var{option} as an option to the assembler. If @var{option} 634890075Sobriencontains commas, it is split into multiple options at the commas. 6349132718Skan 6350132718Skan@item -Xassembler @var{option} 6351132718Skan@opindex Xassembler 6352132718SkanPass @var{option} as an option to the assembler. You can use this to 6353132718Skansupply system-specific assembler options which GCC does not know how to 6354132718Skanrecognize. 6355132718Skan 6356132718SkanIf you want to pass an option that takes an argument, you must use 6357132718Skan@option{-Xassembler} twice, once for the option and once for the argument. 6358132718Skan 635990075Sobrien@end table 636090075Sobrien 636190075Sobrien@node Link Options 636290075Sobrien@section Options for Linking 636390075Sobrien@cindex link options 636490075Sobrien@cindex options, linking 636590075Sobrien 636690075SobrienThese options come into play when the compiler links object files into 636790075Sobrienan executable output file. They are meaningless if the compiler is 636890075Sobriennot doing a link step. 636990075Sobrien 637090075Sobrien@table @gcctabopt 637190075Sobrien@cindex file names 637290075Sobrien@item @var{object-file-name} 637390075SobrienA file name that does not end in a special recognized suffix is 637490075Sobrienconsidered to name an object file or library. (Object files are 637590075Sobriendistinguished from libraries by the linker according to the file 637690075Sobriencontents.) If linking is done, these object files are used as input 637790075Sobriento the linker. 637890075Sobrien 637990075Sobrien@item -c 638090075Sobrien@itemx -S 638190075Sobrien@itemx -E 638290075Sobrien@opindex c 638390075Sobrien@opindex S 638490075Sobrien@opindex E 638590075SobrienIf any of these options is used, then the linker is not run, and 638690075Sobrienobject file names should not be used as arguments. @xref{Overall 638790075SobrienOptions}. 638890075Sobrien 638990075Sobrien@cindex Libraries 639090075Sobrien@item -l@var{library} 639190075Sobrien@itemx -l @var{library} 639290075Sobrien@opindex l 639390075SobrienSearch the library named @var{library} when linking. (The second 639490075Sobrienalternative with the library as a separate argument is only for 639590075SobrienPOSIX compliance and is not recommended.) 639690075Sobrien 639790075SobrienIt makes a difference where in the command you write this option; the 639890075Sobrienlinker searches and processes libraries and object files in the order they 639990075Sobrienare specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z} 640090075Sobrienafter file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers 640190075Sobriento functions in @samp{z}, those functions may not be loaded. 640290075Sobrien 640390075SobrienThe linker searches a standard list of directories for the library, 640490075Sobrienwhich is actually a file named @file{lib@var{library}.a}. The linker 640590075Sobrienthen uses this file as if it had been specified precisely by name. 640690075Sobrien 640790075SobrienThe directories searched include several standard system directories 640890075Sobrienplus any that you specify with @option{-L}. 640990075Sobrien 641090075SobrienNormally the files found this way are library files---archive files 641190075Sobrienwhose members are object files. The linker handles an archive file by 641290075Sobrienscanning through it for members which define symbols that have so far 641390075Sobrienbeen referenced but not defined. But if the file that is found is an 641490075Sobrienordinary object file, it is linked in the usual fashion. The only 641590075Sobriendifference between using an @option{-l} option and specifying a file name 641690075Sobrienis that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a} 641790075Sobrienand searches several directories. 641890075Sobrien 641990075Sobrien@item -nostartfiles 642090075Sobrien@opindex nostartfiles 642190075SobrienDo not use the standard system startup files when linking. 642290075SobrienThe standard system libraries are used normally, unless @option{-nostdlib} 642390075Sobrienor @option{-nodefaultlibs} is used. 642490075Sobrien 642590075Sobrien@item -nodefaultlibs 642690075Sobrien@opindex nodefaultlibs 642790075SobrienDo not use the standard system libraries when linking. 642890075SobrienOnly the libraries you specify will be passed to the linker. 642990075SobrienThe standard startup files are used normally, unless @option{-nostartfiles} 6430169689Skanis used. The compiler may generate calls to @code{memcmp}, 6431169689Skan@code{memset}, @code{memcpy} and @code{memmove}. 6432169689SkanThese entries are usually resolved by entries in 643390075Sobrienlibc. These entry points should be supplied through some other 643490075Sobrienmechanism when this option is specified. 643590075Sobrien 643690075Sobrien@item -nostdlib 643790075Sobrien@opindex nostdlib 643890075SobrienDo not use the standard system startup files or libraries when linking. 643990075SobrienNo startup files and only the libraries you specify will be passed to 6440169689Skanthe linker. The compiler may generate calls to @code{memcmp}, @code{memset}, 6441169689Skan@code{memcpy} and @code{memmove}. 6442169689SkanThese entries are usually resolved by entries in 644390075Sobrienlibc. These entry points should be supplied through some other 644490075Sobrienmechanism when this option is specified. 644590075Sobrien 644690075Sobrien@cindex @option{-lgcc}, use with @option{-nostdlib} 644790075Sobrien@cindex @option{-nostdlib} and unresolved references 644890075Sobrien@cindex unresolved references and @option{-nostdlib} 644990075Sobrien@cindex @option{-lgcc}, use with @option{-nodefaultlibs} 645090075Sobrien@cindex @option{-nodefaultlibs} and unresolved references 645190075Sobrien@cindex unresolved references and @option{-nodefaultlibs} 645290075SobrienOne of the standard libraries bypassed by @option{-nostdlib} and 645390075Sobrien@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines 645490075Sobrienthat GCC uses to overcome shortcomings of particular machines, or special 645590075Sobrienneeds for some languages. 645690075Sobrien(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler 645790075SobrienCollection (GCC) Internals}, 645890075Sobrienfor more discussion of @file{libgcc.a}.) 645990075SobrienIn most cases, you need @file{libgcc.a} even when you want to avoid 646090075Sobrienother standard libraries. In other words, when you specify @option{-nostdlib} 646190075Sobrienor @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well. 646290075SobrienThis ensures that you have no unresolved references to internal GCC 646390075Sobrienlibrary subroutines. (For example, @samp{__main}, used to ensure C++ 646490075Sobrienconstructors will be called; @pxref{Collect2,,@code{collect2}, gccint, 646590075SobrienGNU Compiler Collection (GCC) Internals}.) 646690075Sobrien 6467132718Skan@item -pie 6468132718Skan@opindex pie 6469132718SkanProduce a position independent executable on targets which support it. 6470132718SkanFor predictable results, you must also specify the same set of options 6471132718Skanthat were used to generate code (@option{-fpie}, @option{-fPIE}, 6472132718Skanor model suboptions) when you specify this option. 6473132718Skan 6474169689Skan@item -rdynamic 6475169689Skan@opindex rdynamic 6476169689SkanPass the flag @option{-export-dynamic} to the ELF linker, on targets 6477169689Skanthat support it. This instructs the linker to add all symbols, not 6478169689Skanonly used ones, to the dynamic symbol table. This option is needed 6479169689Skanfor some uses of @code{dlopen} or to allow obtaining backtraces 6480169689Skanfrom within a program. 6481169689Skan 648290075Sobrien@item -s 648390075Sobrien@opindex s 648490075SobrienRemove all symbol table and relocation information from the executable. 648590075Sobrien 648690075Sobrien@item -static 648790075Sobrien@opindex static 648890075SobrienOn systems that support dynamic linking, this prevents linking with the shared 648990075Sobrienlibraries. On other systems, this option has no effect. 649090075Sobrien 649190075Sobrien@item -shared 649290075Sobrien@opindex shared 649390075SobrienProduce a shared object which can then be linked with other objects to 649490075Sobrienform an executable. Not all systems support this option. For predictable 649590075Sobrienresults, you must also specify the same set of options that were used to 649690075Sobriengenerate code (@option{-fpic}, @option{-fPIC}, or model suboptions) 649790075Sobrienwhen you specify this option.@footnote{On some systems, @samp{gcc -shared} 649890075Sobrienneeds to build supplementary stub code for constructors to work. On 649990075Sobrienmulti-libbed systems, @samp{gcc -shared} must select the correct support 650090075Sobrienlibraries to link against. Failing to supply the correct flags may lead 650190075Sobriento subtle defects. Supplying them in cases where they are not necessary 650290075Sobrienis innocuous.} 650390075Sobrien 650490075Sobrien@item -shared-libgcc 650590075Sobrien@itemx -static-libgcc 650690075Sobrien@opindex shared-libgcc 650790075Sobrien@opindex static-libgcc 650890075SobrienOn systems that provide @file{libgcc} as a shared library, these options 650990075Sobrienforce the use of either the shared or static version respectively. 651090075SobrienIf no shared version of @file{libgcc} was built when the compiler was 651190075Sobrienconfigured, these options have no effect. 651290075Sobrien 651390075SobrienThere are several situations in which an application should use the 651490075Sobrienshared @file{libgcc} instead of the static version. The most common 651590075Sobrienof these is when the application wishes to throw and catch exceptions 651690075Sobrienacross different shared libraries. In that case, each of the libraries 651790075Sobrienas well as the application itself should use the shared @file{libgcc}. 651890075Sobrien 651996263SobrienTherefore, the G++ and GCJ drivers automatically add 652096263Sobrien@option{-shared-libgcc} whenever you build a shared library or a main 652196263Sobrienexecutable, because C++ and Java programs typically use exceptions, so 652296263Sobrienthis is the right thing to do. 652390075Sobrien 652496263SobrienIf, instead, you use the GCC driver to create shared libraries, you may 652596263Sobrienfind that they will not always be linked with the shared @file{libgcc}. 6526132718SkanIf GCC finds, at its configuration time, that you have a non-GNU linker 6527132718Skanor a GNU linker that does not support option @option{--eh-frame-hdr}, 6528132718Skanit will link the shared version of @file{libgcc} into shared libraries 6529132718Skanby default. Otherwise, it will take advantage of the linker and optimize 6530132718Skanaway the linking with the shared version of @file{libgcc}, linking with 6531132718Skanthe static version of libgcc by default. This allows exceptions to 6532132718Skanpropagate through such shared libraries, without incurring relocation 6533132718Skancosts at library load time. 653496263Sobrien 653596263SobrienHowever, if a library or main executable is supposed to throw or catch 653696263Sobrienexceptions, you must link it using the G++ or GCJ driver, as appropriate 653796263Sobrienfor the languages used in the program, or using the option 653896263Sobrien@option{-shared-libgcc}, such that it is linked with the shared 653990075Sobrien@file{libgcc}. 654090075Sobrien 654190075Sobrien@item -symbolic 654290075Sobrien@opindex symbolic 654390075SobrienBind references to global symbols when building a shared object. Warn 654490075Sobrienabout any unresolved references (unless overridden by the link editor 654590075Sobrienoption @samp{-Xlinker -z -Xlinker defs}). Only a few systems support 654690075Sobrienthis option. 654790075Sobrien 654890075Sobrien@item -Xlinker @var{option} 654990075Sobrien@opindex Xlinker 655090075SobrienPass @var{option} as an option to the linker. You can use this to 655190075Sobriensupply system-specific linker options which GCC does not know how to 655290075Sobrienrecognize. 655390075Sobrien 655490075SobrienIf you want to pass an option that takes an argument, you must use 655590075Sobrien@option{-Xlinker} twice, once for the option and once for the argument. 655690075SobrienFor example, to pass @option{-assert definitions}, you must write 655790075Sobrien@samp{-Xlinker -assert -Xlinker definitions}. It does not work to write 655890075Sobrien@option{-Xlinker "-assert definitions"}, because this passes the entire 655990075Sobrienstring as a single argument, which is not what the linker expects. 656090075Sobrien 656190075Sobrien@item -Wl,@var{option} 656290075Sobrien@opindex Wl 656390075SobrienPass @var{option} as an option to the linker. If @var{option} contains 656490075Sobriencommas, it is split into multiple options at the commas. 656590075Sobrien 656690075Sobrien@item -u @var{symbol} 656790075Sobrien@opindex u 656890075SobrienPretend the symbol @var{symbol} is undefined, to force linking of 656990075Sobrienlibrary modules to define it. You can use @option{-u} multiple times with 657090075Sobriendifferent symbols to force loading of additional library modules. 657190075Sobrien@end table 657290075Sobrien 657390075Sobrien@node Directory Options 657490075Sobrien@section Options for Directory Search 657590075Sobrien@cindex directory options 657690075Sobrien@cindex options, directory search 657790075Sobrien@cindex search path 657890075Sobrien 657990075SobrienThese options specify directories to search for header files, for 658090075Sobrienlibraries and for parts of the compiler: 658190075Sobrien 658290075Sobrien@table @gcctabopt 658390075Sobrien@item -I@var{dir} 658490075Sobrien@opindex I 658590075SobrienAdd the directory @var{dir} to the head of the list of directories to be 658690075Sobriensearched for header files. This can be used to override a system header 658790075Sobrienfile, substituting your own version, since these directories are 658890075Sobriensearched before the system header file directories. However, you should 658990075Sobriennot use this option to add directories that contain vendor-supplied 659090075Sobriensystem header files (use @option{-isystem} for that). If you use more than 659190075Sobrienone @option{-I} option, the directories are scanned in left-to-right 659290075Sobrienorder; the standard system directories come after. 659390075Sobrien 659490075SobrienIf a standard system include directory, or a directory specified with 6595104752Skan@option{-isystem}, is also specified with @option{-I}, the @option{-I} 6596104752Skanoption will be ignored. The directory will still be searched but as a 6597104752Skansystem directory at its normal position in the system include chain. 6598104752SkanThis is to ensure that GCC's procedure to fix buggy system headers and 6599117395Skanthe ordering for the include_next directive are not inadvertently changed. 6600104752SkanIf you really need to change the search order for system directories, 6601104752Skanuse the @option{-nostdinc} and/or @option{-isystem} options. 660290075Sobrien 6603169689Skan@item -iquote@var{dir} 6604169689Skan@opindex iquote 6605169689SkanAdd the directory @var{dir} to the head of the list of directories to 6606169689Skanbe searched for header files only for the case of @samp{#include 6607169689Skan"@var{file}"}; they are not searched for @samp{#include <@var{file}>}, 6608169689Skanotherwise just like @option{-I}. 660990075Sobrien 661090075Sobrien@item -L@var{dir} 661190075Sobrien@opindex L 661290075SobrienAdd directory @var{dir} to the list of directories to be searched 661390075Sobrienfor @option{-l}. 661490075Sobrien 661590075Sobrien@item -B@var{prefix} 661690075Sobrien@opindex B 661790075SobrienThis option specifies where to find the executables, libraries, 661890075Sobrieninclude files, and data files of the compiler itself. 661990075Sobrien 662090075SobrienThe compiler driver program runs one or more of the subprograms 662190075Sobrien@file{cpp}, @file{cc1}, @file{as} and @file{ld}. It tries 662290075Sobrien@var{prefix} as a prefix for each program it tries to run, both with and 662390075Sobrienwithout @samp{@var{machine}/@var{version}/} (@pxref{Target Options}). 662490075Sobrien 662590075SobrienFor each subprogram to be run, the compiler driver first tries the 662690075Sobrien@option{-B} prefix, if any. If that name is not found, or if @option{-B} 662790075Sobrienwas not specified, the driver tries two standard prefixes, which are 6628132718Skan@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of 662990075Sobrienthose results in a file name that is found, the unmodified program 663090075Sobrienname is searched for using the directories specified in your 663190075Sobrien@env{PATH} environment variable. 663290075Sobrien 663390075SobrienThe compiler will check to see if the path provided by the @option{-B} 663490075Sobrienrefers to a directory, and if necessary it will add a directory 663590075Sobrienseparator character at the end of the path. 663690075Sobrien 663790075Sobrien@option{-B} prefixes that effectively specify directory names also apply 663890075Sobriento libraries in the linker, because the compiler translates these 663990075Sobrienoptions into @option{-L} options for the linker. They also apply to 664090075Sobrienincludes files in the preprocessor, because the compiler translates these 664190075Sobrienoptions into @option{-isystem} options for the preprocessor. In this case, 664290075Sobrienthe compiler appends @samp{include} to the prefix. 664390075Sobrien 664490075SobrienThe run-time support file @file{libgcc.a} can also be searched for using 664590075Sobrienthe @option{-B} prefix, if needed. If it is not found there, the two 664690075Sobrienstandard prefixes above are tried, and that is all. The file is left 664790075Sobrienout of the link if it is not found by those means. 664890075Sobrien 664990075SobrienAnother way to specify a prefix much like the @option{-B} prefix is to use 665090075Sobrienthe environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment 665190075SobrienVariables}. 665290075Sobrien 665390075SobrienAs a special kludge, if the path provided by @option{-B} is 665490075Sobrien@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to 665590075Sobrien9, then it will be replaced by @file{[dir/]include}. This is to help 665690075Sobrienwith boot-strapping the compiler. 665790075Sobrien 665890075Sobrien@item -specs=@var{file} 665990075Sobrien@opindex specs 666090075SobrienProcess @var{file} after the compiler reads in the standard @file{specs} 666190075Sobrienfile, in order to override the defaults that the @file{gcc} driver 666290075Sobrienprogram uses when determining what switches to pass to @file{cc1}, 666390075Sobrien@file{cc1plus}, @file{as}, @file{ld}, etc. More than one 666490075Sobrien@option{-specs=@var{file}} can be specified on the command line, and they 666590075Sobrienare processed in order, from left to right. 6666169689Skan 6667169689Skan@item --sysroot=@var{dir} 6668169689Skan@opindex sysroot 6669169689SkanUse @var{dir} as the logical root directory for headers and libraries. 6670169689SkanFor example, if the compiler would normally search for headers in 6671169689Skan@file{/usr/include} and libraries in @file{/usr/lib}, it will instead 6672169689Skansearch @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}. 6673169689Skan 6674169689SkanIf you use both this option and the @option{-isysroot} option, then 6675169689Skanthe @option{--sysroot} option will apply to libraries, but the 6676169689Skan@option{-isysroot} option will apply to header files. 6677169689Skan 6678169689SkanThe GNU linker (beginning with version 2.16) has the necessary support 6679169689Skanfor this option. If your linker does not support this option, the 6680169689Skanheader file aspect of @option{--sysroot} will still work, but the 6681169689Skanlibrary aspect will not. 6682169689Skan 6683169689Skan@item -I- 6684169689Skan@opindex I- 6685169689SkanThis option has been deprecated. Please use @option{-iquote} instead for 6686169689Skan@option{-I} directories before the @option{-I-} and remove the @option{-I-}. 6687169689SkanAny directories you specify with @option{-I} options before the @option{-I-} 6688169689Skanoption are searched only for the case of @samp{#include "@var{file}"}; 6689169689Skanthey are not searched for @samp{#include <@var{file}>}. 6690169689Skan 6691169689SkanIf additional directories are specified with @option{-I} options after 6692169689Skanthe @option{-I-}, these directories are searched for all @samp{#include} 6693169689Skandirectives. (Ordinarily @emph{all} @option{-I} directories are used 6694169689Skanthis way.) 6695169689Skan 6696169689SkanIn addition, the @option{-I-} option inhibits the use of the current 6697169689Skandirectory (where the current input file came from) as the first search 6698169689Skandirectory for @samp{#include "@var{file}"}. There is no way to 6699169689Skanoverride this effect of @option{-I-}. With @option{-I.} you can specify 6700169689Skansearching the directory which was current when the compiler was 6701169689Skaninvoked. That is not exactly the same as what the preprocessor does 6702169689Skanby default, but it is often satisfactory. 6703169689Skan 6704169689Skan@option{-I-} does not inhibit the use of the standard system directories 6705169689Skanfor header files. Thus, @option{-I-} and @option{-nostdinc} are 6706169689Skanindependent. 670790075Sobrien@end table 670890075Sobrien 670990075Sobrien@c man end 671090075Sobrien 671190075Sobrien@node Spec Files 671290075Sobrien@section Specifying subprocesses and the switches to pass to them 671390075Sobrien@cindex Spec Files 6714117395Skan 671590075Sobrien@command{gcc} is a driver program. It performs its job by invoking a 671690075Sobriensequence of other programs to do the work of compiling, assembling and 671790075Sobrienlinking. GCC interprets its command-line parameters and uses these to 671890075Sobriendeduce which programs it should invoke, and which command-line options 671990075Sobrienit ought to place on their command lines. This behavior is controlled 672090075Sobrienby @dfn{spec strings}. In most cases there is one spec string for each 672190075Sobrienprogram that GCC can invoke, but a few programs have multiple spec 672290075Sobrienstrings to control their behavior. The spec strings built into GCC can 672390075Sobrienbe overridden by using the @option{-specs=} command-line switch to specify 672490075Sobriena spec file. 672590075Sobrien 672690075Sobrien@dfn{Spec files} are plaintext files that are used to construct spec 672790075Sobrienstrings. They consist of a sequence of directives separated by blank 672890075Sobrienlines. The type of directive is determined by the first non-whitespace 672990075Sobriencharacter on the line and it can be one of the following: 673090075Sobrien 673190075Sobrien@table @code 673290075Sobrien@item %@var{command} 673390075SobrienIssues a @var{command} to the spec file processor. The commands that can 673490075Sobrienappear here are: 673590075Sobrien 673690075Sobrien@table @code 673790075Sobrien@item %include <@var{file}> 673890075Sobrien@cindex %include 673990075SobrienSearch for @var{file} and insert its text at the current point in the 674090075Sobrienspecs file. 674190075Sobrien 674290075Sobrien@item %include_noerr <@var{file}> 674390075Sobrien@cindex %include_noerr 674490075SobrienJust like @samp{%include}, but do not generate an error message if the include 674590075Sobrienfile cannot be found. 674690075Sobrien 674790075Sobrien@item %rename @var{old_name} @var{new_name} 674890075Sobrien@cindex %rename 674990075SobrienRename the spec string @var{old_name} to @var{new_name}. 675090075Sobrien 675190075Sobrien@end table 675290075Sobrien 675390075Sobrien@item *[@var{spec_name}]: 675490075SobrienThis tells the compiler to create, override or delete the named spec 675590075Sobrienstring. All lines after this directive up to the next directive or 675690075Sobrienblank line are considered to be the text for the spec string. If this 675790075Sobrienresults in an empty string then the spec will be deleted. (Or, if the 675890075Sobrienspec did not exist, then nothing will happened.) Otherwise, if the spec 675990075Sobriendoes not currently exist a new spec will be created. If the spec does 676090075Sobrienexist then its contents will be overridden by the text of this 676190075Sobriendirective, unless the first character of that text is the @samp{+} 676290075Sobriencharacter, in which case the text will be appended to the spec. 676390075Sobrien 676490075Sobrien@item [@var{suffix}]: 676590075SobrienCreates a new @samp{[@var{suffix}] spec} pair. All lines after this directive 676690075Sobrienand up to the next directive or blank line are considered to make up the 676790075Sobrienspec string for the indicated suffix. When the compiler encounters an 676890075Sobrieninput file with the named suffix, it will processes the spec string in 676990075Sobrienorder to work out how to compile that file. For example: 677090075Sobrien 677190075Sobrien@smallexample 677290075Sobrien.ZZ: 677390075Sobrienz-compile -input %i 677490075Sobrien@end smallexample 677590075Sobrien 677690075SobrienThis says that any input file whose name ends in @samp{.ZZ} should be 677790075Sobrienpassed to the program @samp{z-compile}, which should be invoked with the 677890075Sobriencommand-line switch @option{-input} and with the result of performing the 677990075Sobrien@samp{%i} substitution. (See below.) 678090075Sobrien 678190075SobrienAs an alternative to providing a spec string, the text that follows a 678290075Sobriensuffix directive can be one of the following: 678390075Sobrien 678490075Sobrien@table @code 678590075Sobrien@item @@@var{language} 678690075SobrienThis says that the suffix is an alias for a known @var{language}. This is 678790075Sobriensimilar to using the @option{-x} command-line switch to GCC to specify a 678890075Sobrienlanguage explicitly. For example: 678990075Sobrien 679090075Sobrien@smallexample 679190075Sobrien.ZZ: 679290075Sobrien@@c++ 679390075Sobrien@end smallexample 679490075Sobrien 679590075SobrienSays that .ZZ files are, in fact, C++ source files. 679690075Sobrien 679790075Sobrien@item #@var{name} 679890075SobrienThis causes an error messages saying: 679990075Sobrien 680090075Sobrien@smallexample 680190075Sobrien@var{name} compiler not installed on this system. 680290075Sobrien@end smallexample 680390075Sobrien@end table 680490075Sobrien 680590075SobrienGCC already has an extensive list of suffixes built into it. 680690075SobrienThis directive will add an entry to the end of the list of suffixes, but 680790075Sobriensince the list is searched from the end backwards, it is effectively 680890075Sobrienpossible to override earlier entries using this technique. 680990075Sobrien 681090075Sobrien@end table 681190075Sobrien 681290075SobrienGCC has the following spec strings built into it. Spec files can 681390075Sobrienoverride these strings or create their own. Note that individual 681490075Sobrientargets can also add their own spec strings to this list. 681590075Sobrien 681690075Sobrien@smallexample 681790075Sobrienasm Options to pass to the assembler 681890075Sobrienasm_final Options to pass to the assembler post-processor 681990075Sobriencpp Options to pass to the C preprocessor 682090075Sobriencc1 Options to pass to the C compiler 682190075Sobriencc1plus Options to pass to the C++ compiler 682290075Sobrienendfile Object files to include at the end of the link 682390075Sobrienlink Options to pass to the linker 682490075Sobrienlib Libraries to include on the command line to the linker 682590075Sobrienlibgcc Decides which GCC support library to pass to the linker 682690075Sobrienlinker Sets the name of the linker 682790075Sobrienpredefines Defines to be passed to the C preprocessor 682890075Sobriensigned_char Defines to pass to CPP to say whether @code{char} is signed 682990075Sobrien by default 683090075Sobrienstartfile Object files to include at the start of the link 683190075Sobrien@end smallexample 683290075Sobrien 683390075SobrienHere is a small example of a spec file: 683490075Sobrien 683590075Sobrien@smallexample 683690075Sobrien%rename lib old_lib 683790075Sobrien 683890075Sobrien*lib: 683990075Sobrien--start-group -lgcc -lc -leval1 --end-group %(old_lib) 684090075Sobrien@end smallexample 684190075Sobrien 684290075SobrienThis example renames the spec called @samp{lib} to @samp{old_lib} and 684390075Sobrienthen overrides the previous definition of @samp{lib} with a new one. 684490075SobrienThe new definition adds in some extra command-line options before 684590075Sobrienincluding the text of the old definition. 684690075Sobrien 684790075Sobrien@dfn{Spec strings} are a list of command-line options to be passed to their 684890075Sobriencorresponding program. In addition, the spec strings can contain 684990075Sobrien@samp{%}-prefixed sequences to substitute variable text or to 685090075Sobrienconditionally insert text into the command line. Using these constructs 685190075Sobrienit is possible to generate quite complex command lines. 685290075Sobrien 685390075SobrienHere is a table of all defined @samp{%}-sequences for spec 685490075Sobrienstrings. Note that spaces are not generated automatically around the 685590075Sobrienresults of expanding these sequences. Therefore you can concatenate them 685690075Sobrientogether or combine them with constant text in a single argument. 685790075Sobrien 685890075Sobrien@table @code 685990075Sobrien@item %% 686090075SobrienSubstitute one @samp{%} into the program name or argument. 686190075Sobrien 686290075Sobrien@item %i 686390075SobrienSubstitute the name of the input file being processed. 686490075Sobrien 686590075Sobrien@item %b 686690075SobrienSubstitute the basename of the input file being processed. 686790075SobrienThis is the substring up to (and not including) the last period 686890075Sobrienand not including the directory. 686990075Sobrien 687090075Sobrien@item %B 687190075SobrienThis is the same as @samp{%b}, but include the file suffix (text after 687290075Sobrienthe last period). 687390075Sobrien 687490075Sobrien@item %d 687590075SobrienMarks the argument containing or following the @samp{%d} as a 687690075Sobrientemporary file name, so that that file will be deleted if GCC exits 687790075Sobriensuccessfully. Unlike @samp{%g}, this contributes no text to the 687890075Sobrienargument. 687990075Sobrien 688090075Sobrien@item %g@var{suffix} 688190075SobrienSubstitute a file name that has suffix @var{suffix} and is chosen 688290075Sobrienonce per compilation, and mark the argument in the same way as 688390075Sobrien@samp{%d}. To reduce exposure to denial-of-service attacks, the file 688490075Sobrienname is now chosen in a way that is hard to predict even when previously 688590075Sobrienchosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s} 688690075Sobrienmight turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches 688790075Sobrienthe regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is 688890075Sobrientreated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g} 688990075Sobrienwas simply substituted with a file name chosen once per compilation, 689090075Sobrienwithout regard to any appended suffix (which was therefore treated 689190075Sobrienjust like ordinary text), making such attacks more likely to succeed. 689290075Sobrien 689390075Sobrien@item %u@var{suffix} 689490075SobrienLike @samp{%g}, but generates a new temporary file name even if 689590075Sobrien@samp{%u@var{suffix}} was already seen. 689690075Sobrien 689790075Sobrien@item %U@var{suffix} 689890075SobrienSubstitutes the last file name generated with @samp{%u@var{suffix}}, generating a 689990075Sobriennew one if there is no such last file name. In the absence of any 690090075Sobrien@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share 690190075Sobrienthe same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s} 690290075Sobrienwould involve the generation of two distinct file names, one 690390075Sobrienfor each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was 690490075Sobriensimply substituted with a file name chosen for the previous @samp{%u}, 690590075Sobrienwithout regard to any appended suffix. 690690075Sobrien 6907119256Skan@item %j@var{suffix} 690890075SobrienSubstitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is 690990075Sobrienwritable, and if save-temps is off; otherwise, substitute the name 691090075Sobrienof a temporary file, just like @samp{%u}. This temporary file is not 691190075Sobrienmeant for communication between processes, but rather as a junk 691290075Sobriendisposal mechanism. 691390075Sobrien 6914132718Skan@item %|@var{suffix} 6915132718Skan@itemx %m@var{suffix} 6916132718SkanLike @samp{%g}, except if @option{-pipe} is in effect. In that case 6917132718Skan@samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at 6918132718Skanall. These are the two most common ways to instruct a program that it 6919132718Skanshould read from standard input or write to standard output. If you 6920132718Skanneed something more elaborate you can use an @samp{%@{pipe:@code{X}@}} 6921132718Skanconstruct: see for example @file{f/lang-specs.h}. 6922132718Skan 692390075Sobrien@item %.@var{SUFFIX} 692490075SobrienSubstitutes @var{.SUFFIX} for the suffixes of a matched switch's args 692590075Sobrienwhen it is subsequently output with @samp{%*}. @var{SUFFIX} is 692690075Sobrienterminated by the next space or %. 692790075Sobrien 692890075Sobrien@item %w 692990075SobrienMarks the argument containing or following the @samp{%w} as the 693090075Sobriendesignated output file of this compilation. This puts the argument 693190075Sobrieninto the sequence of arguments that @samp{%o} will substitute later. 693290075Sobrien 693390075Sobrien@item %o 693490075SobrienSubstitutes the names of all the output files, with spaces 693590075Sobrienautomatically placed around them. You should write spaces 693690075Sobrienaround the @samp{%o} as well or the results are undefined. 693790075Sobrien@samp{%o} is for use in the specs for running the linker. 693890075SobrienInput files whose names have no recognized suffix are not compiled 693990075Sobrienat all, but they are included among the output files, so they will 694090075Sobrienbe linked. 694190075Sobrien 694290075Sobrien@item %O 694390075SobrienSubstitutes the suffix for object files. Note that this is 694490075Sobrienhandled specially when it immediately follows @samp{%g, %u, or %U}, 694590075Sobrienbecause of the need for those to form complete file names. The 694690075Sobrienhandling is such that @samp{%O} is treated exactly as if it had already 694790075Sobrienbeen substituted, except that @samp{%g, %u, and %U} do not currently 694890075Sobriensupport additional @var{suffix} characters following @samp{%O} as they would 694990075Sobrienfollowing, for example, @samp{.o}. 695090075Sobrien 695190075Sobrien@item %p 695290075SobrienSubstitutes the standard macro predefinitions for the 695390075Sobriencurrent target machine. Use this when running @code{cpp}. 695490075Sobrien 695590075Sobrien@item %P 695690075SobrienLike @samp{%p}, but puts @samp{__} before and after the name of each 695790075Sobrienpredefined macro, except for macros that start with @samp{__} or with 695890075Sobrien@samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO 695990075SobrienC@. 696090075Sobrien 696190075Sobrien@item %I 6962132718SkanSubstitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}), 6963169689Skan@option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}), 6964132718Skan@option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options) 6965169689Skanand @option{-imultilib} as necessary. 696690075Sobrien 696790075Sobrien@item %s 696890075SobrienCurrent argument is the name of a library or startup file of some sort. 696990075SobrienSearch for that file in a standard list of directories and substitute 697090075Sobrienthe full name found. 697190075Sobrien 697290075Sobrien@item %e@var{str} 697390075SobrienPrint @var{str} as an error message. @var{str} is terminated by a newline. 697490075SobrienUse this when inconsistent options are detected. 697590075Sobrien 697690075Sobrien@item %(@var{name}) 697790075SobrienSubstitute the contents of spec string @var{name} at this point. 697890075Sobrien 697990075Sobrien@item %[@var{name}] 698090075SobrienLike @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments. 698190075Sobrien 698290075Sobrien@item %x@{@var{option}@} 698390075SobrienAccumulate an option for @samp{%X}. 698490075Sobrien 698590075Sobrien@item %X 698690075SobrienOutput the accumulated linker options specified by @option{-Wl} or a @samp{%x} 698790075Sobrienspec string. 698890075Sobrien 698990075Sobrien@item %Y 699090075SobrienOutput the accumulated assembler options specified by @option{-Wa}. 699190075Sobrien 699290075Sobrien@item %Z 699390075SobrienOutput the accumulated preprocessor options specified by @option{-Wp}. 699490075Sobrien 699590075Sobrien@item %a 699690075SobrienProcess the @code{asm} spec. This is used to compute the 699790075Sobrienswitches to be passed to the assembler. 699890075Sobrien 699990075Sobrien@item %A 700090075SobrienProcess the @code{asm_final} spec. This is a spec string for 700190075Sobrienpassing switches to an assembler post-processor, if such a program is 700290075Sobrienneeded. 700390075Sobrien 700490075Sobrien@item %l 700590075SobrienProcess the @code{link} spec. This is the spec for computing the 700690075Sobriencommand line passed to the linker. Typically it will make use of the 700790075Sobrien@samp{%L %G %S %D and %E} sequences. 700890075Sobrien 700990075Sobrien@item %D 701090075SobrienDump out a @option{-L} option for each directory that GCC believes might 701190075Sobriencontain startup files. If the target supports multilibs then the 701290075Sobriencurrent multilib directory will be prepended to each of these paths. 701390075Sobrien 701490075Sobrien@item %L 701590075SobrienProcess the @code{lib} spec. This is a spec string for deciding which 701690075Sobrienlibraries should be included on the command line to the linker. 701790075Sobrien 701890075Sobrien@item %G 701990075SobrienProcess the @code{libgcc} spec. This is a spec string for deciding 702090075Sobrienwhich GCC support library should be included on the command line to the linker. 702190075Sobrien 702290075Sobrien@item %S 702390075SobrienProcess the @code{startfile} spec. This is a spec for deciding which 702490075Sobrienobject files should be the first ones passed to the linker. Typically 702590075Sobrienthis might be a file named @file{crt0.o}. 702690075Sobrien 702790075Sobrien@item %E 702890075SobrienProcess the @code{endfile} spec. This is a spec string that specifies 702990075Sobrienthe last object files that will be passed to the linker. 703090075Sobrien 703190075Sobrien@item %C 703290075SobrienProcess the @code{cpp} spec. This is used to construct the arguments 703390075Sobriento be passed to the C preprocessor. 703490075Sobrien 703590075Sobrien@item %1 703690075SobrienProcess the @code{cc1} spec. This is used to construct the options to be 703790075Sobrienpassed to the actual C compiler (@samp{cc1}). 703890075Sobrien 703990075Sobrien@item %2 704090075SobrienProcess the @code{cc1plus} spec. This is used to construct the options to be 704190075Sobrienpassed to the actual C++ compiler (@samp{cc1plus}). 704290075Sobrien 704390075Sobrien@item %* 704490075SobrienSubstitute the variable part of a matched option. See below. 704590075SobrienNote that each comma in the substituted string is replaced by 704690075Sobriena single space. 704790075Sobrien 7048132718Skan@item %<@code{S} 7049132718SkanRemove all occurrences of @code{-S} from the command line. Note---this 7050132718Skancommand is position dependent. @samp{%} commands in the spec string 7051132718Skanbefore this one will see @code{-S}, @samp{%} commands in the spec string 7052132718Skanafter this one will not. 7053132718Skan 7054117395Skan@item %:@var{function}(@var{args}) 7055117395SkanCall the named function @var{function}, passing it @var{args}. 7056117395Skan@var{args} is first processed as a nested spec string, then split 7057117395Skaninto an argument vector in the usual fashion. The function returns 7058117395Skana string which is processed as if it had appeared literally as part 7059117395Skanof the current spec. 7060117395Skan 7061117395SkanThe following built-in spec functions are provided: 7062117395Skan 7063117395Skan@table @code 7064117395Skan@item @code{if-exists} 7065117395SkanThe @code{if-exists} spec function takes one argument, an absolute 7066117395Skanpathname to a file. If the file exists, @code{if-exists} returns the 7067117395Skanpathname. Here is a small example of its usage: 7068117395Skan 7069117395Skan@smallexample 7070117395Skan*startfile: 7071117395Skancrt0%O%s %:if-exists(crti%O%s) crtbegin%O%s 7072117395Skan@end smallexample 7073117395Skan 7074117395Skan@item @code{if-exists-else} 7075117395SkanThe @code{if-exists-else} spec function is similar to the @code{if-exists} 7076117395Skanspec function, except that it takes two arguments. The first argument is 7077117395Skanan absolute pathname to a file. If the file exists, @code{if-exists-else} 7078117395Skanreturns the pathname. If it does not exist, it returns the second argument. 7079117395SkanThis way, @code{if-exists-else} can be used to select one file or another, 7080117395Skanbased on the existence of the first. Here is a small example of its usage: 7081117395Skan 7082132718Skan@smallexample 7083117395Skan*startfile: 7084117395Skancrt0%O%s %:if-exists(crti%O%s) \ 7085117395Skan%:if-exists-else(crtbeginT%O%s crtbegin%O%s) 7086117395Skan@end smallexample 7087169689Skan 7088169689Skan@item @code{replace-outfile} 7089169689SkanThe @code{replace-outfile} spec function takes two arguments. It looks for the 7090169689Skanfirst argument in the outfiles array and replaces it with the second argument. Here 7091169689Skanis a small example of its usage: 7092169689Skan 7093169689Skan@smallexample 7094220755Sdim%@{static|static-libgcc|static-libstdc++:%:replace-outfile(-lstdc++ \ 7095220755Sdimlibstdc++.a%s)@} 7096220755Sdim 7097169689Skan@end smallexample 7098169689Skan 7099132718Skan@end table 7100117395Skan 710190075Sobrien@item %@{@code{S}@} 710290075SobrienSubstitutes the @code{-S} switch, if that switch was given to GCC@. 710390075SobrienIf that switch was not specified, this substitutes nothing. Note that 710490075Sobrienthe leading dash is omitted when specifying this option, and it is 710590075Sobrienautomatically inserted if the substitution is performed. Thus the spec 710690075Sobrienstring @samp{%@{foo@}} would match the command-line option @option{-foo} 710790075Sobrienand would output the command line option @option{-foo}. 710890075Sobrien 710990075Sobrien@item %W@{@code{S}@} 711090075SobrienLike %@{@code{S}@} but mark last argument supplied within as a file to be 711190075Sobriendeleted on failure. 711290075Sobrien 711390075Sobrien@item %@{@code{S}*@} 711490075SobrienSubstitutes all the switches specified to GCC whose names start 711590075Sobrienwith @code{-S}, but which also take an argument. This is used for 711690075Sobrienswitches like @option{-o}, @option{-D}, @option{-I}, etc. 711790075SobrienGCC considers @option{-o foo} as being 711890075Sobrienone switch whose names starts with @samp{o}. %@{o*@} would substitute this 711990075Sobrientext, including the space. Thus two arguments would be generated. 712090075Sobrien 712190075Sobrien@item %@{@code{S}*&@code{T}*@} 712290075SobrienLike %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options 712390075Sobrien(the order of @code{S} and @code{T} in the spec is not significant). 712490075SobrienThere can be any number of ampersand-separated variables; for each the 712590075Sobrienwild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}. 712690075Sobrien 712790075Sobrien@item %@{@code{S}:@code{X}@} 7128132718SkanSubstitutes @code{X}, if the @samp{-S} switch was given to GCC@. 712990075Sobrien 713090075Sobrien@item %@{!@code{S}:@code{X}@} 7131132718SkanSubstitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@. 713290075Sobrien 7133132718Skan@item %@{@code{S}*:@code{X}@} 7134132718SkanSubstitutes @code{X} if one or more switches whose names start with 7135132718Skan@code{-S} are specified to GCC@. Normally @code{X} is substituted only 7136132718Skanonce, no matter how many such switches appeared. However, if @code{%*} 7137132718Skanappears somewhere in @code{X}, then @code{X} will be substituted once 7138132718Skanfor each matching switch, with the @code{%*} replaced by the part of 7139132718Skanthat switch that matched the @code{*}. 714090075Sobrien 714190075Sobrien@item %@{.@code{S}:@code{X}@} 7142132718SkanSubstitutes @code{X}, if processing a file with suffix @code{S}. 714390075Sobrien 714490075Sobrien@item %@{!.@code{S}:@code{X}@} 7145132718SkanSubstitutes @code{X}, if @emph{not} processing a file with suffix @code{S}. 714690075Sobrien 714790075Sobrien@item %@{@code{S}|@code{P}:@code{X}@} 7148132718SkanSubstitutes @code{X} if either @code{-S} or @code{-P} was given to GCC@. 7149132718SkanThis may be combined with @samp{!}, @samp{.}, and @code{*} sequences as well, 7150132718Skanalthough they have a stronger binding than the @samp{|}. If @code{%*} 7151132718Skanappears in @code{X}, all of the alternatives must be starred, and only 7152132718Skanthe first matching alternative is substituted. 715390075Sobrien 7154132718SkanFor example, a spec string like this: 7155132718Skan 715690075Sobrien@smallexample 715790075Sobrien%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@} 715890075Sobrien@end smallexample 715990075Sobrien 716090075Sobrienwill output the following command-line options from the following input 716190075Sobriencommand-line options: 716290075Sobrien 716390075Sobrien@smallexample 716490075Sobrienfred.c -foo -baz 716590075Sobrienjim.d -bar -boggle 716690075Sobrien-d fred.c -foo -baz -boggle 716790075Sobrien-d jim.d -bar -baz -boggle 716890075Sobrien@end smallexample 716990075Sobrien 7170132718Skan@item %@{S:X; T:Y; :D@} 7171132718Skan 7172132718SkanIf @code{S} was given to GCC, substitutes @code{X}; else if @code{T} was 7173132718Skangiven to GCC, substitutes @code{Y}; else substitutes @code{D}. There can 7174132718Skanbe as many clauses as you need. This may be combined with @code{.}, 7175132718Skan@code{!}, @code{|}, and @code{*} as needed. 7176132718Skan 7177132718Skan 717890075Sobrien@end table 717990075Sobrien 7180132718SkanThe conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar 7181132718Skanconstruct may contain other nested @samp{%} constructs or spaces, or 7182132718Skaneven newlines. They are processed as usual, as described above. 7183132718SkanTrailing white space in @code{X} is ignored. White space may also 7184132718Skanappear anywhere on the left side of the colon in these constructs, 7185132718Skanexcept between @code{.} or @code{*} and the corresponding word. 718690075Sobrien 7187132718SkanThe @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are 7188132718Skanhandled specifically in these constructs. If another value of 7189132718Skan@option{-O} or the negated form of a @option{-f}, @option{-m}, or 7190132718Skan@option{-W} switch is found later in the command line, the earlier 7191132718Skanswitch value is ignored, except with @{@code{S}*@} where @code{S} is 7192132718Skanjust one letter, which passes all matching options. 719390075Sobrien 7194132718SkanThe character @samp{|} at the beginning of the predicate text is used to 7195132718Skanindicate that a command should be piped to the following command, but 7196132718Skanonly if @option{-pipe} is specified. 719790075Sobrien 719890075SobrienIt is built into GCC which switches take arguments and which do not. 719990075Sobrien(You might think it would be useful to generalize this to allow each 720090075Sobriencompiler's spec to say which switches take arguments. But this cannot 720190075Sobrienbe done in a consistent fashion. GCC cannot even decide which input 720290075Sobrienfiles have been specified without knowing which switches take arguments, 720390075Sobrienand it must know which input files to compile in order to tell which 720490075Sobriencompilers to run). 720590075Sobrien 720690075SobrienGCC also knows implicitly that arguments starting in @option{-l} are to be 720790075Sobrientreated as compiler output files, and passed to the linker in their 720890075Sobrienproper position among the other output files. 720990075Sobrien 721090075Sobrien@c man begin OPTIONS 721190075Sobrien 721290075Sobrien@node Target Options 721390075Sobrien@section Specifying Target Machine and Compiler Version 721490075Sobrien@cindex target options 721590075Sobrien@cindex cross compiling 721690075Sobrien@cindex specifying machine version 721790075Sobrien@cindex specifying compiler version and target machine 721890075Sobrien@cindex compiler version, specifying 721990075Sobrien@cindex target machine, specifying 722090075Sobrien 7221117395SkanThe usual way to run GCC is to run the executable called @file{gcc}, or 7222117395Skan@file{<machine>-gcc} when cross-compiling, or 7223117395Skan@file{<machine>-gcc-<version>} to run a version other than the one that 7224117395Skanwas installed last. Sometimes this is inconvenient, so GCC provides 7225117395Skanoptions that will switch to another cross-compiler or version. 722690075Sobrien 722790075Sobrien@table @gcctabopt 722890075Sobrien@item -b @var{machine} 722990075Sobrien@opindex b 723090075SobrienThe argument @var{machine} specifies the target machine for compilation. 723190075Sobrien 723290075SobrienThe value to use for @var{machine} is the same as was specified as the 723390075Sobrienmachine type when configuring GCC as a cross-compiler. For 723490075Sobrienexample, if a cross-compiler was configured with @samp{configure 7235169689Skanarm-elf}, meaning to compile for an arm processor with elf binaries, 7236169689Skanthen you would specify @option{-b arm-elf} to run that cross compiler. 7237169689SkanBecause there are other options beginning with @option{-b}, the 7238169689Skanconfiguration must contain a hyphen. 723990075Sobrien 724090075Sobrien@item -V @var{version} 724190075Sobrien@opindex V 724290075SobrienThe argument @var{version} specifies which version of GCC to run. 724390075SobrienThis is useful when multiple versions are installed. For example, 7244169689Skan@var{version} might be @samp{4.0}, meaning to run GCC version 4.0. 724590075Sobrien@end table 724690075Sobrien 7247117395SkanThe @option{-V} and @option{-b} options work by running the 7248117395Skan@file{<machine>-gcc-<version>} executable, so there's no real reason to 7249117395Skanuse them if you can just run that directly. 725090075Sobrien 725190075Sobrien@node Submodel Options 725290075Sobrien@section Hardware Models and Configurations 725390075Sobrien@cindex submodel options 725490075Sobrien@cindex specifying hardware config 725590075Sobrien@cindex hardware models and configurations, specifying 725690075Sobrien@cindex machine dependent options 725790075Sobrien 725890075SobrienEarlier we discussed the standard option @option{-b} which chooses among 725990075Sobriendifferent installed compilers for completely different target 726090075Sobrienmachines, such as VAX vs.@: 68000 vs.@: 80386. 726190075Sobrien 726290075SobrienIn addition, each of these target machine types can have its own 726390075Sobrienspecial options, starting with @samp{-m}, to choose among various 726490075Sobrienhardware models or configurations---for example, 68010 vs 68020, 726590075Sobrienfloating coprocessor or none. A single installed version of the 726690075Sobriencompiler can compile for any model or configuration, according to the 726790075Sobrienoptions specified. 726890075Sobrien 726990075SobrienSome configurations of the compiler also support additional special 727090075Sobrienoptions, usually for compatibility with other compilers on the same 727190075Sobrienplatform. 727290075Sobrien 7273169689Skan@c This list is ordered alphanumerically by subsection name. 7274169689Skan@c It should be the same order and spelling as these options are listed 7275169689Skan@c in Machine Dependent Options 727690075Sobrien 727790075Sobrien@menu 7278169689Skan* ARC Options:: 727990075Sobrien* ARM Options:: 7280169689Skan* AVR Options:: 7281169689Skan* Blackfin Options:: 7282169689Skan* CRIS Options:: 7283169689Skan* CRX Options:: 7284117395Skan* Darwin Options:: 728590075Sobrien* DEC Alpha Options:: 728690075Sobrien* DEC Alpha/VMS Options:: 7287169689Skan* FRV Options:: 7288169689Skan* GNU/Linux Options:: 728990075Sobrien* H8/300 Options:: 7290169689Skan* HPPA Options:: 7291169689Skan* i386 and x86-64 Options:: 7292169689Skan* IA-64 Options:: 7293169689Skan* M32C Options:: 7294169689Skan* M32R/D Options:: 7295169689Skan* M680x0 Options:: 7296169689Skan* M68hc1x Options:: 7297169689Skan* MCore Options:: 7298169689Skan* MIPS Options:: 7299169689Skan* MMIX Options:: 7300169689Skan* MN10300 Options:: 7301169689Skan* MT Options:: 7302169689Skan* PDP-11 Options:: 7303169689Skan* PowerPC Options:: 7304169689Skan* RS/6000 and PowerPC Options:: 7305169689Skan* S/390 and zSeries Options:: 7306169689Skan* Score Options:: 730790075Sobrien* SH Options:: 7308169689Skan* SPARC Options:: 730990075Sobrien* System V Options:: 731090075Sobrien* TMS320C3x/C4x Options:: 731190075Sobrien* V850 Options:: 7312169689Skan* VAX Options:: 7313169689Skan* x86-64 Options:: 731490075Sobrien* Xstormy16 Options:: 731590075Sobrien* Xtensa Options:: 7316169689Skan* zSeries Options:: 731790075Sobrien@end menu 731890075Sobrien 7319169689Skan@node ARC Options 7320169689Skan@subsection ARC Options 7321169689Skan@cindex ARC Options 732290075Sobrien 7323169689SkanThese options are defined for ARC implementations: 732490075Sobrien 732590075Sobrien@table @gcctabopt 7326169689Skan@item -EL 7327169689Skan@opindex EL 7328169689SkanCompile code for little endian mode. This is the default. 732990075Sobrien 7330169689Skan@item -EB 7331169689Skan@opindex EB 7332169689SkanCompile code for big endian mode. 733390075Sobrien 7334169689Skan@item -mmangle-cpu 7335169689Skan@opindex mmangle-cpu 7336169689SkanPrepend the name of the cpu to all public symbol names. 7337169689SkanIn multiple-processor systems, there are many ARC variants with different 7338169689Skaninstruction and register set characteristics. This flag prevents code 7339169689Skancompiled for one cpu to be linked with code compiled for another. 7340169689SkanNo facility exists for handling variants that are ``almost identical''. 7341169689SkanThis is an all or nothing option. 734290075Sobrien 7343169689Skan@item -mcpu=@var{cpu} 734490075Sobrien@opindex mcpu 7345169689SkanCompile code for ARC variant @var{cpu}. 7346169689SkanWhich variants are supported depend on the configuration. 7347169689SkanAll variants support @option{-mcpu=base}, this is the default. 734890075Sobrien 7349169689Skan@item -mtext=@var{text-section} 7350169689Skan@itemx -mdata=@var{data-section} 7351169689Skan@itemx -mrodata=@var{readonly-data-section} 7352169689Skan@opindex mtext 7353169689Skan@opindex mdata 7354169689Skan@opindex mrodata 7355169689SkanPut functions, data, and readonly data in @var{text-section}, 7356169689Skan@var{data-section}, and @var{readonly-data-section} respectively 7357169689Skanby default. This can be overridden with the @code{section} attribute. 7358169689Skan@xref{Variable Attributes}. 735990075Sobrien 736090075Sobrien@end table 736190075Sobrien 736290075Sobrien@node ARM Options 736390075Sobrien@subsection ARM Options 736490075Sobrien@cindex ARM options 736590075Sobrien 736690075SobrienThese @samp{-m} options are defined for Advanced RISC Machines (ARM) 736790075Sobrienarchitectures: 736890075Sobrien 736990075Sobrien@table @gcctabopt 7370169689Skan@item -mabi=@var{name} 7371169689Skan@opindex mabi 7372169689SkanGenerate code for the specified ABI@. Permissible values are: @samp{apcs-gnu}, 7373169689Skan@samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}. 7374169689Skan 737590075Sobrien@item -mapcs-frame 737690075Sobrien@opindex mapcs-frame 737790075SobrienGenerate a stack frame that is compliant with the ARM Procedure Call 737890075SobrienStandard for all functions, even if this is not strictly necessary for 737990075Sobriencorrect execution of the code. Specifying @option{-fomit-frame-pointer} 738090075Sobrienwith this option will cause the stack frames not to be generated for 738190075Sobrienleaf functions. The default is @option{-mno-apcs-frame}. 738290075Sobrien 738390075Sobrien@item -mapcs 738490075Sobrien@opindex mapcs 738590075SobrienThis is a synonym for @option{-mapcs-frame}. 738690075Sobrien 738790075Sobrien@ignore 738890075Sobrien@c not currently implemented 738990075Sobrien@item -mapcs-stack-check 739090075Sobrien@opindex mapcs-stack-check 739190075SobrienGenerate code to check the amount of stack space available upon entry to 739290075Sobrienevery function (that actually uses some stack space). If there is 739390075Sobrieninsufficient space available then either the function 739490075Sobrien@samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be 739590075Sobriencalled, depending upon the amount of stack space required. The run time 739690075Sobriensystem is required to provide these functions. The default is 739790075Sobrien@option{-mno-apcs-stack-check}, since this produces smaller code. 739890075Sobrien 739990075Sobrien@c not currently implemented 740090075Sobrien@item -mapcs-float 740190075Sobrien@opindex mapcs-float 740290075SobrienPass floating point arguments using the float point registers. This is 740390075Sobrienone of the variants of the APCS@. This option is recommended if the 740490075Sobrientarget hardware has a floating point unit or if a lot of floating point 740590075Sobrienarithmetic is going to be performed by the code. The default is 740690075Sobrien@option{-mno-apcs-float}, since integer only code is slightly increased in 740790075Sobriensize if @option{-mapcs-float} is used. 740890075Sobrien 740990075Sobrien@c not currently implemented 741090075Sobrien@item -mapcs-reentrant 741190075Sobrien@opindex mapcs-reentrant 741290075SobrienGenerate reentrant, position independent code. The default is 741390075Sobrien@option{-mno-apcs-reentrant}. 741490075Sobrien@end ignore 741590075Sobrien 741690075Sobrien@item -mthumb-interwork 741790075Sobrien@opindex mthumb-interwork 741890075SobrienGenerate code which supports calling between the ARM and Thumb 741990075Sobrieninstruction sets. Without this option the two instruction sets cannot 742090075Sobrienbe reliably used inside one program. The default is 742190075Sobrien@option{-mno-thumb-interwork}, since slightly larger code is generated 742290075Sobrienwhen @option{-mthumb-interwork} is specified. 742390075Sobrien 742490075Sobrien@item -mno-sched-prolog 742590075Sobrien@opindex mno-sched-prolog 742690075SobrienPrevent the reordering of instructions in the function prolog, or the 742790075Sobrienmerging of those instruction with the instructions in the function's 742890075Sobrienbody. This means that all functions will start with a recognizable set 742990075Sobrienof instructions (or in fact one of a choice from a small set of 743090075Sobriendifferent function prologues), and this information can be used to 743190075Sobrienlocate the start if functions inside an executable piece of code. The 743290075Sobriendefault is @option{-msched-prolog}. 743390075Sobrien 743490075Sobrien@item -mhard-float 743590075Sobrien@opindex mhard-float 743690075SobrienGenerate output containing floating point instructions. This is the 743790075Sobriendefault. 743890075Sobrien 743990075Sobrien@item -msoft-float 744090075Sobrien@opindex msoft-float 744190075SobrienGenerate output containing library calls for floating point. 744290075Sobrien@strong{Warning:} the requisite libraries are not available for all ARM 744390075Sobrientargets. Normally the facilities of the machine's usual C compiler are 744490075Sobrienused, but this cannot be done directly in cross-compilation. You must make 744590075Sobrienyour own arrangements to provide suitable library functions for 744690075Sobriencross-compilation. 744790075Sobrien 744890075Sobrien@option{-msoft-float} changes the calling convention in the output file; 744990075Sobrientherefore, it is only useful if you compile @emph{all} of a program with 745090075Sobrienthis option. In particular, you need to compile @file{libgcc.a}, the 745190075Sobrienlibrary that comes with GCC, with @option{-msoft-float} in order for 745290075Sobrienthis to work. 745390075Sobrien 7454169689Skan@item -mfloat-abi=@var{name} 7455169689Skan@opindex mfloat-abi 7456169689SkanSpecifies which ABI to use for floating point values. Permissible values 7457169689Skanare: @samp{soft}, @samp{softfp} and @samp{hard}. 7458169689Skan 7459169689Skan@samp{soft} and @samp{hard} are equivalent to @option{-msoft-float} 7460169689Skanand @option{-mhard-float} respectively. @samp{softfp} allows the generation 7461169689Skanof floating point instructions, but still uses the soft-float calling 7462169689Skanconventions. 7463169689Skan 746490075Sobrien@item -mlittle-endian 746590075Sobrien@opindex mlittle-endian 746690075SobrienGenerate code for a processor running in little-endian mode. This is 746790075Sobrienthe default for all standard configurations. 746890075Sobrien 746990075Sobrien@item -mbig-endian 747090075Sobrien@opindex mbig-endian 747190075SobrienGenerate code for a processor running in big-endian mode; the default is 747290075Sobriento compile code for a little-endian processor. 747390075Sobrien 747490075Sobrien@item -mwords-little-endian 747590075Sobrien@opindex mwords-little-endian 747690075SobrienThis option only applies when generating code for big-endian processors. 747790075SobrienGenerate code for a little-endian word order but a big-endian byte 747890075Sobrienorder. That is, a byte order of the form @samp{32107654}. Note: this 747990075Sobrienoption should only be used if you require compatibility with code for 748090075Sobrienbig-endian ARM processors generated by versions of the compiler prior to 748190075Sobrien2.8. 748290075Sobrien 748390075Sobrien@item -mcpu=@var{name} 748490075Sobrien@opindex mcpu 748590075SobrienThis specifies the name of the target ARM processor. GCC uses this name 748690075Sobriento determine what kind of instructions it can emit when generating 748790075Sobrienassembly code. Permissible names are: @samp{arm2}, @samp{arm250}, 748890075Sobrien@samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610}, 748990075Sobrien@samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm}, 749090075Sobrien@samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700}, 749190075Sobrien@samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100}, 7492169689Skan@samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s}, 7493169689Skan@samp{arm8}, @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100}, 749490075Sobrien@samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920}, 7495169689Skan@samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s}, 7496169689Skan@samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi}, 7497169689Skan@samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s}, 7498169689Skan@samp{arm10e}, @samp{arm1020e}, @samp{arm1022e}, 7499169689Skan@samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp}, 7500169689Skan@samp{arm1176jz-s}, @samp{arm1176jzf-s}, @samp{xscale}, @samp{iwmmxt}, 7501132718Skan@samp{ep9312}. 750290075Sobrien 750390075Sobrien@itemx -mtune=@var{name} 750490075Sobrien@opindex mtune 750590075SobrienThis option is very similar to the @option{-mcpu=} option, except that 750690075Sobrieninstead of specifying the actual target processor type, and hence 750790075Sobrienrestricting which instructions can be used, it specifies that GCC should 750890075Sobrientune the performance of the code as if the target were of the type 750990075Sobrienspecified in this option, but still choosing the instructions that it 751090075Sobrienwill generate based on the cpu specified by a @option{-mcpu=} option. 751190075SobrienFor some ARM implementations better performance can be obtained by using 751290075Sobrienthis option. 751390075Sobrien 751490075Sobrien@item -march=@var{name} 751590075Sobrien@opindex march 751690075SobrienThis specifies the name of the target ARM architecture. GCC uses this 751790075Sobrienname to determine what kind of instructions it can emit when generating 751890075Sobrienassembly code. This option can be used in conjunction with or instead 751990075Sobrienof the @option{-mcpu=} option. Permissible names are: @samp{armv2}, 752090075Sobrien@samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t}, 7521169689Skan@samp{armv5}, @samp{armv5t}, @samp{armv5te}, @samp{armv6}, @samp{armv6j}, 7522132718Skan@samp{iwmmxt}, @samp{ep9312}. 752390075Sobrien 7524169689Skan@item -mfpu=@var{name} 7525169689Skan@itemx -mfpe=@var{number} 752690075Sobrien@itemx -mfp=@var{number} 7527169689Skan@opindex mfpu 752890075Sobrien@opindex mfpe 752990075Sobrien@opindex mfp 7530169689SkanThis specifies what floating point hardware (or hardware emulation) is 7531169689Skanavailable on the target. Permissible names are: @samp{fpa}, @samp{fpe2}, 7532169689Skan@samp{fpe3}, @samp{maverick}, @samp{vfp}. @option{-mfp} and @option{-mfpe} 7533169689Skanare synonyms for @option{-mfpu}=@samp{fpe}@var{number}, for compatibility 7534169689Skanwith older versions of GCC@. 753590075Sobrien 7536169689SkanIf @option{-msoft-float} is specified this specifies the format of 7537169689Skanfloating point values. 7538169689Skan 753990075Sobrien@item -mstructure-size-boundary=@var{n} 754090075Sobrien@opindex mstructure-size-boundary 754190075SobrienThe size of all structures and unions will be rounded up to a multiple 7542169689Skanof the number of bits set by this option. Permissible values are 8, 32 7543169689Skanand 64. The default value varies for different toolchains. For the COFF 7544169689Skantargeted toolchain the default value is 8. A value of 64 is only allowed 7545169689Skanif the underlying ABI supports it. 754690075Sobrien 7547169689SkanSpecifying the larger number can produce faster, more efficient code, but 7548169689Skancan also increase the size of the program. Different values are potentially 7549169689Skanincompatible. Code compiled with one value cannot necessarily expect to 7550169689Skanwork with code or libraries compiled with another value, if they exchange 7551169689Skaninformation using structures or unions. 7552169689Skan 755390075Sobrien@item -mabort-on-noreturn 755490075Sobrien@opindex mabort-on-noreturn 755590075SobrienGenerate a call to the function @code{abort} at the end of a 755690075Sobrien@code{noreturn} function. It will be executed if the function tries to 755790075Sobrienreturn. 755890075Sobrien 755990075Sobrien@item -mlong-calls 756090075Sobrien@itemx -mno-long-calls 756190075Sobrien@opindex mlong-calls 756290075Sobrien@opindex mno-long-calls 756390075SobrienTells the compiler to perform function calls by first loading the 756490075Sobrienaddress of the function into a register and then performing a subroutine 756590075Sobriencall on this register. This switch is needed if the target function 756690075Sobrienwill lie outside of the 64 megabyte addressing range of the offset based 756790075Sobrienversion of subroutine call instruction. 756890075Sobrien 756990075SobrienEven if this switch is enabled, not all function calls will be turned 757090075Sobrieninto long calls. The heuristic is that static functions, functions 757190075Sobrienwhich have the @samp{short-call} attribute, functions that are inside 757290075Sobrienthe scope of a @samp{#pragma no_long_calls} directive and functions whose 757390075Sobriendefinitions have already been compiled within the current compilation 757490075Sobrienunit, will not be turned into long calls. The exception to this rule is 757590075Sobrienthat weak function definitions, functions with the @samp{long-call} 757690075Sobrienattribute or the @samp{section} attribute, and functions that are within 757790075Sobrienthe scope of a @samp{#pragma long_calls} directive, will always be 757890075Sobrienturned into long calls. 757990075Sobrien 758090075SobrienThis feature is not enabled by default. Specifying 758190075Sobrien@option{-mno-long-calls} will restore the default behavior, as will 758290075Sobrienplacing the function calls within the scope of a @samp{#pragma 758390075Sobrienlong_calls_off} directive. Note these switches have no effect on how 758490075Sobrienthe compiler generates code to handle function calls via function 758590075Sobrienpointers. 758690075Sobrien 758790075Sobrien@item -mnop-fun-dllimport 758890075Sobrien@opindex mnop-fun-dllimport 758990075SobrienDisable support for the @code{dllimport} attribute. 759090075Sobrien 759190075Sobrien@item -msingle-pic-base 759290075Sobrien@opindex msingle-pic-base 759390075SobrienTreat the register used for PIC addressing as read-only, rather than 759490075Sobrienloading it in the prologue for each function. The run-time system is 759590075Sobrienresponsible for initializing this register with an appropriate value 759690075Sobrienbefore execution begins. 759790075Sobrien 759890075Sobrien@item -mpic-register=@var{reg} 759990075Sobrien@opindex mpic-register 760090075SobrienSpecify the register to be used for PIC addressing. The default is R10 760190075Sobrienunless stack-checking is enabled, when R9 is used. 760290075Sobrien 7603132718Skan@item -mcirrus-fix-invalid-insns 7604132718Skan@opindex mcirrus-fix-invalid-insns 7605132718Skan@opindex mno-cirrus-fix-invalid-insns 7606132718SkanInsert NOPs into the instruction stream to in order to work around 7607132718Skanproblems with invalid Maverick instruction combinations. This option 7608132718Skanis only valid if the @option{-mcpu=ep9312} option has been used to 7609132718Skanenable generation of instructions for the Cirrus Maverick floating 7610132718Skanpoint co-processor. This option is not enabled by default, since the 7611132718Skanproblem is only present in older Maverick implementations. The default 7612132718Skancan be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns} 7613132718Skanswitch. 7614132718Skan 761590075Sobrien@item -mpoke-function-name 761690075Sobrien@opindex mpoke-function-name 761790075SobrienWrite the name of each function into the text section, directly 761890075Sobrienpreceding the function prologue. The generated code is similar to this: 761990075Sobrien 762090075Sobrien@smallexample 762190075Sobrien t0 762290075Sobrien .ascii "arm_poke_function_name", 0 762390075Sobrien .align 762490075Sobrien t1 762590075Sobrien .word 0xff000000 + (t1 - t0) 762690075Sobrien arm_poke_function_name 762790075Sobrien mov ip, sp 762890075Sobrien stmfd sp!, @{fp, ip, lr, pc@} 762990075Sobrien sub fp, ip, #4 763090075Sobrien@end smallexample 763190075Sobrien 763290075SobrienWhen performing a stack backtrace, code can inspect the value of 763390075Sobrien@code{pc} stored at @code{fp + 0}. If the trace function then looks at 763490075Sobrienlocation @code{pc - 12} and the top 8 bits are set, then we know that 763590075Sobrienthere is a function name embedded immediately preceding this location 763690075Sobrienand has length @code{((pc[-3]) & 0xff000000)}. 763790075Sobrien 763890075Sobrien@item -mthumb 763990075Sobrien@opindex mthumb 764090075SobrienGenerate code for the 16-bit Thumb instruction set. The default is to 764190075Sobrienuse the 32-bit ARM instruction set. 764290075Sobrien 764390075Sobrien@item -mtpcs-frame 764490075Sobrien@opindex mtpcs-frame 764590075SobrienGenerate a stack frame that is compliant with the Thumb Procedure Call 764690075SobrienStandard for all non-leaf functions. (A leaf function is one that does 764790075Sobriennot call any other functions.) The default is @option{-mno-tpcs-frame}. 764890075Sobrien 764990075Sobrien@item -mtpcs-leaf-frame 765090075Sobrien@opindex mtpcs-leaf-frame 765190075SobrienGenerate a stack frame that is compliant with the Thumb Procedure Call 765290075SobrienStandard for all leaf functions. (A leaf function is one that does 765390075Sobriennot call any other functions.) The default is @option{-mno-apcs-leaf-frame}. 765490075Sobrien 765590075Sobrien@item -mcallee-super-interworking 765690075Sobrien@opindex mcallee-super-interworking 765790075SobrienGives all externally visible functions in the file being compiled an ARM 765890075Sobrieninstruction set header which switches to Thumb mode before executing the 765990075Sobrienrest of the function. This allows these functions to be called from 766090075Sobriennon-interworking code. 766190075Sobrien 766290075Sobrien@item -mcaller-super-interworking 766390075Sobrien@opindex mcaller-super-interworking 766490075SobrienAllows calls via function pointers (including virtual functions) to 766590075Sobrienexecute correctly regardless of whether the target code has been 766690075Sobriencompiled for interworking or not. There is a small overhead in the cost 766790075Sobrienof executing a function pointer if this option is enabled. 766890075Sobrien 7669169689Skan@item -mtp=@var{name} 7670169689Skan@opindex mtp 7671169689SkanSpecify the access model for the thread local storage pointer. The valid 7672169689Skanmodels are @option{soft}, which generates calls to @code{__aeabi_read_tp}, 7673169689Skan@option{cp15}, which fetches the thread pointer from @code{cp15} directly 7674169689Skan(supported in the arm6k architecture), and @option{auto}, which uses the 7675169689Skanbest available method for the selected processor. The default setting is 7676169689Skan@option{auto}. 767790075Sobrien 767890075Sobrien@end table 767990075Sobrien 7680169689Skan@node AVR Options 7681169689Skan@subsection AVR Options 7682169689Skan@cindex AVR Options 768390075Sobrien 7684169689SkanThese options are defined for AVR implementations: 768590075Sobrien 768690075Sobrien@table @gcctabopt 7687169689Skan@item -mmcu=@var{mcu} 7688169689Skan@opindex mmcu 7689169689SkanSpecify ATMEL AVR instruction set or MCU type. 7690132718Skan 7691169689SkanInstruction set avr1 is for the minimal AVR core, not supported by the C 7692169689Skancompiler, only for assembler programs (MCU types: at90s1200, attiny10, 7693169689Skanattiny11, attiny12, attiny15, attiny28). 769490075Sobrien 7695169689SkanInstruction set avr2 (default) is for the classic AVR core with up to 7696169689Skan8K program memory space (MCU types: at90s2313, at90s2323, attiny22, 7697169689Skanat90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515, 7698169689Skanat90c8534, at90s8535). 769990075Sobrien 7700169689SkanInstruction set avr3 is for the classic AVR core with up to 128K program 7701169689Skanmemory space (MCU types: atmega103, atmega603, at43usb320, at76c711). 770290075Sobrien 7703169689SkanInstruction set avr4 is for the enhanced AVR core with up to 8K program 7704169689Skanmemory space (MCU types: atmega8, atmega83, atmega85). 770590075Sobrien 7706169689SkanInstruction set avr5 is for the enhanced AVR core with up to 128K program 7707169689Skanmemory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323, 7708169689Skanatmega64, atmega128, at43usb355, at94k). 770990075Sobrien 7710169689Skan@item -msize 7711169689Skan@opindex msize 7712169689SkanOutput instruction sizes to the asm file. 771390075Sobrien 7714169689Skan@item -minit-stack=@var{N} 7715169689Skan@opindex minit-stack 7716169689SkanSpecify the initial stack address, which may be a symbol or numeric value, 7717169689Skan@samp{__stack} is the default. 771890075Sobrien 7719169689Skan@item -mno-interrupts 7720169689Skan@opindex mno-interrupts 7721169689SkanGenerated code is not compatible with hardware interrupts. 7722169689SkanCode size will be smaller. 772390075Sobrien 7724169689Skan@item -mcall-prologues 7725169689Skan@opindex mcall-prologues 7726169689SkanFunctions prologues/epilogues expanded as call to appropriate 7727169689Skansubroutines. Code size will be smaller. 772890075Sobrien 7729169689Skan@item -mno-tablejump 7730169689Skan@opindex mno-tablejump 7731169689SkanDo not generate tablejump insns which sometimes increase code size. 773290075Sobrien 7733169689Skan@item -mtiny-stack 7734169689Skan@opindex mtiny-stack 7735169689SkanChange only the low 8 bits of the stack pointer. 773690075Sobrien 7737169689Skan@item -mint8 7738169689Skan@opindex mint8 7739169689SkanAssume int to be 8 bit integer. This affects the sizes of all types: A 7740169689Skanchar will be 1 byte, an int will be 1 byte, an long will be 2 bytes 7741169689Skanand long long will be 4 bytes. Please note that this option does not 7742169689Skancomply to the C standards, but it will provide you with smaller code 7743169689Skansize. 774490075Sobrien@end table 774590075Sobrien 7746169689Skan@node Blackfin Options 7747169689Skan@subsection Blackfin Options 7748169689Skan@cindex Blackfin Options 774990075Sobrien 775090075Sobrien@table @gcctabopt 7751169689Skan@item -momit-leaf-frame-pointer 7752169689Skan@opindex momit-leaf-frame-pointer 7753169689SkanDon't keep the frame pointer in a register for leaf functions. This 7754169689Skanavoids the instructions to save, set up and restore frame pointers and 7755169689Skanmakes an extra register available in leaf functions. The option 7756169689Skan@option{-fomit-frame-pointer} removes the frame pointer for all functions 7757169689Skanwhich might make debugging harder. 775890075Sobrien 7759169689Skan@item -mspecld-anomaly 7760169689Skan@opindex mspecld-anomaly 7761169689SkanWhen enabled, the compiler will ensure that the generated code does not 7762169689Skancontain speculative loads after jump instructions. This option is enabled 7763169689Skanby default. 776490075Sobrien 7765169689Skan@item -mno-specld-anomaly 7766169689Skan@opindex mno-specld-anomaly 7767169689SkanDon't generate extra code to prevent speculative loads from occurring. 776890075Sobrien 7769169689Skan@item -mcsync-anomaly 7770169689Skan@opindex mcsync-anomaly 7771169689SkanWhen enabled, the compiler will ensure that the generated code does not 7772169689Skancontain CSYNC or SSYNC instructions too soon after conditional branches. 7773169689SkanThis option is enabled by default. 777490075Sobrien 7775169689Skan@item -mno-csync-anomaly 7776169689Skan@opindex mno-csync-anomaly 7777169689SkanDon't generate extra code to prevent CSYNC or SSYNC instructions from 7778169689Skanoccurring too soon after a conditional branch. 777990075Sobrien 7780169689Skan@item -mlow-64k 7781169689Skan@opindex mlow-64k 7782169689SkanWhen enabled, the compiler is free to take advantage of the knowledge that 7783169689Skanthe entire program fits into the low 64k of memory. 778490075Sobrien 7785169689Skan@item -mno-low-64k 7786169689Skan@opindex mno-low-64k 7787169689SkanAssume that the program is arbitrarily large. This is the default. 778890075Sobrien 7789169689Skan@item -mid-shared-library 7790169689Skan@opindex mid-shared-library 7791169689SkanGenerate code that supports shared libraries via the library ID method. 7792169689SkanThis allows for execute in place and shared libraries in an environment 7793169689Skanwithout virtual memory management. This option implies @option{-fPIC}. 779490075Sobrien 7795169689Skan@item -mno-id-shared-library 7796169689Skan@opindex mno-id-shared-library 7797169689SkanGenerate code that doesn't assume ID based shared libraries are being used. 7798169689SkanThis is the default. 779990075Sobrien 7800169689Skan@item -mshared-library-id=n 7801169689Skan@opindex mshared-library-id 7802169689SkanSpecified the identification number of the ID based shared library being 7803169689Skancompiled. Specifying a value of 0 will generate more compact code, specifying 7804169689Skanother values will force the allocation of that number to the current 7805169689Skanlibrary but is no more space or time efficient than omitting this option. 780690075Sobrien 7807169689Skan@item -mlong-calls 7808169689Skan@itemx -mno-long-calls 7809169689Skan@opindex mlong-calls 7810169689Skan@opindex mno-long-calls 7811169689SkanTells the compiler to perform function calls by first loading the 7812169689Skanaddress of the function into a register and then performing a subroutine 7813169689Skancall on this register. This switch is needed if the target function 7814169689Skanwill lie outside of the 24 bit addressing range of the offset based 7815169689Skanversion of subroutine call instruction. 781690075Sobrien 7817169689SkanThis feature is not enabled by default. Specifying 7818169689Skan@option{-mno-long-calls} will restore the default behavior. Note these 7819169689Skanswitches have no effect on how the compiler generates code to handle 7820169689Skanfunction calls via function pointers. 7821169689Skan@end table 782290075Sobrien 7823169689Skan@node CRIS Options 7824169689Skan@subsection CRIS Options 7825169689Skan@cindex CRIS Options 782690075Sobrien 7827169689SkanThese options are defined specifically for the CRIS ports. 782890075Sobrien 7829169689Skan@table @gcctabopt 7830169689Skan@item -march=@var{architecture-type} 7831169689Skan@itemx -mcpu=@var{architecture-type} 7832169689Skan@opindex march 7833169689Skan@opindex mcpu 7834169689SkanGenerate code for the specified architecture. The choices for 7835169689Skan@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for 7836169689Skanrespectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@. 7837169689SkanDefault is @samp{v0} except for cris-axis-linux-gnu, where the default is 7838169689Skan@samp{v10}. 783990075Sobrien 7840169689Skan@item -mtune=@var{architecture-type} 784190075Sobrien@opindex mtune 7842169689SkanTune to @var{architecture-type} everything applicable about the generated 7843169689Skancode, except for the ABI and the set of available instructions. The 7844169689Skanchoices for @var{architecture-type} are the same as for 7845169689Skan@option{-march=@var{architecture-type}}. 784690075Sobrien 7847169689Skan@item -mmax-stack-frame=@var{n} 7848169689Skan@opindex mmax-stack-frame 7849169689SkanWarn when the stack frame of a function exceeds @var{n} bytes. 785090075Sobrien 7851169689Skan@item -melinux-stacksize=@var{n} 7852169689Skan@opindex melinux-stacksize 7853169689SkanOnly available with the @samp{cris-axis-aout} target. Arranges for 7854169689Skanindications in the program to the kernel loader that the stack of the 7855169689Skanprogram should be set to @var{n} bytes. 7856117395Skan 7857169689Skan@item -metrax4 7858169689Skan@itemx -metrax100 7859169689Skan@opindex metrax4 7860169689Skan@opindex metrax100 7861169689SkanThe options @option{-metrax4} and @option{-metrax100} are synonyms for 7862169689Skan@option{-march=v3} and @option{-march=v8} respectively. 7863117395Skan 7864169689Skan@item -mmul-bug-workaround 7865169689Skan@itemx -mno-mul-bug-workaround 7866169689Skan@opindex mmul-bug-workaround 7867169689Skan@opindex mno-mul-bug-workaround 7868169689SkanWork around a bug in the @code{muls} and @code{mulu} instructions for CPU 7869169689Skanmodels where it applies. This option is active by default. 7870117395Skan 7871169689Skan@item -mpdebug 7872169689Skan@opindex mpdebug 7873169689SkanEnable CRIS-specific verbose debug-related information in the assembly 7874169689Skancode. This option also has the effect to turn off the @samp{#NO_APP} 7875169689Skanformatted-code indicator to the assembler at the beginning of the 7876169689Skanassembly file. 7877132718Skan 7878169689Skan@item -mcc-init 7879169689Skan@opindex mcc-init 7880169689SkanDo not use condition-code results from previous instruction; always emit 7881169689Skancompare and test instructions before use of condition codes. 7882132718Skan 7883169689Skan@item -mno-side-effects 7884169689Skan@opindex mno-side-effects 7885169689SkanDo not emit instructions with side-effects in addressing modes other than 7886169689Skanpost-increment. 788790075Sobrien 7888169689Skan@item -mstack-align 7889169689Skan@itemx -mno-stack-align 7890169689Skan@itemx -mdata-align 7891169689Skan@itemx -mno-data-align 7892169689Skan@itemx -mconst-align 7893169689Skan@itemx -mno-const-align 7894169689Skan@opindex mstack-align 7895169689Skan@opindex mno-stack-align 7896169689Skan@opindex mdata-align 7897169689Skan@opindex mno-data-align 7898169689Skan@opindex mconst-align 7899169689Skan@opindex mno-const-align 7900169689SkanThese options (no-options) arranges (eliminate arrangements) for the 7901169689Skanstack-frame, individual data and constants to be aligned for the maximum 7902169689Skansingle data access size for the chosen CPU model. The default is to 7903169689Skanarrange for 32-bit alignment. ABI details such as structure layout are 7904169689Skannot affected by these options. 790590075Sobrien 7906169689Skan@item -m32-bit 7907169689Skan@itemx -m16-bit 7908169689Skan@itemx -m8-bit 7909169689Skan@opindex m32-bit 7910169689Skan@opindex m16-bit 7911169689Skan@opindex m8-bit 7912169689SkanSimilar to the stack- data- and const-align options above, these options 7913169689Skanarrange for stack-frame, writable data and constants to all be 32-bit, 7914169689Skan16-bit or 8-bit aligned. The default is 32-bit alignment. 791590075Sobrien 7916169689Skan@item -mno-prologue-epilogue 7917169689Skan@itemx -mprologue-epilogue 7918169689Skan@opindex mno-prologue-epilogue 7919169689Skan@opindex mprologue-epilogue 7920169689SkanWith @option{-mno-prologue-epilogue}, the normal function prologue and 7921169689Skanepilogue that sets up the stack-frame are omitted and no return 7922169689Skaninstructions or return sequences are generated in the code. Use this 7923169689Skanoption only together with visual inspection of the compiled code: no 7924169689Skanwarnings or errors are generated when call-saved registers must be saved, 7925169689Skanor storage for local variable needs to be allocated. 792690075Sobrien 7927169689Skan@item -mno-gotplt 7928169689Skan@itemx -mgotplt 7929169689Skan@opindex mno-gotplt 7930169689Skan@opindex mgotplt 7931169689SkanWith @option{-fpic} and @option{-fPIC}, don't generate (do generate) 7932169689Skaninstruction sequences that load addresses for functions from the PLT part 7933169689Skanof the GOT rather than (traditional on other architectures) calls to the 7934169689SkanPLT@. The default is @option{-mgotplt}. 7935146895Skan 7936169689Skan@item -maout 7937169689Skan@opindex maout 7938169689SkanLegacy no-op option only recognized with the cris-axis-aout target. 793990075Sobrien 7940169689Skan@item -melf 7941169689Skan@opindex melf 7942169689SkanLegacy no-op option only recognized with the cris-axis-elf and 7943169689Skancris-axis-linux-gnu targets. 794490075Sobrien 7945169689Skan@item -melinux 7946169689Skan@opindex melinux 7947169689SkanOnly recognized with the cris-axis-aout target, where it selects a 7948169689SkanGNU/linux-like multilib, include files and instruction set for 7949169689Skan@option{-march=v8}. 7950132718Skan 7951169689Skan@item -mlinux 7952169689Skan@opindex mlinux 7953169689SkanLegacy no-op option only recognized with the cris-axis-linux-gnu target. 795490075Sobrien 7955169689Skan@item -sim 7956169689Skan@opindex sim 7957169689SkanThis option, recognized for the cris-axis-aout and cris-axis-elf arranges 7958169689Skanto link with input-output functions from a simulator library. Code, 7959169689Skaninitialized data and zero-initialized data are allocated consecutively. 796090075Sobrien 7961169689Skan@item -sim2 7962169689Skan@opindex sim2 7963169689SkanLike @option{-sim}, but pass linker options to locate initialized data at 7964169689Skan0x40000000 and zero-initialized data at 0x80000000. 7965169689Skan@end table 796690075Sobrien 7967169689Skan@node CRX Options 7968169689Skan@subsection CRX Options 7969169689Skan@cindex CRX Options 797090075Sobrien 7971169689SkanThese options are defined specifically for the CRX ports. 797290075Sobrien 7973169689Skan@table @gcctabopt 797490075Sobrien 7975169689Skan@item -mmac 7976169689Skan@opindex mmac 7977169689SkanEnable the use of multiply-accumulate instructions. Disabled by default. 797890075Sobrien 7979169689Skan@item -mpush-args 7980169689Skan@opindex mpush-args 7981169689SkanPush instructions will be used to pass outgoing arguments when functions 7982169689Skanare called. Enabled by default. 7983169689Skan@end table 798490075Sobrien 7985169689Skan@node Darwin Options 7986169689Skan@subsection Darwin Options 7987169689Skan@cindex Darwin options 798890075Sobrien 7989169689SkanThese options are defined for all architectures running the Darwin operating 7990169689Skansystem. 799190075Sobrien 7992169689SkanFSF GCC on Darwin does not create ``fat'' object files; it will create 7993169689Skanan object file for the single architecture that it was built to 7994169689Skantarget. Apple's GCC on Darwin does create ``fat'' files if multiple 7995169689Skan@option{-arch} options are used; it does so by running the compiler or 7996169689Skanlinker multiple times and joining the results together with 7997169689Skan@file{lipo}. 799890075Sobrien 7999169689SkanThe subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or 8000169689Skan@samp{i686}) is determined by the flags that specify the ISA 8001169689Skanthat GCC is targetting, like @option{-mcpu} or @option{-march}. The 8002169689Skan@option{-force_cpusubtype_ALL} option can be used to override this. 800390075Sobrien 8004169689SkanThe Darwin tools vary in their behavior when presented with an ISA 8005169689Skanmismatch. The assembler, @file{as}, will only permit instructions to 8006169689Skanbe used that are valid for the subtype of the file it is generating, 8007169689Skanso you cannot put 64-bit instructions in an @samp{ppc750} object file. 8008169689SkanThe linker for shared libraries, @file{/usr/bin/libtool}, will fail 8009169689Skanand print an error if asked to create a shared library with a less 8010169689Skanrestrictive subtype than its input files (for instance, trying to put 8011169689Skana @samp{ppc970} object file in a @samp{ppc7400} library). The linker 8012169689Skanfor executables, @file{ld}, will quietly give the executable the most 8013169689Skanrestrictive subtype of any of its input files. 801490075Sobrien 8015169689Skan@table @gcctabopt 8016169689Skan@item -F@var{dir} 8017169689Skan@opindex F 8018169689SkanAdd the framework directory @var{dir} to the head of the list of 8019169689Skandirectories to be searched for header files. These directories are 8020169689Skaninterleaved with those specified by @option{-I} options and are 8021169689Skanscanned in a left-to-right order. 8022132718Skan 8023169689SkanA framework directory is a directory with frameworks in it. A 8024169689Skanframework is a directory with a @samp{"Headers"} and/or 8025169689Skan@samp{"PrivateHeaders"} directory contained directly in it that ends 8026169689Skanin @samp{".framework"}. The name of a framework is the name of this 8027169689Skandirectory excluding the @samp{".framework"}. Headers associated with 8028169689Skanthe framework are found in one of those two directories, with 8029169689Skan@samp{"Headers"} being searched first. A subframework is a framework 8030169689Skandirectory that is in a framework's @samp{"Frameworks"} directory. 8031169689SkanIncludes of subframework headers can only appear in a header of a 8032169689Skanframework that contains the subframework, or in a sibling subframework 8033169689Skanheader. Two subframeworks are siblings if they occur in the same 8034169689Skanframework. A subframework should not have the same name as a 8035169689Skanframework, a warning will be issued if this is violated. Currently a 8036169689Skansubframework cannot have subframeworks, in the future, the mechanism 8037169689Skanmay be extended to support this. The standard frameworks can be found 8038169689Skanin @samp{"/System/Library/Frameworks"} and 8039169689Skan@samp{"/Library/Frameworks"}. An example include looks like 8040169689Skan@code{#include <Framework/header.h>}, where @samp{Framework} denotes 8041169689Skanthe name of the framework and header.h is found in the 8042169689Skan@samp{"PrivateHeaders"} or @samp{"Headers"} directory. 8043132718Skan 8044169689Skan@item -gused 8045169689Skan@opindex gused 8046169689SkanEmit debugging information for symbols that are used. For STABS 8047169689Skandebugging format, this enables @option{-feliminate-unused-debug-symbols}. 8048169689SkanThis is by default ON@. 8049132718Skan 8050169689Skan@item -gfull 8051169689Skan@opindex gfull 8052169689SkanEmit debugging information for all symbols and types. 8053132718Skan 8054169689Skan@item -mmacosx-version-min=@var{version} 8055169689SkanThe earliest version of MacOS X that this executable will run on 8056169689Skanis @var{version}. Typical values of @var{version} include @code{10.1}, 8057169689Skan@code{10.2}, and @code{10.3.9}. 805890075Sobrien 8059169689SkanThe default for this option is to make choices that seem to be most 8060169689Skanuseful. 806190075Sobrien 8062169689Skan@item -mkernel 8063169689Skan@opindex mkernel 8064169689SkanEnable kernel development mode. The @option{-mkernel} option sets 8065169689Skan@option{-static}, @option{-fno-common}, @option{-fno-cxa-atexit}, 8066169689Skan@option{-fno-exceptions}, @option{-fno-non-call-exceptions}, 8067169689Skan@option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where 8068169689Skanapplicable. This mode also sets @option{-mno-altivec}, 8069169689Skan@option{-msoft-float}, @option{-fno-builtin} and 8070169689Skan@option{-mlong-branch} for PowerPC targets. 807190075Sobrien 8072169689Skan@item -mone-byte-bool 8073169689Skan@opindex mone-byte-bool 8074169689SkanOverride the defaults for @samp{bool} so that @samp{sizeof(bool)==1}. 8075169689SkanBy default @samp{sizeof(bool)} is @samp{4} when compiling for 8076169689SkanDarwin/PowerPC and @samp{1} when compiling for Darwin/x86, so this 8077169689Skanoption has no effect on x86. 807890075Sobrien 8079169689Skan@strong{Warning:} The @option{-mone-byte-bool} switch causes GCC 8080169689Skanto generate code that is not binary compatible with code generated 8081169689Skanwithout that switch. Using this switch may require recompiling all 8082169689Skanother modules in a program, including system libraries. Use this 8083169689Skanswitch to conform to a non-default data model. 808490075Sobrien 8085169689Skan@item -mfix-and-continue 8086169689Skan@itemx -ffix-and-continue 8087169689Skan@itemx -findirect-data 8088169689Skan@opindex mfix-and-continue 8089169689Skan@opindex ffix-and-continue 8090169689Skan@opindex findirect-data 8091169689SkanGenerate code suitable for fast turn around development. Needed to 8092169689Skanenable gdb to dynamically load @code{.o} files into already running 8093169689Skanprograms. @option{-findirect-data} and @option{-ffix-and-continue} 8094169689Skanare provided for backwards compatibility. 809590075Sobrien 8096132718Skan@item -all_load 8097132718Skan@opindex all_load 8098117395SkanLoads all members of static archive libraries. 8099117395SkanSee man ld(1) for more information. 8100117395Skan 8101117395Skan@item -arch_errors_fatal 8102117395Skan@opindex arch_errors_fatal 8103117395SkanCause the errors having to do with files that have the wrong architecture 8104117395Skanto be fatal. 8105117395Skan 8106117395Skan@item -bind_at_load 8107117395Skan@opindex bind_at_load 8108117395SkanCauses the output file to be marked such that the dynamic linker will 8109117395Skanbind all undefined references when the file is loaded or launched. 8110117395Skan 8111132718Skan@item -bundle 8112117395Skan@opindex bundle 8113117395SkanProduce a Mach-o bundle format file. 8114117395SkanSee man ld(1) for more information. 8115117395Skan 8116117395Skan@item -bundle_loader @var{executable} 8117117395Skan@opindex bundle_loader 8118169689SkanThis option specifies the @var{executable} that will be loading the build 8119169689Skanoutput file being linked. See man ld(1) for more information. 8120117395Skan 8121169689Skan@item -dynamiclib 8122169689Skan@opindex dynamiclib 8123169689SkanWhen passed this option, GCC will produce a dynamic library instead of 8124169689Skanan executable when linking, using the Darwin @file{libtool} command. 8125169689Skan 8126169689Skan@item -force_cpusubtype_ALL 8127169689Skan@opindex force_cpusubtype_ALL 8128169689SkanThis causes GCC's output file to have the @var{ALL} subtype, instead of 8129169689Skanone controlled by the @option{-mcpu} or @option{-march} option. 8130169689Skan 8131117395Skan@item -allowable_client @var{client_name} 8132132718Skan@itemx -client_name 8133132718Skan@itemx -compatibility_version 8134132718Skan@itemx -current_version 8135169689Skan@itemx -dead_strip 8136132718Skan@itemx -dependency-file 8137132718Skan@itemx -dylib_file 8138132718Skan@itemx -dylinker_install_name 8139132718Skan@itemx -dynamic 8140132718Skan@itemx -exported_symbols_list 8141132718Skan@itemx -filelist 8142132718Skan@itemx -flat_namespace 8143132718Skan@itemx -force_flat_namespace 8144132718Skan@itemx -headerpad_max_install_names 8145132718Skan@itemx -image_base 8146132718Skan@itemx -init 8147132718Skan@itemx -install_name 8148132718Skan@itemx -keep_private_externs 8149132718Skan@itemx -multi_module 8150132718Skan@itemx -multiply_defined 8151132718Skan@itemx -multiply_defined_unused 8152132718Skan@itemx -noall_load 8153169689Skan@itemx -no_dead_strip_inits_and_terms 8154132718Skan@itemx -nofixprebinding 8155132718Skan@itemx -nomultidefs 8156132718Skan@itemx -noprebind 8157132718Skan@itemx -noseglinkedit 8158132718Skan@itemx -pagezero_size 8159132718Skan@itemx -prebind 8160132718Skan@itemx -prebind_all_twolevel_modules 8161132718Skan@itemx -private_bundle 8162132718Skan@itemx -read_only_relocs 8163132718Skan@itemx -sectalign 8164132718Skan@itemx -sectobjectsymbols 8165132718Skan@itemx -whyload 8166132718Skan@itemx -seg1addr 8167132718Skan@itemx -sectcreate 8168132718Skan@itemx -sectobjectsymbols 8169132718Skan@itemx -sectorder 8170169689Skan@itemx -segaddr 8171169689Skan@itemx -segs_read_only_addr 8172169689Skan@itemx -segs_read_write_addr 8173132718Skan@itemx -seg_addr_table 8174132718Skan@itemx -seg_addr_table_filename 8175132718Skan@itemx -seglinkedit 8176132718Skan@itemx -segprot 8177132718Skan@itemx -segs_read_only_addr 8178132718Skan@itemx -segs_read_write_addr 8179132718Skan@itemx -single_module 8180132718Skan@itemx -static 8181132718Skan@itemx -sub_library 8182132718Skan@itemx -sub_umbrella 8183132718Skan@itemx -twolevel_namespace 8184132718Skan@itemx -umbrella 8185132718Skan@itemx -undefined 8186132718Skan@itemx -unexported_symbols_list 8187132718Skan@itemx -weak_reference_mismatches 8188132718Skan@itemx -whatsloaded 8189117395Skan 8190117395Skan@opindex allowable_client 8191117395Skan@opindex client_name 8192117395Skan@opindex compatibility_version 8193117395Skan@opindex current_version 8194169689Skan@opindex dead_strip 8195117395Skan@opindex dependency-file 8196117395Skan@opindex dylib_file 8197117395Skan@opindex dylinker_install_name 8198117395Skan@opindex dynamic 8199117395Skan@opindex exported_symbols_list 8200132718Skan@opindex filelist 8201132718Skan@opindex flat_namespace 8202117395Skan@opindex force_flat_namespace 8203117395Skan@opindex headerpad_max_install_names 8204117395Skan@opindex image_base 8205132718Skan@opindex init 8206117395Skan@opindex install_name 8207117395Skan@opindex keep_private_externs 8208132718Skan@opindex multi_module 8209117395Skan@opindex multiply_defined 8210132718Skan@opindex multiply_defined_unused 8211132718Skan@opindex noall_load 8212169689Skan@opindex no_dead_strip_inits_and_terms 8213132718Skan@opindex nofixprebinding 8214132718Skan@opindex nomultidefs 8215117395Skan@opindex noprebind 8216132718Skan@opindex noseglinkedit 8217117395Skan@opindex pagezero_size 8218117395Skan@opindex prebind 8219117395Skan@opindex prebind_all_twolevel_modules 8220132718Skan@opindex private_bundle 8221117395Skan@opindex read_only_relocs 8222132718Skan@opindex sectalign 8223132718Skan@opindex sectobjectsymbols 8224132718Skan@opindex whyload 8225117395Skan@opindex seg1addr 8226132718Skan@opindex sectcreate 8227132718Skan@opindex sectobjectsymbols 8228132718Skan@opindex sectorder 8229169689Skan@opindex segaddr 8230169689Skan@opindex segs_read_only_addr 8231169689Skan@opindex segs_read_write_addr 8232117395Skan@opindex seg_addr_table 8233117395Skan@opindex seg_addr_table_filename 8234117395Skan@opindex seglinkedit 8235117395Skan@opindex segprot 8236117395Skan@opindex segs_read_only_addr 8237117395Skan@opindex segs_read_write_addr 8238117395Skan@opindex single_module 8239117395Skan@opindex static 8240117395Skan@opindex sub_library 8241117395Skan@opindex sub_umbrella 8242117395Skan@opindex twolevel_namespace 8243117395Skan@opindex umbrella 8244117395Skan@opindex undefined 8245117395Skan@opindex unexported_symbols_list 8246117395Skan@opindex weak_reference_mismatches 8247117395Skan@opindex whatsloaded 8248117395Skan 8249169689SkanThese options are passed to the Darwin linker. The Darwin linker man page 8250117395Skandescribes them in detail. 8251117395Skan@end table 8252117395Skan 8253169689Skan@node DEC Alpha Options 8254169689Skan@subsection DEC Alpha Options 8255117395Skan 8256169689SkanThese @samp{-m} options are defined for the DEC Alpha implementations: 825790075Sobrien 825890075Sobrien@table @gcctabopt 8259169689Skan@item -mno-soft-float 8260169689Skan@itemx -msoft-float 8261169689Skan@opindex mno-soft-float 8262169689Skan@opindex msoft-float 8263169689SkanUse (do not use) the hardware floating-point instructions for 8264169689Skanfloating-point operations. When @option{-msoft-float} is specified, 8265169689Skanfunctions in @file{libgcc.a} will be used to perform floating-point 8266169689Skanoperations. Unless they are replaced by routines that emulate the 8267169689Skanfloating-point operations, or compiled in such a way as to call such 8268169689Skanemulations routines, these routines will issue floating-point 8269169689Skanoperations. If you are compiling for an Alpha without floating-point 8270169689Skanoperations, you must ensure that the library is built so as not to call 8271169689Skanthem. 827290075Sobrien 8273169689SkanNote that Alpha implementations without floating-point operations are 8274169689Skanrequired to have floating-point registers. 8275132718Skan 8276169689Skan@item -mfp-reg 8277169689Skan@itemx -mno-fp-regs 8278169689Skan@opindex mfp-reg 8279169689Skan@opindex mno-fp-regs 8280169689SkanGenerate code that uses (does not use) the floating-point register set. 8281169689Skan@option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point 8282169689Skanregister set is not used, floating point operands are passed in integer 8283169689Skanregisters as if they were integers and floating-point results are passed 8284169689Skanin @code{$0} instead of @code{$f0}. This is a non-standard calling sequence, 8285169689Skanso any function with a floating-point argument or return value called by code 8286169689Skancompiled with @option{-mno-fp-regs} must also be compiled with that 8287169689Skanoption. 8288132718Skan 8289169689SkanA typical use of this option is building a kernel that does not use, 8290169689Skanand hence need not save and restore, any floating-point registers. 829190075Sobrien 8292169689Skan@item -mieee 8293169689Skan@opindex mieee 8294169689SkanThe Alpha architecture implements floating-point hardware optimized for 8295169689Skanmaximum performance. It is mostly compliant with the IEEE floating 8296169689Skanpoint standard. However, for full compliance, software assistance is 8297169689Skanrequired. This option generates code fully IEEE compliant code 8298169689Skan@emph{except} that the @var{inexact-flag} is not maintained (see below). 8299169689SkanIf this option is turned on, the preprocessor macro @code{_IEEE_FP} is 8300169689Skandefined during compilation. The resulting code is less efficient but is 8301169689Skanable to correctly support denormalized numbers and exceptional IEEE 8302169689Skanvalues such as not-a-number and plus/minus infinity. Other Alpha 8303169689Skancompilers call this option @option{-ieee_with_no_inexact}. 8304117395Skan 8305169689Skan@item -mieee-with-inexact 8306169689Skan@opindex mieee-with-inexact 8307169689SkanThis is like @option{-mieee} except the generated code also maintains 8308169689Skanthe IEEE @var{inexact-flag}. Turning on this option causes the 8309169689Skangenerated code to implement fully-compliant IEEE math. In addition to 8310169689Skan@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor 8311169689Skanmacro. On some Alpha implementations the resulting code may execute 8312169689Skansignificantly slower than the code generated by default. Since there is 8313169689Skanvery little code that depends on the @var{inexact-flag}, you should 8314169689Skannormally not specify this option. Other Alpha compilers call this 8315169689Skanoption @option{-ieee_with_inexact}. 8316117395Skan 8317169689Skan@item -mfp-trap-mode=@var{trap-mode} 8318169689Skan@opindex mfp-trap-mode 8319169689SkanThis option controls what floating-point related traps are enabled. 8320169689SkanOther Alpha compilers call this option @option{-fptm @var{trap-mode}}. 8321169689SkanThe trap mode can be set to one of four values: 8322117395Skan 8323169689Skan@table @samp 8324169689Skan@item n 8325169689SkanThis is the default (normal) setting. The only traps that are enabled 8326169689Skanare the ones that cannot be disabled in software (e.g., division by zero 8327169689Skantrap). 832890075Sobrien 8329169689Skan@item u 8330169689SkanIn addition to the traps enabled by @samp{n}, underflow traps are enabled 8331169689Skanas well. 833290075Sobrien 8333169689Skan@item su 8334169689SkanLike @samp{u}, but the instructions are marked to be safe for software 8335169689Skancompletion (see Alpha architecture manual for details). 8336117395Skan 8337169689Skan@item sui 8338169689SkanLike @samp{su}, but inexact traps are enabled as well. 8339169689Skan@end table 834090075Sobrien 8341169689Skan@item -mfp-rounding-mode=@var{rounding-mode} 8342169689Skan@opindex mfp-rounding-mode 8343169689SkanSelects the IEEE rounding mode. Other Alpha compilers call this option 8344169689Skan@option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one 8345169689Skanof: 834690075Sobrien 8347169689Skan@table @samp 8348169689Skan@item n 8349169689SkanNormal IEEE rounding mode. Floating point numbers are rounded towards 8350169689Skanthe nearest machine number or towards the even machine number in case 8351169689Skanof a tie. 835290075Sobrien 8353169689Skan@item m 8354169689SkanRound towards minus infinity. 835590075Sobrien 8356169689Skan@item c 8357169689SkanChopped rounding mode. Floating point numbers are rounded towards zero. 835890075Sobrien 8359169689Skan@item d 8360169689SkanDynamic rounding mode. A field in the floating point control register 8361169689Skan(@var{fpcr}, see Alpha architecture reference manual) controls the 8362169689Skanrounding mode in effect. The C library initializes this register for 8363169689Skanrounding towards plus infinity. Thus, unless your program modifies the 8364169689Skan@var{fpcr}, @samp{d} corresponds to round towards plus infinity. 8365169689Skan@end table 8366132718Skan 8367169689Skan@item -mtrap-precision=@var{trap-precision} 8368169689Skan@opindex mtrap-precision 8369169689SkanIn the Alpha architecture, floating point traps are imprecise. This 8370169689Skanmeans without software assistance it is impossible to recover from a 8371169689Skanfloating trap and program execution normally needs to be terminated. 8372169689SkanGCC can generate code that can assist operating system trap handlers 8373169689Skanin determining the exact location that caused a floating point trap. 8374169689SkanDepending on the requirements of an application, different levels of 8375169689Skanprecisions can be selected: 837690075Sobrien 8377169689Skan@table @samp 8378169689Skan@item p 8379169689SkanProgram precision. This option is the default and means a trap handler 8380169689Skancan only identify which program caused a floating point exception. 838190075Sobrien 8382169689Skan@item f 8383169689SkanFunction precision. The trap handler can determine the function that 8384169689Skancaused a floating point exception. 838590075Sobrien 8386169689Skan@item i 8387169689SkanInstruction precision. The trap handler can determine the exact 8388169689Skaninstruction that caused a floating point exception. 8389169689Skan@end table 8390117395Skan 8391169689SkanOther Alpha compilers provide the equivalent options called 8392169689Skan@option{-scope_safe} and @option{-resumption_safe}. 839390075Sobrien 8394169689Skan@item -mieee-conformant 8395169689Skan@opindex mieee-conformant 8396169689SkanThis option marks the generated code as IEEE conformant. You must not 8397169689Skanuse this option unless you also specify @option{-mtrap-precision=i} and either 8398169689Skan@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect 8399169689Skanis to emit the line @samp{.eflag 48} in the function prologue of the 8400169689Skangenerated assembly file. Under DEC Unix, this has the effect that 8401169689SkanIEEE-conformant math library routines will be linked in. 840290075Sobrien 8403169689Skan@item -mbuild-constants 8404169689Skan@opindex mbuild-constants 8405169689SkanNormally GCC examines a 32- or 64-bit integer constant to 8406169689Skansee if it can construct it from smaller constants in two or three 8407169689Skaninstructions. If it cannot, it will output the constant as a literal and 8408169689Skangenerate code to load it from the data segment at runtime. 840990075Sobrien 8410169689SkanUse this option to require GCC to construct @emph{all} integer constants 8411169689Skanusing code, even if it takes more instructions (the maximum is six). 841290075Sobrien 8413169689SkanYou would typically use this option to build a shared library dynamic 8414169689Skanloader. Itself a shared library, it must relocate itself in memory 8415169689Skanbefore it can find the variables and constants in its own data segment. 841690075Sobrien 8417169689Skan@item -malpha-as 8418169689Skan@itemx -mgas 8419169689Skan@opindex malpha-as 8420169689Skan@opindex mgas 8421169689SkanSelect whether to generate code to be assembled by the vendor-supplied 8422169689Skanassembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}. 842390075Sobrien 8424169689Skan@item -mbwx 8425169689Skan@itemx -mno-bwx 8426169689Skan@itemx -mcix 8427169689Skan@itemx -mno-cix 8428169689Skan@itemx -mfix 8429169689Skan@itemx -mno-fix 8430169689Skan@itemx -mmax 8431169689Skan@itemx -mno-max 8432169689Skan@opindex mbwx 8433169689Skan@opindex mno-bwx 8434169689Skan@opindex mcix 8435169689Skan@opindex mno-cix 8436169689Skan@opindex mfix 8437169689Skan@opindex mno-fix 8438169689Skan@opindex mmax 8439169689Skan@opindex mno-max 8440169689SkanIndicate whether GCC should generate code to use the optional BWX, 8441169689SkanCIX, FIX and MAX instruction sets. The default is to use the instruction 8442169689Skansets supported by the CPU type specified via @option{-mcpu=} option or that 8443169689Skanof the CPU on which GCC was built if none was specified. 844490075Sobrien 8445169689Skan@item -mfloat-vax 8446169689Skan@itemx -mfloat-ieee 8447169689Skan@opindex mfloat-vax 8448169689Skan@opindex mfloat-ieee 8449169689SkanGenerate code that uses (does not use) VAX F and G floating point 8450169689Skanarithmetic instead of IEEE single and double precision. 845190075Sobrien 8452169689Skan@item -mexplicit-relocs 8453169689Skan@itemx -mno-explicit-relocs 8454169689Skan@opindex mexplicit-relocs 8455169689Skan@opindex mno-explicit-relocs 8456169689SkanOlder Alpha assemblers provided no way to generate symbol relocations 8457169689Skanexcept via assembler macros. Use of these macros does not allow 8458169689Skanoptimal instruction scheduling. GNU binutils as of version 2.12 8459169689Skansupports a new syntax that allows the compiler to explicitly mark 8460169689Skanwhich relocations should apply to which instructions. This option 8461169689Skanis mostly useful for debugging, as GCC detects the capabilities of 8462169689Skanthe assembler when it is built and sets the default accordingly. 846390075Sobrien 8464169689Skan@item -msmall-data 8465169689Skan@itemx -mlarge-data 8466169689Skan@opindex msmall-data 8467169689Skan@opindex mlarge-data 8468169689SkanWhen @option{-mexplicit-relocs} is in effect, static data is 8469169689Skanaccessed via @dfn{gp-relative} relocations. When @option{-msmall-data} 8470169689Skanis used, objects 8 bytes long or smaller are placed in a @dfn{small data area} 8471169689Skan(the @code{.sdata} and @code{.sbss} sections) and are accessed via 8472169689Skan16-bit relocations off of the @code{$gp} register. This limits the 8473169689Skansize of the small data area to 64KB, but allows the variables to be 8474169689Skandirectly accessed via a single instruction. 8475132718Skan 8476169689SkanThe default is @option{-mlarge-data}. With this option the data area 8477169689Skanis limited to just below 2GB@. Programs that require more than 2GB of 8478169689Skandata must use @code{malloc} or @code{mmap} to allocate the data in the 8479169689Skanheap instead of in the program's data segment. 8480132718Skan 8481169689SkanWhen generating code for shared libraries, @option{-fpic} implies 8482169689Skan@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}. 8483132718Skan 8484169689Skan@item -msmall-text 8485169689Skan@itemx -mlarge-text 8486169689Skan@opindex msmall-text 8487169689Skan@opindex mlarge-text 8488169689SkanWhen @option{-msmall-text} is used, the compiler assumes that the 8489169689Skancode of the entire program (or shared library) fits in 4MB, and is 8490169689Skanthus reachable with a branch instruction. When @option{-msmall-data} 8491169689Skanis used, the compiler can assume that all local symbols share the 8492169689Skansame @code{$gp} value, and thus reduce the number of instructions 8493169689Skanrequired for a function call from 4 to 1. 8494169689Skan 8495169689SkanThe default is @option{-mlarge-text}. 8496169689Skan 8497169689Skan@item -mcpu=@var{cpu_type} 8498169689Skan@opindex mcpu 8499169689SkanSet the instruction set and instruction scheduling parameters for 8500169689Skanmachine type @var{cpu_type}. You can specify either the @samp{EV} 8501169689Skanstyle name or the corresponding chip number. GCC supports scheduling 8502169689Skanparameters for the EV4, EV5 and EV6 family of processors and will 8503169689Skanchoose the default values for the instruction set from the processor 8504169689Skanyou specify. If you do not specify a processor type, GCC will default 8505169689Skanto the processor on which the compiler was built. 8506169689Skan 8507169689SkanSupported values for @var{cpu_type} are 8508169689Skan 8509169689Skan@table @samp 8510169689Skan@item ev4 8511169689Skan@itemx ev45 8512169689Skan@itemx 21064 8513169689SkanSchedules as an EV4 and has no instruction set extensions. 8514169689Skan 8515169689Skan@item ev5 8516169689Skan@itemx 21164 8517169689SkanSchedules as an EV5 and has no instruction set extensions. 8518169689Skan 8519169689Skan@item ev56 8520169689Skan@itemx 21164a 8521169689SkanSchedules as an EV5 and supports the BWX extension. 8522169689Skan 8523169689Skan@item pca56 8524169689Skan@itemx 21164pc 8525169689Skan@itemx 21164PC 8526169689SkanSchedules as an EV5 and supports the BWX and MAX extensions. 8527169689Skan 8528169689Skan@item ev6 8529169689Skan@itemx 21264 8530169689SkanSchedules as an EV6 and supports the BWX, FIX, and MAX extensions. 8531169689Skan 8532169689Skan@item ev67 8533169689Skan@itemx 21264a 8534169689SkanSchedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions. 8535169689Skan@end table 8536169689Skan 8537169689Skan@item -mtune=@var{cpu_type} 8538169689Skan@opindex mtune 8539169689SkanSet only the instruction scheduling parameters for machine type 8540169689Skan@var{cpu_type}. The instruction set is not changed. 8541169689Skan 8542169689Skan@item -mmemory-latency=@var{time} 8543169689Skan@opindex mmemory-latency 8544169689SkanSets the latency the scheduler should assume for typical memory 8545169689Skanreferences as seen by the application. This number is highly 8546169689Skandependent on the memory access patterns used by the application 8547169689Skanand the size of the external cache on the machine. 8548169689Skan 8549169689SkanValid options for @var{time} are 8550169689Skan 8551169689Skan@table @samp 8552169689Skan@item @var{number} 8553169689SkanA decimal number representing clock cycles. 8554169689Skan 8555169689Skan@item L1 8556169689Skan@itemx L2 8557169689Skan@itemx L3 8558169689Skan@itemx main 8559169689SkanThe compiler contains estimates of the number of clock cycles for 8560169689Skan``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches 8561169689Skan(also called Dcache, Scache, and Bcache), as well as to main memory. 8562169689SkanNote that L3 is only valid for EV5. 8563169689Skan 8564169689Skan@end table 8565169689Skan@end table 8566169689Skan 8567169689Skan@node DEC Alpha/VMS Options 8568169689Skan@subsection DEC Alpha/VMS Options 8569169689Skan 8570169689SkanThese @samp{-m} options are defined for the DEC Alpha/VMS implementations: 8571169689Skan 8572169689Skan@table @gcctabopt 8573169689Skan@item -mvms-return-codes 8574169689Skan@opindex mvms-return-codes 8575169689SkanReturn VMS condition codes from main. The default is to return POSIX 8576169689Skanstyle condition (e.g.@ error) codes. 8577169689Skan@end table 8578169689Skan 8579169689Skan@node FRV Options 8580169689Skan@subsection FRV Options 8581169689Skan@cindex FRV Options 8582169689Skan 8583169689Skan@table @gcctabopt 8584169689Skan@item -mgpr-32 8585169689Skan@opindex mgpr-32 8586169689Skan 8587169689SkanOnly use the first 32 general purpose registers. 8588169689Skan 8589169689Skan@item -mgpr-64 8590169689Skan@opindex mgpr-64 8591169689Skan 8592169689SkanUse all 64 general purpose registers. 8593169689Skan 8594169689Skan@item -mfpr-32 8595169689Skan@opindex mfpr-32 8596169689Skan 8597169689SkanUse only the first 32 floating point registers. 8598169689Skan 8599169689Skan@item -mfpr-64 8600169689Skan@opindex mfpr-64 8601169689Skan 8602169689SkanUse all 64 floating point registers 8603169689Skan 860490075Sobrien@item -mhard-float 860590075Sobrien@opindex mhard-float 860690075Sobrien 8607169689SkanUse hardware instructions for floating point operations. 8608169689Skan 8609132718Skan@item -msoft-float 8610132718Skan@opindex msoft-float 861190075Sobrien 8612169689SkanUse library routines for floating point operations. 861390075Sobrien 8614169689Skan@item -malloc-cc 8615169689Skan@opindex malloc-cc 861690075Sobrien 8617169689SkanDynamically allocate condition code registers. 861890075Sobrien 8619169689Skan@item -mfixed-cc 8620169689Skan@opindex mfixed-cc 8621132718Skan 8622169689SkanDo not try to dynamically allocate condition code registers, only 8623169689Skanuse @code{icc0} and @code{fcc0}. 8624132718Skan 8625169689Skan@item -mdword 8626169689Skan@opindex mdword 8627132718Skan 8628169689SkanChange ABI to use double word insns. 8629132718Skan 8630169689Skan@item -mno-dword 8631169689Skan@opindex mno-dword 8632132718Skan 8633169689SkanDo not use double word instructions. 863490075Sobrien 8635169689Skan@item -mdouble 8636169689Skan@opindex mdouble 863790075Sobrien 8638169689SkanUse floating point double instructions. 863990075Sobrien 8640169689Skan@item -mno-double 8641169689Skan@opindex mno-double 8642132718Skan 8643169689SkanDo not use floating point double instructions. 8644132718Skan 8645169689Skan@item -mmedia 8646169689Skan@opindex mmedia 8647132718Skan 8648169689SkanUse media instructions. 8649132718Skan 8650169689Skan@item -mno-media 8651169689Skan@opindex mno-media 8652132718Skan 8653169689SkanDo not use media instructions. 8654132718Skan 8655169689Skan@item -mmuladd 8656169689Skan@opindex mmuladd 8657132718Skan 8658169689SkanUse multiply and add/subtract instructions. 8659169689Skan 8660169689Skan@item -mno-muladd 8661169689Skan@opindex mno-muladd 8662169689Skan 8663169689SkanDo not use multiply and add/subtract instructions. 8664169689Skan 8665169689Skan@item -mfdpic 8666169689Skan@opindex mfdpic 8667169689Skan 8668169689SkanSelect the FDPIC ABI, that uses function descriptors to represent 8669169689Skanpointers to functions. Without any PIC/PIE-related options, it 8670169689Skanimplies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it 8671169689Skanassumes GOT entries and small data are within a 12-bit range from the 8672169689SkanGOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets 8673169689Skanare computed with 32 bits. 8674169689Skan 8675169689Skan@item -minline-plt 8676169689Skan@opindex minline-plt 8677169689Skan 8678169689SkanEnable inlining of PLT entries in function calls to functions that are 8679169689Skannot known to bind locally. It has no effect without @option{-mfdpic}. 8680169689SkanIt's enabled by default if optimizing for speed and compiling for 8681169689Skanshared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an 8682169689Skanoptimization option such as @option{-O3} or above is present in the 8683169689Skancommand line. 8684169689Skan 8685169689Skan@item -mTLS 8686169689Skan@opindex TLS 8687169689Skan 8688169689SkanAssume a large TLS segment when generating thread-local code. 8689169689Skan 8690169689Skan@item -mtls 8691169689Skan@opindex tls 8692169689Skan 8693169689SkanDo not assume a large TLS segment when generating thread-local code. 8694169689Skan 8695169689Skan@item -mgprel-ro 8696169689Skan@opindex mgprel-ro 8697169689Skan 8698169689SkanEnable the use of @code{GPREL} relocations in the FDPIC ABI for data 8699169689Skanthat is known to be in read-only sections. It's enabled by default, 8700169689Skanexcept for @option{-fpic} or @option{-fpie}: even though it may help 8701169689Skanmake the global offset table smaller, it trades 1 instruction for 4. 8702169689SkanWith @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4, 8703169689Skanone of which may be shared by multiple symbols, and it avoids the need 8704169689Skanfor a GOT entry for the referenced symbol, so it's more likely to be a 8705169689Skanwin. If it is not, @option{-mno-gprel-ro} can be used to disable it. 8706169689Skan 8707169689Skan@item -multilib-library-pic 8708169689Skan@opindex multilib-library-pic 8709169689Skan 8710169689SkanLink with the (library, not FD) pic libraries. It's implied by 8711169689Skan@option{-mlibrary-pic}, as well as by @option{-fPIC} and 8712169689Skan@option{-fpic} without @option{-mfdpic}. You should never have to use 8713169689Skanit explicitly. 8714169689Skan 8715169689Skan@item -mlinked-fp 8716169689Skan@opindex mlinked-fp 8717169689Skan 8718169689SkanFollow the EABI requirement of always creating a frame pointer whenever 8719169689Skana stack frame is allocated. This option is enabled by default and can 8720169689Skanbe disabled with @option{-mno-linked-fp}. 8721169689Skan 8722132718Skan@item -mlong-calls 8723132718Skan@opindex mlong-calls 8724169689Skan 8725169689SkanUse indirect addressing to call functions outside the current 8726169689Skancompilation unit. This allows the functions to be placed anywhere 8727169689Skanwithin the 32-bit address space. 8728169689Skan 8729169689Skan@item -malign-labels 8730169689Skan@opindex malign-labels 8731169689Skan 8732169689SkanTry to align labels to an 8-byte boundary by inserting nops into the 8733169689Skanprevious packet. This option only has an effect when VLIW packing 8734169689Skanis enabled. It doesn't create new packets; it merely adds nops to 8735169689Skanexisting ones. 8736169689Skan 8737169689Skan@item -mlibrary-pic 8738169689Skan@opindex mlibrary-pic 8739169689Skan 8740169689SkanGenerate position-independent EABI code. 8741169689Skan 8742169689Skan@item -macc-4 8743169689Skan@opindex macc-4 8744169689Skan 8745169689SkanUse only the first four media accumulator registers. 8746169689Skan 8747169689Skan@item -macc-8 8748169689Skan@opindex macc-8 8749169689Skan 8750169689SkanUse all eight media accumulator registers. 8751169689Skan 8752169689Skan@item -mpack 8753169689Skan@opindex mpack 8754169689Skan 8755169689SkanPack VLIW instructions. 8756169689Skan 8757169689Skan@item -mno-pack 8758169689Skan@opindex mno-pack 8759169689Skan 8760169689SkanDo not pack VLIW instructions. 8761169689Skan 8762169689Skan@item -mno-eflags 8763169689Skan@opindex mno-eflags 8764169689Skan 8765169689SkanDo not mark ABI switches in e_flags. 8766169689Skan 8767169689Skan@item -mcond-move 8768169689Skan@opindex mcond-move 8769169689Skan 8770169689SkanEnable the use of conditional-move instructions (default). 8771169689Skan 8772169689SkanThis switch is mainly for debugging the compiler and will likely be removed 8773169689Skanin a future version. 8774169689Skan 8775169689Skan@item -mno-cond-move 8776169689Skan@opindex mno-cond-move 8777169689Skan 8778169689SkanDisable the use of conditional-move instructions. 8779169689Skan 8780169689SkanThis switch is mainly for debugging the compiler and will likely be removed 8781169689Skanin a future version. 8782169689Skan 8783169689Skan@item -mscc 8784169689Skan@opindex mscc 8785169689Skan 8786169689SkanEnable the use of conditional set instructions (default). 8787169689Skan 8788169689SkanThis switch is mainly for debugging the compiler and will likely be removed 8789169689Skanin a future version. 8790169689Skan 8791169689Skan@item -mno-scc 8792169689Skan@opindex mno-scc 8793169689Skan 8794169689SkanDisable the use of conditional set instructions. 8795169689Skan 8796169689SkanThis switch is mainly for debugging the compiler and will likely be removed 8797169689Skanin a future version. 8798169689Skan 8799169689Skan@item -mcond-exec 8800169689Skan@opindex mcond-exec 8801169689Skan 8802169689SkanEnable the use of conditional execution (default). 8803169689Skan 8804169689SkanThis switch is mainly for debugging the compiler and will likely be removed 8805169689Skanin a future version. 8806169689Skan 8807169689Skan@item -mno-cond-exec 8808169689Skan@opindex mno-cond-exec 8809169689Skan 8810169689SkanDisable the use of conditional execution. 8811169689Skan 8812169689SkanThis switch is mainly for debugging the compiler and will likely be removed 8813169689Skanin a future version. 8814169689Skan 8815169689Skan@item -mvliw-branch 8816169689Skan@opindex mvliw-branch 8817169689Skan 8818169689SkanRun a pass to pack branches into VLIW instructions (default). 8819169689Skan 8820169689SkanThis switch is mainly for debugging the compiler and will likely be removed 8821169689Skanin a future version. 8822169689Skan 8823169689Skan@item -mno-vliw-branch 8824169689Skan@opindex mno-vliw-branch 8825169689Skan 8826169689SkanDo not run a pass to pack branches into VLIW instructions. 8827169689Skan 8828169689SkanThis switch is mainly for debugging the compiler and will likely be removed 8829169689Skanin a future version. 8830169689Skan 8831169689Skan@item -mmulti-cond-exec 8832169689Skan@opindex mmulti-cond-exec 8833169689Skan 8834169689SkanEnable optimization of @code{&&} and @code{||} in conditional execution 8835169689Skan(default). 8836169689Skan 8837169689SkanThis switch is mainly for debugging the compiler and will likely be removed 8838169689Skanin a future version. 8839169689Skan 8840169689Skan@item -mno-multi-cond-exec 8841169689Skan@opindex mno-multi-cond-exec 8842169689Skan 8843169689SkanDisable optimization of @code{&&} and @code{||} in conditional execution. 8844169689Skan 8845169689SkanThis switch is mainly for debugging the compiler and will likely be removed 8846169689Skanin a future version. 8847169689Skan 8848169689Skan@item -mnested-cond-exec 8849169689Skan@opindex mnested-cond-exec 8850169689Skan 8851169689SkanEnable nested conditional execution optimizations (default). 8852169689Skan 8853169689SkanThis switch is mainly for debugging the compiler and will likely be removed 8854169689Skanin a future version. 8855169689Skan 8856169689Skan@item -mno-nested-cond-exec 8857169689Skan@opindex mno-nested-cond-exec 8858169689Skan 8859169689SkanDisable nested conditional execution optimizations. 8860169689Skan 8861169689SkanThis switch is mainly for debugging the compiler and will likely be removed 8862169689Skanin a future version. 8863169689Skan 8864169689Skan@item -moptimize-membar 8865169689Skan@opindex moptimize-membar 8866169689Skan 8867169689SkanThis switch removes redundant @code{membar} instructions from the 8868169689Skancompiler generated code. It is enabled by default. 8869169689Skan 8870169689Skan@item -mno-optimize-membar 8871169689Skan@opindex mno-optimize-membar 8872169689Skan 8873169689SkanThis switch disables the automatic removal of redundant @code{membar} 8874169689Skaninstructions from the generated code. 8875169689Skan 8876169689Skan@item -mtomcat-stats 8877169689Skan@opindex mtomcat-stats 8878169689Skan 8879169689SkanCause gas to print out tomcat statistics. 8880169689Skan 8881169689Skan@item -mcpu=@var{cpu} 8882169689Skan@opindex mcpu 8883169689Skan 8884169689SkanSelect the processor type for which to generate code. Possible values are 8885169689Skan@samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450}, 8886169689Skan@samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}. 8887169689Skan 8888169689Skan@end table 8889169689Skan 8890169689Skan@node GNU/Linux Options 8891169689Skan@subsection GNU/Linux Options 8892169689Skan 8893169689SkanThese @samp{-m} options are defined for GNU/Linux targets: 8894169689Skan 8895169689Skan@table @gcctabopt 8896169689Skan@item -mglibc 8897169689Skan@opindex mglibc 8898169689SkanUse the GNU C library instead of uClibc. This is the default except 8899169689Skanon @samp{*-*-linux-*uclibc*} targets. 8900169689Skan 8901169689Skan@item -muclibc 8902169689Skan@opindex muclibc 8903169689SkanUse uClibc instead of the GNU C library. This is the default on 8904169689Skan@samp{*-*-linux-*uclibc*} targets. 8905169689Skan@end table 8906169689Skan 8907169689Skan@node H8/300 Options 8908169689Skan@subsection H8/300 Options 8909169689Skan 8910169689SkanThese @samp{-m} options are defined for the H8/300 implementations: 8911169689Skan 8912169689Skan@table @gcctabopt 8913169689Skan@item -mrelax 8914169689Skan@opindex mrelax 8915169689SkanShorten some address references at link time, when possible; uses the 8916169689Skanlinker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300, 8917169689Skanld, Using ld}, for a fuller description. 8918169689Skan 8919169689Skan@item -mh 8920169689Skan@opindex mh 8921169689SkanGenerate code for the H8/300H@. 8922169689Skan 8923169689Skan@item -ms 8924169689Skan@opindex ms 8925169689SkanGenerate code for the H8S@. 8926169689Skan 8927169689Skan@item -mn 8928169689Skan@opindex mn 8929169689SkanGenerate code for the H8S and H8/300H in the normal mode. This switch 8930169689Skanmust be used either with @option{-mh} or @option{-ms}. 8931169689Skan 8932169689Skan@item -ms2600 8933169689Skan@opindex ms2600 8934169689SkanGenerate code for the H8S/2600. This switch must be used with @option{-ms}. 8935169689Skan 8936169689Skan@item -mint32 8937169689Skan@opindex mint32 8938169689SkanMake @code{int} data 32 bits by default. 8939169689Skan 8940169689Skan@item -malign-300 8941169689Skan@opindex malign-300 8942169689SkanOn the H8/300H and H8S, use the same alignment rules as for the H8/300. 8943169689SkanThe default for the H8/300H and H8S is to align longs and floats on 4 8944169689Skanbyte boundaries. 8945169689Skan@option{-malign-300} causes them to be aligned on 2 byte boundaries. 8946169689SkanThis option has no effect on the H8/300. 8947169689Skan@end table 8948169689Skan 8949169689Skan@node HPPA Options 8950169689Skan@subsection HPPA Options 8951169689Skan@cindex HPPA Options 8952169689Skan 8953169689SkanThese @samp{-m} options are defined for the HPPA family of computers: 8954169689Skan 8955169689Skan@table @gcctabopt 8956169689Skan@item -march=@var{architecture-type} 8957169689Skan@opindex march 8958169689SkanGenerate code for the specified architecture. The choices for 8959169689Skan@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA 8960169689Skan1.1, and @samp{2.0} for PA 2.0 processors. Refer to 8961169689Skan@file{/usr/lib/sched.models} on an HP-UX system to determine the proper 8962169689Skanarchitecture option for your machine. Code compiled for lower numbered 8963169689Skanarchitectures will run on higher numbered architectures, but not the 8964169689Skanother way around. 8965169689Skan 8966169689Skan@item -mpa-risc-1-0 8967169689Skan@itemx -mpa-risc-1-1 8968169689Skan@itemx -mpa-risc-2-0 8969169689Skan@opindex mpa-risc-1-0 8970169689Skan@opindex mpa-risc-1-1 8971169689Skan@opindex mpa-risc-2-0 8972169689SkanSynonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively. 8973169689Skan 8974169689Skan@item -mbig-switch 8975169689Skan@opindex mbig-switch 8976169689SkanGenerate code suitable for big switch tables. Use this option only if 8977169689Skanthe assembler/linker complain about out of range branches within a switch 8978169689Skantable. 8979169689Skan 8980169689Skan@item -mjump-in-delay 8981169689Skan@opindex mjump-in-delay 8982169689SkanFill delay slots of function calls with unconditional jump instructions 8983169689Skanby modifying the return pointer for the function call to be the target 8984169689Skanof the conditional jump. 8985169689Skan 8986169689Skan@item -mdisable-fpregs 8987169689Skan@opindex mdisable-fpregs 8988169689SkanPrevent floating point registers from being used in any manner. This is 8989169689Skannecessary for compiling kernels which perform lazy context switching of 8990169689Skanfloating point registers. If you use this option and attempt to perform 8991169689Skanfloating point operations, the compiler will abort. 8992169689Skan 8993169689Skan@item -mdisable-indexing 8994169689Skan@opindex mdisable-indexing 8995169689SkanPrevent the compiler from using indexing address modes. This avoids some 8996169689Skanrather obscure problems when compiling MIG generated code under MACH@. 8997169689Skan 8998169689Skan@item -mno-space-regs 8999169689Skan@opindex mno-space-regs 9000169689SkanGenerate code that assumes the target has no space registers. This allows 9001169689SkanGCC to generate faster indirect calls and use unscaled index address modes. 9002169689Skan 9003169689SkanSuch code is suitable for level 0 PA systems and kernels. 9004169689Skan 9005169689Skan@item -mfast-indirect-calls 9006169689Skan@opindex mfast-indirect-calls 9007169689SkanGenerate code that assumes calls never cross space boundaries. This 9008169689Skanallows GCC to emit code which performs faster indirect calls. 9009169689Skan 9010169689SkanThis option will not work in the presence of shared libraries or nested 9011169689Skanfunctions. 9012169689Skan 9013169689Skan@item -mfixed-range=@var{register-range} 9014169689Skan@opindex mfixed-range 9015169689SkanGenerate code treating the given register range as fixed registers. 9016169689SkanA fixed register is one that the register allocator can not use. This is 9017169689Skanuseful when compiling kernel code. A register range is specified as 9018169689Skantwo registers separated by a dash. Multiple register ranges can be 9019169689Skanspecified separated by a comma. 9020169689Skan 9021169689Skan@item -mlong-load-store 9022169689Skan@opindex mlong-load-store 9023169689SkanGenerate 3-instruction load and store sequences as sometimes required by 9024169689Skanthe HP-UX 10 linker. This is equivalent to the @samp{+k} option to 9025169689Skanthe HP compilers. 9026169689Skan 9027169689Skan@item -mportable-runtime 9028169689Skan@opindex mportable-runtime 9029169689SkanUse the portable calling conventions proposed by HP for ELF systems. 9030169689Skan 9031169689Skan@item -mgas 9032169689Skan@opindex mgas 9033169689SkanEnable the use of assembler directives only GAS understands. 9034169689Skan 9035169689Skan@item -mschedule=@var{cpu-type} 9036169689Skan@opindex mschedule 9037169689SkanSchedule code according to the constraints for the machine type 9038169689Skan@var{cpu-type}. The choices for @var{cpu-type} are @samp{700} 9039169689Skan@samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer 9040169689Skanto @file{/usr/lib/sched.models} on an HP-UX system to determine the 9041169689Skanproper scheduling option for your machine. The default scheduling is 9042169689Skan@samp{8000}. 9043169689Skan 9044169689Skan@item -mlinker-opt 9045169689Skan@opindex mlinker-opt 9046169689SkanEnable the optimization pass in the HP-UX linker. Note this makes symbolic 9047169689Skandebugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9 9048169689Skanlinkers in which they give bogus error messages when linking some programs. 9049169689Skan 9050169689Skan@item -msoft-float 9051169689Skan@opindex msoft-float 9052169689SkanGenerate output containing library calls for floating point. 9053169689Skan@strong{Warning:} the requisite libraries are not available for all HPPA 9054169689Skantargets. Normally the facilities of the machine's usual C compiler are 9055169689Skanused, but this cannot be done directly in cross-compilation. You must make 9056169689Skanyour own arrangements to provide suitable library functions for 9057169689Skancross-compilation. The embedded target @samp{hppa1.1-*-pro} 9058169689Skandoes provide software floating point support. 9059169689Skan 9060169689Skan@option{-msoft-float} changes the calling convention in the output file; 9061169689Skantherefore, it is only useful if you compile @emph{all} of a program with 9062169689Skanthis option. In particular, you need to compile @file{libgcc.a}, the 9063169689Skanlibrary that comes with GCC, with @option{-msoft-float} in order for 9064169689Skanthis to work. 9065169689Skan 9066169689Skan@item -msio 9067169689Skan@opindex msio 9068169689SkanGenerate the predefine, @code{_SIO}, for server IO@. The default is 9069169689Skan@option{-mwsio}. This generates the predefines, @code{__hp9000s700}, 9070169689Skan@code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These 9071169689Skanoptions are available under HP-UX and HI-UX@. 9072169689Skan 9073169689Skan@item -mgnu-ld 9074169689Skan@opindex gnu-ld 9075169689SkanUse GNU ld specific options. This passes @option{-shared} to ld when 9076169689Skanbuilding a shared library. It is the default when GCC is configured, 9077169689Skanexplicitly or implicitly, with the GNU linker. This option does not 9078169689Skanhave any affect on which ld is called, it only changes what parameters 9079169689Skanare passed to that ld. The ld that is called is determined by the 9080169689Skan@option{--with-ld} configure option, GCC's program search path, and 9081169689Skanfinally by the user's @env{PATH}. The linker used by GCC can be printed 9082169689Skanusing @samp{which `gcc -print-prog-name=ld`}. This option is only available 9083169689Skanon the 64 bit HP-UX GCC, i.e. configured with @samp{hppa*64*-*-hpux*}. 9084169689Skan 9085169689Skan@item -mhp-ld 9086169689Skan@opindex hp-ld 9087169689SkanUse HP ld specific options. This passes @option{-b} to ld when building 9088169689Skana shared library and passes @option{+Accept TypeMismatch} to ld on all 9089169689Skanlinks. It is the default when GCC is configured, explicitly or 9090169689Skanimplicitly, with the HP linker. This option does not have any affect on 9091169689Skanwhich ld is called, it only changes what parameters are passed to that 9092169689Skanld. The ld that is called is determined by the @option{--with-ld} 9093169689Skanconfigure option, GCC's program search path, and finally by the user's 9094169689Skan@env{PATH}. The linker used by GCC can be printed using @samp{which 9095169689Skan`gcc -print-prog-name=ld`}. This option is only available on the 64 bit 9096169689SkanHP-UX GCC, i.e. configured with @samp{hppa*64*-*-hpux*}. 9097169689Skan 9098169689Skan@item -mlong-calls 9099132718Skan@opindex mno-long-calls 9100169689SkanGenerate code that uses long call sequences. This ensures that a call 9101169689Skanis always able to reach linker generated stubs. The default is to generate 9102169689Skanlong calls only when the distance from the call site to the beginning 9103169689Skanof the function or translation unit, as the case may be, exceeds a 9104169689Skanpredefined limit set by the branch type being used. The limits for 9105169689Skannormal calls are 7,600,000 and 240,000 bytes, respectively for the 9106169689SkanPA 2.0 and PA 1.X architectures. Sibcalls are always limited at 9107169689Skan240,000 bytes. 9108132718Skan 9109169689SkanDistances are measured from the beginning of functions when using the 9110169689Skan@option{-ffunction-sections} option, or when using the @option{-mgas} 9111169689Skanand @option{-mno-portable-runtime} options together under HP-UX with 9112169689Skanthe SOM linker. 9113132718Skan 9114169689SkanIt is normally not desirable to use this option as it will degrade 9115169689Skanperformance. However, it may be useful in large applications, 9116169689Skanparticularly when partial linking is used to build the application. 911790075Sobrien 9118169689SkanThe types of long calls used depends on the capabilities of the 9119169689Skanassembler and linker, and the type of code being generated. The 9120169689Skanimpact on systems that support long absolute calls, and long pic 9121169689Skansymbol-difference or pc-relative calls should be relatively small. 9122169689SkanHowever, an indirect call is used on 32-bit ELF systems in pic code 9123169689Skanand it is quite long. 912490075Sobrien 9125169689Skan@item -munix=@var{unix-std} 9126169689Skan@opindex march 9127169689SkanGenerate compiler predefines and select a startfile for the specified 9128169689SkanUNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95} 9129169689Skanand @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95} 9130169689Skanis available on HP-UX 10.10 and later. @samp{98} is available on HP-UX 9131169689Skan11.11 and later. The default values are @samp{93} for HP-UX 10.00, 9132169689Skan@samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11 9133169689Skanand later. 913490075Sobrien 9135169689Skan@option{-munix=93} provides the same predefines as GCC 3.3 and 3.4. 9136169689Skan@option{-munix=95} provides additional predefines for @code{XOPEN_UNIX} 9137169689Skanand @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}. 9138169689Skan@option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX}, 9139169689Skan@code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and 9140169689Skan@code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}. 914190075Sobrien 9142169689SkanIt is @emph{important} to note that this option changes the interfaces 9143169689Skanfor various library routines. It also affects the operational behavior 9144169689Skanof the C library. Thus, @emph{extreme} care is needed in using this 9145169689Skanoption. 914690075Sobrien 9147169689SkanLibrary code that is intended to operate with more than one UNIX 9148169689Skanstandard must test, set and restore the variable @var{__xpg4_extended_mask} 9149169689Skanas appropriate. Most GNU software doesn't provide this capability. 9150117395Skan 9151169689Skan@item -nolibdld 9152169689Skan@opindex nolibdld 9153169689SkanSuppress the generation of link options to search libdld.sl when the 9154169689Skan@option{-static} option is specified on HP-UX 10 and later. 9155169689Skan 9156169689Skan@item -static 9157169689Skan@opindex static 9158169689SkanThe HP-UX implementation of setlocale in libc has a dependency on 9159169689Skanlibdld.sl. There isn't an archive version of libdld.sl. Thus, 9160169689Skanwhen the @option{-static} option is specified, special link options 9161169689Skanare needed to resolve this dependency. 9162169689Skan 9163169689SkanOn HP-UX 10 and later, the GCC driver adds the necessary options to 9164169689Skanlink with libdld.sl when the @option{-static} option is specified. 9165169689SkanThis causes the resulting binary to be dynamic. On the 64-bit port, 9166169689Skanthe linkers generate dynamic binaries by default in any case. The 9167169689Skan@option{-nolibdld} option can be used to prevent the GCC driver from 9168169689Skanadding these link options. 9169169689Skan 9170169689Skan@item -threads 9171169689Skan@opindex threads 9172169689SkanAdd support for multithreading with the @dfn{dce thread} library 9173169689Skanunder HP-UX@. This option sets flags for both the preprocessor and 9174169689Skanlinker. 917590075Sobrien@end table 917690075Sobrien 917790075Sobrien@node i386 and x86-64 Options 917890075Sobrien@subsection Intel 386 and AMD x86-64 Options 917990075Sobrien@cindex i386 Options 918090075Sobrien@cindex x86-64 Options 918190075Sobrien@cindex Intel 386 Options 918290075Sobrien@cindex AMD x86-64 Options 918390075Sobrien 918490075SobrienThese @samp{-m} options are defined for the i386 and x86-64 family of 918590075Sobriencomputers: 918690075Sobrien 918790075Sobrien@table @gcctabopt 9188132718Skan@item -mtune=@var{cpu-type} 9189132718Skan@opindex mtune 919090075SobrienTune to @var{cpu-type} everything applicable about the generated code, except 919190075Sobrienfor the ABI and the set of available instructions. The choices for 9192132718Skan@var{cpu-type} are: 9193132718Skan@table @emph 9194169689Skan@item generic 9195169689SkanProduce code optimized for the most common IA32/AMD64/EM64T processors. 9196169689SkanIf you know the CPU on which your code will run, then you should use 9197169689Skanthe corresponding @option{-mtune} option instead of 9198169689Skan@option{-mtune=generic}. But, if you do not know exactly what CPU users 9199169689Skanof your application will have, then you should use this option. 9200169689Skan 9201169689SkanAs new processors are deployed in the marketplace, the behavior of this 9202169689Skanoption will change. Therefore, if you upgrade to a newer version of 9203169689SkanGCC, the code generated option will change to reflect the processors 9204169689Skanthat were most common when that version of GCC was released. 9205169689Skan 9206169689SkanThere is no @option{-march=generic} option because @option{-march} 9207169689Skanindicates the instruction set the compiler can use, and there is no 9208169689Skangeneric instruction set applicable to all processors. In contrast, 9209169689Skan@option{-mtune} indicates the processor (or, in this case, collection of 9210169689Skanprocessors) for which the code is optimized. 9211169689Skan@item native 9212169689SkanThis selects the CPU to tune for at compilation time by determining 9213169689Skanthe processor type of the compiling machine. Using @option{-mtune=native} 9214169689Skanwill produce code optimized for the local machine under the constraints 9215169689Skanof the selected instruction set. Using @option{-march=native} will 9216169689Skanenable all instruction subsets supported by the local machine (hence 9217169689Skanthe result might not run on different machines). 9218132718Skan@item i386 9219169689SkanOriginal Intel's i386 CPU@. 9220132718Skan@item i486 9221169689SkanIntel's i486 CPU@. (No scheduling is implemented for this chip.) 9222132718Skan@item i586, pentium 9223132718SkanIntel Pentium CPU with no MMX support. 9224132718Skan@item pentium-mmx 9225132718SkanIntel PentiumMMX CPU based on Pentium core with MMX instruction set support. 9226169689Skan@item pentiumpro 9227169689SkanIntel PentiumPro CPU@. 9228169689Skan@item i686 9229169689SkanSame as @code{generic}, but when used as @code{march} option, PentiumPro 9230169689Skaninstruction set will be used, so the code will run on all i686 family chips. 9231132718Skan@item pentium2 9232132718SkanIntel Pentium2 CPU based on PentiumPro core with MMX instruction set support. 9233132718Skan@item pentium3, pentium3m 9234132718SkanIntel Pentium3 CPU based on PentiumPro core with MMX and SSE instruction set 9235132718Skansupport. 9236132718Skan@item pentium-m 9237132718SkanLow power version of Intel Pentium3 CPU with MMX, SSE and SSE2 instruction set 9238132718Skansupport. Used by Centrino notebooks. 9239132718Skan@item pentium4, pentium4m 9240132718SkanIntel Pentium4 CPU with MMX, SSE and SSE2 instruction set support. 9241132718Skan@item prescott 9242132718SkanImproved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction 9243132718Skanset support. 9244132718Skan@item nocona 9245132718SkanImproved version of Intel Pentium4 CPU with 64-bit extensions, MMX, SSE, 9246132718SkanSSE2 and SSE3 instruction set support. 9247219374Smm@item core2 9248219374SmmIntel Core2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3 9249219374Smminstruction set support. 9250132718Skan@item k6 9251132718SkanAMD K6 CPU with MMX instruction set support. 9252132718Skan@item k6-2, k6-3 9253132718SkanImproved versions of AMD K6 CPU with MMX and 3dNOW! instruction set support. 9254132718Skan@item athlon, athlon-tbird 9255132718SkanAMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and SSE prefetch instructions 9256132718Skansupport. 9257132718Skan@item athlon-4, athlon-xp, athlon-mp 9258132718SkanImproved AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and full SSE 9259132718Skaninstruction set support. 9260132718Skan@item k8, opteron, athlon64, athlon-fx 9261132718SkanAMD K8 core based CPUs with x86-64 instruction set support. (This supersets 9262132718SkanMMX, SSE, SSE2, 3dNOW!, enhanced 3dNOW! and 64-bit instruction set extensions.) 9263218895Smm@item k8-sse3, opteron-sse3, athlon64-sse3 9264218895SmmImproved versions of k8, opteron and athlon64 with SSE3 instruction set support. 9265251212Spfg@item amdfam10, barcelona 9266251212SpfgAMD Family 10h core based CPUs with x86-64 instruction set support. (This 9267251212Spfgsupersets MMX, SSE, SSE2, SSE3, SSE4A, 3dNOW!, enhanced 3dNOW!, ABM and 64-bit 9268251212Spfginstruction set extensions.) 9269132718Skan@item winchip-c6 9270132718SkanIDT Winchip C6 CPU, dealt in same way as i486 with additional MMX instruction 9271132718Skanset support. 9272132718Skan@item winchip2 9273132718SkanIDT Winchip2 CPU, dealt in same way as i486 with additional MMX and 3dNOW! 9274132718Skaninstruction set support. 9275132718Skan@item c3 9276169689SkanVia C3 CPU with MMX and 3dNOW! instruction set support. (No scheduling is 9277132718Skanimplemented for this chip.) 9278132718Skan@item c3-2 9279132718SkanVia C3-2 CPU with MMX and SSE instruction set support. (No scheduling is 9280132718Skanimplemented for this chip.) 9281219374Smm@item geode 9282219374SmmEmbedded AMD CPU with MMX and 3dNOW! instruction set support. 9283132718Skan@end table 928490075Sobrien 928590075SobrienWhile picking a specific @var{cpu-type} will schedule things appropriately 928690075Sobrienfor that particular chip, the compiler will not generate any code that 928790075Sobriendoes not run on the i386 without the @option{-march=@var{cpu-type}} option 9288132718Skanbeing used. 928990075Sobrien 929090075Sobrien@item -march=@var{cpu-type} 929190075Sobrien@opindex march 929290075SobrienGenerate instructions for the machine type @var{cpu-type}. The choices 9293132718Skanfor @var{cpu-type} are the same as for @option{-mtune}. Moreover, 9294132718Skanspecifying @option{-march=@var{cpu-type}} implies @option{-mtune=@var{cpu-type}}. 929590075Sobrien 9296132718Skan@item -mcpu=@var{cpu-type} 9297132718Skan@opindex mcpu 9298132718SkanA deprecated synonym for @option{-mtune}. 9299132718Skan 930090075Sobrien@item -m386 930190075Sobrien@itemx -m486 930290075Sobrien@itemx -mpentium 930390075Sobrien@itemx -mpentiumpro 930490075Sobrien@opindex m386 930590075Sobrien@opindex m486 930690075Sobrien@opindex mpentium 930790075Sobrien@opindex mpentiumpro 9308132718SkanThese options are synonyms for @option{-mtune=i386}, @option{-mtune=i486}, 9309132718Skan@option{-mtune=pentium}, and @option{-mtune=pentiumpro} respectively. 931090075SobrienThese synonyms are deprecated. 931190075Sobrien 931290075Sobrien@item -mfpmath=@var{unit} 931390075Sobrien@opindex march 9314132718SkanGenerate floating point arithmetics for selected unit @var{unit}. The choices 931590075Sobrienfor @var{unit} are: 931690075Sobrien 931790075Sobrien@table @samp 931890075Sobrien@item 387 931990075SobrienUse the standard 387 floating point coprocessor present majority of chips and 932090075Sobrienemulated otherwise. Code compiled with this option will run almost everywhere. 9321117395SkanThe temporary results are computed in 80bit precision instead of precision 932290075Sobrienspecified by the type resulting in slightly different results compared to most 9323169689Skanof other chips. See @option{-ffloat-store} for more detailed description. 932490075Sobrien 932590075SobrienThis is the default choice for i386 compiler. 932690075Sobrien 932790075Sobrien@item sse 932890075SobrienUse scalar floating point instructions present in the SSE instruction set. 932990075SobrienThis instruction set is supported by Pentium3 and newer chips, in the AMD line 933090075Sobrienby Athlon-4, Athlon-xp and Athlon-mp chips. The earlier version of SSE 933190075Sobrieninstruction set supports only single precision arithmetics, thus the double and 933290075Sobrienextended precision arithmetics is still done using 387. Later version, present 933390075Sobrienonly in Pentium4 and the future AMD x86-64 chips supports double precision 933490075Sobrienarithmetics too. 933590075Sobrien 9336169689SkanFor the i386 compiler, you need to use @option{-march=@var{cpu-type}}, @option{-msse} 9337169689Skanor @option{-msse2} switches to enable SSE extensions and make this option 9338169689Skaneffective. For the x86-64 compiler, these extensions are enabled by default. 933990075Sobrien 9340132718SkanThe resulting code should be considerably faster in the majority of cases and avoid 934190075Sobrienthe numerical instability problems of 387 code, but may break some existing 934290075Sobriencode that expects temporaries to be 80bit. 934390075Sobrien 9344132718SkanThis is the default choice for the x86-64 compiler. 934590075Sobrien 934690075Sobrien@item sse,387 9347117395SkanAttempt to utilize both instruction sets at once. This effectively double the 934890075Sobrienamount of available registers and on chips with separate execution units for 934990075Sobrien387 and SSE the execution resources too. Use this option with care, as it is 9350132718Skanstill experimental, because the GCC register allocator does not model separate 935190075Sobrienfunctional units well resulting in instable performance. 935290075Sobrien@end table 935390075Sobrien 935490075Sobrien@item -masm=@var{dialect} 935590075Sobrien@opindex masm=@var{dialect} 9356169689SkanOutput asm instructions using selected @var{dialect}. Supported 9357169689Skanchoices are @samp{intel} or @samp{att} (the default one). Darwin does 9358169689Skannot support @samp{intel}. 935990075Sobrien 936090075Sobrien@item -mieee-fp 936190075Sobrien@itemx -mno-ieee-fp 936290075Sobrien@opindex mieee-fp 936390075Sobrien@opindex mno-ieee-fp 936490075SobrienControl whether or not the compiler uses IEEE floating point 936590075Sobriencomparisons. These handle correctly the case where the result of a 936690075Sobriencomparison is unordered. 936790075Sobrien 936890075Sobrien@item -msoft-float 936990075Sobrien@opindex msoft-float 937090075SobrienGenerate output containing library calls for floating point. 937190075Sobrien@strong{Warning:} the requisite libraries are not part of GCC@. 937290075SobrienNormally the facilities of the machine's usual C compiler are used, but 937390075Sobrienthis can't be done directly in cross-compilation. You must make your 937490075Sobrienown arrangements to provide suitable library functions for 937590075Sobriencross-compilation. 937690075Sobrien 937790075SobrienOn machines where a function returns floating point results in the 80387 937890075Sobrienregister stack, some floating point opcodes may be emitted even if 937990075Sobrien@option{-msoft-float} is used. 938090075Sobrien 938190075Sobrien@item -mno-fp-ret-in-387 938290075Sobrien@opindex mno-fp-ret-in-387 938390075SobrienDo not use the FPU registers for return values of functions. 938490075Sobrien 938590075SobrienThe usual calling convention has functions return values of types 938690075Sobrien@code{float} and @code{double} in an FPU register, even if there 938790075Sobrienis no FPU@. The idea is that the operating system should emulate 938890075Sobrienan FPU@. 938990075Sobrien 939090075SobrienThe option @option{-mno-fp-ret-in-387} causes such values to be returned 939190075Sobrienin ordinary CPU registers instead. 939290075Sobrien 939390075Sobrien@item -mno-fancy-math-387 939490075Sobrien@opindex mno-fancy-math-387 939590075SobrienSome 387 emulators do not support the @code{sin}, @code{cos} and 939690075Sobrien@code{sqrt} instructions for the 387. Specify this option to avoid 9397181540Sdasgenerating those instructions. This option is the default on 939896263SobrienOpenBSD and NetBSD@. This option is overridden when @option{-march} 939996263Sobrienindicates that the target cpu will always have an FPU and so the 940096263Sobrieninstruction will not need emulation. As of revision 2.6.1, these 940196263Sobrieninstructions are not generated unless you also use the 940296263Sobrien@option{-funsafe-math-optimizations} switch. 940390075Sobrien 940490075Sobrien@item -malign-double 940590075Sobrien@itemx -mno-align-double 940690075Sobrien@opindex malign-double 940790075Sobrien@opindex mno-align-double 940890075SobrienControl whether GCC aligns @code{double}, @code{long double}, and 940990075Sobrien@code{long long} variables on a two word boundary or a one word 941090075Sobrienboundary. Aligning @code{double} variables on a two word boundary will 941190075Sobrienproduce code that runs somewhat faster on a @samp{Pentium} at the 941290075Sobrienexpense of more memory. 941390075Sobrien 9414169689SkanOn x86-64, @option{-malign-double} is enabled by default. 9415169689Skan 9416110611Skan@strong{Warning:} if you use the @option{-malign-double} switch, 9417102780Skanstructures containing the above types will be aligned differently than 9418110611Skanthe published application binary interface specifications for the 386 9419110611Skanand will not be binary compatible with structures in code compiled 9420110611Skanwithout that switch. 9421102780Skan 9422119256Skan@item -m96bit-long-double 9423132718Skan@itemx -m128bit-long-double 9424119256Skan@opindex m96bit-long-double 942590075Sobrien@opindex m128bit-long-double 9426169689SkanThese switches control the size of @code{long double} type. The i386 9427132718Skanapplication binary interface specifies the size to be 96 bits, 9428119256Skanso @option{-m96bit-long-double} is the default in 32 bit mode. 942990075Sobrien 9430119256SkanModern architectures (Pentium and newer) would prefer @code{long double} 9431132718Skanto be aligned to an 8 or 16 byte boundary. In arrays or structures 9432132718Skanconforming to the ABI, this would not be possible. So specifying a 9433119256Skan@option{-m128bit-long-double} will align @code{long double} 9434119256Skanto a 16 byte boundary by padding the @code{long double} with an additional 9435132718Skan32 bit zero. 9436119256Skan 9437119256SkanIn the x86-64 compiler, @option{-m128bit-long-double} is the default choice as 9438119256Skanits ABI specifies that @code{long double} is to be aligned on 16 byte boundary. 9439132718Skan 9440119256SkanNotice that neither of these options enable any extra precision over the x87 9441132718Skanstandard of 80 bits for a @code{long double}. 9442119256Skan 9443119256Skan@strong{Warning:} if you override the default value for your target ABI, the 9444132718Skanstructures and arrays containing @code{long double} variables will change 9445132718Skantheir size as well as function calling convention for function taking 9446132718Skan@code{long double} will be modified. Hence they will not be binary 9447132718Skancompatible with arrays or structures in code compiled without that switch. 944890075Sobrien 9449169689Skan@item -mmlarge-data-threshold=@var{number} 9450169689Skan@opindex mlarge-data-threshold=@var{number} 9451169689SkanWhen @option{-mcmodel=medium} is specified, the data greater than 9452169689Skan@var{threshold} are placed in large data section. This value must be the 9453169689Skansame across all object linked into the binary and defaults to 65535. 945490075Sobrien 945590075Sobrien@item -msvr3-shlib 945690075Sobrien@itemx -mno-svr3-shlib 945790075Sobrien@opindex msvr3-shlib 945890075Sobrien@opindex mno-svr3-shlib 945990075SobrienControl whether GCC places uninitialized local variables into the 946090075Sobrien@code{bss} or @code{data} segments. @option{-msvr3-shlib} places them 946190075Sobrieninto @code{bss}. These options are meaningful only on System V Release 3. 946290075Sobrien 946390075Sobrien@item -mrtd 946490075Sobrien@opindex mrtd 946590075SobrienUse a different function-calling convention, in which functions that 946690075Sobrientake a fixed number of arguments return with the @code{ret} @var{num} 946790075Sobrieninstruction, which pops their arguments while returning. This saves one 946890075Sobrieninstruction in the caller since there is no need to pop the arguments 946990075Sobrienthere. 947090075Sobrien 947190075SobrienYou can specify that an individual function is called with this calling 947290075Sobriensequence with the function attribute @samp{stdcall}. You can also 947390075Sobrienoverride the @option{-mrtd} option by using the function attribute 947490075Sobrien@samp{cdecl}. @xref{Function Attributes}. 947590075Sobrien 947690075Sobrien@strong{Warning:} this calling convention is incompatible with the one 947790075Sobriennormally used on Unix, so you cannot use it if you need to call 947890075Sobrienlibraries compiled with the Unix compiler. 947990075Sobrien 948090075SobrienAlso, you must provide function prototypes for all functions that 948190075Sobrientake variable numbers of arguments (including @code{printf}); 948290075Sobrienotherwise incorrect code will be generated for calls to those 948390075Sobrienfunctions. 948490075Sobrien 948590075SobrienIn addition, seriously incorrect code will result if you call a 948690075Sobrienfunction with too many arguments. (Normally, extra arguments are 948790075Sobrienharmlessly ignored.) 948890075Sobrien 948990075Sobrien@item -mregparm=@var{num} 949090075Sobrien@opindex mregparm 949190075SobrienControl how many registers are used to pass integer arguments. By 949290075Sobriendefault, no registers are used to pass arguments, and at most 3 949390075Sobrienregisters can be used. You can control this behavior for a specific 949490075Sobrienfunction by using the function attribute @samp{regparm}. 949590075Sobrien@xref{Function Attributes}. 949690075Sobrien 949790075Sobrien@strong{Warning:} if you use this switch, and 949890075Sobrien@var{num} is nonzero, then you must build all modules with the same 949990075Sobrienvalue, including any libraries. This includes the system libraries and 950090075Sobrienstartup modules. 950190075Sobrien 9502169689Skan@item -msseregparm 9503169689Skan@opindex msseregparm 9504169689SkanUse SSE register passing conventions for float and double arguments 9505169689Skanand return values. You can control this behavior for a specific 9506169689Skanfunction by using the function attribute @samp{sseregparm}. 9507169689Skan@xref{Function Attributes}. 9508169689Skan 9509169689Skan@strong{Warning:} if you use this switch then you must build all 9510169689Skanmodules with the same value, including any libraries. This includes 9511169689Skanthe system libraries and startup modules. 9512169689Skan 9513169689Skan@item -mstackrealign 9514169689Skan@opindex mstackrealign 9515169689SkanRealign the stack at entry. On the Intel x86, the 9516169689Skan@option{-mstackrealign} option will generate an alternate prologue and 9517169689Skanepilogue that realigns the runtime stack. This supports mixing legacy 9518169689Skancodes that keep a 4-byte aligned stack with modern codes that keep a 9519169689Skan16-byte stack for SSE compatibility. The alternate prologue and 9520169689Skanepilogue are slower and bigger than the regular ones, and the 9521169689Skanalternate prologue requires an extra scratch register; this lowers the 9522169689Skannumber of registers available if used in conjunction with the 9523169689Skan@code{regparm} attribute. The @option{-mstackrealign} option is 9524169689Skanincompatible with the nested function prologue; this is considered a 9525169689Skanhard error. See also the attribute @code{force_align_arg_pointer}, 9526169689Skanapplicable to individual functions. 9527169689Skan 952890075Sobrien@item -mpreferred-stack-boundary=@var{num} 952990075Sobrien@opindex mpreferred-stack-boundary 953090075SobrienAttempt to keep the stack boundary aligned to a 2 raised to @var{num} 953190075Sobrienbyte boundary. If @option{-mpreferred-stack-boundary} is not specified, 9532169689Skanthe default is 4 (16 bytes or 128 bits). 953390075Sobrien 953490075SobrienOn Pentium and PentiumPro, @code{double} and @code{long double} values 953590075Sobrienshould be aligned to an 8 byte boundary (see @option{-malign-double}) or 953690075Sobriensuffer significant run time performance penalties. On Pentium III, the 9537169689SkanStreaming SIMD Extension (SSE) data type @code{__m128} may not work 9538169689Skanproperly if it is not 16 byte aligned. 953990075Sobrien 954090075SobrienTo ensure proper alignment of this values on the stack, the stack boundary 954190075Sobrienmust be as aligned as that required by any value stored on the stack. 954290075SobrienFurther, every function must be generated such that it keeps the stack 954390075Sobrienaligned. Thus calling a function compiled with a higher preferred 954490075Sobrienstack boundary from a function compiled with a lower preferred stack 954590075Sobrienboundary will most likely misalign the stack. It is recommended that 954690075Sobrienlibraries that use callbacks always use the default setting. 954790075Sobrien 954890075SobrienThis extra alignment does consume extra stack space, and generally 954990075Sobrienincreases code size. Code that is sensitive to stack space usage, such 955090075Sobrienas embedded systems and operating system kernels, may want to reduce the 955190075Sobrienpreferred alignment to @option{-mpreferred-stack-boundary=2}. 955290075Sobrien 955390075Sobrien@item -mmmx 955490075Sobrien@itemx -mno-mmx 955590075Sobrien@item -msse 955690075Sobrien@itemx -mno-sse 955790075Sobrien@item -msse2 955890075Sobrien@itemx -mno-sse2 9559132718Skan@item -msse3 9560132718Skan@itemx -mno-sse3 9561219639Smm@item -mssse3 9562219639Smm@itemx -mno-ssse3 9563251212Spfg@item -msse4a 9564251212Spfg@item -mno-sse4a 956590075Sobrien@item -m3dnow 956690075Sobrien@itemx -mno-3dnow 9567251212Spfg@item -mpopcnt 9568251212Spfg@itemx -mno-popcnt 9569251212Spfg@item -mabm 9570251212Spfg@itemx -mno-abm 9571255185Sjmg@item -maes 9572255185Sjmg@itemx -mno-aes 957390075Sobrien@opindex mmmx 957490075Sobrien@opindex mno-mmx 957590075Sobrien@opindex msse 957690075Sobrien@opindex mno-sse 957790075Sobrien@opindex m3dnow 957890075Sobrien@opindex mno-3dnow 9579169689SkanThese switches enable or disable the use of instructions in the MMX, 9580255185SjmgSSE, SSE2, SSE3, SSSE3, SSE4A, ABM, AES or 3DNow! extended 9581255185Sjmginstruction sets. These extensions are also available as built-in 9582255185Sjmgfunctions: see @ref{X86 Built-in Functions}, for details of the functions 9583255185Sjmgenabled and disabled by these switches. 958490075Sobrien 9585117395SkanTo have SSE/SSE2 instructions generated automatically from floating-point 9586169689Skancode (as opposed to 387 instructions), see @option{-mfpmath=sse}. 9587107590Sobrien 9588169689SkanThese options will enable GCC to use these extended instructions in 9589169689Skangenerated code, even without @option{-mfpmath=sse}. Applications which 9590169689Skanperform runtime CPU detection must compile separate files for each 9591169689Skansupported architecture, using the appropriate flags. In particular, 9592169689Skanthe file containing the CPU detection code should be compiled without 9593169689Skanthese options. 9594169689Skan 959590075Sobrien@item -mpush-args 959690075Sobrien@itemx -mno-push-args 959790075Sobrien@opindex mpush-args 959890075Sobrien@opindex mno-push-args 959990075SobrienUse PUSH operations to store outgoing parameters. This method is shorter 960090075Sobrienand usually equally fast as method using SUB/MOV operations and is enabled 960190075Sobrienby default. In some cases disabling it may improve performance because of 960290075Sobrienimproved scheduling and reduced dependencies. 960390075Sobrien 960490075Sobrien@item -maccumulate-outgoing-args 960590075Sobrien@opindex maccumulate-outgoing-args 960690075SobrienIf enabled, the maximum amount of space required for outgoing arguments will be 960790075Sobriencomputed in the function prologue. This is faster on most modern CPUs 960890075Sobrienbecause of reduced dependencies, improved scheduling and reduced stack usage 960990075Sobrienwhen preferred stack boundary is not equal to 2. The drawback is a notable 961090075Sobrienincrease in code size. This switch implies @option{-mno-push-args}. 961190075Sobrien 961290075Sobrien@item -mthreads 961390075Sobrien@opindex mthreads 961490075SobrienSupport thread-safe exception handling on @samp{Mingw32}. Code that relies 961590075Sobrienon thread-safe exception handling must compile and link all code with the 961690075Sobrien@option{-mthreads} option. When compiling, @option{-mthreads} defines 961790075Sobrien@option{-D_MT}; when linking, it links in a special thread helper library 961890075Sobrien@option{-lmingwthrd} which cleans up per thread exception handling data. 961990075Sobrien 962090075Sobrien@item -mno-align-stringops 962190075Sobrien@opindex mno-align-stringops 962290075SobrienDo not align destination of inlined string operations. This switch reduces 962390075Sobriencode size and improves performance in case the destination is already aligned, 9624132718Skanbut GCC doesn't know about it. 962590075Sobrien 962690075Sobrien@item -minline-all-stringops 962790075Sobrien@opindex minline-all-stringops 962890075SobrienBy default GCC inlines string operations only when destination is known to be 962990075Sobrienaligned at least to 4 byte boundary. This enables more inlining, increase code 963090075Sobriensize, but may improve performance of code that depends on fast memcpy, strlen 963190075Sobrienand memset for short lengths. 963290075Sobrien 963390075Sobrien@item -momit-leaf-frame-pointer 963490075Sobrien@opindex momit-leaf-frame-pointer 963590075SobrienDon't keep the frame pointer in a register for leaf functions. This 963690075Sobrienavoids the instructions to save, set up and restore frame pointers and 963790075Sobrienmakes an extra register available in leaf functions. The option 963890075Sobrien@option{-fomit-frame-pointer} removes the frame pointer for all functions 963990075Sobrienwhich might make debugging harder. 9640132718Skan 9641132718Skan@item -mtls-direct-seg-refs 9642132718Skan@itemx -mno-tls-direct-seg-refs 9643132718Skan@opindex mtls-direct-seg-refs 9644132718SkanControls whether TLS variables may be accessed with offsets from the 9645132718SkanTLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit), 9646132718Skanor whether the thread base pointer must be added. Whether or not this 9647132718Skanis legal depends on the operating system, and whether it maps the 9648132718Skansegment to cover the entire TLS area. 9649132718Skan 9650132718SkanFor systems that use GNU libc, the default is on. 965190075Sobrien@end table 965290075Sobrien 965390075SobrienThese @samp{-m} switches are supported in addition to the above 965490075Sobrienon AMD x86-64 processors in 64-bit environments. 965590075Sobrien 965690075Sobrien@table @gcctabopt 965790075Sobrien@item -m32 965890075Sobrien@itemx -m64 965990075Sobrien@opindex m32 966090075Sobrien@opindex m64 966190075SobrienGenerate code for a 32-bit or 64-bit environment. 966290075SobrienThe 32-bit environment sets int, long and pointer to 32 bits and 966390075Sobriengenerates code that runs on any i386 system. 966490075SobrienThe 64-bit environment sets int to 32 bits and long and pointer 9665169689Skanto 64 bits and generates code for AMD's x86-64 architecture. For 9666169689Skandarwin only the -m64 option turns off the @option{-fno-pic} and 9667169689Skan@option{-mdynamic-no-pic} options. 966890075Sobrien 966990075Sobrien@item -mno-red-zone 967090075Sobrien@opindex no-red-zone 967190075SobrienDo not use a so called red zone for x86-64 code. The red zone is mandated 967290075Sobrienby the x86-64 ABI, it is a 128-byte area beyond the location of the 967390075Sobrienstack pointer that will not be modified by signal or interrupt handlers 967490075Sobrienand therefore can be used for temporary data without adjusting the stack 967590075Sobrienpointer. The flag @option{-mno-red-zone} disables this red zone. 9676102780Skan 9677102780Skan@item -mcmodel=small 9678102780Skan@opindex mcmodel=small 9679102780SkanGenerate code for the small code model: the program and its symbols must 9680102780Skanbe linked in the lower 2 GB of the address space. Pointers are 64 bits. 9681102780SkanPrograms can be statically or dynamically linked. This is the default 9682102780Skancode model. 9683102780Skan 9684102780Skan@item -mcmodel=kernel 9685102780Skan@opindex mcmodel=kernel 9686102780SkanGenerate code for the kernel code model. The kernel runs in the 9687102780Skannegative 2 GB of the address space. 9688102780SkanThis model has to be used for Linux kernel code. 9689102780Skan 9690102780Skan@item -mcmodel=medium 9691102780Skan@opindex mcmodel=medium 9692102780SkanGenerate code for the medium model: The program is linked in the lower 2 9693102780SkanGB of the address space but symbols can be located anywhere in the 9694102780Skanaddress space. Programs can be statically or dynamically linked, but 9695102780Skanbuilding of shared libraries are not supported with the medium model. 9696102780Skan 9697102780Skan@item -mcmodel=large 9698102780Skan@opindex mcmodel=large 9699102780SkanGenerate code for the large model: This model makes no assumptions 9700102780Skanabout addresses and sizes of sections. Currently GCC does not implement 9701102780Skanthis model. 970290075Sobrien@end table 970390075Sobrien 9704169689Skan@node IA-64 Options 9705169689Skan@subsection IA-64 Options 9706169689Skan@cindex IA-64 Options 970790075Sobrien 9708169689SkanThese are the @samp{-m} options defined for the Intel IA-64 architecture. 970990075Sobrien 971090075Sobrien@table @gcctabopt 9711169689Skan@item -mbig-endian 9712169689Skan@opindex mbig-endian 9713169689SkanGenerate code for a big endian target. This is the default for HP-UX@. 971490075Sobrien 9715169689Skan@item -mlittle-endian 9716169689Skan@opindex mlittle-endian 9717169689SkanGenerate code for a little endian target. This is the default for AIX5 9718169689Skanand GNU/Linux. 971990075Sobrien 9720169689Skan@item -mgnu-as 9721169689Skan@itemx -mno-gnu-as 9722169689Skan@opindex mgnu-as 9723169689Skan@opindex mno-gnu-as 9724169689SkanGenerate (or don't) code for the GNU assembler. This is the default. 9725169689Skan@c Also, this is the default if the configure option @option{--with-gnu-as} 9726169689Skan@c is used. 972790075Sobrien 9728117395Skan@item -mgnu-ld 9729169689Skan@itemx -mno-gnu-ld 9730169689Skan@opindex mgnu-ld 9731169689Skan@opindex mno-gnu-ld 9732169689SkanGenerate (or don't) code for the GNU linker. This is the default. 9733169689Skan@c Also, this is the default if the configure option @option{--with-gnu-ld} 9734169689Skan@c is used. 9735117395Skan 9736169689Skan@item -mno-pic 9737169689Skan@opindex mno-pic 9738169689SkanGenerate code that does not use a global pointer register. The result 9739169689Skanis not position independent code, and violates the IA-64 ABI@. 9740117395Skan 9741169689Skan@item -mvolatile-asm-stop 9742169689Skan@itemx -mno-volatile-asm-stop 9743169689Skan@opindex mvolatile-asm-stop 9744169689Skan@opindex mno-volatile-asm-stop 9745169689SkanGenerate (or don't) a stop bit immediately before and after volatile asm 9746169689Skanstatements. 9747117395Skan 9748169689Skan@item -mregister-names 9749169689Skan@itemx -mno-register-names 9750169689Skan@opindex mregister-names 9751169689Skan@opindex mno-register-names 9752169689SkanGenerate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for 9753169689Skanthe stacked registers. This may make assembler output more readable. 9754117395Skan 9755169689Skan@item -mno-sdata 9756169689Skan@itemx -msdata 9757169689Skan@opindex mno-sdata 9758169689Skan@opindex msdata 9759169689SkanDisable (or enable) optimizations that use the small data section. This may 9760169689Skanbe useful for working around optimizer bugs. 9761117395Skan 9762169689Skan@item -mconstant-gp 9763169689Skan@opindex mconstant-gp 9764169689SkanGenerate code that uses a single constant global pointer value. This is 9765169689Skanuseful when compiling kernel code. 9766117395Skan 9767169689Skan@item -mauto-pic 9768169689Skan@opindex mauto-pic 9769169689SkanGenerate code that is self-relocatable. This implies @option{-mconstant-gp}. 9770169689SkanThis is useful when compiling firmware code. 9771117395Skan 9772169689Skan@item -minline-float-divide-min-latency 9773169689Skan@opindex minline-float-divide-min-latency 9774169689SkanGenerate code for inline divides of floating point values 9775169689Skanusing the minimum latency algorithm. 9776117395Skan 9777169689Skan@item -minline-float-divide-max-throughput 9778169689Skan@opindex minline-float-divide-max-throughput 9779169689SkanGenerate code for inline divides of floating point values 9780169689Skanusing the maximum throughput algorithm. 9781117395Skan 9782169689Skan@item -minline-int-divide-min-latency 9783169689Skan@opindex minline-int-divide-min-latency 9784169689SkanGenerate code for inline divides of integer values 9785169689Skanusing the minimum latency algorithm. 978690075Sobrien 9787169689Skan@item -minline-int-divide-max-throughput 9788169689Skan@opindex minline-int-divide-max-throughput 9789169689SkanGenerate code for inline divides of integer values 9790169689Skanusing the maximum throughput algorithm. 979190075Sobrien 9792169689Skan@item -minline-sqrt-min-latency 9793169689Skan@opindex minline-sqrt-min-latency 9794169689SkanGenerate code for inline square roots 9795169689Skanusing the minimum latency algorithm. 979690075Sobrien 9797169689Skan@item -minline-sqrt-max-throughput 9798169689Skan@opindex minline-sqrt-max-throughput 9799169689SkanGenerate code for inline square roots 9800169689Skanusing the maximum throughput algorithm. 980190075Sobrien 9802169689Skan@item -mno-dwarf2-asm 9803169689Skan@itemx -mdwarf2-asm 9804169689Skan@opindex mno-dwarf2-asm 9805169689Skan@opindex mdwarf2-asm 9806169689SkanDon't (or do) generate assembler code for the DWARF2 line number debugging 9807169689Skaninfo. This may be useful when not using the GNU assembler. 980890075Sobrien 9809169689Skan@item -mearly-stop-bits 9810169689Skan@itemx -mno-early-stop-bits 9811169689Skan@opindex mearly-stop-bits 9812169689Skan@opindex mno-early-stop-bits 9813169689SkanAllow stop bits to be placed earlier than immediately preceding the 9814169689Skaninstruction that triggered the stop bit. This can improve instruction 9815169689Skanscheduling, but does not always do so. 981690075Sobrien 9817169689Skan@item -mfixed-range=@var{register-range} 9818169689Skan@opindex mfixed-range 9819169689SkanGenerate code treating the given register range as fixed registers. 9820169689SkanA fixed register is one that the register allocator can not use. This is 9821169689Skanuseful when compiling kernel code. A register range is specified as 9822169689Skantwo registers separated by a dash. Multiple register ranges can be 9823169689Skanspecified separated by a comma. 982490075Sobrien 9825169689Skan@item -mtls-size=@var{tls-size} 9826169689Skan@opindex mtls-size 9827169689SkanSpecify bit size of immediate TLS offsets. Valid values are 14, 22, and 9828169689Skan64. 982990075Sobrien 9830169689Skan@item -mtune=@var{cpu-type} 9831169689Skan@opindex mtune 9832169689SkanTune the instruction scheduling for a particular CPU, Valid values are 9833169689Skanitanium, itanium1, merced, itanium2, and mckinley. 983490075Sobrien 9835169689Skan@item -mt 9836169689Skan@itemx -pthread 9837169689Skan@opindex mt 9838169689Skan@opindex pthread 9839169689SkanAdd support for multithreading using the POSIX threads library. This 9840169689Skanoption sets flags for both the preprocessor and linker. It does 9841169689Skannot affect the thread safety of object code produced by the compiler or 9842169689Skanthat of libraries supplied with it. These are HP-UX specific flags. 984390075Sobrien 9844169689Skan@item -milp32 9845169689Skan@itemx -mlp64 9846169689Skan@opindex milp32 9847169689Skan@opindex mlp64 9848169689SkanGenerate code for a 32-bit or 64-bit environment. 9849169689SkanThe 32-bit environment sets int, long and pointer to 32 bits. 9850169689SkanThe 64-bit environment sets int to 32 bits and long and pointer 9851169689Skanto 64 bits. These are HP-UX specific flags. 985290075Sobrien 9853169689Skan@item -mno-sched-br-data-spec 9854169689Skan@itemx -msched-br-data-spec 9855169689Skan@opindex mno-sched-br-data-spec 9856169689Skan@opindex msched-br-data-spec 9857169689Skan(Dis/En)able data speculative scheduling before reload. 9858169689SkanThis will result in generation of the ld.a instructions and 9859169689Skanthe corresponding check instructions (ld.c / chk.a). 9860169689SkanThe default is 'disable'. 986190075Sobrien 9862169689Skan@item -msched-ar-data-spec 9863169689Skan@itemx -mno-sched-ar-data-spec 9864169689Skan@opindex msched-ar-data-spec 9865169689Skan@opindex mno-sched-ar-data-spec 9866169689Skan(En/Dis)able data speculative scheduling after reload. 9867169689SkanThis will result in generation of the ld.a instructions and 9868169689Skanthe corresponding check instructions (ld.c / chk.a). 9869169689SkanThe default is 'enable'. 987090075Sobrien 9871169689Skan@item -mno-sched-control-spec 9872169689Skan@itemx -msched-control-spec 9873169689Skan@opindex mno-sched-control-spec 9874169689Skan@opindex msched-control-spec 9875169689Skan(Dis/En)able control speculative scheduling. This feature is 9876169689Skanavailable only during region scheduling (i.e. before reload). 9877169689SkanThis will result in generation of the ld.s instructions and 9878169689Skanthe corresponding check instructions chk.s . 9879169689SkanThe default is 'disable'. 988090075Sobrien 9881169689Skan@item -msched-br-in-data-spec 9882169689Skan@itemx -mno-sched-br-in-data-spec 9883169689Skan@opindex msched-br-in-data-spec 9884169689Skan@opindex mno-sched-br-in-data-spec 9885169689Skan(En/Dis)able speculative scheduling of the instructions that 9886169689Skanare dependent on the data speculative loads before reload. 9887169689SkanThis is effective only with @option{-msched-br-data-spec} enabled. 9888169689SkanThe default is 'enable'. 988990075Sobrien 9890169689Skan@item -msched-ar-in-data-spec 9891169689Skan@itemx -mno-sched-ar-in-data-spec 9892169689Skan@opindex msched-ar-in-data-spec 9893169689Skan@opindex mno-sched-ar-in-data-spec 9894169689Skan(En/Dis)able speculative scheduling of the instructions that 9895169689Skanare dependent on the data speculative loads after reload. 9896169689SkanThis is effective only with @option{-msched-ar-data-spec} enabled. 9897169689SkanThe default is 'enable'. 989890075Sobrien 9899169689Skan@item -msched-in-control-spec 9900169689Skan@itemx -mno-sched-in-control-spec 9901169689Skan@opindex msched-in-control-spec 9902169689Skan@opindex mno-sched-in-control-spec 9903169689Skan(En/Dis)able speculative scheduling of the instructions that 9904169689Skanare dependent on the control speculative loads. 9905169689SkanThis is effective only with @option{-msched-control-spec} enabled. 9906169689SkanThe default is 'enable'. 990790075Sobrien 9908169689Skan@item -msched-ldc 9909169689Skan@itemx -mno-sched-ldc 9910169689Skan@opindex msched-ldc 9911169689Skan@opindex mno-sched-ldc 9912169689Skan(En/Dis)able use of simple data speculation checks ld.c . 9913169689SkanIf disabled, only chk.a instructions will be emitted to check 9914169689Skandata speculative loads. 9915169689SkanThe default is 'enable'. 991690075Sobrien 9917169689Skan@item -mno-sched-control-ldc 9918169689Skan@itemx -msched-control-ldc 9919169689Skan@opindex mno-sched-control-ldc 9920169689Skan@opindex msched-control-ldc 9921169689Skan(Dis/En)able use of ld.c instructions to check control speculative loads. 9922169689SkanIf enabled, in case of control speculative load with no speculatively 9923169689Skanscheduled dependent instructions this load will be emitted as ld.sa and 9924169689Skanld.c will be used to check it. 9925169689SkanThe default is 'disable'. 992690075Sobrien 9927169689Skan@item -mno-sched-spec-verbose 9928169689Skan@itemx -msched-spec-verbose 9929169689Skan@opindex mno-sched-spec-verbose 9930169689Skan@opindex msched-spec-verbose 9931169689Skan(Dis/En)able printing of the information about speculative motions. 993290075Sobrien 9933169689Skan@item -mno-sched-prefer-non-data-spec-insns 9934169689Skan@itemx -msched-prefer-non-data-spec-insns 9935169689Skan@opindex mno-sched-prefer-non-data-spec-insns 9936169689Skan@opindex msched-prefer-non-data-spec-insns 9937169689SkanIf enabled, data speculative instructions will be chosen for schedule 9938169689Skanonly if there are no other choices at the moment. This will make 9939169689Skanthe use of the data speculation much more conservative. 9940169689SkanThe default is 'disable'. 994190075Sobrien 9942169689Skan@item -mno-sched-prefer-non-control-spec-insns 9943169689Skan@itemx -msched-prefer-non-control-spec-insns 9944169689Skan@opindex mno-sched-prefer-non-control-spec-insns 9945169689Skan@opindex msched-prefer-non-control-spec-insns 9946169689SkanIf enabled, control speculative instructions will be chosen for schedule 9947169689Skanonly if there are no other choices at the moment. This will make 9948169689Skanthe use of the control speculation much more conservative. 9949169689SkanThe default is 'disable'. 995090075Sobrien 9951169689Skan@item -mno-sched-count-spec-in-critical-path 9952169689Skan@itemx -msched-count-spec-in-critical-path 9953169689Skan@opindex mno-sched-count-spec-in-critical-path 9954169689Skan@opindex msched-count-spec-in-critical-path 9955169689SkanIf enabled, speculative dependencies will be considered during 9956169689Skancomputation of the instructions priorities. This will make the use of the 9957169689Skanspeculation a bit more conservative. 9958169689SkanThe default is 'disable'. 995990075Sobrien 996090075Sobrien@end table 996190075Sobrien 9962169689Skan@node M32C Options 9963169689Skan@subsection M32C Options 9964169689Skan@cindex M32C options 996590075Sobrien 996690075Sobrien@table @gcctabopt 9967169689Skan@item -mcpu=@var{name} 9968169689Skan@opindex mcpu= 9969169689SkanSelect the CPU for which code is generated. @var{name} may be one of 9970169689Skan@samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to 9971169689Skan/60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for 9972169689Skanthe M32C/80 series. 997390075Sobrien 9974169689Skan@item -msim 9975169689Skan@opindex msim 9976169689SkanSpecifies that the program will be run on the simulator. This causes 9977169689Skanan alternate runtime library to be linked in which supports, for 9978169689Skanexample, file I/O. You must not use this option when generating 9979169689Skanprograms that will run on real hardware; you must provide your own 9980169689Skanruntime library for whatever I/O functions are needed. 998190075Sobrien 9982169689Skan@item -memregs=@var{number} 9983169689Skan@opindex memregs= 9984169689SkanSpecifies the number of memory-based pseudo-registers GCC will use 9985169689Skanduring code generation. These pseudo-registers will be used like real 9986169689Skanregisters, so there is a tradeoff between GCC's ability to fit the 9987169689Skancode into available registers, and the performance penalty of using 9988169689Skanmemory instead of registers. Note that all modules in a program must 9989169689Skanbe compiled with the same value for this option. Because of that, you 9990169689Skanmust not use this option with the default runtime libraries gcc 9991169689Skanbuilds. 999290075Sobrien 999390075Sobrien@end table 999490075Sobrien 9995169689Skan@node M32R/D Options 9996169689Skan@subsection M32R/D Options 9997169689Skan@cindex M32R/D options 999890075Sobrien 9999169689SkanThese @option{-m} options are defined for Renesas M32R/D architectures: 1000090075Sobrien 1000190075Sobrien@table @gcctabopt 10002169689Skan@item -m32r2 10003169689Skan@opindex m32r2 10004169689SkanGenerate code for the M32R/2@. 1000590075Sobrien 10006169689Skan@item -m32rx 10007169689Skan@opindex m32rx 10008169689SkanGenerate code for the M32R/X@. 1000990075Sobrien 10010169689Skan@item -m32r 10011169689Skan@opindex m32r 10012169689SkanGenerate code for the M32R@. This is the default. 10013132718Skan 10014169689Skan@item -mmodel=small 10015169689Skan@opindex mmodel=small 10016169689SkanAssume all objects live in the lower 16MB of memory (so that their addresses 10017169689Skancan be loaded with the @code{ld24} instruction), and assume all subroutines 10018169689Skanare reachable with the @code{bl} instruction. 10019169689SkanThis is the default. 1002090075Sobrien 10021169689SkanThe addressability of a particular object can be set with the 10022169689Skan@code{model} attribute. 1002390075Sobrien 10024169689Skan@item -mmodel=medium 10025169689Skan@opindex mmodel=medium 10026169689SkanAssume objects may be anywhere in the 32-bit address space (the compiler 10027169689Skanwill generate @code{seth/add3} instructions to load their addresses), and 10028169689Skanassume all subroutines are reachable with the @code{bl} instruction. 1002990075Sobrien 10030169689Skan@item -mmodel=large 10031169689Skan@opindex mmodel=large 10032169689SkanAssume objects may be anywhere in the 32-bit address space (the compiler 10033169689Skanwill generate @code{seth/add3} instructions to load their addresses), and 10034169689Skanassume subroutines may not be reachable with the @code{bl} instruction 10035169689Skan(the compiler will generate the much slower @code{seth/add3/jl} 10036169689Skaninstruction sequence). 1003790075Sobrien 10038169689Skan@item -msdata=none 10039169689Skan@opindex msdata=none 10040169689SkanDisable use of the small data area. Variables will be put into 10041169689Skanone of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the 10042169689Skan@code{section} attribute has been specified). 10043169689SkanThis is the default. 1004490075Sobrien 10045169689SkanThe small data area consists of sections @samp{.sdata} and @samp{.sbss}. 10046169689SkanObjects may be explicitly put in the small data area with the 10047169689Skan@code{section} attribute using one of these sections. 1004890075Sobrien 10049169689Skan@item -msdata=sdata 10050169689Skan@opindex msdata=sdata 10051169689SkanPut small global and static data in the small data area, but do not 10052169689Skangenerate special code to reference them. 1005390075Sobrien 10054169689Skan@item -msdata=use 10055169689Skan@opindex msdata=use 10056169689SkanPut small global and static data in the small data area, and generate 10057169689Skanspecial instructions to reference them. 1005890075Sobrien 10059169689Skan@item -G @var{num} 1006090075Sobrien@opindex G 10061169689Skan@cindex smaller data references 10062169689SkanPut global and static objects less than or equal to @var{num} bytes 10063169689Skaninto the small data or bss sections instead of the normal data or bss 10064169689Skansections. The default value of @var{num} is 8. 10065169689SkanThe @option{-msdata} option must be set to one of @samp{sdata} or @samp{use} 10066169689Skanfor this option to have any effect. 1006790075Sobrien 10068169689SkanAll modules should be compiled with the same @option{-G @var{num}} value. 10069169689SkanCompiling with different values of @var{num} may or may not work; if it 10070169689Skandoesn't the linker will give an error message---incorrect code will not be 10071169689Skangenerated. 1007290075Sobrien 10073169689Skan@item -mdebug 10074169689Skan@opindex mdebug 10075169689SkanMakes the M32R specific code in the compiler display some statistics 10076169689Skanthat might help in debugging programs. 1007790075Sobrien 10078169689Skan@item -malign-loops 10079169689Skan@opindex malign-loops 10080169689SkanAlign all loops to a 32-byte boundary. 1008190075Sobrien 10082169689Skan@item -mno-align-loops 10083169689Skan@opindex mno-align-loops 10084169689SkanDo not enforce a 32-byte alignment for loops. This is the default. 1008590075Sobrien 10086169689Skan@item -missue-rate=@var{number} 10087169689Skan@opindex missue-rate=@var{number} 10088169689SkanIssue @var{number} instructions per cycle. @var{number} can only be 1 10089169689Skanor 2. 1009090075Sobrien 10091169689Skan@item -mbranch-cost=@var{number} 10092169689Skan@opindex mbranch-cost=@var{number} 10093169689Skan@var{number} can only be 1 or 2. If it is 1 then branches will be 10094169689Skanpreferred over conditional code, if it is 2, then the opposite will 10095169689Skanapply. 1009690075Sobrien 10097169689Skan@item -mflush-trap=@var{number} 10098169689Skan@opindex mflush-trap=@var{number} 10099169689SkanSpecifies the trap number to use to flush the cache. The default is 10100169689Skan12. Valid numbers are between 0 and 15 inclusive. 1010190075Sobrien 10102169689Skan@item -mno-flush-trap 10103169689Skan@opindex mno-flush-trap 10104169689SkanSpecifies that the cache cannot be flushed by using a trap. 1010590075Sobrien 10106169689Skan@item -mflush-func=@var{name} 10107169689Skan@opindex mflush-func=@var{name} 10108169689SkanSpecifies the name of the operating system function to call to flush 10109169689Skanthe cache. The default is @emph{_flush_cache}, but a function call 10110169689Skanwill only be used if a trap is not available. 1011190075Sobrien 10112169689Skan@item -mno-flush-func 10113169689Skan@opindex mno-flush-func 10114169689SkanIndicates that there is no OS function for flushing the cache. 1011590075Sobrien 1011690075Sobrien@end table 1011790075Sobrien 10118169689Skan@node M680x0 Options 10119169689Skan@subsection M680x0 Options 10120169689Skan@cindex M680x0 options 1012190075Sobrien 10122169689SkanThese are the @samp{-m} options defined for the 68000 series. The default 10123169689Skanvalues for these options depends on which style of 68000 was selected when 10124169689Skanthe compiler was configured; the defaults for the most common choices are 10125169689Skangiven below. 1012690075Sobrien 1012790075Sobrien@table @gcctabopt 10128169689Skan@item -m68000 10129169689Skan@itemx -mc68000 10130169689Skan@opindex m68000 10131169689Skan@opindex mc68000 10132169689SkanGenerate output for a 68000. This is the default 10133169689Skanwhen the compiler is configured for 68000-based systems. 1013490075Sobrien 10135169689SkanUse this option for microcontrollers with a 68000 or EC000 core, 10136169689Skanincluding the 68008, 68302, 68306, 68307, 68322, 68328 and 68356. 1013790075Sobrien 10138169689Skan@item -m68020 10139169689Skan@itemx -mc68020 10140169689Skan@opindex m68020 10141169689Skan@opindex mc68020 10142169689SkanGenerate output for a 68020. This is the default 10143169689Skanwhen the compiler is configured for 68020-based systems. 1014490075Sobrien 10145169689Skan@item -m68881 10146169689Skan@opindex m68881 10147169689SkanGenerate output containing 68881 instructions for floating point. 10148169689SkanThis is the default for most 68020 systems unless @option{--nfp} was 10149169689Skanspecified when the compiler was configured. 1015090075Sobrien 10151169689Skan@item -m68030 10152169689Skan@opindex m68030 10153169689SkanGenerate output for a 68030. This is the default when the compiler is 10154169689Skanconfigured for 68030-based systems. 1015590075Sobrien 10156169689Skan@item -m68040 10157169689Skan@opindex m68040 10158169689SkanGenerate output for a 68040. This is the default when the compiler is 10159169689Skanconfigured for 68040-based systems. 1016090075Sobrien 10161169689SkanThis option inhibits the use of 68881/68882 instructions that have to be 10162169689Skanemulated by software on the 68040. Use this option if your 68040 does not 10163169689Skanhave code to emulate those instructions. 1016490075Sobrien 10165169689Skan@item -m68060 10166169689Skan@opindex m68060 10167169689SkanGenerate output for a 68060. This is the default when the compiler is 10168169689Skanconfigured for 68060-based systems. 1016990075Sobrien 10170169689SkanThis option inhibits the use of 68020 and 68881/68882 instructions that 10171169689Skanhave to be emulated by software on the 68060. Use this option if your 68060 10172169689Skandoes not have code to emulate those instructions. 10173117395Skan 10174169689Skan@item -mcpu32 10175169689Skan@opindex mcpu32 10176169689SkanGenerate output for a CPU32. This is the default 10177169689Skanwhen the compiler is configured for CPU32-based systems. 10178117395Skan 10179169689SkanUse this option for microcontrollers with a 10180169689SkanCPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334, 10181169689Skan68336, 68340, 68341, 68349 and 68360. 10182132718Skan 10183169689Skan@item -m5200 10184169689Skan@opindex m5200 10185169689SkanGenerate output for a 520X ``coldfire'' family cpu. This is the default 10186169689Skanwhen the compiler is configured for 520X-based systems. 10187132718Skan 10188169689SkanUse this option for microcontroller with a 5200 core, including 10189169689Skanthe MCF5202, MCF5203, MCF5204 and MCF5202. 10190117395Skan 10191169689Skan@item -mcfv4e 10192169689Skan@opindex mcfv4e 10193169689SkanGenerate output for a ColdFire V4e family cpu (e.g.@: 547x/548x). 10194169689SkanThis includes use of hardware floating point instructions. 10195117395Skan 10196169689Skan@item -m68020-40 10197169689Skan@opindex m68020-40 10198169689SkanGenerate output for a 68040, without using any of the new instructions. 10199169689SkanThis results in code which can run relatively efficiently on either a 10200169689Skan68020/68881 or a 68030 or a 68040. The generated code does use the 10201169689Skan68881 instructions that are emulated on the 68040. 10202117395Skan 10203169689Skan@item -m68020-60 10204169689Skan@opindex m68020-60 10205169689SkanGenerate output for a 68060, without using any of the new instructions. 10206169689SkanThis results in code which can run relatively efficiently on either a 10207169689Skan68020/68881 or a 68030 or a 68040. The generated code does use the 10208169689Skan68881 instructions that are emulated on the 68060. 10209117395Skan 1021090075Sobrien@item -msoft-float 1021190075Sobrien@opindex msoft-float 1021290075SobrienGenerate output containing library calls for floating point. 10213169689Skan@strong{Warning:} the requisite libraries are not available for all m68k 10214169689Skantargets. Normally the facilities of the machine's usual C compiler are 10215169689Skanused, but this can't be done directly in cross-compilation. You must 10216169689Skanmake your own arrangements to provide suitable library functions for 10217169689Skancross-compilation. The embedded targets @samp{m68k-*-aout} and 10218169689Skan@samp{m68k-*-coff} do provide software floating point support. 1021990075Sobrien 10220169689Skan@item -mshort 10221169689Skan@opindex mshort 10222169689SkanConsider type @code{int} to be 16 bits wide, like @code{short int}. 10223169689SkanAdditionally, parameters passed on the stack are also aligned to a 10224169689Skan16-bit boundary even on targets whose API mandates promotion to 32-bit. 10225117395Skan 1022690075Sobrien@item -mnobitfield 1022790075Sobrien@opindex mnobitfield 10228169689SkanDo not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32} 10229169689Skanand @option{-m5200} options imply @w{@option{-mnobitfield}}. 1023090075Sobrien 1023190075Sobrien@item -mbitfield 1023290075Sobrien@opindex mbitfield 10233169689SkanDo use the bit-field instructions. The @option{-m68020} option implies 10234169689Skan@option{-mbitfield}. This is the default if you use a configuration 10235169689Skandesigned for a 68020. 1023690075Sobrien 1023790075Sobrien@item -mrtd 1023890075Sobrien@opindex mrtd 1023990075SobrienUse a different function-calling convention, in which functions 10240169689Skanthat take a fixed number of arguments return with the @code{rtd} 10241169689Skaninstruction, which pops their arguments while returning. This 10242169689Skansaves one instruction in the caller since there is no need to pop 10243169689Skanthe arguments there. 1024490075Sobrien 1024590075SobrienThis calling convention is incompatible with the one normally 1024690075Sobrienused on Unix, so you cannot use it if you need to call libraries 1024790075Sobriencompiled with the Unix compiler. 1024890075Sobrien 1024990075SobrienAlso, you must provide function prototypes for all functions that 1025090075Sobrientake variable numbers of arguments (including @code{printf}); 1025190075Sobrienotherwise incorrect code will be generated for calls to those 1025290075Sobrienfunctions. 1025390075Sobrien 1025490075SobrienIn addition, seriously incorrect code will result if you call a 1025590075Sobrienfunction with too many arguments. (Normally, extra arguments are 1025690075Sobrienharmlessly ignored.) 1025790075Sobrien 10258169689SkanThe @code{rtd} instruction is supported by the 68010, 68020, 68030, 10259169689Skan68040, 68060 and CPU32 processors, but not by the 68000 or 5200. 1026090075Sobrien 10261169689Skan@item -malign-int 10262169689Skan@itemx -mno-align-int 10263169689Skan@opindex malign-int 10264169689Skan@opindex mno-align-int 10265169689SkanControl whether GCC aligns @code{int}, @code{long}, @code{long long}, 10266169689Skan@code{float}, @code{double}, and @code{long double} variables on a 32-bit 10267169689Skanboundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}). 10268169689SkanAligning variables on 32-bit boundaries produces code that runs somewhat 10269169689Skanfaster on processors with 32-bit busses at the expense of more memory. 1027090075Sobrien 10271169689Skan@strong{Warning:} if you use the @option{-malign-int} switch, GCC will 10272169689Skanalign structures containing the above types differently than 10273169689Skanmost published application binary interface specifications for the m68k. 1027490075Sobrien 10275169689Skan@item -mpcrel 10276169689Skan@opindex mpcrel 10277169689SkanUse the pc-relative addressing mode of the 68000 directly, instead of 10278169689Skanusing a global offset table. At present, this option implies @option{-fpic}, 10279169689Skanallowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is 10280169689Skannot presently supported with @option{-mpcrel}, though this could be supported for 10281169689Skan68020 and higher processors. 1028290075Sobrien 10283169689Skan@item -mno-strict-align 10284169689Skan@itemx -mstrict-align 10285169689Skan@opindex mno-strict-align 10286169689Skan@opindex mstrict-align 10287169689SkanDo not (do) assume that unaligned memory references will be handled by 10288169689Skanthe system. 1028990075Sobrien 10290169689Skan@item -msep-data 10291169689SkanGenerate code that allows the data segment to be located in a different 10292169689Skanarea of memory from the text segment. This allows for execute in place in 10293169689Skanan environment without virtual memory management. This option implies 10294169689Skan@option{-fPIC}. 1029590075Sobrien 10296169689Skan@item -mno-sep-data 10297169689SkanGenerate code that assumes that the data segment follows the text segment. 10298169689SkanThis is the default. 1029990075Sobrien 10300169689Skan@item -mid-shared-library 10301169689SkanGenerate code that supports shared libraries via the library ID method. 10302169689SkanThis allows for execute in place and shared libraries in an environment 10303169689Skanwithout virtual memory management. This option implies @option{-fPIC}. 1030490075Sobrien 10305169689Skan@item -mno-id-shared-library 10306169689SkanGenerate code that doesn't assume ID based shared libraries are being used. 10307169689SkanThis is the default. 1030890075Sobrien 10309169689Skan@item -mshared-library-id=n 10310169689SkanSpecified the identification number of the ID based shared library being 10311169689Skancompiled. Specifying a value of 0 will generate more compact code, specifying 10312169689Skanother values will force the allocation of that number to the current 10313169689Skanlibrary but is no more space or time efficient than omitting this option. 1031490075Sobrien 1031590075Sobrien@end table 1031690075Sobrien 10317169689Skan@node M68hc1x Options 10318169689Skan@subsection M68hc1x Options 10319169689Skan@cindex M68hc1x options 1032090075Sobrien 10321169689SkanThese are the @samp{-m} options defined for the 68hc11 and 68hc12 10322169689Skanmicrocontrollers. The default values for these options depends on 10323169689Skanwhich style of microcontroller was selected when the compiler was configured; 10324169689Skanthe defaults for the most common choices are given below. 1032590075Sobrien 1032690075Sobrien@table @gcctabopt 10327169689Skan@item -m6811 10328169689Skan@itemx -m68hc11 10329169689Skan@opindex m6811 10330169689Skan@opindex m68hc11 10331169689SkanGenerate output for a 68HC11. This is the default 10332169689Skanwhen the compiler is configured for 68HC11-based systems. 1033390075Sobrien 10334169689Skan@item -m6812 10335169689Skan@itemx -m68hc12 10336169689Skan@opindex m6812 10337169689Skan@opindex m68hc12 10338169689SkanGenerate output for a 68HC12. This is the default 10339169689Skanwhen the compiler is configured for 68HC12-based systems. 1034090075Sobrien 10341169689Skan@item -m68S12 10342169689Skan@itemx -m68hcs12 10343169689Skan@opindex m68S12 10344169689Skan@opindex m68hcs12 10345169689SkanGenerate output for a 68HCS12. 1034690075Sobrien 10347169689Skan@item -mauto-incdec 10348169689Skan@opindex mauto-incdec 10349169689SkanEnable the use of 68HC12 pre and post auto-increment and auto-decrement 10350169689Skanaddressing modes. 1035190075Sobrien 10352169689Skan@item -minmax 10353169689Skan@itemx -nominmax 10354169689Skan@opindex minmax 10355169689Skan@opindex mnominmax 10356169689SkanEnable the use of 68HC12 min and max instructions. 1035790075Sobrien 10358169689Skan@item -mlong-calls 10359169689Skan@itemx -mno-long-calls 10360169689Skan@opindex mlong-calls 10361169689Skan@opindex mno-long-calls 10362169689SkanTreat all calls as being far away (near). If calls are assumed to be 10363169689Skanfar away, the compiler will use the @code{call} instruction to 10364169689Skancall a function and the @code{rtc} instruction for returning. 1036590075Sobrien 10366169689Skan@item -mshort 10367169689Skan@opindex mshort 10368169689SkanConsider type @code{int} to be 16 bits wide, like @code{short int}. 1036990075Sobrien 10370169689Skan@item -msoft-reg-count=@var{count} 10371169689Skan@opindex msoft-reg-count 10372169689SkanSpecify the number of pseudo-soft registers which are used for the 10373169689Skancode generation. The maximum number is 32. Using more pseudo-soft 10374169689Skanregister may or may not result in better code depending on the program. 10375169689SkanThe default is 4 for 68HC11 and 2 for 68HC12. 1037690075Sobrien 1037790075Sobrien@end table 1037890075Sobrien 1037990075Sobrien@node MCore Options 1038090075Sobrien@subsection MCore Options 1038190075Sobrien@cindex MCore options 1038290075Sobrien 1038390075SobrienThese are the @samp{-m} options defined for the Motorola M*Core 1038490075Sobrienprocessors. 1038590075Sobrien 1038690075Sobrien@table @gcctabopt 1038790075Sobrien 1038890075Sobrien@item -mhardlit 1038990075Sobrien@itemx -mno-hardlit 1039090075Sobrien@opindex mhardlit 1039190075Sobrien@opindex mno-hardlit 1039290075SobrienInline constants into the code stream if it can be done in two 1039390075Sobrieninstructions or less. 1039490075Sobrien 1039590075Sobrien@item -mdiv 1039690075Sobrien@itemx -mno-div 1039790075Sobrien@opindex mdiv 1039890075Sobrien@opindex mno-div 1039990075SobrienUse the divide instruction. (Enabled by default). 1040090075Sobrien 1040190075Sobrien@item -mrelax-immediate 1040290075Sobrien@itemx -mno-relax-immediate 1040390075Sobrien@opindex mrelax-immediate 1040490075Sobrien@opindex mno-relax-immediate 1040590075SobrienAllow arbitrary sized immediates in bit operations. 1040690075Sobrien 1040790075Sobrien@item -mwide-bitfields 1040890075Sobrien@itemx -mno-wide-bitfields 1040990075Sobrien@opindex mwide-bitfields 1041090075Sobrien@opindex mno-wide-bitfields 1041190075SobrienAlways treat bit-fields as int-sized. 1041290075Sobrien 1041390075Sobrien@item -m4byte-functions 1041490075Sobrien@itemx -mno-4byte-functions 1041590075Sobrien@opindex m4byte-functions 1041690075Sobrien@opindex mno-4byte-functions 1041790075SobrienForce all functions to be aligned to a four byte boundary. 1041890075Sobrien 1041990075Sobrien@item -mcallgraph-data 1042090075Sobrien@itemx -mno-callgraph-data 1042190075Sobrien@opindex mcallgraph-data 1042290075Sobrien@opindex mno-callgraph-data 1042390075SobrienEmit callgraph information. 1042490075Sobrien 1042590075Sobrien@item -mslow-bytes 1042690075Sobrien@itemx -mno-slow-bytes 1042790075Sobrien@opindex mslow-bytes 1042890075Sobrien@opindex mno-slow-bytes 1042990075SobrienPrefer word access when reading byte quantities. 1043090075Sobrien 1043190075Sobrien@item -mlittle-endian 1043290075Sobrien@itemx -mbig-endian 1043390075Sobrien@opindex mlittle-endian 1043490075Sobrien@opindex mbig-endian 1043590075SobrienGenerate code for a little endian target. 1043690075Sobrien 1043790075Sobrien@item -m210 1043890075Sobrien@itemx -m340 1043990075Sobrien@opindex m210 1044090075Sobrien@opindex m340 1044190075SobrienGenerate code for the 210 processor. 1044290075Sobrien@end table 1044390075Sobrien 10444169689Skan@node MIPS Options 10445169689Skan@subsection MIPS Options 10446169689Skan@cindex MIPS options 1044790075Sobrien 1044890075Sobrien@table @gcctabopt 1044990075Sobrien 10450169689Skan@item -EB 10451169689Skan@opindex EB 10452169689SkanGenerate big-endian code. 1045390075Sobrien 10454169689Skan@item -EL 10455169689Skan@opindex EL 10456169689SkanGenerate little-endian code. This is the default for @samp{mips*el-*-*} 10457169689Skanconfigurations. 1045890075Sobrien 10459169689Skan@item -march=@var{arch} 10460169689Skan@opindex march 10461169689SkanGenerate code that will run on @var{arch}, which can be the name of a 10462169689Skangeneric MIPS ISA, or the name of a particular processor. 10463169689SkanThe ISA names are: 10464169689Skan@samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4}, 10465169689Skan@samp{mips32}, @samp{mips32r2}, and @samp{mips64}. 10466169689SkanThe processor names are: 10467169689Skan@samp{4kc}, @samp{4km}, @samp{4kp}, 10468169689Skan@samp{5kc}, @samp{5kf}, 10469169689Skan@samp{20kc}, 10470169689Skan@samp{24k}, @samp{24kc}, @samp{24kf}, @samp{24kx}, 10471169689Skan@samp{m4k}, 10472169689Skan@samp{orion}, 10473169689Skan@samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400}, 10474169689Skan@samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000}, 10475169689Skan@samp{rm7000}, @samp{rm9000}, 10476169689Skan@samp{sb1}, 10477169689Skan@samp{sr71000}, 10478169689Skan@samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300}, 10479169689Skan@samp{vr5000}, @samp{vr5400} and @samp{vr5500}. 10480169689SkanThe special value @samp{from-abi} selects the 10481169689Skanmost compatible architecture for the selected ABI (that is, 10482169689Skan@samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@. 1048390075Sobrien 10484169689SkanIn processor names, a final @samp{000} can be abbreviated as @samp{k} 10485169689Skan(for example, @samp{-march=r2k}). Prefixes are optional, and 10486169689Skan@samp{vr} may be written @samp{r}. 1048790075Sobrien 10488169689SkanGCC defines two macros based on the value of this option. The first 10489169689Skanis @samp{_MIPS_ARCH}, which gives the name of target architecture, as 10490169689Skana string. The second has the form @samp{_MIPS_ARCH_@var{foo}}, 10491169689Skanwhere @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@. 10492169689SkanFor example, @samp{-march=r2000} will set @samp{_MIPS_ARCH} 10493169689Skanto @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}. 1049490075Sobrien 10495169689SkanNote that the @samp{_MIPS_ARCH} macro uses the processor names given 10496169689Skanabove. In other words, it will have the full prefix and will not 10497169689Skanabbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi}, 10498169689Skanthe macro names the resolved architecture (either @samp{"mips1"} or 10499169689Skan@samp{"mips3"}). It names the default architecture when no 10500169689Skan@option{-march} option is given. 1050190075Sobrien 10502169689Skan@item -mtune=@var{arch} 10503169689Skan@opindex mtune 10504169689SkanOptimize for @var{arch}. Among other things, this option controls 10505169689Skanthe way instructions are scheduled, and the perceived cost of arithmetic 10506169689Skanoperations. The list of @var{arch} values is the same as for 10507169689Skan@option{-march}. 1050890075Sobrien 10509169689SkanWhen this option is not used, GCC will optimize for the processor 10510169689Skanspecified by @option{-march}. By using @option{-march} and 10511169689Skan@option{-mtune} together, it is possible to generate code that will 10512169689Skanrun on a family of processors, but optimize the code for one 10513169689Skanparticular member of that family. 1051490075Sobrien 10515169689Skan@samp{-mtune} defines the macros @samp{_MIPS_TUNE} and 10516169689Skan@samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the 10517169689Skan@samp{-march} ones described above. 1051890075Sobrien 10519169689Skan@item -mips1 10520169689Skan@opindex mips1 10521169689SkanEquivalent to @samp{-march=mips1}. 1052290075Sobrien 10523169689Skan@item -mips2 10524169689Skan@opindex mips2 10525169689SkanEquivalent to @samp{-march=mips2}. 1052690075Sobrien 10527169689Skan@item -mips3 10528169689Skan@opindex mips3 10529169689SkanEquivalent to @samp{-march=mips3}. 1053090075Sobrien 10531169689Skan@item -mips4 10532169689Skan@opindex mips4 10533169689SkanEquivalent to @samp{-march=mips4}. 10534117395Skan 10535169689Skan@item -mips32 10536169689Skan@opindex mips32 10537169689SkanEquivalent to @samp{-march=mips32}. 10538117395Skan 10539169689Skan@item -mips32r2 10540169689Skan@opindex mips32r2 10541169689SkanEquivalent to @samp{-march=mips32r2}. 10542146895Skan 10543169689Skan@item -mips64 10544169689Skan@opindex mips64 10545169689SkanEquivalent to @samp{-march=mips64}. 10546146895Skan 10547169689Skan@item -mips16 10548169689Skan@itemx -mno-mips16 10549169689Skan@opindex mips16 10550169689Skan@opindex mno-mips16 10551169689SkanGenerate (do not generate) MIPS16 code. If GCC is targetting a 10552169689SkanMIPS32 or MIPS64 architecture, it will make use of the MIPS16e ASE@. 1055390075Sobrien 10554169689Skan@item -mabi=32 10555169689Skan@itemx -mabi=o64 10556169689Skan@itemx -mabi=n32 10557169689Skan@itemx -mabi=64 10558169689Skan@itemx -mabi=eabi 10559169689Skan@opindex mabi=32 10560169689Skan@opindex mabi=o64 10561169689Skan@opindex mabi=n32 10562169689Skan@opindex mabi=64 10563169689Skan@opindex mabi=eabi 10564169689SkanGenerate code for the given ABI@. 10565146895Skan 10566169689SkanNote that the EABI has a 32-bit and a 64-bit variant. GCC normally 10567169689Skangenerates 64-bit code when you select a 64-bit architecture, but you 10568169689Skancan use @option{-mgp32} to get 32-bit code instead. 10569132718Skan 10570169689SkanFor information about the O64 ABI, see 10571169689Skan@w{@uref{http://gcc.gnu.org/projects/mipso64-abi.html}}. 10572146895Skan 10573169689Skan@item -mabicalls 10574169689Skan@itemx -mno-abicalls 10575169689Skan@opindex mabicalls 10576169689Skan@opindex mno-abicalls 10577169689SkanGenerate (do not generate) code that is suitable for SVR4-style 10578169689Skandynamic objects. @option{-mabicalls} is the default for SVR4-based 10579169689Skansystems. 10580146895Skan 10581169689Skan@item -mshared 10582169689Skan@itemx -mno-shared 10583169689SkanGenerate (do not generate) code that is fully position-independent, 10584169689Skanand that can therefore be linked into shared libraries. This option 10585169689Skanonly affects @option{-mabicalls}. 10586146895Skan 10587169689SkanAll @option{-mabicalls} code has traditionally been position-independent, 10588169689Skanregardless of options like @option{-fPIC} and @option{-fpic}. However, 10589169689Skanas an extension, the GNU toolchain allows executables to use absolute 10590169689Skanaccesses for locally-binding symbols. It can also use shorter GP 10591169689Skaninitialization sequences and generate direct calls to locally-defined 10592169689Skanfunctions. This mode is selected by @option{-mno-shared}. 10593146895Skan 10594169689Skan@option{-mno-shared} depends on binutils 2.16 or higher and generates 10595169689Skanobjects that can only be linked by the GNU linker. However, the option 10596169689Skandoes not affect the ABI of the final executable; it only affects the ABI 10597169689Skanof relocatable objects. Using @option{-mno-shared} will generally make 10598169689Skanexecutables both smaller and quicker. 1059990075Sobrien 10600169689Skan@option{-mshared} is the default. 1060190075Sobrien 10602169689Skan@item -mxgot 10603169689Skan@itemx -mno-xgot 10604169689Skan@opindex mxgot 10605169689Skan@opindex mno-xgot 10606169689SkanLift (do not lift) the usual restrictions on the size of the global 10607169689Skanoffset table. 1060890075Sobrien 10609169689SkanGCC normally uses a single instruction to load values from the GOT@. 10610169689SkanWhile this is relatively efficient, it will only work if the GOT 10611169689Skanis smaller than about 64k. Anything larger will cause the linker 10612169689Skanto report an error such as: 1061390075Sobrien 10614169689Skan@cindex relocation truncated to fit (MIPS) 10615169689Skan@smallexample 10616169689Skanrelocation truncated to fit: R_MIPS_GOT16 foobar 10617169689Skan@end smallexample 1061890075Sobrien 10619169689SkanIf this happens, you should recompile your code with @option{-mxgot}. 10620169689SkanIt should then work with very large GOTs, although it will also be 10621169689Skanless efficient, since it will take three instructions to fetch the 10622169689Skanvalue of a global symbol. 1062390075Sobrien 10624169689SkanNote that some linkers can create multiple GOTs. If you have such a 10625169689Skanlinker, you should only need to use @option{-mxgot} when a single object 10626169689Skanfile accesses more than 64k's worth of GOT entries. Very few do. 1062790075Sobrien 10628169689SkanThese options have no effect unless GCC is generating position 10629169689Skanindependent code. 1063090075Sobrien 10631169689Skan@item -mgp32 10632169689Skan@opindex mgp32 10633169689SkanAssume that general-purpose registers are 32 bits wide. 1063490075Sobrien 10635169689Skan@item -mgp64 10636169689Skan@opindex mgp64 10637169689SkanAssume that general-purpose registers are 64 bits wide. 1063890075Sobrien 10639169689Skan@item -mfp32 10640169689Skan@opindex mfp32 10641169689SkanAssume that floating-point registers are 32 bits wide. 1064290075Sobrien 10643169689Skan@item -mfp64 10644169689Skan@opindex mfp64 10645169689SkanAssume that floating-point registers are 64 bits wide. 10646169689Skan 1064790075Sobrien@item -mhard-float 1064890075Sobrien@opindex mhard-float 10649169689SkanUse floating-point coprocessor instructions. 10650169689Skan 10651169689Skan@item -msoft-float 1065290075Sobrien@opindex msoft-float 10653169689SkanDo not use floating-point coprocessor instructions. Implement 10654169689Skanfloating-point calculations using library calls instead. 1065590075Sobrien 10656169689Skan@item -msingle-float 10657169689Skan@opindex msingle-float 10658169689SkanAssume that the floating-point coprocessor only supports single-precision 10659169689Skanoperations. 1066090075Sobrien 10661169689Skan@itemx -mdouble-float 10662169689Skan@opindex mdouble-float 10663169689SkanAssume that the floating-point coprocessor supports double-precision 10664169689Skanoperations. This is the default. 1066590075Sobrien 10666169689Skan@itemx -mdsp 10667169689Skan@itemx -mno-dsp 10668169689Skan@opindex mdsp 10669169689Skan@opindex mno-dsp 10670169689SkanUse (do not use) the MIPS DSP ASE. @xref{MIPS DSP Built-in Functions}. 1067190075Sobrien 10672169689Skan@itemx -mpaired-single 10673169689Skan@itemx -mno-paired-single 10674169689Skan@opindex mpaired-single 10675169689Skan@opindex mno-paired-single 10676169689SkanUse (do not use) paired-single floating-point instructions. 10677169689Skan@xref{MIPS Paired-Single Support}. This option can only be used 10678169689Skanwhen generating 64-bit code and requires hardware floating-point 10679169689Skansupport to be enabled. 10680132718Skan 10681169689Skan@itemx -mips3d 10682169689Skan@itemx -mno-mips3d 10683169689Skan@opindex mips3d 10684169689Skan@opindex mno-mips3d 10685169689SkanUse (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}. 10686169689SkanThe option @option{-mips3d} implies @option{-mpaired-single}. 1068790075Sobrien 10688169689Skan@item -mlong64 10689169689Skan@opindex mlong64 10690169689SkanForce @code{long} types to be 64 bits wide. See @option{-mlong32} for 10691169689Skanan explanation of the default and the way that the pointer size is 10692169689Skandetermined. 1069390075Sobrien 10694169689Skan@item -mlong32 10695169689Skan@opindex mlong32 10696169689SkanForce @code{long}, @code{int}, and pointer types to be 32 bits wide. 10697132718Skan 10698169689SkanThe default size of @code{int}s, @code{long}s and pointers depends on 10699169689Skanthe ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI 10700169689Skanuses 64-bit @code{long}s, as does the 64-bit EABI; the others use 10701169689Skan32-bit @code{long}s. Pointers are the same size as @code{long}s, 10702169689Skanor the same size as integer registers, whichever is smaller. 10703132718Skan 10704169689Skan@item -msym32 10705169689Skan@itemx -mno-sym32 10706169689Skan@opindex msym32 10707169689Skan@opindex mno-sym32 10708169689SkanAssume (do not assume) that all symbols have 32-bit values, regardless 10709169689Skanof the selected ABI@. This option is useful in combination with 10710169689Skan@option{-mabi=64} and @option{-mno-abicalls} because it allows GCC 10711169689Skanto generate shorter and faster references to symbolic addresses. 1071290075Sobrien 10713169689Skan@item -G @var{num} 10714169689Skan@opindex G 10715169689Skan@cindex smaller data references (MIPS) 10716169689Skan@cindex gp-relative references (MIPS) 10717169689SkanPut global and static items less than or equal to @var{num} bytes into 10718169689Skanthe small data or bss section instead of the normal data or bss section. 10719169689SkanThis allows the data to be accessed using a single instruction. 1072090075Sobrien 10721169689SkanAll modules should be compiled with the same @option{-G @var{num}} 10722169689Skanvalue. 1072390075Sobrien 10724169689Skan@item -membedded-data 10725169689Skan@itemx -mno-embedded-data 10726169689Skan@opindex membedded-data 10727169689Skan@opindex mno-embedded-data 10728169689SkanAllocate variables to the read-only data section first if possible, then 10729169689Skannext in the small data section if possible, otherwise in data. This gives 10730169689Skanslightly slower code than the default, but reduces the amount of RAM required 10731169689Skanwhen executing, and thus may be preferred for some embedded systems. 1073290075Sobrien 10733169689Skan@item -muninit-const-in-rodata 10734169689Skan@itemx -mno-uninit-const-in-rodata 10735169689Skan@opindex muninit-const-in-rodata 10736169689Skan@opindex mno-uninit-const-in-rodata 10737169689SkanPut uninitialized @code{const} variables in the read-only data section. 10738169689SkanThis option is only meaningful in conjunction with @option{-membedded-data}. 1073990075Sobrien 10740169689Skan@item -msplit-addresses 10741169689Skan@itemx -mno-split-addresses 10742169689Skan@opindex msplit-addresses 10743169689Skan@opindex mno-split-addresses 10744169689SkanEnable (disable) use of the @code{%hi()} and @code{%lo()} assembler 10745169689Skanrelocation operators. This option has been superseded by 10746169689Skan@option{-mexplicit-relocs} but is retained for backwards compatibility. 1074790075Sobrien 10748169689Skan@item -mexplicit-relocs 10749169689Skan@itemx -mno-explicit-relocs 10750169689Skan@opindex mexplicit-relocs 10751169689Skan@opindex mno-explicit-relocs 10752169689SkanUse (do not use) assembler relocation operators when dealing with symbolic 10753169689Skanaddresses. The alternative, selected by @option{-mno-explicit-relocs}, 10754169689Skanis to use assembler macros instead. 1075590075Sobrien 10756169689Skan@option{-mexplicit-relocs} is the default if GCC was configured 10757169689Skanto use an assembler that supports relocation operators. 1075890075Sobrien 10759169689Skan@item -mcheck-zero-division 10760169689Skan@itemx -mno-check-zero-division 10761169689Skan@opindex mcheck-zero-division 10762169689Skan@opindex mno-check-zero-division 10763169689SkanTrap (do not trap) on integer division by zero. The default is 10764169689Skan@option{-mcheck-zero-division}. 10765132718Skan 10766169689Skan@item -mdivide-traps 10767169689Skan@itemx -mdivide-breaks 10768169689Skan@opindex mdivide-traps 10769169689Skan@opindex mdivide-breaks 10770169689SkanMIPS systems check for division by zero by generating either a 10771169689Skanconditional trap or a break instruction. Using traps results in 10772169689Skansmaller code, but is only supported on MIPS II and later. Also, some 10773169689Skanversions of the Linux kernel have a bug that prevents trap from 10774169689Skangenerating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to 10775169689Skanallow conditional traps on architectures that support them and 10776169689Skan@option{-mdivide-breaks} to force the use of breaks. 1077790075Sobrien 10778169689SkanThe default is usually @option{-mdivide-traps}, but this can be 10779169689Skanoverridden at configure time using @option{--with-divide=breaks}. 10780169689SkanDivide-by-zero checks can be completely disabled using 10781169689Skan@option{-mno-check-zero-division}. 1078290075Sobrien 10783169689Skan@item -mmemcpy 10784169689Skan@itemx -mno-memcpy 10785169689Skan@opindex mmemcpy 10786169689Skan@opindex mno-memcpy 10787169689SkanForce (do not force) the use of @code{memcpy()} for non-trivial block 10788169689Skanmoves. The default is @option{-mno-memcpy}, which allows GCC to inline 10789169689Skanmost constant-sized copies. 1079090075Sobrien 10791169689Skan@item -mlong-calls 10792169689Skan@itemx -mno-long-calls 10793169689Skan@opindex mlong-calls 10794169689Skan@opindex mno-long-calls 10795169689SkanDisable (do not disable) use of the @code{jal} instruction. Calling 10796169689Skanfunctions using @code{jal} is more efficient but requires the caller 10797169689Skanand callee to be in the same 256 megabyte segment. 1079890075Sobrien 10799169689SkanThis option has no effect on abicalls code. The default is 10800169689Skan@option{-mno-long-calls}. 1080190075Sobrien 10802169689Skan@item -mmad 10803169689Skan@itemx -mno-mad 10804169689Skan@opindex mmad 10805169689Skan@opindex mno-mad 10806169689SkanEnable (disable) use of the @code{mad}, @code{madu} and @code{mul} 10807169689Skaninstructions, as provided by the R4650 ISA@. 1080890075Sobrien 10809169689Skan@item -mfused-madd 10810169689Skan@itemx -mno-fused-madd 10811169689Skan@opindex mfused-madd 10812169689Skan@opindex mno-fused-madd 10813169689SkanEnable (disable) use of the floating point multiply-accumulate 10814169689Skaninstructions, when they are available. The default is 10815169689Skan@option{-mfused-madd}. 1081690075Sobrien 10817169689SkanWhen multiply-accumulate instructions are used, the intermediate 10818169689Skanproduct is calculated to infinite precision and is not subject to 10819169689Skanthe FCSR Flush to Zero bit. This may be undesirable in some 10820169689Skancircumstances. 1082190075Sobrien 10822169689Skan@item -nocpp 10823169689Skan@opindex nocpp 10824169689SkanTell the MIPS assembler to not run its preprocessor over user 10825169689Skanassembler files (with a @samp{.s} suffix) when assembling them. 1082690075Sobrien 10827169689Skan@item -mfix-r4000 10828169689Skan@itemx -mno-fix-r4000 10829169689Skan@opindex mfix-r4000 10830169689Skan@opindex mno-fix-r4000 10831169689SkanWork around certain R4000 CPU errata: 10832169689Skan@itemize @minus 10833169689Skan@item 10834169689SkanA double-word or a variable shift may give an incorrect result if executed 10835169689Skanimmediately after starting an integer division. 10836169689Skan@item 10837169689SkanA double-word or a variable shift may give an incorrect result if executed 10838169689Skanwhile an integer multiplication is in progress. 10839169689Skan@item 10840169689SkanAn integer division may give an incorrect result if started in a delay slot 10841169689Skanof a taken branch or a jump. 10842169689Skan@end itemize 1084390075Sobrien 10844169689Skan@item -mfix-r4400 10845169689Skan@itemx -mno-fix-r4400 10846169689Skan@opindex mfix-r4400 10847169689Skan@opindex mno-fix-r4400 10848169689SkanWork around certain R4400 CPU errata: 10849169689Skan@itemize @minus 10850169689Skan@item 10851169689SkanA double-word or a variable shift may give an incorrect result if executed 10852169689Skanimmediately after starting an integer division. 10853169689Skan@end itemize 1085490075Sobrien 10855169689Skan@item -mfix-vr4120 10856169689Skan@itemx -mno-fix-vr4120 10857169689Skan@opindex mfix-vr4120 10858169689SkanWork around certain VR4120 errata: 10859169689Skan@itemize @minus 10860169689Skan@item 10861169689Skan@code{dmultu} does not always produce the correct result. 10862169689Skan@item 10863169689Skan@code{div} and @code{ddiv} do not always produce the correct result if one 10864169689Skanof the operands is negative. 10865169689Skan@end itemize 10866169689SkanThe workarounds for the division errata rely on special functions in 10867169689Skan@file{libgcc.a}. At present, these functions are only provided by 10868169689Skanthe @code{mips64vr*-elf} configurations. 1086990075Sobrien 10870169689SkanOther VR4120 errata require a nop to be inserted between certain pairs of 10871169689Skaninstructions. These errata are handled by the assembler, not by GCC itself. 10872169689Skan 10873169689Skan@item -mfix-vr4130 10874169689Skan@opindex mfix-vr4130 10875169689SkanWork around the VR4130 @code{mflo}/@code{mfhi} errata. The 10876169689Skanworkarounds are implemented by the assembler rather than by GCC, 10877169689Skanalthough GCC will avoid using @code{mflo} and @code{mfhi} if the 10878169689SkanVR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi} 10879169689Skaninstructions are available instead. 10880169689Skan 10881169689Skan@item -mfix-sb1 10882169689Skan@itemx -mno-fix-sb1 10883169689Skan@opindex mfix-sb1 10884169689SkanWork around certain SB-1 CPU core errata. 10885169689Skan(This flag currently works around the SB-1 revision 2 10886169689Skan``F1'' and ``F2'' floating point errata.) 10887169689Skan 10888169689Skan@item -mflush-func=@var{func} 10889169689Skan@itemx -mno-flush-func 10890169689Skan@opindex mflush-func 10891169689SkanSpecifies the function to call to flush the I and D caches, or to not 10892169689Skancall any such function. If called, the function must take the same 10893169689Skanarguments as the common @code{_flush_func()}, that is, the address of the 10894169689Skanmemory range for which the cache is being flushed, the size of the 10895169689Skanmemory range, and the number 3 (to flush both caches). The default 10896169689Skandepends on the target GCC was configured for, but commonly is either 10897169689Skan@samp{_flush_func} or @samp{__cpu_flush}. 10898169689Skan 10899169689Skan@item -mbranch-likely 10900169689Skan@itemx -mno-branch-likely 10901169689Skan@opindex mbranch-likely 10902169689Skan@opindex mno-branch-likely 10903169689SkanEnable or disable use of Branch Likely instructions, regardless of the 10904169689Skandefault for the selected architecture. By default, Branch Likely 10905169689Skaninstructions may be generated if they are supported by the selected 10906169689Skanarchitecture. An exception is for the MIPS32 and MIPS64 architectures 10907169689Skanand processors which implement those architectures; for those, Branch 10908169689SkanLikely instructions will not be generated by default because the MIPS32 10909169689Skanand MIPS64 architectures specifically deprecate their use. 10910169689Skan 10911169689Skan@item -mfp-exceptions 10912169689Skan@itemx -mno-fp-exceptions 10913169689Skan@opindex mfp-exceptions 10914169689SkanSpecifies whether FP exceptions are enabled. This affects how we schedule 10915169689SkanFP instructions for some processors. The default is that FP exceptions are 10916169689Skanenabled. 10917169689Skan 10918169689SkanFor instance, on the SB-1, if FP exceptions are disabled, and we are emitting 10919169689Skan64-bit code, then we can use both FP pipes. Otherwise, we can only use one 10920169689SkanFP pipe. 10921169689Skan 10922169689Skan@item -mvr4130-align 10923169689Skan@itemx -mno-vr4130-align 10924169689Skan@opindex mvr4130-align 10925169689SkanThe VR4130 pipeline is two-way superscalar, but can only issue two 10926169689Skaninstructions together if the first one is 8-byte aligned. When this 10927169689Skanoption is enabled, GCC will align pairs of instructions that it 10928169689Skanthinks should execute in parallel. 10929169689Skan 10930169689SkanThis option only has an effect when optimizing for the VR4130. 10931169689SkanIt normally makes code faster, but at the expense of making it bigger. 10932169689SkanIt is enabled by default at optimization level @option{-O3}. 1093390075Sobrien@end table 1093490075Sobrien 1093590075Sobrien@node MMIX Options 1093690075Sobrien@subsection MMIX Options 1093790075Sobrien@cindex MMIX Options 1093890075Sobrien 1093990075SobrienThese options are defined for the MMIX: 1094090075Sobrien 1094190075Sobrien@table @gcctabopt 1094290075Sobrien@item -mlibfuncs 1094390075Sobrien@itemx -mno-libfuncs 1094490075Sobrien@opindex mlibfuncs 1094590075Sobrien@opindex mno-libfuncs 1094690075SobrienSpecify that intrinsic library functions are being compiled, passing all 1094790075Sobrienvalues in registers, no matter the size. 1094890075Sobrien 1094990075Sobrien@item -mepsilon 1095090075Sobrien@itemx -mno-epsilon 1095190075Sobrien@opindex mepsilon 1095290075Sobrien@opindex mno-epsilon 1095390075SobrienGenerate floating-point comparison instructions that compare with respect 1095490075Sobriento the @code{rE} epsilon register. 1095590075Sobrien 1095690075Sobrien@item -mabi=mmixware 1095790075Sobrien@itemx -mabi=gnu 1095890075Sobrien@opindex mabi-mmixware 1095990075Sobrien@opindex mabi=gnu 1096090075SobrienGenerate code that passes function parameters and return values that (in 1096190075Sobrienthe called function) are seen as registers @code{$0} and up, as opposed to 1096290075Sobrienthe GNU ABI which uses global registers @code{$231} and up. 1096390075Sobrien 1096490075Sobrien@item -mzero-extend 1096590075Sobrien@itemx -mno-zero-extend 1096690075Sobrien@opindex mzero-extend 1096790075Sobrien@opindex mno-zero-extend 1096890075SobrienWhen reading data from memory in sizes shorter than 64 bits, use (do not 1096990075Sobrienuse) zero-extending load instructions by default, rather than 1097090075Sobriensign-extending ones. 1097190075Sobrien 1097290075Sobrien@item -mknuthdiv 1097390075Sobrien@itemx -mno-knuthdiv 1097490075Sobrien@opindex mknuthdiv 1097590075Sobrien@opindex mno-knuthdiv 1097690075SobrienMake the result of a division yielding a remainder have the same sign as 1097790075Sobrienthe divisor. With the default, @option{-mno-knuthdiv}, the sign of the 1097890075Sobrienremainder follows the sign of the dividend. Both methods are 1097990075Sobrienarithmetically valid, the latter being almost exclusively used. 1098090075Sobrien 1098190075Sobrien@item -mtoplevel-symbols 1098290075Sobrien@itemx -mno-toplevel-symbols 1098390075Sobrien@opindex mtoplevel-symbols 1098490075Sobrien@opindex mno-toplevel-symbols 1098590075SobrienPrepend (do not prepend) a @samp{:} to all global symbols, so the assembly 1098690075Sobriencode can be used with the @code{PREFIX} assembly directive. 1098790075Sobrien 1098890075Sobrien@item -melf 1098990075Sobrien@opindex melf 1099090075SobrienGenerate an executable in the ELF format, rather than the default 1099190075Sobrien@samp{mmo} format used by the @command{mmix} simulator. 1099290075Sobrien 1099390075Sobrien@item -mbranch-predict 1099490075Sobrien@itemx -mno-branch-predict 1099590075Sobrien@opindex mbranch-predict 1099690075Sobrien@opindex mno-branch-predict 1099790075SobrienUse (do not use) the probable-branch instructions, when static branch 1099890075Sobrienprediction indicates a probable branch. 1099996263Sobrien 1100096263Sobrien@item -mbase-addresses 1100196263Sobrien@itemx -mno-base-addresses 1100296263Sobrien@opindex mbase-addresses 1100396263Sobrien@opindex mno-base-addresses 1100496263SobrienGenerate (do not generate) code that uses @emph{base addresses}. Using a 1100596263Sobrienbase address automatically generates a request (handled by the assembler 1100696263Sobrienand the linker) for a constant to be set up in a global register. The 1100796263Sobrienregister is used for one or more base address requests within the range 0 1100896263Sobriento 255 from the value held in the register. The generally leads to short 1100996263Sobrienand fast code, but the number of different data items that can be 1101096263Sobrienaddressed is limited. This means that a program that uses lots of static 1101196263Sobriendata may require @option{-mno-base-addresses}. 11012117395Skan 11013117395Skan@item -msingle-exit 11014117395Skan@itemx -mno-single-exit 11015117395Skan@opindex msingle-exit 11016117395Skan@opindex mno-single-exit 11017117395SkanForce (do not force) generated code to have a single exit point in each 11018117395Skanfunction. 1101990075Sobrien@end table 1102090075Sobrien 11021169689Skan@node MN10300 Options 11022169689Skan@subsection MN10300 Options 11023169689Skan@cindex MN10300 options 11024169689Skan 11025169689SkanThese @option{-m} options are defined for Matsushita MN10300 architectures: 11026169689Skan 11027169689Skan@table @gcctabopt 11028169689Skan@item -mmult-bug 11029169689Skan@opindex mmult-bug 11030169689SkanGenerate code to avoid bugs in the multiply instructions for the MN10300 11031169689Skanprocessors. This is the default. 11032169689Skan 11033169689Skan@item -mno-mult-bug 11034169689Skan@opindex mno-mult-bug 11035169689SkanDo not generate code to avoid bugs in the multiply instructions for the 11036169689SkanMN10300 processors. 11037169689Skan 11038169689Skan@item -mam33 11039169689Skan@opindex mam33 11040169689SkanGenerate code which uses features specific to the AM33 processor. 11041169689Skan 11042169689Skan@item -mno-am33 11043169689Skan@opindex mno-am33 11044169689SkanDo not generate code which uses features specific to the AM33 processor. This 11045169689Skanis the default. 11046169689Skan 11047169689Skan@item -mreturn-pointer-on-d0 11048169689Skan@opindex mreturn-pointer-on-d0 11049169689SkanWhen generating a function which returns a pointer, return the pointer 11050169689Skanin both @code{a0} and @code{d0}. Otherwise, the pointer is returned 11051169689Skanonly in a0, and attempts to call such functions without a prototype 11052169689Skanwould result in errors. Note that this option is on by default; use 11053169689Skan@option{-mno-return-pointer-on-d0} to disable it. 11054169689Skan 11055169689Skan@item -mno-crt0 11056169689Skan@opindex mno-crt0 11057169689SkanDo not link in the C run-time initialization object file. 11058169689Skan 11059169689Skan@item -mrelax 11060169689Skan@opindex mrelax 11061169689SkanIndicate to the linker that it should perform a relaxation optimization pass 11062169689Skanto shorten branches, calls and absolute memory addresses. This option only 11063169689Skanhas an effect when used on the command line for the final link step. 11064169689Skan 11065169689SkanThis option makes symbolic debugging impossible. 11066169689Skan@end table 11067169689Skan 11068169689Skan@node MT Options 11069169689Skan@subsection MT Options 11070169689Skan@cindex MT options 11071169689Skan 11072169689SkanThese @option{-m} options are defined for Morpho MT architectures: 11073169689Skan 11074169689Skan@table @gcctabopt 11075169689Skan 11076169689Skan@item -march=@var{cpu-type} 11077169689Skan@opindex march 11078169689SkanGenerate code that will run on @var{cpu-type}, which is the name of a system 11079169689Skanrepresenting a certain processor type. Possible values for 11080169689Skan@var{cpu-type} are @samp{ms1-64-001}, @samp{ms1-16-002}, 11081169689Skan@samp{ms1-16-003} and @samp{ms2}. 11082169689Skan 11083169689SkanWhen this option is not used, the default is @option{-march=ms1-16-002}. 11084169689Skan 11085169689Skan@item -mbacc 11086169689Skan@opindex mbacc 11087169689SkanUse byte loads and stores when generating code. 11088169689Skan 11089169689Skan@item -mno-bacc 11090169689Skan@opindex mno-bacc 11091169689SkanDo not use byte loads and stores when generating code. 11092169689Skan 11093169689Skan@item -msim 11094169689Skan@opindex msim 11095169689SkanUse simulator runtime 11096169689Skan 11097169689Skan@item -mno-crt0 11098169689Skan@opindex mno-crt0 11099169689SkanDo not link in the C run-time initialization object file 11100169689Skan@file{crti.o}. Other run-time initialization and termination files 11101169689Skansuch as @file{startup.o} and @file{exit.o} are still included on the 11102169689Skanlinker command line. 11103169689Skan 11104169689Skan@end table 11105169689Skan 1110690075Sobrien@node PDP-11 Options 1110790075Sobrien@subsection PDP-11 Options 1110890075Sobrien@cindex PDP-11 Options 1110990075Sobrien 1111090075SobrienThese options are defined for the PDP-11: 1111190075Sobrien 1111290075Sobrien@table @gcctabopt 1111390075Sobrien@item -mfpu 1111490075Sobrien@opindex mfpu 1111590075SobrienUse hardware FPP floating point. This is the default. (FIS floating 1111690075Sobrienpoint on the PDP-11/40 is not supported.) 1111790075Sobrien 1111890075Sobrien@item -msoft-float 1111990075Sobrien@opindex msoft-float 1112090075SobrienDo not use hardware floating point. 1112190075Sobrien 1112290075Sobrien@item -mac0 1112390075Sobrien@opindex mac0 1112490075SobrienReturn floating-point results in ac0 (fr0 in Unix assembler syntax). 1112590075Sobrien 1112690075Sobrien@item -mno-ac0 1112790075Sobrien@opindex mno-ac0 1112890075SobrienReturn floating-point results in memory. This is the default. 1112990075Sobrien 1113090075Sobrien@item -m40 1113190075Sobrien@opindex m40 1113290075SobrienGenerate code for a PDP-11/40. 1113390075Sobrien 1113490075Sobrien@item -m45 1113590075Sobrien@opindex m45 1113690075SobrienGenerate code for a PDP-11/45. This is the default. 1113790075Sobrien 1113890075Sobrien@item -m10 1113990075Sobrien@opindex m10 1114090075SobrienGenerate code for a PDP-11/10. 1114190075Sobrien 1114290075Sobrien@item -mbcopy-builtin 1114390075Sobrien@opindex bcopy-builtin 11144169689SkanUse inline @code{movmemhi} patterns for copying memory. This is the 1114590075Sobriendefault. 1114690075Sobrien 1114790075Sobrien@item -mbcopy 1114890075Sobrien@opindex mbcopy 11149169689SkanDo not use inline @code{movmemhi} patterns for copying memory. 1115090075Sobrien 1115190075Sobrien@item -mint16 1115290075Sobrien@itemx -mno-int32 1115390075Sobrien@opindex mint16 1115490075Sobrien@opindex mno-int32 1115590075SobrienUse 16-bit @code{int}. This is the default. 1115690075Sobrien 1115790075Sobrien@item -mint32 1115890075Sobrien@itemx -mno-int16 1115990075Sobrien@opindex mint32 1116090075Sobrien@opindex mno-int16 1116190075SobrienUse 32-bit @code{int}. 1116290075Sobrien 1116390075Sobrien@item -mfloat64 1116490075Sobrien@itemx -mno-float32 1116590075Sobrien@opindex mfloat64 1116690075Sobrien@opindex mno-float32 1116790075SobrienUse 64-bit @code{float}. This is the default. 1116890075Sobrien 1116990075Sobrien@item -mfloat32 11170132718Skan@itemx -mno-float64 1117190075Sobrien@opindex mfloat32 1117290075Sobrien@opindex mno-float64 1117390075SobrienUse 32-bit @code{float}. 1117490075Sobrien 1117590075Sobrien@item -mabshi 1117690075Sobrien@opindex mabshi 1117790075SobrienUse @code{abshi2} pattern. This is the default. 1117890075Sobrien 1117990075Sobrien@item -mno-abshi 1118090075Sobrien@opindex mno-abshi 1118190075SobrienDo not use @code{abshi2} pattern. 1118290075Sobrien 1118390075Sobrien@item -mbranch-expensive 1118490075Sobrien@opindex mbranch-expensive 1118590075SobrienPretend that branches are expensive. This is for experimenting with 1118690075Sobriencode generation only. 1118790075Sobrien 1118890075Sobrien@item -mbranch-cheap 1118990075Sobrien@opindex mbranch-cheap 1119090075SobrienDo not pretend that branches are expensive. This is the default. 1119190075Sobrien 1119290075Sobrien@item -msplit 1119390075Sobrien@opindex msplit 11194169689SkanGenerate code for a system with split I&D@. 1119590075Sobrien 1119690075Sobrien@item -mno-split 1119790075Sobrien@opindex mno-split 11198169689SkanGenerate code for a system without split I&D@. This is the default. 1119990075Sobrien 1120090075Sobrien@item -munix-asm 1120190075Sobrien@opindex munix-asm 1120290075SobrienUse Unix assembler syntax. This is the default when configured for 1120390075Sobrien@samp{pdp11-*-bsd}. 1120490075Sobrien 1120590075Sobrien@item -mdec-asm 1120690075Sobrien@opindex mdec-asm 1120790075SobrienUse DEC assembler syntax. This is the default when configured for any 1120890075SobrienPDP-11 target other than @samp{pdp11-*-bsd}. 1120990075Sobrien@end table 1121090075Sobrien 11211169689Skan@node PowerPC Options 11212169689Skan@subsection PowerPC Options 11213169689Skan@cindex PowerPC options 1121490075Sobrien 11215169689SkanThese are listed under @xref{RS/6000 and PowerPC Options}. 1121690075Sobrien 11217169689Skan@node RS/6000 and PowerPC Options 11218169689Skan@subsection IBM RS/6000 and PowerPC Options 11219169689Skan@cindex RS/6000 and PowerPC Options 11220169689Skan@cindex IBM RS/6000 and PowerPC Options 11221169689Skan 11222169689SkanThese @samp{-m} options are defined for the IBM RS/6000 and PowerPC: 1122390075Sobrien@table @gcctabopt 11224169689Skan@item -mpower 11225169689Skan@itemx -mno-power 11226169689Skan@itemx -mpower2 11227169689Skan@itemx -mno-power2 11228169689Skan@itemx -mpowerpc 11229169689Skan@itemx -mno-powerpc 11230169689Skan@itemx -mpowerpc-gpopt 11231169689Skan@itemx -mno-powerpc-gpopt 11232169689Skan@itemx -mpowerpc-gfxopt 11233169689Skan@itemx -mno-powerpc-gfxopt 11234169689Skan@itemx -mpowerpc64 11235169689Skan@itemx -mno-powerpc64 11236169689Skan@itemx -mmfcrf 11237169689Skan@itemx -mno-mfcrf 11238169689Skan@itemx -mpopcntb 11239169689Skan@itemx -mno-popcntb 11240169689Skan@itemx -mfprnd 11241169689Skan@itemx -mno-fprnd 11242169689Skan@opindex mpower 11243169689Skan@opindex mno-power 11244169689Skan@opindex mpower2 11245169689Skan@opindex mno-power2 11246169689Skan@opindex mpowerpc 11247169689Skan@opindex mno-powerpc 11248169689Skan@opindex mpowerpc-gpopt 11249169689Skan@opindex mno-powerpc-gpopt 11250169689Skan@opindex mpowerpc-gfxopt 11251169689Skan@opindex mno-powerpc-gfxopt 11252169689Skan@opindex mpowerpc64 11253169689Skan@opindex mno-powerpc64 11254169689Skan@opindex mmfcrf 11255169689Skan@opindex mno-mfcrf 11256169689Skan@opindex mpopcntb 11257169689Skan@opindex mno-popcntb 11258169689Skan@opindex mfprnd 11259169689Skan@opindex mno-fprnd 11260169689SkanGCC supports two related instruction set architectures for the 11261169689SkanRS/6000 and PowerPC@. The @dfn{POWER} instruction set are those 11262169689Skaninstructions supported by the @samp{rios} chip set used in the original 11263169689SkanRS/6000 systems and the @dfn{PowerPC} instruction set is the 11264169689Skanarchitecture of the Freescale MPC5xx, MPC6xx, MPC8xx microprocessors, and 11265169689Skanthe IBM 4xx, 6xx, and follow-on microprocessors. 11266169689Skan 11267169689SkanNeither architecture is a subset of the other. However there is a 11268169689Skanlarge common subset of instructions supported by both. An MQ 11269169689Skanregister is included in processors supporting the POWER architecture. 11270169689Skan 11271169689SkanYou use these options to specify which instructions are available on the 11272169689Skanprocessor you are using. The default value of these options is 11273169689Skandetermined when configuring GCC@. Specifying the 11274169689Skan@option{-mcpu=@var{cpu_type}} overrides the specification of these 11275169689Skanoptions. We recommend you use the @option{-mcpu=@var{cpu_type}} option 11276169689Skanrather than the options listed above. 11277169689Skan 11278169689SkanThe @option{-mpower} option allows GCC to generate instructions that 11279169689Skanare found only in the POWER architecture and to use the MQ register. 11280169689SkanSpecifying @option{-mpower2} implies @option{-power} and also allows GCC 11281169689Skanto generate instructions that are present in the POWER2 architecture but 11282169689Skannot the original POWER architecture. 11283169689Skan 11284169689SkanThe @option{-mpowerpc} option allows GCC to generate instructions that 11285169689Skanare found only in the 32-bit subset of the PowerPC architecture. 11286169689SkanSpecifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows 11287169689SkanGCC to use the optional PowerPC architecture instructions in the 11288169689SkanGeneral Purpose group, including floating-point square root. Specifying 11289169689Skan@option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to 11290169689Skanuse the optional PowerPC architecture instructions in the Graphics 11291169689Skangroup, including floating-point select. 11292169689Skan 11293169689SkanThe @option{-mmfcrf} option allows GCC to generate the move from 11294169689Skancondition register field instruction implemented on the POWER4 11295169689Skanprocessor and other processors that support the PowerPC V2.01 11296169689Skanarchitecture. 11297169689SkanThe @option{-mpopcntb} option allows GCC to generate the popcount and 11298169689Skandouble precision FP reciprocal estimate instruction implemented on the 11299169689SkanPOWER5 processor and other processors that support the PowerPC V2.02 11300169689Skanarchitecture. 11301169689SkanThe @option{-mfprnd} option allows GCC to generate the FP round to 11302169689Skaninteger instructions implemented on the POWER5+ processor and other 11303169689Skanprocessors that support the PowerPC V2.03 architecture. 11304169689Skan 11305169689SkanThe @option{-mpowerpc64} option allows GCC to generate the additional 11306169689Skan64-bit instructions that are found in the full PowerPC64 architecture 11307169689Skanand to treat GPRs as 64-bit, doubleword quantities. GCC defaults to 11308169689Skan@option{-mno-powerpc64}. 11309169689Skan 11310169689SkanIf you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC 11311169689Skanwill use only the instructions in the common subset of both 11312169689Skanarchitectures plus some special AIX common-mode calls, and will not use 11313169689Skanthe MQ register. Specifying both @option{-mpower} and @option{-mpowerpc} 11314169689Skanpermits GCC to use any instruction from either architecture and to 11315169689Skanallow use of the MQ register; specify this for the Motorola MPC601. 11316169689Skan 11317169689Skan@item -mnew-mnemonics 11318169689Skan@itemx -mold-mnemonics 11319169689Skan@opindex mnew-mnemonics 11320169689Skan@opindex mold-mnemonics 11321169689SkanSelect which mnemonics to use in the generated assembler code. With 11322169689Skan@option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for 11323169689Skanthe PowerPC architecture. With @option{-mold-mnemonics} it uses the 11324169689Skanassembler mnemonics defined for the POWER architecture. Instructions 11325169689Skandefined in only one architecture have only one mnemonic; GCC uses that 11326169689Skanmnemonic irrespective of which of these options is specified. 11327169689Skan 11328169689SkanGCC defaults to the mnemonics appropriate for the architecture in 11329169689Skanuse. Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the 11330169689Skanvalue of these option. Unless you are building a cross-compiler, you 11331169689Skanshould normally not specify either @option{-mnew-mnemonics} or 11332169689Skan@option{-mold-mnemonics}, but should instead accept the default. 11333169689Skan 11334169689Skan@item -mcpu=@var{cpu_type} 11335169689Skan@opindex mcpu 11336169689SkanSet architecture type, register usage, choice of mnemonics, and 11337169689Skaninstruction scheduling parameters for machine type @var{cpu_type}. 11338169689SkanSupported values for @var{cpu_type} are @samp{401}, @samp{403}, 11339169689Skan@samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{505}, 11340169689Skan@samp{601}, @samp{602}, @samp{603}, @samp{603e}, @samp{604}, 11341169689Skan@samp{604e}, @samp{620}, @samp{630}, @samp{740}, @samp{7400}, 11342169689Skan@samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823}, 11343169689Skan@samp{860}, @samp{970}, @samp{8540}, @samp{ec603e}, @samp{G3}, 11344169689Skan@samp{G4}, @samp{G5}, @samp{power}, @samp{power2}, @samp{power3}, 11345169689Skan@samp{power4}, @samp{power5}, @samp{power5+}, @samp{power6}, 11346169689Skan@samp{common}, @samp{powerpc}, @samp{powerpc64}, 11347169689Skan@samp{rios}, @samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64}. 11348169689Skan 11349169689Skan@option{-mcpu=common} selects a completely generic processor. Code 11350169689Skangenerated under this option will run on any POWER or PowerPC processor. 11351169689SkanGCC will use only the instructions in the common subset of both 11352169689Skanarchitectures, and will not use the MQ register. GCC assumes a generic 11353169689Skanprocessor model for scheduling purposes. 11354169689Skan 11355169689Skan@option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and 11356169689Skan@option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit 11357169689SkanPowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine 11358169689Skantypes, with an appropriate, generic processor model assumed for 11359169689Skanscheduling purposes. 11360169689Skan 11361169689SkanThe other options specify a specific processor. Code generated under 11362169689Skanthose options will run best on that processor, and may not run at all on 11363169689Skanothers. 11364169689Skan 11365169689SkanThe @option{-mcpu} options automatically enable or disable the 11366169689Skanfollowing options: @option{-maltivec}, @option{-mfprnd}, 11367169689Skan@option{-mhard-float}, @option{-mmfcrf}, @option{-mmultiple}, 11368169689Skan@option{-mnew-mnemonics}, @option{-mpopcntb}, @option{-mpower}, 11369169689Skan@option{-mpower2}, @option{-mpowerpc64}, @option{-mpowerpc-gpopt}, 11370169689Skan@option{-mpowerpc-gfxopt}, @option{-mstring}, @option{-mmulhw}, @option{-mdlmzb}. 11371169689SkanThe particular options 11372169689Skanset for any particular CPU will vary between compiler versions, 11373169689Skandepending on what setting seems to produce optimal code for that CPU; 11374169689Skanit doesn't necessarily reflect the actual hardware's capabilities. If 11375169689Skanyou wish to set an individual option to a particular value, you may 11376169689Skanspecify it after the @option{-mcpu} option, like @samp{-mcpu=970 11377169689Skan-mno-altivec}. 11378169689Skan 11379169689SkanOn AIX, the @option{-maltivec} and @option{-mpowerpc64} options are 11380169689Skannot enabled or disabled by the @option{-mcpu} option at present because 11381169689SkanAIX does not have full support for these options. You may still 11382169689Skanenable or disable them individually if you're sure it'll work in your 11383169689Skanenvironment. 11384169689Skan 11385169689Skan@item -mtune=@var{cpu_type} 11386169689Skan@opindex mtune 11387169689SkanSet the instruction scheduling parameters for machine type 11388169689Skan@var{cpu_type}, but do not set the architecture type, register usage, or 11389169689Skanchoice of mnemonics, as @option{-mcpu=@var{cpu_type}} would. The same 11390169689Skanvalues for @var{cpu_type} are used for @option{-mtune} as for 11391169689Skan@option{-mcpu}. If both are specified, the code generated will use the 11392169689Skanarchitecture, registers, and mnemonics set by @option{-mcpu}, but the 11393169689Skanscheduling parameters set by @option{-mtune}. 11394169689Skan 11395169689Skan@item -mswdiv 11396169689Skan@itemx -mno-swdiv 11397169689Skan@opindex mswdiv 11398169689Skan@opindex mno-swdiv 11399169689SkanGenerate code to compute division as reciprocal estimate and iterative 11400169689Skanrefinement, creating opportunities for increased throughput. This 11401169689Skanfeature requires: optional PowerPC Graphics instruction set for single 11402169689Skanprecision and FRE instruction for double precision, assuming divides 11403169689Skancannot generate user-visible traps, and the domain values not include 11404169689SkanInfinities, denormals or zero denominator. 11405169689Skan 11406169689Skan@item -maltivec 11407169689Skan@itemx -mno-altivec 11408169689Skan@opindex maltivec 11409169689Skan@opindex mno-altivec 11410169689SkanGenerate code that uses (does not use) AltiVec instructions, and also 11411169689Skanenable the use of built-in functions that allow more direct access to 11412169689Skanthe AltiVec instruction set. You may also need to set 11413169689Skan@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI 11414169689Skanenhancements. 11415169689Skan 11416169689Skan@item -mvrsave 11417169689Skan@item -mno-vrsave 11418169689Skan@opindex mvrsave 11419169689Skan@opindex mno-vrsave 11420169689SkanGenerate VRSAVE instructions when generating AltiVec code. 11421169689Skan 11422169689Skan@item -msecure-plt 11423169689Skan@opindex msecure-plt 11424169689SkanGenerate code that allows ld and ld.so to build executables and shared 11425169689Skanlibraries with non-exec .plt and .got sections. This is a PowerPC 11426169689Skan32-bit SYSV ABI option. 11427169689Skan 11428169689Skan@item -mbss-plt 11429169689Skan@opindex mbss-plt 11430169689SkanGenerate code that uses a BSS .plt section that ld.so fills in, and 11431169689Skanrequires .plt and .got sections that are both writable and executable. 11432169689SkanThis is a PowerPC 32-bit SYSV ABI option. 11433169689Skan 11434169689Skan@item -misel 11435169689Skan@itemx -mno-isel 11436169689Skan@opindex misel 11437169689Skan@opindex mno-isel 11438169689SkanThis switch enables or disables the generation of ISEL instructions. 11439169689Skan 11440169689Skan@item -misel=@var{yes/no} 11441169689SkanThis switch has been deprecated. Use @option{-misel} and 11442169689Skan@option{-mno-isel} instead. 11443169689Skan 11444169689Skan@item -mspe 11445169689Skan@itemx -mno-spe 11446169689Skan@opindex mspe 11447169689Skan@opindex mno-spe 11448169689SkanThis switch enables or disables the generation of SPE simd 11449169689Skaninstructions. 11450169689Skan 11451169689Skan@item -mspe=@var{yes/no} 11452169689SkanThis option has been deprecated. Use @option{-mspe} and 11453169689Skan@option{-mno-spe} instead. 11454169689Skan 11455169689Skan@item -mfloat-gprs=@var{yes/single/double/no} 11456169689Skan@itemx -mfloat-gprs 11457169689Skan@opindex mfloat-gprs 11458169689SkanThis switch enables or disables the generation of floating point 11459169689Skanoperations on the general purpose registers for architectures that 11460169689Skansupport it. 11461169689Skan 11462169689SkanThe argument @var{yes} or @var{single} enables the use of 11463169689Skansingle-precision floating point operations. 11464169689Skan 11465169689SkanThe argument @var{double} enables the use of single and 11466169689Skandouble-precision floating point operations. 11467169689Skan 11468169689SkanThe argument @var{no} disables floating point operations on the 11469169689Skangeneral purpose registers. 11470169689Skan 11471169689SkanThis option is currently only available on the MPC854x. 11472169689Skan 11473169689Skan@item -m32 11474169689Skan@itemx -m64 11475169689Skan@opindex m32 11476169689Skan@opindex m64 11477169689SkanGenerate code for 32-bit or 64-bit environments of Darwin and SVR4 11478169689Skantargets (including GNU/Linux). The 32-bit environment sets int, long 11479169689Skanand pointer to 32 bits and generates code that runs on any PowerPC 11480169689Skanvariant. The 64-bit environment sets int to 32 bits and long and 11481169689Skanpointer to 64 bits, and generates code for PowerPC64, as for 11482169689Skan@option{-mpowerpc64}. 11483169689Skan 11484169689Skan@item -mfull-toc 11485169689Skan@itemx -mno-fp-in-toc 11486169689Skan@itemx -mno-sum-in-toc 11487169689Skan@itemx -mminimal-toc 11488169689Skan@opindex mfull-toc 11489169689Skan@opindex mno-fp-in-toc 11490169689Skan@opindex mno-sum-in-toc 11491169689Skan@opindex mminimal-toc 11492169689SkanModify generation of the TOC (Table Of Contents), which is created for 11493169689Skanevery executable file. The @option{-mfull-toc} option is selected by 11494169689Skandefault. In that case, GCC will allocate at least one TOC entry for 11495169689Skaneach unique non-automatic variable reference in your program. GCC 11496169689Skanwill also place floating-point constants in the TOC@. However, only 11497169689Skan16,384 entries are available in the TOC@. 11498169689Skan 11499169689SkanIf you receive a linker error message that saying you have overflowed 11500169689Skanthe available TOC space, you can reduce the amount of TOC space used 11501169689Skanwith the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options. 11502169689Skan@option{-mno-fp-in-toc} prevents GCC from putting floating-point 11503169689Skanconstants in the TOC and @option{-mno-sum-in-toc} forces GCC to 11504169689Skangenerate code to calculate the sum of an address and a constant at 11505169689Skanrun-time instead of putting that sum into the TOC@. You may specify one 11506169689Skanor both of these options. Each causes GCC to produce very slightly 11507169689Skanslower and larger code at the expense of conserving TOC space. 11508169689Skan 11509169689SkanIf you still run out of space in the TOC even when you specify both of 11510169689Skanthese options, specify @option{-mminimal-toc} instead. This option causes 11511169689SkanGCC to make only one TOC entry for every file. When you specify this 11512169689Skanoption, GCC will produce code that is slower and larger but which 11513169689Skanuses extremely little TOC space. You may wish to use this option 11514169689Skanonly on files that contain less frequently executed code. 11515169689Skan 11516169689Skan@item -maix64 11517169689Skan@itemx -maix32 11518169689Skan@opindex maix64 11519169689Skan@opindex maix32 11520169689SkanEnable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit 11521169689Skan@code{long} type, and the infrastructure needed to support them. 11522169689SkanSpecifying @option{-maix64} implies @option{-mpowerpc64} and 11523169689Skan@option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and 11524169689Skanimplies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}. 11525169689Skan 11526169689Skan@item -mxl-compat 11527169689Skan@itemx -mno-xl-compat 11528169689Skan@opindex mxl-compat 11529169689Skan@opindex mno-xl-compat 11530169689SkanProduce code that conforms more closely to IBM XL compiler semantics 11531169689Skanwhen using AIX-compatible ABI. Pass floating-point arguments to 11532169689Skanprototyped functions beyond the register save area (RSA) on the stack 11533169689Skanin addition to argument FPRs. Do not assume that most significant 11534169689Skandouble in 128-bit long double value is properly rounded when comparing 11535169689Skanvalues and converting to double. Use XL symbol names for long double 11536169689Skansupport routines. 11537169689Skan 11538169689SkanThe AIX calling convention was extended but not initially documented to 11539169689Skanhandle an obscure K&R C case of calling a function that takes the 11540169689Skanaddress of its arguments with fewer arguments than declared. IBM XL 11541169689Skancompilers access floating point arguments which do not fit in the 11542169689SkanRSA from the stack when a subroutine is compiled without 11543169689Skanoptimization. Because always storing floating-point arguments on the 11544169689Skanstack is inefficient and rarely needed, this option is not enabled by 11545169689Skandefault and only is necessary when calling subroutines compiled by IBM 11546169689SkanXL compilers without optimization. 11547169689Skan 11548169689Skan@item -mpe 11549169689Skan@opindex mpe 11550169689SkanSupport @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an 11551169689Skanapplication written to use message passing with special startup code to 11552169689Skanenable the application to run. The system must have PE installed in the 11553169689Skanstandard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file 11554169689Skanmust be overridden with the @option{-specs=} option to specify the 11555169689Skanappropriate directory location. The Parallel Environment does not 11556169689Skansupport threads, so the @option{-mpe} option and the @option{-pthread} 11557169689Skanoption are incompatible. 11558169689Skan 11559169689Skan@item -malign-natural 11560169689Skan@itemx -malign-power 11561169689Skan@opindex malign-natural 11562169689Skan@opindex malign-power 11563169689SkanOn AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option 11564169689Skan@option{-malign-natural} overrides the ABI-defined alignment of larger 11565169689Skantypes, such as floating-point doubles, on their natural size-based boundary. 11566169689SkanThe option @option{-malign-power} instructs GCC to follow the ABI-specified 11567169689Skanalignment rules. GCC defaults to the standard alignment defined in the ABI@. 11568169689Skan 11569169689SkanOn 64-bit Darwin, natural alignment is the default, and @option{-malign-power} 11570169689Skanis not supported. 11571169689Skan 11572169689Skan@item -msoft-float 11573169689Skan@itemx -mhard-float 11574169689Skan@opindex msoft-float 11575169689Skan@opindex mhard-float 11576169689SkanGenerate code that does not use (uses) the floating-point register set. 11577169689SkanSoftware floating point emulation is provided if you use the 11578169689Skan@option{-msoft-float} option, and pass the option to GCC when linking. 11579169689Skan 11580169689Skan@item -mmultiple 11581169689Skan@itemx -mno-multiple 11582169689Skan@opindex mmultiple 11583169689Skan@opindex mno-multiple 11584169689SkanGenerate code that uses (does not use) the load multiple word 11585169689Skaninstructions and the store multiple word instructions. These 11586169689Skaninstructions are generated by default on POWER systems, and not 11587169689Skangenerated on PowerPC systems. Do not use @option{-mmultiple} on little 11588169689Skanendian PowerPC systems, since those instructions do not work when the 11589169689Skanprocessor is in little endian mode. The exceptions are PPC740 and 11590169689SkanPPC750 which permit the instructions usage in little endian mode. 11591169689Skan 11592169689Skan@item -mstring 11593169689Skan@itemx -mno-string 11594169689Skan@opindex mstring 11595169689Skan@opindex mno-string 11596169689SkanGenerate code that uses (does not use) the load string instructions 11597169689Skanand the store string word instructions to save multiple registers and 11598169689Skando small block moves. These instructions are generated by default on 11599169689SkanPOWER systems, and not generated on PowerPC systems. Do not use 11600169689Skan@option{-mstring} on little endian PowerPC systems, since those 11601169689Skaninstructions do not work when the processor is in little endian mode. 11602169689SkanThe exceptions are PPC740 and PPC750 which permit the instructions 11603169689Skanusage in little endian mode. 11604169689Skan 11605169689Skan@item -mupdate 11606169689Skan@itemx -mno-update 11607169689Skan@opindex mupdate 11608169689Skan@opindex mno-update 11609169689SkanGenerate code that uses (does not use) the load or store instructions 11610169689Skanthat update the base register to the address of the calculated memory 11611169689Skanlocation. These instructions are generated by default. If you use 11612169689Skan@option{-mno-update}, there is a small window between the time that the 11613169689Skanstack pointer is updated and the address of the previous frame is 11614169689Skanstored, which means code that walks the stack frame across interrupts or 11615169689Skansignals may get corrupted data. 11616169689Skan 11617169689Skan@item -mfused-madd 11618169689Skan@itemx -mno-fused-madd 11619169689Skan@opindex mfused-madd 11620169689Skan@opindex mno-fused-madd 11621169689SkanGenerate code that uses (does not use) the floating point multiply and 11622169689Skanaccumulate instructions. These instructions are generated by default if 11623169689Skanhardware floating is used. 11624169689Skan 11625169689Skan@item -mmulhw 11626169689Skan@itemx -mno-mulhw 11627169689Skan@opindex mmulhw 11628169689Skan@opindex mno-mulhw 11629169689SkanGenerate code that uses (does not use) the half-word multiply and 11630169689Skanmultiply-accumulate instructions on the IBM 405 and 440 processors. 11631169689SkanThese instructions are generated by default when targetting those 11632169689Skanprocessors. 11633169689Skan 11634169689Skan@item -mdlmzb 11635169689Skan@itemx -mno-dlmzb 11636169689Skan@opindex mdlmzb 11637169689Skan@opindex mno-dlmzb 11638169689SkanGenerate code that uses (does not use) the string-search @samp{dlmzb} 11639169689Skaninstruction on the IBM 405 and 440 processors. This instruction is 11640169689Skangenerated by default when targetting those processors. 11641169689Skan 11642169689Skan@item -mno-bit-align 11643169689Skan@itemx -mbit-align 11644169689Skan@opindex mno-bit-align 11645169689Skan@opindex mbit-align 11646169689SkanOn System V.4 and embedded PowerPC systems do not (do) force structures 11647169689Skanand unions that contain bit-fields to be aligned to the base type of the 11648169689Skanbit-field. 11649169689Skan 11650169689SkanFor example, by default a structure containing nothing but 8 11651169689Skan@code{unsigned} bit-fields of length 1 would be aligned to a 4 byte 11652169689Skanboundary and have a size of 4 bytes. By using @option{-mno-bit-align}, 11653169689Skanthe structure would be aligned to a 1 byte boundary and be one byte in 11654169689Skansize. 11655169689Skan 11656169689Skan@item -mno-strict-align 11657169689Skan@itemx -mstrict-align 11658169689Skan@opindex mno-strict-align 11659169689Skan@opindex mstrict-align 11660169689SkanOn System V.4 and embedded PowerPC systems do not (do) assume that 11661169689Skanunaligned memory references will be handled by the system. 11662169689Skan 11663169689Skan@item -mrelocatable 11664169689Skan@itemx -mno-relocatable 11665169689Skan@opindex mrelocatable 11666169689Skan@opindex mno-relocatable 11667169689SkanOn embedded PowerPC systems generate code that allows (does not allow) 11668169689Skanthe program to be relocated to a different address at runtime. If you 11669169689Skanuse @option{-mrelocatable} on any module, all objects linked together must 11670169689Skanbe compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}. 11671169689Skan 11672169689Skan@item -mrelocatable-lib 11673169689Skan@itemx -mno-relocatable-lib 11674169689Skan@opindex mrelocatable-lib 11675169689Skan@opindex mno-relocatable-lib 11676169689SkanOn embedded PowerPC systems generate code that allows (does not allow) 11677169689Skanthe program to be relocated to a different address at runtime. Modules 11678169689Skancompiled with @option{-mrelocatable-lib} can be linked with either modules 11679169689Skancompiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or 11680169689Skanwith modules compiled with the @option{-mrelocatable} options. 11681169689Skan 11682169689Skan@item -mno-toc 11683169689Skan@itemx -mtoc 11684169689Skan@opindex mno-toc 11685169689Skan@opindex mtoc 11686169689SkanOn System V.4 and embedded PowerPC systems do not (do) assume that 11687169689Skanregister 2 contains a pointer to a global area pointing to the addresses 11688169689Skanused in the program. 11689169689Skan 11690169689Skan@item -mlittle 11691169689Skan@itemx -mlittle-endian 11692169689Skan@opindex mlittle 11693169689Skan@opindex mlittle-endian 11694169689SkanOn System V.4 and embedded PowerPC systems compile code for the 11695169689Skanprocessor in little endian mode. The @option{-mlittle-endian} option is 11696169689Skanthe same as @option{-mlittle}. 11697169689Skan 11698169689Skan@item -mbig 11699169689Skan@itemx -mbig-endian 11700169689Skan@opindex mbig 11701169689Skan@opindex mbig-endian 11702169689SkanOn System V.4 and embedded PowerPC systems compile code for the 11703169689Skanprocessor in big endian mode. The @option{-mbig-endian} option is 11704169689Skanthe same as @option{-mbig}. 11705169689Skan 11706169689Skan@item -mdynamic-no-pic 11707169689Skan@opindex mdynamic-no-pic 11708169689SkanOn Darwin and Mac OS X systems, compile code so that it is not 11709169689Skanrelocatable, but that its external references are relocatable. The 11710169689Skanresulting code is suitable for applications, but not shared 11711169689Skanlibraries. 11712169689Skan 11713169689Skan@item -mprioritize-restricted-insns=@var{priority} 11714169689Skan@opindex mprioritize-restricted-insns 11715169689SkanThis option controls the priority that is assigned to 11716169689Skandispatch-slot restricted instructions during the second scheduling 11717169689Skanpass. The argument @var{priority} takes the value @var{0/1/2} to assign 11718169689Skan@var{no/highest/second-highest} priority to dispatch slot restricted 11719169689Skaninstructions. 11720169689Skan 11721169689Skan@item -msched-costly-dep=@var{dependence_type} 11722169689Skan@opindex msched-costly-dep 11723169689SkanThis option controls which dependences are considered costly 11724169689Skanby the target during instruction scheduling. The argument 11725169689Skan@var{dependence_type} takes one of the following values: 11726169689Skan@var{no}: no dependence is costly, 11727169689Skan@var{all}: all dependences are costly, 11728169689Skan@var{true_store_to_load}: a true dependence from store to load is costly, 11729169689Skan@var{store_to_load}: any dependence from store to load is costly, 11730169689Skan@var{number}: any dependence which latency >= @var{number} is costly. 11731169689Skan 11732169689Skan@item -minsert-sched-nops=@var{scheme} 11733169689Skan@opindex minsert-sched-nops 11734169689SkanThis option controls which nop insertion scheme will be used during 11735169689Skanthe second scheduling pass. The argument @var{scheme} takes one of the 11736169689Skanfollowing values: 11737169689Skan@var{no}: Don't insert nops. 11738169689Skan@var{pad}: Pad with nops any dispatch group which has vacant issue slots, 11739169689Skanaccording to the scheduler's grouping. 11740169689Skan@var{regroup_exact}: Insert nops to force costly dependent insns into 11741169689Skanseparate groups. Insert exactly as many nops as needed to force an insn 11742169689Skanto a new group, according to the estimated processor grouping. 11743169689Skan@var{number}: Insert nops to force costly dependent insns into 11744169689Skanseparate groups. Insert @var{number} nops to force an insn to a new group. 11745169689Skan 11746169689Skan@item -mcall-sysv 11747169689Skan@opindex mcall-sysv 11748169689SkanOn System V.4 and embedded PowerPC systems compile code using calling 11749169689Skanconventions that adheres to the March 1995 draft of the System V 11750169689SkanApplication Binary Interface, PowerPC processor supplement. This is the 11751169689Skandefault unless you configured GCC using @samp{powerpc-*-eabiaix}. 11752169689Skan 11753169689Skan@item -mcall-sysv-eabi 11754169689Skan@opindex mcall-sysv-eabi 11755169689SkanSpecify both @option{-mcall-sysv} and @option{-meabi} options. 11756169689Skan 11757169689Skan@item -mcall-sysv-noeabi 11758169689Skan@opindex mcall-sysv-noeabi 11759169689SkanSpecify both @option{-mcall-sysv} and @option{-mno-eabi} options. 11760169689Skan 11761169689Skan@item -mcall-solaris 11762169689Skan@opindex mcall-solaris 11763169689SkanOn System V.4 and embedded PowerPC systems compile code for the Solaris 11764169689Skanoperating system. 11765169689Skan 11766169689Skan@item -mcall-linux 11767169689Skan@opindex mcall-linux 11768169689SkanOn System V.4 and embedded PowerPC systems compile code for the 11769169689SkanLinux-based GNU system. 11770169689Skan 11771169689Skan@item -mcall-gnu 11772169689Skan@opindex mcall-gnu 11773169689SkanOn System V.4 and embedded PowerPC systems compile code for the 11774169689SkanHurd-based GNU system. 11775169689Skan 11776169689Skan@item -mcall-netbsd 11777169689Skan@opindex mcall-netbsd 11778169689SkanOn System V.4 and embedded PowerPC systems compile code for the 11779169689SkanNetBSD operating system. 11780169689Skan 11781169689Skan@item -maix-struct-return 11782169689Skan@opindex maix-struct-return 11783169689SkanReturn all structures in memory (as specified by the AIX ABI)@. 11784169689Skan 11785169689Skan@item -msvr4-struct-return 11786169689Skan@opindex msvr4-struct-return 11787169689SkanReturn structures smaller than 8 bytes in registers (as specified by the 11788169689SkanSVR4 ABI)@. 11789169689Skan 11790169689Skan@item -mabi=@var{abi-type} 11791169689Skan@opindex mabi 11792169689SkanExtend the current ABI with a particular extension, or remove such extension. 11793169689SkanValid values are @var{altivec}, @var{no-altivec}, @var{spe}, 11794169689Skan@var{no-spe}, @var{ibmlongdouble}, @var{ieeelongdouble}@. 11795169689Skan 11796169689Skan@item -mabi=spe 11797169689Skan@opindex mabi=spe 11798169689SkanExtend the current ABI with SPE ABI extensions. This does not change 11799169689Skanthe default ABI, instead it adds the SPE ABI extensions to the current 11800169689SkanABI@. 11801169689Skan 11802169689Skan@item -mabi=no-spe 11803169689Skan@opindex mabi=no-spe 11804169689SkanDisable Booke SPE ABI extensions for the current ABI@. 11805169689Skan 11806169689Skan@item -mabi=ibmlongdouble 11807169689Skan@opindex mabi=ibmlongdouble 11808169689SkanChange the current ABI to use IBM extended precision long double. 11809169689SkanThis is a PowerPC 32-bit SYSV ABI option. 11810169689Skan 11811169689Skan@item -mabi=ieeelongdouble 11812169689Skan@opindex mabi=ieeelongdouble 11813169689SkanChange the current ABI to use IEEE extended precision long double. 11814169689SkanThis is a PowerPC 32-bit Linux ABI option. 11815169689Skan 11816169689Skan@item -mprototype 11817169689Skan@itemx -mno-prototype 11818169689Skan@opindex mprototype 11819169689Skan@opindex mno-prototype 11820169689SkanOn System V.4 and embedded PowerPC systems assume that all calls to 11821169689Skanvariable argument functions are properly prototyped. Otherwise, the 11822169689Skancompiler must insert an instruction before every non prototyped call to 11823169689Skanset or clear bit 6 of the condition code register (@var{CR}) to 11824169689Skanindicate whether floating point values were passed in the floating point 11825169689Skanregisters in case the function takes a variable arguments. With 11826169689Skan@option{-mprototype}, only calls to prototyped variable argument functions 11827169689Skanwill set or clear the bit. 11828169689Skan 1182990075Sobrien@item -msim 1183090075Sobrien@opindex msim 11831169689SkanOn embedded PowerPC systems, assume that the startup module is called 11832169689Skan@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and 11833169689Skan@file{libc.a}. This is the default for @samp{powerpc-*-eabisim}. 11834169689Skanconfigurations. 1183590075Sobrien 11836169689Skan@item -mmvme 11837169689Skan@opindex mmvme 11838169689SkanOn embedded PowerPC systems, assume that the startup module is called 11839169689Skan@file{crt0.o} and the standard C libraries are @file{libmvme.a} and 11840169689Skan@file{libc.a}. 11841117395Skan 11842169689Skan@item -mads 11843169689Skan@opindex mads 11844169689SkanOn embedded PowerPC systems, assume that the startup module is called 11845169689Skan@file{crt0.o} and the standard C libraries are @file{libads.a} and 11846169689Skan@file{libc.a}. 11847117395Skan 11848169689Skan@item -myellowknife 11849169689Skan@opindex myellowknife 11850169689SkanOn embedded PowerPC systems, assume that the startup module is called 11851169689Skan@file{crt0.o} and the standard C libraries are @file{libyk.a} and 11852169689Skan@file{libc.a}. 11853117395Skan 11854169689Skan@item -mvxworks 11855169689Skan@opindex mvxworks 11856169689SkanOn System V.4 and embedded PowerPC systems, specify that you are 11857169689Skancompiling for a VxWorks system. 11858117395Skan 11859169689Skan@item -mwindiss 11860169689Skan@opindex mwindiss 11861169689SkanSpecify that you are compiling for the WindISS simulation environment. 11862117395Skan 11863169689Skan@item -memb 11864169689Skan@opindex memb 11865169689SkanOn embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags 11866169689Skanheader to indicate that @samp{eabi} extended relocations are used. 11867117395Skan 11868169689Skan@item -meabi 11869169689Skan@itemx -mno-eabi 11870169689Skan@opindex meabi 11871169689Skan@opindex mno-eabi 11872169689SkanOn System V.4 and embedded PowerPC systems do (do not) adhere to the 11873169689SkanEmbedded Applications Binary Interface (eabi) which is a set of 11874169689Skanmodifications to the System V.4 specifications. Selecting @option{-meabi} 11875169689Skanmeans that the stack is aligned to an 8 byte boundary, a function 11876169689Skan@code{__eabi} is called to from @code{main} to set up the eabi 11877169689Skanenvironment, and the @option{-msdata} option can use both @code{r2} and 11878169689Skan@code{r13} to point to two separate small data areas. Selecting 11879169689Skan@option{-mno-eabi} means that the stack is aligned to a 16 byte boundary, 11880169689Skando not call an initialization function from @code{main}, and the 11881169689Skan@option{-msdata} option will only use @code{r13} to point to a single 11882169689Skansmall data area. The @option{-meabi} option is on by default if you 11883169689Skanconfigured GCC using one of the @samp{powerpc*-*-eabi*} options. 11884117395Skan 11885169689Skan@item -msdata=eabi 11886169689Skan@opindex msdata=eabi 11887169689SkanOn System V.4 and embedded PowerPC systems, put small initialized 11888169689Skan@code{const} global and static data in the @samp{.sdata2} section, which 11889169689Skanis pointed to by register @code{r2}. Put small initialized 11890169689Skannon-@code{const} global and static data in the @samp{.sdata} section, 11891169689Skanwhich is pointed to by register @code{r13}. Put small uninitialized 11892169689Skanglobal and static data in the @samp{.sbss} section, which is adjacent to 11893169689Skanthe @samp{.sdata} section. The @option{-msdata=eabi} option is 11894169689Skanincompatible with the @option{-mrelocatable} option. The 11895169689Skan@option{-msdata=eabi} option also sets the @option{-memb} option. 11896117395Skan 11897169689Skan@item -msdata=sysv 11898169689Skan@opindex msdata=sysv 11899169689SkanOn System V.4 and embedded PowerPC systems, put small global and static 11900169689Skandata in the @samp{.sdata} section, which is pointed to by register 11901169689Skan@code{r13}. Put small uninitialized global and static data in the 11902169689Skan@samp{.sbss} section, which is adjacent to the @samp{.sdata} section. 11903169689SkanThe @option{-msdata=sysv} option is incompatible with the 11904169689Skan@option{-mrelocatable} option. 11905117395Skan 11906169689Skan@item -msdata=default 11907169689Skan@itemx -msdata 11908169689Skan@opindex msdata=default 11909169689Skan@opindex msdata 11910169689SkanOn System V.4 and embedded PowerPC systems, if @option{-meabi} is used, 11911169689Skancompile code the same as @option{-msdata=eabi}, otherwise compile code the 11912169689Skansame as @option{-msdata=sysv}. 11913169689Skan 11914169689Skan@item -msdata-data 11915169689Skan@opindex msdata-data 11916169689SkanOn System V.4 and embedded PowerPC systems, put small global 11917169689Skandata in the @samp{.sdata} section. Put small uninitialized global 11918169689Skandata in the @samp{.sbss} section. Do not use register @code{r13} 11919169689Skanto address small data however. This is the default behavior unless 11920169689Skanother @option{-msdata} options are used. 11921169689Skan 11922169689Skan@item -msdata=none 11923169689Skan@itemx -mno-sdata 11924169689Skan@opindex msdata=none 11925169689Skan@opindex mno-sdata 11926169689SkanOn embedded PowerPC systems, put all initialized global and static data 11927169689Skanin the @samp{.data} section, and all uninitialized data in the 11928169689Skan@samp{.bss} section. 11929169689Skan 11930169689Skan@item -G @var{num} 11931169689Skan@opindex G 11932169689Skan@cindex smaller data references (PowerPC) 11933169689Skan@cindex .sdata/.sdata2 references (PowerPC) 11934169689SkanOn embedded PowerPC systems, put global and static items less than or 11935169689Skanequal to @var{num} bytes into the small data or bss sections instead of 11936169689Skanthe normal data or bss section. By default, @var{num} is 8. The 11937169689Skan@option{-G @var{num}} switch is also passed to the linker. 11938169689SkanAll modules should be compiled with the same @option{-G @var{num}} value. 11939169689Skan 11940169689Skan@item -mregnames 11941169689Skan@itemx -mno-regnames 11942169689Skan@opindex mregnames 11943169689Skan@opindex mno-regnames 11944169689SkanOn System V.4 and embedded PowerPC systems do (do not) emit register 11945169689Skannames in the assembly language output using symbolic forms. 11946169689Skan 11947169689Skan@item -mlongcall 11948169689Skan@itemx -mno-longcall 11949169689Skan@opindex mlongcall 11950169689Skan@opindex mno-longcall 11951169689SkanBy default assume that all calls are far away so that a longer more 11952169689Skanexpensive calling sequence is required. This is required for calls 11953169689Skanfurther than 32 megabytes (33,554,432 bytes) from the current location. 11954169689SkanA short call will be generated if the compiler knows 11955169689Skanthe call cannot be that far away. This setting can be overridden by 11956169689Skanthe @code{shortcall} function attribute, or by @code{#pragma 11957169689Skanlongcall(0)}. 11958169689Skan 11959169689SkanSome linkers are capable of detecting out-of-range calls and generating 11960169689Skanglue code on the fly. On these systems, long calls are unnecessary and 11961169689Skangenerate slower code. As of this writing, the AIX linker can do this, 11962169689Skanas can the GNU linker for PowerPC/64. It is planned to add this feature 11963169689Skanto the GNU linker for 32-bit PowerPC systems as well. 11964169689Skan 11965169689SkanOn Darwin/PPC systems, @code{#pragma longcall} will generate ``jbsr 11966169689Skancallee, L42'', plus a ``branch island'' (glue code). The two target 11967169689Skanaddresses represent the callee and the ``branch island''. The 11968169689SkanDarwin/PPC linker will prefer the first address and generate a ``bl 11969169689Skancallee'' if the PPC ``bl'' instruction will reach the callee directly; 11970169689Skanotherwise, the linker will generate ``bl L42'' to call the ``branch 11971169689Skanisland''. The ``branch island'' is appended to the body of the 11972169689Skancalling function; it computes the full 32-bit address of the callee 11973169689Skanand jumps to it. 11974169689Skan 11975169689SkanOn Mach-O (Darwin) systems, this option directs the compiler emit to 11976169689Skanthe glue for every direct call, and the Darwin linker decides whether 11977169689Skanto use or discard it. 11978169689Skan 11979169689SkanIn the future, we may cause GCC to ignore all longcall specifications 11980169689Skanwhen the linker is known to generate glue. 11981169689Skan 11982169689Skan@item -pthread 11983169689Skan@opindex pthread 11984169689SkanAdds support for multithreading with the @dfn{pthreads} library. 11985169689SkanThis option sets flags for both the preprocessor and linker. 11986169689Skan 11987169689Skan@end table 11988169689Skan 11989169689Skan@node S/390 and zSeries Options 11990169689Skan@subsection S/390 and zSeries Options 11991169689Skan@cindex S/390 and zSeries Options 11992169689Skan 11993169689SkanThese are the @samp{-m} options defined for the S/390 and zSeries architecture. 11994169689Skan 11995169689Skan@table @gcctabopt 11996117395Skan@item -mhard-float 11997169689Skan@itemx -msoft-float 11998117395Skan@opindex mhard-float 11999169689Skan@opindex msoft-float 12000169689SkanUse (do not use) the hardware floating-point instructions and registers 12001169689Skanfor floating-point operations. When @option{-msoft-float} is specified, 12002169689Skanfunctions in @file{libgcc.a} will be used to perform floating-point 12003169689Skanoperations. When @option{-mhard-float} is specified, the compiler 12004169689Skangenerates IEEE floating-point instructions. This is the default. 12005117395Skan 12006169689Skan@item -mlong-double-64 12007169689Skan@itemx -mlong-double-128 12008169689Skan@opindex mlong-double-64 12009169689Skan@opindex mlong-double-128 12010169689SkanThese switches control the size of @code{long double} type. A size 12011169689Skanof 64bit makes the @code{long double} type equivalent to the @code{double} 12012169689Skantype. This is the default. 12013117395Skan 12014169689Skan@item -mbackchain 12015169689Skan@itemx -mno-backchain 12016169689Skan@opindex mbackchain 12017169689Skan@opindex mno-backchain 12018169689SkanStore (do not store) the address of the caller's frame as backchain pointer 12019169689Skaninto the callee's stack frame. 12020169689SkanA backchain may be needed to allow debugging using tools that do not understand 12021169689SkanDWARF-2 call frame information. 12022169689SkanWhen @option{-mno-packed-stack} is in effect, the backchain pointer is stored 12023169689Skanat the bottom of the stack frame; when @option{-mpacked-stack} is in effect, 12024169689Skanthe backchain is placed into the topmost word of the 96/160 byte register 12025169689Skansave area. 12026117395Skan 12027169689SkanIn general, code compiled with @option{-mbackchain} is call-compatible with 12028169689Skancode compiled with @option{-mmo-backchain}; however, use of the backchain 12029169689Skanfor debugging purposes usually requires that the whole binary is built with 12030169689Skan@option{-mbackchain}. Note that the combination of @option{-mbackchain}, 12031169689Skan@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order 12032169689Skanto build a linux kernel use @option{-msoft-float}. 12033117395Skan 12034169689SkanThe default is to not maintain the backchain. 12035117395Skan 12036169689Skan@item -mpacked-stack 12037169689Skan@item -mno-packed-stack 12038169689Skan@opindex mpacked-stack 12039169689Skan@opindex mno-packed-stack 12040169689SkanUse (do not use) the packed stack layout. When @option{-mno-packed-stack} is 12041169689Skanspecified, the compiler uses the all fields of the 96/160 byte register save 12042169689Skanarea only for their default purpose; unused fields still take up stack space. 12043169689SkanWhen @option{-mpacked-stack} is specified, register save slots are densely 12044169689Skanpacked at the top of the register save area; unused space is reused for other 12045169689Skanpurposes, allowing for more efficient use of the available stack space. 12046169689SkanHowever, when @option{-mbackchain} is also in effect, the topmost word of 12047169689Skanthe save area is always used to store the backchain, and the return address 12048169689Skanregister is always saved two words below the backchain. 12049117395Skan 12050169689SkanAs long as the stack frame backchain is not used, code generated with 12051169689Skan@option{-mpacked-stack} is call-compatible with code generated with 12052169689Skan@option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for 12053169689SkanS/390 or zSeries generated code that uses the stack frame backchain at run 12054169689Skantime, not just for debugging purposes. Such code is not call-compatible 12055169689Skanwith code compiled with @option{-mpacked-stack}. Also, note that the 12056169689Skancombination of @option{-mbackchain}, 12057169689Skan@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order 12058169689Skanto build a linux kernel use @option{-msoft-float}. 12059117395Skan 12060169689SkanThe default is to not use the packed stack layout. 12061117395Skan 12062169689Skan@item -msmall-exec 12063169689Skan@itemx -mno-small-exec 12064169689Skan@opindex msmall-exec 12065169689Skan@opindex mno-small-exec 12066169689SkanGenerate (or do not generate) code using the @code{bras} instruction 12067169689Skanto do subroutine calls. 12068169689SkanThis only works reliably if the total executable size does not 12069169689Skanexceed 64k. The default is to use the @code{basr} instruction instead, 12070169689Skanwhich does not have this limitation. 12071117395Skan 12072169689Skan@item -m64 12073169689Skan@itemx -m31 12074169689Skan@opindex m64 12075169689Skan@opindex m31 12076169689SkanWhen @option{-m31} is specified, generate code compliant to the 12077169689SkanGNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate 12078169689Skancode compliant to the GNU/Linux for zSeries ABI@. This allows GCC in 12079169689Skanparticular to generate 64-bit instructions. For the @samp{s390} 12080169689Skantargets, the default is @option{-m31}, while the @samp{s390x} 12081169689Skantargets default to @option{-m64}. 12082117395Skan 12083169689Skan@item -mzarch 12084169689Skan@itemx -mesa 12085169689Skan@opindex mzarch 12086169689Skan@opindex mesa 12087169689SkanWhen @option{-mzarch} is specified, generate code using the 12088169689Skaninstructions available on z/Architecture. 12089169689SkanWhen @option{-mesa} is specified, generate code using the 12090169689Skaninstructions available on ESA/390. Note that @option{-mesa} is 12091169689Skannot possible with @option{-m64}. 12092169689SkanWhen generating code compliant to the GNU/Linux for S/390 ABI, 12093169689Skanthe default is @option{-mesa}. When generating code compliant 12094169689Skanto the GNU/Linux for zSeries ABI, the default is @option{-mzarch}. 12095117395Skan 12096169689Skan@item -mmvcle 12097169689Skan@itemx -mno-mvcle 12098169689Skan@opindex mmvcle 12099169689Skan@opindex mno-mvcle 12100169689SkanGenerate (or do not generate) code using the @code{mvcle} instruction 12101169689Skanto perform block moves. When @option{-mno-mvcle} is specified, 12102169689Skanuse a @code{mvc} loop instead. This is the default unless optimizing for 12103169689Skansize. 12104117395Skan 12105169689Skan@item -mdebug 12106169689Skan@itemx -mno-debug 12107169689Skan@opindex mdebug 12108169689Skan@opindex mno-debug 12109169689SkanPrint (or do not print) additional debug information when compiling. 12110169689SkanThe default is to not print debug information. 12111117395Skan 12112169689Skan@item -march=@var{cpu-type} 12113169689Skan@opindex march 12114169689SkanGenerate code that will run on @var{cpu-type}, which is the name of a system 12115169689Skanrepresenting a certain processor type. Possible values for 12116169689Skan@var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, and @samp{z990}. 12117169689SkanWhen generating code using the instructions available on z/Architecture, 12118169689Skanthe default is @option{-march=z900}. Otherwise, the default is 12119169689Skan@option{-march=g5}. 12120117395Skan 12121169689Skan@item -mtune=@var{cpu-type} 12122169689Skan@opindex mtune 12123169689SkanTune to @var{cpu-type} everything applicable about the generated code, 12124169689Skanexcept for the ABI and the set of available instructions. 12125169689SkanThe list of @var{cpu-type} values is the same as for @option{-march}. 12126169689SkanThe default is the value used for @option{-march}. 12127117395Skan 12128169689Skan@item -mtpf-trace 12129169689Skan@itemx -mno-tpf-trace 12130169689Skan@opindex mtpf-trace 12131169689Skan@opindex mno-tpf-trace 12132169689SkanGenerate code that adds (does not add) in TPF OS specific branches to trace 12133169689Skanroutines in the operating system. This option is off by default, even 12134169689Skanwhen compiling for the TPF OS@. 12135117395Skan 12136169689Skan@item -mfused-madd 12137169689Skan@itemx -mno-fused-madd 12138169689Skan@opindex mfused-madd 12139169689Skan@opindex mno-fused-madd 12140169689SkanGenerate code that uses (does not use) the floating point multiply and 12141169689Skanaccumulate instructions. These instructions are generated by default if 12142169689Skanhardware floating point is used. 12143117395Skan 12144169689Skan@item -mwarn-framesize=@var{framesize} 12145169689Skan@opindex mwarn-framesize 12146169689SkanEmit a warning if the current function exceeds the given frame size. Because 12147169689Skanthis is a compile time check it doesn't need to be a real problem when the program 12148169689Skanruns. It is intended to identify functions which most probably cause 12149169689Skana stack overflow. It is useful to be used in an environment with limited stack 12150169689Skansize e.g.@: the linux kernel. 12151117395Skan 12152169689Skan@item -mwarn-dynamicstack 12153169689Skan@opindex mwarn-dynamicstack 12154169689SkanEmit a warning if the function calls alloca or uses dynamically 12155169689Skansized arrays. This is generally a bad idea with a limited stack size. 12156117395Skan 12157169689Skan@item -mstack-guard=@var{stack-guard} 12158169689Skan@item -mstack-size=@var{stack-size} 12159169689Skan@opindex mstack-guard 12160169689Skan@opindex mstack-size 12161169689SkanThese arguments always have to be used in conjunction. If they are present the s390 12162169689Skanback end emits additional instructions in the function prologue which trigger a trap 12163169689Skanif the stack size is @var{stack-guard} bytes above the @var{stack-size} 12164169689Skan(remember that the stack on s390 grows downward). These options are intended to 12165169689Skanbe used to help debugging stack overflow problems. The additionally emitted code 12166169689Skancauses only little overhead and hence can also be used in production like systems 12167169689Skanwithout greater performance degradation. The given values have to be exact 12168169689Skanpowers of 2 and @var{stack-size} has to be greater than @var{stack-guard} without 12169169689Skanexceeding 64k. 12170169689SkanIn order to be efficient the extra code makes the assumption that the stack starts 12171169689Skanat an address aligned to the value given by @var{stack-size}. 12172169689Skan@end table 12173117395Skan 12174169689Skan@node Score Options 12175169689Skan@subsection Score Options 12176169689Skan@cindex Score Options 12177117395Skan 12178169689SkanThese options are defined for Score implementations: 12179117395Skan 12180169689Skan@table @gcctabopt 12181169689Skan@item -meb 12182169689Skan@opindex meb 12183169689SkanCompile code for big endian mode. This is the default. 12184117395Skan 12185169689Skan@item -mel 12186169689Skan@opindex mel 12187169689SkanCompile code for little endian mode. 12188117395Skan 12189169689Skan@item -mnhwloop 12190169689Skan@opindex mnhwloop 12191169689SkanDisable generate bcnz instruction. 12192117395Skan 12193169689Skan@item -muls 12194169689Skan@opindex muls 12195169689SkanEnable generate unaligned load and store instruction. 12196117395Skan 12197169689Skan@item -mmac 12198169689Skan@opindex mmac 12199169689SkanEnable the use of multiply-accumulate instructions. Disabled by default. 12200117395Skan 12201169689Skan@item -mscore5 12202169689Skan@opindex mscore5 12203169689SkanSpecify the SCORE5 as the target architecture. 12204117395Skan 12205169689Skan@item -mscore5u 12206169689Skan@opindex mscore5u 12207169689SkanSpecify the SCORE5U of the target architecture. 12208117395Skan 12209169689Skan@item -mscore7 12210169689Skan@opindex mscore7 12211169689SkanSpecify the SCORE7 as the target architecture. This is the default. 12212117395Skan 12213169689Skan@item -mscore7d 12214169689Skan@opindex mscore7d 12215169689SkanSpecify the SCORE7D as the target architecture. 12216169689Skan@end table 12217117395Skan 12218169689Skan@node SH Options 12219169689Skan@subsection SH Options 12220117395Skan 12221169689SkanThese @samp{-m} options are defined for the SH implementations: 12222117395Skan 12223169689Skan@table @gcctabopt 12224169689Skan@item -m1 12225169689Skan@opindex m1 12226169689SkanGenerate code for the SH1. 12227117395Skan 12228169689Skan@item -m2 12229169689Skan@opindex m2 12230169689SkanGenerate code for the SH2. 12231117395Skan 12232169689Skan@item -m2e 12233169689SkanGenerate code for the SH2e. 12234117395Skan 12235169689Skan@item -m3 12236169689Skan@opindex m3 12237169689SkanGenerate code for the SH3. 12238117395Skan 12239169689Skan@item -m3e 12240169689Skan@opindex m3e 12241169689SkanGenerate code for the SH3e. 12242117395Skan 12243169689Skan@item -m4-nofpu 12244169689Skan@opindex m4-nofpu 12245169689SkanGenerate code for the SH4 without a floating-point unit. 12246117395Skan 12247169689Skan@item -m4-single-only 12248169689Skan@opindex m4-single-only 12249169689SkanGenerate code for the SH4 with a floating-point unit that only 12250169689Skansupports single-precision arithmetic. 12251117395Skan 12252169689Skan@item -m4-single 12253169689Skan@opindex m4-single 12254169689SkanGenerate code for the SH4 assuming the floating-point unit is in 12255169689Skansingle-precision mode by default. 12256117395Skan 12257169689Skan@item -m4 12258169689Skan@opindex m4 12259169689SkanGenerate code for the SH4. 12260117395Skan 12261169689Skan@item -m4a-nofpu 12262169689Skan@opindex m4a-nofpu 12263169689SkanGenerate code for the SH4al-dsp, or for a SH4a in such a way that the 12264169689Skanfloating-point unit is not used. 12265117395Skan 12266169689Skan@item -m4a-single-only 12267169689Skan@opindex m4a-single-only 12268169689SkanGenerate code for the SH4a, in such a way that no double-precision 12269169689Skanfloating point operations are used. 12270117395Skan 12271169689Skan@item -m4a-single 12272169689Skan@opindex m4a-single 12273169689SkanGenerate code for the SH4a assuming the floating-point unit is in 12274169689Skansingle-precision mode by default. 12275117395Skan 12276169689Skan@item -m4a 12277169689Skan@opindex m4a 12278169689SkanGenerate code for the SH4a. 12279117395Skan 12280169689Skan@item -m4al 12281169689Skan@opindex m4al 12282169689SkanSame as @option{-m4a-nofpu}, except that it implicitly passes 12283169689Skan@option{-dsp} to the assembler. GCC doesn't generate any DSP 12284169689Skaninstructions at the moment. 12285117395Skan 12286169689Skan@item -mb 12287169689Skan@opindex mb 12288169689SkanCompile code for the processor in big endian mode. 12289117395Skan 12290169689Skan@item -ml 12291169689Skan@opindex ml 12292169689SkanCompile code for the processor in little endian mode. 12293117395Skan 12294169689Skan@item -mdalign 12295169689Skan@opindex mdalign 12296169689SkanAlign doubles at 64-bit boundaries. Note that this changes the calling 12297169689Skanconventions, and thus some functions from the standard C library will 12298169689Skannot work unless you recompile it first with @option{-mdalign}. 12299117395Skan 12300169689Skan@item -mrelax 12301169689Skan@opindex mrelax 12302169689SkanShorten some address references at link time, when possible; uses the 12303169689Skanlinker option @option{-relax}. 12304117395Skan 12305169689Skan@item -mbigtable 12306169689Skan@opindex mbigtable 12307169689SkanUse 32-bit offsets in @code{switch} tables. The default is to use 12308169689Skan16-bit offsets. 12309117395Skan 12310169689Skan@item -mfmovd 12311169689Skan@opindex mfmovd 12312169689SkanEnable the use of the instruction @code{fmovd}. 12313117395Skan 12314169689Skan@item -mhitachi 12315169689Skan@opindex mhitachi 12316169689SkanComply with the calling conventions defined by Renesas. 12317117395Skan 12318169689Skan@item -mrenesas 12319169689Skan@opindex mhitachi 12320169689SkanComply with the calling conventions defined by Renesas. 12321117395Skan 12322169689Skan@item -mno-renesas 12323169689Skan@opindex mhitachi 12324169689SkanComply with the calling conventions defined for GCC before the Renesas 12325169689Skanconventions were available. This option is the default for all 12326169689Skantargets of the SH toolchain except for @samp{sh-symbianelf}. 12327117395Skan 12328169689Skan@item -mnomacsave 12329169689Skan@opindex mnomacsave 12330169689SkanMark the @code{MAC} register as call-clobbered, even if 12331169689Skan@option{-mhitachi} is given. 12332117395Skan 12333169689Skan@item -mieee 12334169689Skan@opindex mieee 12335169689SkanIncrease IEEE-compliance of floating-point code. 12336169689SkanAt the moment, this is equivalent to @option{-fno-finite-math-only}. 12337169689SkanWhen generating 16 bit SH opcodes, getting IEEE-conforming results for 12338169689Skancomparisons of NANs / infinities incurs extra overhead in every 12339169689Skanfloating point comparison, therefore the default is set to 12340169689Skan@option{-ffinite-math-only}. 12341117395Skan 12342169689Skan@item -misize 12343169689Skan@opindex misize 12344169689SkanDump instruction size and location in the assembly code. 12345117395Skan 12346169689Skan@item -mpadstruct 12347169689Skan@opindex mpadstruct 12348169689SkanThis option is deprecated. It pads structures to multiple of 4 bytes, 12349169689Skanwhich is incompatible with the SH ABI@. 12350117395Skan 12351169689Skan@item -mspace 12352169689Skan@opindex mspace 12353169689SkanOptimize for space instead of speed. Implied by @option{-Os}. 12354117395Skan 12355169689Skan@item -mprefergot 12356169689Skan@opindex mprefergot 12357169689SkanWhen generating position-independent code, emit function calls using 12358169689Skanthe Global Offset Table instead of the Procedure Linkage Table. 12359117395Skan 12360169689Skan@item -musermode 12361169689Skan@opindex musermode 12362169689SkanGenerate a library function call to invalidate instruction cache 12363169689Skanentries, after fixing up a trampoline. This library function call 12364169689Skandoesn't assume it can write to the whole memory address space. This 12365169689Skanis the default when the target is @code{sh-*-linux*}. 12366117395Skan 12367169689Skan@item -multcost=@var{number} 12368169689Skan@opindex multcost=@var{number} 12369169689SkanSet the cost to assume for a multiply insn. 12370117395Skan 12371169689Skan@item -mdiv=@var{strategy} 12372169689Skan@opindex mdiv=@var{strategy} 12373169689SkanSet the division strategy to use for SHmedia code. @var{strategy} must be 12374169689Skanone of: call, call2, fp, inv, inv:minlat, inv20u, inv20l, inv:call, 12375169689Skaninv:call2, inv:fp . 12376169689Skan"fp" performs the operation in floating point. This has a very high latency, 12377169689Skanbut needs only a few instructions, so it might be a good choice if 12378169689Skanyour code has enough easily exploitable ILP to allow the compiler to 12379169689Skanschedule the floating point instructions together with other instructions. 12380169689SkanDivision by zero causes a floating point exception. 12381169689Skan"inv" uses integer operations to calculate the inverse of the divisor, 12382169689Skanand then multiplies the dividend with the inverse. This strategy allows 12383169689Skancse and hoisting of the inverse calculation. Division by zero calculates 12384169689Skanan unspecified result, but does not trap. 12385169689Skan"inv:minlat" is a variant of "inv" where if no cse / hoisting opportunities 12386169689Skanhave been found, or if the entire operation has been hoisted to the same 12387169689Skanplace, the last stages of the inverse calculation are intertwined with the 12388169689Skanfinal multiply to reduce the overall latency, at the expense of using a few 12389169689Skanmore instructions, and thus offering fewer scheduling opportunities with 12390169689Skanother code. 12391169689Skan"call" calls a library function that usually implements the inv:minlat 12392169689Skanstrategy. 12393169689SkanThis gives high code density for m5-*media-nofpu compilations. 12394169689Skan"call2" uses a different entry point of the same library function, where it 12395169689Skanassumes that a pointer to a lookup table has already been set up, which 12396169689Skanexposes the pointer load to cse / code hoisting optimizations. 12397169689Skan"inv:call", "inv:call2" and "inv:fp" all use the "inv" algorithm for initial 12398169689Skancode generation, but if the code stays unoptimized, revert to the "call", 12399169689Skan"call2", or "fp" strategies, respectively. Note that the 12400169689Skanpotentially-trapping side effect of division by zero is carried by a 12401169689Skanseparate instruction, so it is possible that all the integer instructions 12402169689Skanare hoisted out, but the marker for the side effect stays where it is. 12403169689SkanA recombination to fp operations or a call is not possible in that case. 12404169689Skan"inv20u" and "inv20l" are variants of the "inv:minlat" strategy. In the case 12405169689Skanthat the inverse calculation was nor separated from the multiply, they speed 12406169689Skanup division where the dividend fits into 20 bits (plus sign where applicable), 12407169689Skanby inserting a test to skip a number of operations in this case; this test 12408169689Skanslows down the case of larger dividends. inv20u assumes the case of a such 12409169689Skana small dividend to be unlikely, and inv20l assumes it to be likely. 12410117395Skan 12411169689Skan@item -mdivsi3_libfunc=@var{name} 12412169689Skan@opindex mdivsi3_libfunc=@var{name} 12413169689SkanSet the name of the library function used for 32 bit signed division to 12414169689Skan@var{name}. This only affect the name used in the call and inv:call 12415169689Skandivision strategies, and the compiler will still expect the same 12416169689Skansets of input/output/clobbered registers as if this option was not present. 12417117395Skan 12418169689Skan@item -madjust-unroll 12419169689Skan@opindex madjust-unroll 12420169689SkanThrottle unrolling to avoid thrashing target registers. 12421169689SkanThis option only has an effect if the gcc code base supports the 12422169689SkanTARGET_ADJUST_UNROLL_MAX target hook. 12423117395Skan 12424169689Skan@item -mindexed-addressing 12425169689Skan@opindex mindexed-addressing 12426169689SkanEnable the use of the indexed addressing mode for SHmedia32/SHcompact. 12427169689SkanThis is only safe if the hardware and/or OS implement 32 bit wrap-around 12428169689Skansemantics for the indexed addressing mode. The architecture allows the 12429169689Skanimplementation of processors with 64 bit MMU, which the OS could use to 12430169689Skanget 32 bit addressing, but since no current hardware implementation supports 12431169689Skanthis or any other way to make the indexed addressing mode safe to use in 12432169689Skanthe 32 bit ABI, the default is -mno-indexed-addressing. 12433117395Skan 12434169689Skan@item -mgettrcost=@var{number} 12435169689Skan@opindex mgettrcost=@var{number} 12436169689SkanSet the cost assumed for the gettr instruction to @var{number}. 12437169689SkanThe default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise. 12438117395Skan 12439169689Skan@item -mpt-fixed 12440169689Skan@opindex mpt-fixed 12441169689SkanAssume pt* instructions won't trap. This will generally generate better 12442169689Skanscheduled code, but is unsafe on current hardware. The current architecture 12443169689Skandefinition says that ptabs and ptrel trap when the target anded with 3 is 3. 12444169689SkanThis has the unintentional effect of making it unsafe to schedule ptabs / 12445169689Skanptrel before a branch, or hoist it out of a loop. For example, 12446169689Skan__do_global_ctors, a part of libgcc that runs constructors at program 12447169689Skanstartup, calls functions in a list which is delimited by -1. With the 12448169689Skan-mpt-fixed option, the ptabs will be done before testing against -1. 12449169689SkanThat means that all the constructors will be run a bit quicker, but when 12450169689Skanthe loop comes to the end of the list, the program crashes because ptabs 12451169689Skanloads -1 into a target register. Since this option is unsafe for any 12452169689Skanhardware implementing the current architecture specification, the default 12453169689Skanis -mno-pt-fixed. Unless the user specifies a specific cost with 12454169689Skan@option{-mgettrcost}, -mno-pt-fixed also implies @option{-mgettrcost=100}; 12455169689Skanthis deters register allocation using target registers for storing 12456169689Skanordinary integers. 12457117395Skan 12458169689Skan@item -minvalid-symbols 12459169689Skan@opindex minvalid-symbols 12460169689SkanAssume symbols might be invalid. Ordinary function symbols generated by 12461169689Skanthe compiler will always be valid to load with movi/shori/ptabs or 12462169689Skanmovi/shori/ptrel, but with assembler and/or linker tricks it is possible 12463169689Skanto generate symbols that will cause ptabs / ptrel to trap. 12464169689SkanThis option is only meaningful when @option{-mno-pt-fixed} is in effect. 12465169689SkanIt will then prevent cross-basic-block cse, hoisting and most scheduling 12466169689Skanof symbol loads. The default is @option{-mno-invalid-symbols}. 12467169689Skan@end table 12468117395Skan 12469169689Skan@node SPARC Options 12470169689Skan@subsection SPARC Options 12471169689Skan@cindex SPARC options 12472117395Skan 12473169689SkanThese @samp{-m} options are supported on the SPARC: 12474117395Skan 12475169689Skan@table @gcctabopt 12476169689Skan@item -mno-app-regs 12477169689Skan@itemx -mapp-regs 12478169689Skan@opindex mno-app-regs 12479169689Skan@opindex mapp-regs 12480169689SkanSpecify @option{-mapp-regs} to generate output using the global registers 12481169689Skan2 through 4, which the SPARC SVR4 ABI reserves for applications. This 12482169689Skanis the default. 12483117395Skan 12484169689SkanTo be fully SVR4 ABI compliant at the cost of some performance loss, 12485169689Skanspecify @option{-mno-app-regs}. You should compile libraries and system 12486169689Skansoftware with this option. 12487169689Skan 12488169689Skan@item -mfpu 12489169689Skan@itemx -mhard-float 12490169689Skan@opindex mfpu 12491169689Skan@opindex mhard-float 12492169689SkanGenerate output containing floating point instructions. This is the 12493169689Skandefault. 12494169689Skan 12495169689Skan@item -mno-fpu 12496169689Skan@itemx -msoft-float 12497169689Skan@opindex mno-fpu 12498169689Skan@opindex msoft-float 12499169689SkanGenerate output containing library calls for floating point. 12500169689Skan@strong{Warning:} the requisite libraries are not available for all SPARC 12501169689Skantargets. Normally the facilities of the machine's usual C compiler are 12502169689Skanused, but this cannot be done directly in cross-compilation. You must make 12503169689Skanyour own arrangements to provide suitable library functions for 12504169689Skancross-compilation. The embedded targets @samp{sparc-*-aout} and 12505169689Skan@samp{sparclite-*-*} do provide software floating point support. 12506169689Skan 12507169689Skan@option{-msoft-float} changes the calling convention in the output file; 12508169689Skantherefore, it is only useful if you compile @emph{all} of a program with 12509169689Skanthis option. In particular, you need to compile @file{libgcc.a}, the 12510169689Skanlibrary that comes with GCC, with @option{-msoft-float} in order for 12511169689Skanthis to work. 12512169689Skan 12513169689Skan@item -mhard-quad-float 12514169689Skan@opindex mhard-quad-float 12515169689SkanGenerate output containing quad-word (long double) floating point 12516169689Skaninstructions. 12517169689Skan 12518169689Skan@item -msoft-quad-float 12519169689Skan@opindex msoft-quad-float 12520169689SkanGenerate output containing library calls for quad-word (long double) 12521169689Skanfloating point instructions. The functions called are those specified 12522169689Skanin the SPARC ABI@. This is the default. 12523169689Skan 12524169689SkanAs of this writing, there are no SPARC implementations that have hardware 12525169689Skansupport for the quad-word floating point instructions. They all invoke 12526169689Skana trap handler for one of these instructions, and then the trap handler 12527169689Skanemulates the effect of the instruction. Because of the trap handler overhead, 12528169689Skanthis is much slower than calling the ABI library routines. Thus the 12529169689Skan@option{-msoft-quad-float} option is the default. 12530169689Skan 12531169689Skan@item -mno-unaligned-doubles 12532169689Skan@itemx -munaligned-doubles 12533169689Skan@opindex mno-unaligned-doubles 12534169689Skan@opindex munaligned-doubles 12535169689SkanAssume that doubles have 8 byte alignment. This is the default. 12536169689Skan 12537169689SkanWith @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte 12538169689Skanalignment only if they are contained in another type, or if they have an 12539169689Skanabsolute address. Otherwise, it assumes they have 4 byte alignment. 12540169689SkanSpecifying this option avoids some rare compatibility problems with code 12541169689Skangenerated by other compilers. It is not the default because it results 12542169689Skanin a performance loss, especially for floating point code. 12543169689Skan 12544169689Skan@item -mno-faster-structs 12545169689Skan@itemx -mfaster-structs 12546169689Skan@opindex mno-faster-structs 12547169689Skan@opindex mfaster-structs 12548169689SkanWith @option{-mfaster-structs}, the compiler assumes that structures 12549169689Skanshould have 8 byte alignment. This enables the use of pairs of 12550169689Skan@code{ldd} and @code{std} instructions for copies in structure 12551169689Skanassignment, in place of twice as many @code{ld} and @code{st} pairs. 12552169689SkanHowever, the use of this changed alignment directly violates the SPARC 12553169689SkanABI@. Thus, it's intended only for use on targets where the developer 12554169689Skanacknowledges that their resulting code will not be directly in line with 12555169689Skanthe rules of the ABI@. 12556169689Skan 12557169689Skan@item -mimpure-text 12558169689Skan@opindex mimpure-text 12559169689Skan@option{-mimpure-text}, used in addition to @option{-shared}, tells 12560169689Skanthe compiler to not pass @option{-z text} to the linker when linking a 12561169689Skanshared object. Using this option, you can link position-dependent 12562169689Skancode into a shared object. 12563169689Skan 12564169689Skan@option{-mimpure-text} suppresses the ``relocations remain against 12565169689Skanallocatable but non-writable sections'' linker error message. 12566169689SkanHowever, the necessary relocations will trigger copy-on-write, and the 12567169689Skanshared object is not actually shared across processes. Instead of 12568169689Skanusing @option{-mimpure-text}, you should compile all source code with 12569169689Skan@option{-fpic} or @option{-fPIC}. 12570169689Skan 12571169689SkanThis option is only available on SunOS and Solaris. 12572169689Skan 12573169689Skan@item -mcpu=@var{cpu_type} 12574117395Skan@opindex mcpu 12575169689SkanSet the instruction set, register set, and instruction scheduling parameters 12576169689Skanfor machine type @var{cpu_type}. Supported values for @var{cpu_type} are 12577169689Skan@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite}, 12578169689Skan@samp{f930}, @samp{f934}, @samp{hypersparc}, @samp{sparclite86x}, 12579169689Skan@samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc}, 12580169689Skan@samp{ultrasparc3}, and @samp{niagara}. 12581117395Skan 12582169689SkanDefault instruction scheduling parameters are used for values that select 12583169689Skanan architecture and not an implementation. These are @samp{v7}, @samp{v8}, 12584169689Skan@samp{sparclite}, @samp{sparclet}, @samp{v9}. 12585117395Skan 12586169689SkanHere is a list of each supported architecture and their supported 12587169689Skanimplementations. 12588169689Skan 12589169689Skan@smallexample 12590169689Skan v7: cypress 12591169689Skan v8: supersparc, hypersparc 12592169689Skan sparclite: f930, f934, sparclite86x 12593169689Skan sparclet: tsc701 12594169689Skan v9: ultrasparc, ultrasparc3, niagara 12595169689Skan@end smallexample 12596169689Skan 12597169689SkanBy default (unless configured otherwise), GCC generates code for the V7 12598169689Skanvariant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler 12599169689Skanadditionally optimizes it for the Cypress CY7C602 chip, as used in the 12600169689SkanSPARCStation/SPARCServer 3xx series. This is also appropriate for the older 12601169689SkanSPARCStation 1, 2, IPX etc. 12602169689Skan 12603169689SkanWith @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC 12604169689Skanarchitecture. The only difference from V7 code is that the compiler emits 12605169689Skanthe integer multiply and integer divide instructions which exist in SPARC-V8 12606169689Skanbut not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally 12607169689Skanoptimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and 12608169689Skan2000 series. 12609169689Skan 12610169689SkanWith @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of 12611169689Skanthe SPARC architecture. This adds the integer multiply, integer divide step 12612169689Skanand scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7. 12613169689SkanWith @option{-mcpu=f930}, the compiler additionally optimizes it for the 12614169689SkanFujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With 12615169689Skan@option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu 12616169689SkanMB86934 chip, which is the more recent SPARClite with FPU@. 12617169689Skan 12618169689SkanWith @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of 12619169689Skanthe SPARC architecture. This adds the integer multiply, multiply/accumulate, 12620169689Skaninteger divide step and scan (@code{ffs}) instructions which exist in SPARClet 12621169689Skanbut not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally 12622169689Skanoptimizes it for the TEMIC SPARClet chip. 12623169689Skan 12624169689SkanWith @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC 12625169689Skanarchitecture. This adds 64-bit integer and floating-point move instructions, 12626169689Skan3 additional floating-point condition code registers and conditional move 12627169689Skaninstructions. With @option{-mcpu=ultrasparc}, the compiler additionally 12628169689Skanoptimizes it for the Sun UltraSPARC I/II/IIi chips. With 12629169689Skan@option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the 12630169689SkanSun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With 12631169689Skan@option{-mcpu=niagara}, the compiler additionally optimizes it for 12632169689SkanSun UltraSPARC T1 chips. 12633169689Skan 12634169689Skan@item -mtune=@var{cpu_type} 12635169689Skan@opindex mtune 12636169689SkanSet the instruction scheduling parameters for machine type 12637169689Skan@var{cpu_type}, but do not set the instruction set or register set that the 12638169689Skanoption @option{-mcpu=@var{cpu_type}} would. 12639169689Skan 12640169689SkanThe same values for @option{-mcpu=@var{cpu_type}} can be used for 12641169689Skan@option{-mtune=@var{cpu_type}}, but the only useful values are those 12642169689Skanthat select a particular cpu implementation. Those are @samp{cypress}, 12643169689Skan@samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934}, 12644169689Skan@samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc}, 12645169689Skan@samp{ultrasparc3}, and @samp{niagara}. 12646169689Skan 12647169689Skan@item -mv8plus 12648169689Skan@itemx -mno-v8plus 12649169689Skan@opindex mv8plus 12650169689Skan@opindex mno-v8plus 12651169689SkanWith @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The 12652169689Skandifference from the V8 ABI is that the global and out registers are 12653169689Skanconsidered 64-bit wide. This is enabled by default on Solaris in 32-bit 12654169689Skanmode for all SPARC-V9 processors. 12655169689Skan 12656169689Skan@item -mvis 12657169689Skan@itemx -mno-vis 12658169689Skan@opindex mvis 12659169689Skan@opindex mno-vis 12660169689SkanWith @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC 12661169689SkanVisual Instruction Set extensions. The default is @option{-mno-vis}. 12662117395Skan@end table 12663117395Skan 12664169689SkanThese @samp{-m} options are supported in addition to the above 12665169689Skanon SPARC-V9 processors in 64-bit environments: 12666169689Skan 12667169689Skan@table @gcctabopt 12668169689Skan@item -mlittle-endian 12669169689Skan@opindex mlittle-endian 12670169689SkanGenerate code for a processor running in little-endian mode. It is only 12671169689Skanavailable for a few configurations and most notably not on Solaris and Linux. 12672169689Skan 12673169689Skan@item -m32 12674169689Skan@itemx -m64 12675169689Skan@opindex m32 12676169689Skan@opindex m64 12677169689SkanGenerate code for a 32-bit or 64-bit environment. 12678169689SkanThe 32-bit environment sets int, long and pointer to 32 bits. 12679169689SkanThe 64-bit environment sets int to 32 bits and long and pointer 12680169689Skanto 64 bits. 12681169689Skan 12682169689Skan@item -mcmodel=medlow 12683169689Skan@opindex mcmodel=medlow 12684169689SkanGenerate code for the Medium/Low code model: 64-bit addresses, programs 12685169689Skanmust be linked in the low 32 bits of memory. Programs can be statically 12686169689Skanor dynamically linked. 12687169689Skan 12688169689Skan@item -mcmodel=medmid 12689169689Skan@opindex mcmodel=medmid 12690169689SkanGenerate code for the Medium/Middle code model: 64-bit addresses, programs 12691169689Skanmust be linked in the low 44 bits of memory, the text and data segments must 12692169689Skanbe less than 2GB in size and the data segment must be located within 2GB of 12693169689Skanthe text segment. 12694169689Skan 12695169689Skan@item -mcmodel=medany 12696169689Skan@opindex mcmodel=medany 12697169689SkanGenerate code for the Medium/Anywhere code model: 64-bit addresses, programs 12698169689Skanmay be linked anywhere in memory, the text and data segments must be less 12699169689Skanthan 2GB in size and the data segment must be located within 2GB of the 12700169689Skantext segment. 12701169689Skan 12702169689Skan@item -mcmodel=embmedany 12703169689Skan@opindex mcmodel=embmedany 12704169689SkanGenerate code for the Medium/Anywhere code model for embedded systems: 12705169689Skan64-bit addresses, the text and data segments must be less than 2GB in 12706169689Skansize, both starting anywhere in memory (determined at link time). The 12707169689Skanglobal register %g4 points to the base of the data segment. Programs 12708169689Skanare statically linked and PIC is not supported. 12709169689Skan 12710169689Skan@item -mstack-bias 12711169689Skan@itemx -mno-stack-bias 12712169689Skan@opindex mstack-bias 12713169689Skan@opindex mno-stack-bias 12714169689SkanWith @option{-mstack-bias}, GCC assumes that the stack pointer, and 12715169689Skanframe pointer if present, are offset by @minus{}2047 which must be added back 12716169689Skanwhen making stack frame references. This is the default in 64-bit mode. 12717169689SkanOtherwise, assume no such offset is present. 12718169689Skan@end table 12719169689Skan 12720169689SkanThese switches are supported in addition to the above on Solaris: 12721169689Skan 12722169689Skan@table @gcctabopt 12723169689Skan@item -threads 12724169689Skan@opindex threads 12725169689SkanAdd support for multithreading using the Solaris threads library. This 12726169689Skanoption sets flags for both the preprocessor and linker. This option does 12727169689Skannot affect the thread safety of object code produced by the compiler or 12728169689Skanthat of libraries supplied with it. 12729169689Skan 12730169689Skan@item -pthreads 12731169689Skan@opindex pthreads 12732169689SkanAdd support for multithreading using the POSIX threads library. This 12733169689Skanoption sets flags for both the preprocessor and linker. This option does 12734169689Skannot affect the thread safety of object code produced by the compiler or 12735169689Skanthat of libraries supplied with it. 12736169689Skan 12737169689Skan@item -pthread 12738169689Skan@opindex pthread 12739169689SkanThis is a synonym for @option{-pthreads}. 12740169689Skan@end table 12741169689Skan 12742169689Skan@node System V Options 12743169689Skan@subsection Options for System V 12744169689Skan 12745169689SkanThese additional options are available on System V Release 4 for 12746169689Skancompatibility with other compilers on those systems: 12747169689Skan 12748169689Skan@table @gcctabopt 12749169689Skan@item -G 12750169689Skan@opindex G 12751169689SkanCreate a shared object. 12752169689SkanIt is recommended that @option{-symbolic} or @option{-shared} be used instead. 12753169689Skan 12754169689Skan@item -Qy 12755169689Skan@opindex Qy 12756169689SkanIdentify the versions of each tool used by the compiler, in a 12757169689Skan@code{.ident} assembler directive in the output. 12758169689Skan 12759169689Skan@item -Qn 12760169689Skan@opindex Qn 12761169689SkanRefrain from adding @code{.ident} directives to the output file (this is 12762169689Skanthe default). 12763169689Skan 12764169689Skan@item -YP,@var{dirs} 12765169689Skan@opindex YP 12766169689SkanSearch the directories @var{dirs}, and no others, for libraries 12767169689Skanspecified with @option{-l}. 12768169689Skan 12769169689Skan@item -Ym,@var{dir} 12770169689Skan@opindex Ym 12771169689SkanLook in the directory @var{dir} to find the M4 preprocessor. 12772169689SkanThe assembler uses this option. 12773169689Skan@c This is supposed to go with a -Yd for predefined M4 macro files, but 12774169689Skan@c the generic assembler that comes with Solaris takes just -Ym. 12775169689Skan@end table 12776169689Skan 12777169689Skan@node TMS320C3x/C4x Options 12778169689Skan@subsection TMS320C3x/C4x Options 12779169689Skan@cindex TMS320C3x/C4x Options 12780169689Skan 12781169689SkanThese @samp{-m} options are defined for TMS320C3x/C4x implementations: 12782169689Skan 12783169689Skan@table @gcctabopt 12784169689Skan 12785169689Skan@item -mcpu=@var{cpu_type} 12786169689Skan@opindex mcpu 12787169689SkanSet the instruction set, register set, and instruction scheduling 12788169689Skanparameters for machine type @var{cpu_type}. Supported values for 12789169689Skan@var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and 12790169689Skan@samp{c44}. The default is @samp{c40} to generate code for the 12791169689SkanTMS320C40. 12792169689Skan 12793169689Skan@item -mbig-memory 12794169689Skan@itemx -mbig 12795169689Skan@itemx -msmall-memory 12796169689Skan@itemx -msmall 12797169689Skan@opindex mbig-memory 12798169689Skan@opindex mbig 12799169689Skan@opindex msmall-memory 12800169689Skan@opindex msmall 12801169689SkanGenerates code for the big or small memory model. The small memory 12802169689Skanmodel assumed that all data fits into one 64K word page. At run-time 12803169689Skanthe data page (DP) register must be set to point to the 64K page 12804169689Skancontaining the .bss and .data program sections. The big memory model is 12805169689Skanthe default and requires reloading of the DP register for every direct 12806169689Skanmemory access. 12807169689Skan 12808169689Skan@item -mbk 12809169689Skan@itemx -mno-bk 12810169689Skan@opindex mbk 12811169689Skan@opindex mno-bk 12812169689SkanAllow (disallow) allocation of general integer operands into the block 12813169689Skancount register BK@. 12814169689Skan 12815169689Skan@item -mdb 12816169689Skan@itemx -mno-db 12817169689Skan@opindex mdb 12818169689Skan@opindex mno-db 12819169689SkanEnable (disable) generation of code using decrement and branch, 12820169689SkanDBcond(D), instructions. This is enabled by default for the C4x. To be 12821169689Skanon the safe side, this is disabled for the C3x, since the maximum 12822169689Skaniteration count on the C3x is @math{2^{23} + 1} (but who iterates loops more than 12823169689Skan@math{2^{23}} times on the C3x?). Note that GCC will try to reverse a loop so 12824169689Skanthat it can utilize the decrement and branch instruction, but will give 12825169689Skanup if there is more than one memory reference in the loop. Thus a loop 12826169689Skanwhere the loop counter is decremented can generate slightly more 12827169689Skanefficient code, in cases where the RPTB instruction cannot be utilized. 12828169689Skan 12829169689Skan@item -mdp-isr-reload 12830169689Skan@itemx -mparanoid 12831169689Skan@opindex mdp-isr-reload 12832169689Skan@opindex mparanoid 12833169689SkanForce the DP register to be saved on entry to an interrupt service 12834169689Skanroutine (ISR), reloaded to point to the data section, and restored on 12835169689Skanexit from the ISR@. This should not be required unless someone has 12836169689Skanviolated the small memory model by modifying the DP register, say within 12837169689Skanan object library. 12838169689Skan 12839169689Skan@item -mmpyi 12840169689Skan@itemx -mno-mpyi 12841169689Skan@opindex mmpyi 12842169689Skan@opindex mno-mpyi 12843169689SkanFor the C3x use the 24-bit MPYI instruction for integer multiplies 12844169689Skaninstead of a library call to guarantee 32-bit results. Note that if one 12845169689Skanof the operands is a constant, then the multiplication will be performed 12846169689Skanusing shifts and adds. If the @option{-mmpyi} option is not specified for the C3x, 12847169689Skanthen squaring operations are performed inline instead of a library call. 12848169689Skan 12849169689Skan@item -mfast-fix 12850169689Skan@itemx -mno-fast-fix 12851169689Skan@opindex mfast-fix 12852169689Skan@opindex mno-fast-fix 12853169689SkanThe C3x/C4x FIX instruction to convert a floating point value to an 12854169689Skaninteger value chooses the nearest integer less than or equal to the 12855169689Skanfloating point value rather than to the nearest integer. Thus if the 12856169689Skanfloating point number is negative, the result will be incorrectly 12857169689Skantruncated an additional code is necessary to detect and correct this 12858169689Skancase. This option can be used to disable generation of the additional 12859169689Skancode required to correct the result. 12860169689Skan 12861169689Skan@item -mrptb 12862169689Skan@itemx -mno-rptb 12863169689Skan@opindex mrptb 12864169689Skan@opindex mno-rptb 12865169689SkanEnable (disable) generation of repeat block sequences using the RPTB 12866169689Skaninstruction for zero overhead looping. The RPTB construct is only used 12867169689Skanfor innermost loops that do not call functions or jump across the loop 12868169689Skanboundaries. There is no advantage having nested RPTB loops due to the 12869169689Skanoverhead required to save and restore the RC, RS, and RE registers. 12870169689SkanThis is enabled by default with @option{-O2}. 12871169689Skan 12872169689Skan@item -mrpts=@var{count} 12873169689Skan@itemx -mno-rpts 12874169689Skan@opindex mrpts 12875169689Skan@opindex mno-rpts 12876169689SkanEnable (disable) the use of the single instruction repeat instruction 12877169689SkanRPTS@. If a repeat block contains a single instruction, and the loop 12878169689Skancount can be guaranteed to be less than the value @var{count}, GCC will 12879169689Skanemit a RPTS instruction instead of a RPTB@. If no value is specified, 12880169689Skanthen a RPTS will be emitted even if the loop count cannot be determined 12881169689Skanat compile time. Note that the repeated instruction following RPTS does 12882169689Skannot have to be reloaded from memory each iteration, thus freeing up the 12883169689SkanCPU buses for operands. However, since interrupts are blocked by this 12884169689Skaninstruction, it is disabled by default. 12885169689Skan 12886169689Skan@item -mloop-unsigned 12887169689Skan@itemx -mno-loop-unsigned 12888169689Skan@opindex mloop-unsigned 12889169689Skan@opindex mno-loop-unsigned 12890169689SkanThe maximum iteration count when using RPTS and RPTB (and DB on the C40) 12891169689Skanis @math{2^{31} + 1} since these instructions test if the iteration count is 12892169689Skannegative to terminate the loop. If the iteration count is unsigned 12893169689Skanthere is a possibility than the @math{2^{31} + 1} maximum iteration count may be 12894169689Skanexceeded. This switch allows an unsigned iteration count. 12895169689Skan 12896169689Skan@item -mti 12897169689Skan@opindex mti 12898169689SkanTry to emit an assembler syntax that the TI assembler (asm30) is happy 12899169689Skanwith. This also enforces compatibility with the API employed by the TI 12900169689SkanC3x C compiler. For example, long doubles are passed as structures 12901169689Skanrather than in floating point registers. 12902169689Skan 12903169689Skan@item -mregparm 12904169689Skan@itemx -mmemparm 12905169689Skan@opindex mregparm 12906169689Skan@opindex mmemparm 12907169689SkanGenerate code that uses registers (stack) for passing arguments to functions. 12908169689SkanBy default, arguments are passed in registers where possible rather 12909169689Skanthan by pushing arguments on to the stack. 12910169689Skan 12911169689Skan@item -mparallel-insns 12912169689Skan@itemx -mno-parallel-insns 12913169689Skan@opindex mparallel-insns 12914169689Skan@opindex mno-parallel-insns 12915169689SkanAllow the generation of parallel instructions. This is enabled by 12916169689Skandefault with @option{-O2}. 12917169689Skan 12918169689Skan@item -mparallel-mpy 12919169689Skan@itemx -mno-parallel-mpy 12920169689Skan@opindex mparallel-mpy 12921169689Skan@opindex mno-parallel-mpy 12922169689SkanAllow the generation of MPY||ADD and MPY||SUB parallel instructions, 12923169689Skanprovided @option{-mparallel-insns} is also specified. These instructions have 12924169689Skantight register constraints which can pessimize the code generation 12925169689Skanof large functions. 12926169689Skan 12927169689Skan@end table 12928169689Skan 12929169689Skan@node V850 Options 12930169689Skan@subsection V850 Options 12931169689Skan@cindex V850 Options 12932169689Skan 12933169689SkanThese @samp{-m} options are defined for V850 implementations: 12934169689Skan 12935169689Skan@table @gcctabopt 12936169689Skan@item -mlong-calls 12937169689Skan@itemx -mno-long-calls 12938169689Skan@opindex mlong-calls 12939169689Skan@opindex mno-long-calls 12940169689SkanTreat all calls as being far away (near). If calls are assumed to be 12941169689Skanfar away, the compiler will always load the functions address up into a 12942169689Skanregister, and call indirect through the pointer. 12943169689Skan 12944169689Skan@item -mno-ep 12945169689Skan@itemx -mep 12946169689Skan@opindex mno-ep 12947169689Skan@opindex mep 12948169689SkanDo not optimize (do optimize) basic blocks that use the same index 12949169689Skanpointer 4 or more times to copy pointer into the @code{ep} register, and 12950169689Skanuse the shorter @code{sld} and @code{sst} instructions. The @option{-mep} 12951169689Skanoption is on by default if you optimize. 12952169689Skan 12953169689Skan@item -mno-prolog-function 12954169689Skan@itemx -mprolog-function 12955169689Skan@opindex mno-prolog-function 12956169689Skan@opindex mprolog-function 12957169689SkanDo not use (do use) external functions to save and restore registers 12958169689Skanat the prologue and epilogue of a function. The external functions 12959169689Skanare slower, but use less code space if more than one function saves 12960169689Skanthe same number of registers. The @option{-mprolog-function} option 12961169689Skanis on by default if you optimize. 12962169689Skan 12963169689Skan@item -mspace 12964169689Skan@opindex mspace 12965169689SkanTry to make the code as small as possible. At present, this just turns 12966169689Skanon the @option{-mep} and @option{-mprolog-function} options. 12967169689Skan 12968169689Skan@item -mtda=@var{n} 12969169689Skan@opindex mtda 12970169689SkanPut static or global variables whose size is @var{n} bytes or less into 12971169689Skanthe tiny data area that register @code{ep} points to. The tiny data 12972169689Skanarea can hold up to 256 bytes in total (128 bytes for byte references). 12973169689Skan 12974169689Skan@item -msda=@var{n} 12975169689Skan@opindex msda 12976169689SkanPut static or global variables whose size is @var{n} bytes or less into 12977169689Skanthe small data area that register @code{gp} points to. The small data 12978169689Skanarea can hold up to 64 kilobytes. 12979169689Skan 12980169689Skan@item -mzda=@var{n} 12981169689Skan@opindex mzda 12982169689SkanPut static or global variables whose size is @var{n} bytes or less into 12983169689Skanthe first 32 kilobytes of memory. 12984169689Skan 12985169689Skan@item -mv850 12986169689Skan@opindex mv850 12987169689SkanSpecify that the target processor is the V850. 12988169689Skan 12989169689Skan@item -mbig-switch 12990169689Skan@opindex mbig-switch 12991169689SkanGenerate code suitable for big switch tables. Use this option only if 12992169689Skanthe assembler/linker complain about out of range branches within a switch 12993169689Skantable. 12994169689Skan 12995169689Skan@item -mapp-regs 12996169689Skan@opindex mapp-regs 12997169689SkanThis option will cause r2 and r5 to be used in the code generated by 12998169689Skanthe compiler. This setting is the default. 12999169689Skan 13000169689Skan@item -mno-app-regs 13001169689Skan@opindex mno-app-regs 13002169689SkanThis option will cause r2 and r5 to be treated as fixed registers. 13003169689Skan 13004169689Skan@item -mv850e1 13005169689Skan@opindex mv850e1 13006169689SkanSpecify that the target processor is the V850E1. The preprocessor 13007169689Skanconstants @samp{__v850e1__} and @samp{__v850e__} will be defined if 13008169689Skanthis option is used. 13009169689Skan 13010169689Skan@item -mv850e 13011169689Skan@opindex mv850e 13012169689SkanSpecify that the target processor is the V850E@. The preprocessor 13013169689Skanconstant @samp{__v850e__} will be defined if this option is used. 13014169689Skan 13015169689SkanIf neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1} 13016169689Skanare defined then a default target processor will be chosen and the 13017169689Skanrelevant @samp{__v850*__} preprocessor constant will be defined. 13018169689Skan 13019169689SkanThe preprocessor constants @samp{__v850} and @samp{__v851__} are always 13020169689Skandefined, regardless of which processor variant is the target. 13021169689Skan 13022169689Skan@item -mdisable-callt 13023169689Skan@opindex mdisable-callt 13024169689SkanThis option will suppress generation of the CALLT instruction for the 13025169689Skanv850e and v850e1 flavors of the v850 architecture. The default is 13026169689Skan@option{-mno-disable-callt} which allows the CALLT instruction to be used. 13027169689Skan 13028169689Skan@end table 13029169689Skan 13030169689Skan@node VAX Options 13031169689Skan@subsection VAX Options 13032169689Skan@cindex VAX options 13033169689Skan 13034169689SkanThese @samp{-m} options are defined for the VAX: 13035169689Skan 13036169689Skan@table @gcctabopt 13037169689Skan@item -munix 13038169689Skan@opindex munix 13039169689SkanDo not output certain jump instructions (@code{aobleq} and so on) 13040169689Skanthat the Unix assembler for the VAX cannot handle across long 13041169689Skanranges. 13042169689Skan 13043169689Skan@item -mgnu 13044169689Skan@opindex mgnu 13045169689SkanDo output those jump instructions, on the assumption that you 13046169689Skanwill assemble with the GNU assembler. 13047169689Skan 13048169689Skan@item -mg 13049169689Skan@opindex mg 13050169689SkanOutput code for g-format floating point numbers instead of d-format. 13051169689Skan@end table 13052169689Skan 13053169689Skan@node x86-64 Options 13054169689Skan@subsection x86-64 Options 13055169689Skan@cindex x86-64 options 13056169689Skan 13057169689SkanThese are listed under @xref{i386 and x86-64 Options}. 13058169689Skan 13059169689Skan@node Xstormy16 Options 13060169689Skan@subsection Xstormy16 Options 13061169689Skan@cindex Xstormy16 Options 13062169689Skan 13063169689SkanThese options are defined for Xstormy16: 13064169689Skan 13065169689Skan@table @gcctabopt 13066169689Skan@item -msim 13067169689Skan@opindex msim 13068169689SkanChoose startup files and linker script suitable for the simulator. 13069169689Skan@end table 13070169689Skan 1307190075Sobrien@node Xtensa Options 1307290075Sobrien@subsection Xtensa Options 1307390075Sobrien@cindex Xtensa Options 1307490075Sobrien 13075132718SkanThese options are supported for Xtensa targets: 1307690075Sobrien 1307790075Sobrien@table @gcctabopt 13078132718Skan@item -mconst16 13079132718Skan@itemx -mno-const16 13080132718Skan@opindex mconst16 13081132718Skan@opindex mno-const16 13082132718SkanEnable or disable use of @code{CONST16} instructions for loading 13083132718Skanconstant values. The @code{CONST16} instruction is currently not a 13084132718Skanstandard option from Tensilica. When enabled, @code{CONST16} 13085132718Skaninstructions are always used in place of the standard @code{L32R} 13086132718Skaninstructions. The use of @code{CONST16} is enabled by default only if 13087132718Skanthe @code{L32R} instruction is not available. 1308890075Sobrien 1308990075Sobrien@item -mfused-madd 1309090075Sobrien@itemx -mno-fused-madd 1309190075Sobrien@opindex mfused-madd 1309290075Sobrien@opindex mno-fused-madd 1309390075SobrienEnable or disable use of fused multiply/add and multiply/subtract 1309490075Sobrieninstructions in the floating-point option. This has no effect if the 1309590075Sobrienfloating-point option is not also enabled. Disabling fused multiply/add 1309690075Sobrienand multiply/subtract instructions forces the compiler to use separate 1309790075Sobrieninstructions for the multiply and add/subtract operations. This may be 1309890075Sobriendesirable in some cases where strict IEEE 754-compliant results are 1309990075Sobrienrequired: the fused multiply add/subtract instructions do not round the 1310090075Sobrienintermediate result, thereby producing results with @emph{more} bits of 1310190075Sobrienprecision than specified by the IEEE standard. Disabling fused multiply 1310290075Sobrienadd/subtract instructions also ensures that the program output is not 1310390075Sobriensensitive to the compiler's ability to combine multiply and add/subtract 1310490075Sobrienoperations. 1310590075Sobrien 1310690075Sobrien@item -mtext-section-literals 1310790075Sobrien@itemx -mno-text-section-literals 1310890075Sobrien@opindex mtext-section-literals 1310990075Sobrien@opindex mno-text-section-literals 1311090075SobrienControl the treatment of literal pools. The default is 1311190075Sobrien@option{-mno-text-section-literals}, which places literals in a separate 1311290075Sobriensection in the output file. This allows the literal pool to be placed 1311390075Sobrienin a data RAM/ROM, and it also allows the linker to combine literal 1311490075Sobrienpools from separate object files to remove redundant literals and 1311590075Sobrienimprove code size. With @option{-mtext-section-literals}, the literals 1311690075Sobrienare interspersed in the text section in order to keep them as close as 1311790075Sobrienpossible to their references. This may be necessary for large assembly 1311890075Sobrienfiles. 1311990075Sobrien 1312090075Sobrien@item -mtarget-align 1312190075Sobrien@itemx -mno-target-align 1312290075Sobrien@opindex mtarget-align 1312390075Sobrien@opindex mno-target-align 1312490075SobrienWhen this option is enabled, GCC instructs the assembler to 1312590075Sobrienautomatically align instructions to reduce branch penalties at the 1312690075Sobrienexpense of some code density. The assembler attempts to widen density 1312790075Sobrieninstructions to align branch targets and the instructions following call 1312890075Sobrieninstructions. If there are not enough preceding safe density 1312990075Sobrieninstructions to align a target, no widening will be performed. The 1313090075Sobriendefault is @option{-mtarget-align}. These options do not affect the 1313190075Sobrientreatment of auto-aligned instructions like @code{LOOP}, which the 1313290075Sobrienassembler will always align, either by widening density instructions or 1313390075Sobrienby inserting no-op instructions. 1313490075Sobrien 1313590075Sobrien@item -mlongcalls 1313690075Sobrien@itemx -mno-longcalls 1313790075Sobrien@opindex mlongcalls 1313890075Sobrien@opindex mno-longcalls 1313990075SobrienWhen this option is enabled, GCC instructs the assembler to translate 1314090075Sobriendirect calls to indirect calls unless it can determine that the target 1314190075Sobrienof a direct call is in the range allowed by the call instruction. This 1314290075Sobrientranslation typically occurs for calls to functions in other source 1314390075Sobrienfiles. Specifically, the assembler translates a direct @code{CALL} 1314490075Sobrieninstruction into an @code{L32R} followed by a @code{CALLX} instruction. 1314590075SobrienThe default is @option{-mno-longcalls}. This option should be used in 1314690075Sobrienprograms where the call target can potentially be out of range. This 1314790075Sobrienoption is implemented in the assembler, not the compiler, so the 1314890075Sobrienassembly code generated by GCC will still show direct call 1314990075Sobrieninstructions---look at the disassembled object code to see the actual 1315090075Sobrieninstructions. Note that the assembler will use an indirect call for 1315190075Sobrienevery cross-file call, not just those that really will be out of range. 1315290075Sobrien@end table 1315390075Sobrien 13154169689Skan@node zSeries Options 13155169689Skan@subsection zSeries Options 13156169689Skan@cindex zSeries options 13157169689Skan 13158169689SkanThese are listed under @xref{S/390 and zSeries Options}. 13159169689Skan 1316090075Sobrien@node Code Gen Options 1316190075Sobrien@section Options for Code Generation Conventions 1316290075Sobrien@cindex code generation conventions 1316390075Sobrien@cindex options, code generation 1316490075Sobrien@cindex run-time options 1316590075Sobrien 1316690075SobrienThese machine-independent options control the interface conventions 1316790075Sobrienused in code generation. 1316890075Sobrien 1316990075SobrienMost of them have both positive and negative forms; the negative form 1317090075Sobrienof @option{-ffoo} would be @option{-fno-foo}. In the table below, only 1317190075Sobrienone of the forms is listed---the one which is not the default. You 1317290075Sobriencan figure out the other form by either removing @samp{no-} or adding 1317390075Sobrienit. 1317490075Sobrien 1317590075Sobrien@table @gcctabopt 13176117395Skan@item -fbounds-check 13177117395Skan@opindex fbounds-check 13178117395SkanFor front-ends that support it, generate additional code to check that 13179117395Skanindices used to access arrays are within the declared range. This is 13180169689Skancurrently only supported by the Java and Fortran front-ends, where 13181117395Skanthis option defaults to true and false respectively. 13182117395Skan 13183117395Skan@item -ftrapv 13184117395Skan@opindex ftrapv 13185117395SkanThis option generates traps for signed overflow on addition, subtraction, 13186117395Skanmultiplication operations. 13187117395Skan 13188132718Skan@item -fwrapv 13189132718Skan@opindex fwrapv 13190132718SkanThis option instructs the compiler to assume that signed arithmetic 13191132718Skanoverflow of addition, subtraction and multiplication wraps around 13192132718Skanusing twos-complement representation. This flag enables some optimizations 13193169689Skanand disables others. This option is enabled by default for the Java 13194132718Skanfront-end, as required by the Java language specification. 13195132718Skan 1319690075Sobrien@item -fexceptions 1319790075Sobrien@opindex fexceptions 1319890075SobrienEnable exception handling. Generates extra code needed to propagate 1319990075Sobrienexceptions. For some targets, this implies GCC will generate frame 1320090075Sobrienunwind information for all functions, which can produce significant data 1320190075Sobriensize overhead, although it does not affect execution. If you do not 1320290075Sobrienspecify this option, GCC will enable it by default for languages like 1320390075SobrienC++ which normally require exception handling, and disable it for 1320490075Sobrienlanguages like C that do not normally require it. However, you may need 1320590075Sobriento enable this option when compiling C code that needs to interoperate 1320690075Sobrienproperly with exception handlers written in C++. You may also wish to 1320790075Sobriendisable this option if you are compiling older C++ programs that don't 1320890075Sobrienuse exception handling. 1320990075Sobrien 1321090075Sobrien@item -fnon-call-exceptions 1321190075Sobrien@opindex fnon-call-exceptions 1321290075SobrienGenerate code that allows trapping instructions to throw exceptions. 1321390075SobrienNote that this requires platform-specific runtime support that does 1321490075Sobriennot exist everywhere. Moreover, it only allows @emph{trapping} 1321590075Sobrieninstructions to throw exceptions, i.e.@: memory references or floating 1321690075Sobrienpoint instructions. It does not allow exceptions to be thrown from 1321790075Sobrienarbitrary signal handlers such as @code{SIGALRM}. 1321890075Sobrien 1321990075Sobrien@item -funwind-tables 1322090075Sobrien@opindex funwind-tables 1322190075SobrienSimilar to @option{-fexceptions}, except that it will just generate any needed 1322290075Sobrienstatic data, but will not affect the generated code in any other way. 1322390075SobrienYou will normally not enable this option; instead, a language processor 1322490075Sobrienthat needs this handling would enable it on your behalf. 1322590075Sobrien 1322690075Sobrien@item -fasynchronous-unwind-tables 13227169689Skan@opindex fasynchronous-unwind-tables 1322890075SobrienGenerate unwind table in dwarf2 format, if supported by target machine. The 1322990075Sobrientable is exact at each instruction boundary, so it can be used for stack 1323090075Sobrienunwinding from asynchronous events (such as debugger or garbage collector). 1323190075Sobrien 1323290075Sobrien@item -fpcc-struct-return 1323390075Sobrien@opindex fpcc-struct-return 1323490075SobrienReturn ``short'' @code{struct} and @code{union} values in memory like 1323590075Sobrienlonger ones, rather than in registers. This convention is less 1323690075Sobrienefficient, but it has the advantage of allowing intercallability between 13237103445SkanGCC-compiled files and files compiled with other compilers, particularly 13238103445Skanthe Portable C Compiler (pcc). 1323990075Sobrien 1324090075SobrienThe precise convention for returning structures in memory depends 1324190075Sobrienon the target configuration macros. 1324290075Sobrien 1324390075SobrienShort structures and unions are those whose size and alignment match 1324490075Sobrienthat of some integer type. 1324590075Sobrien 13246103445Skan@strong{Warning:} code compiled with the @option{-fpcc-struct-return} 13247103445Skanswitch is not binary compatible with code compiled with the 13248103445Skan@option{-freg-struct-return} switch. 13249103445SkanUse it to conform to a non-default application binary interface. 13250103445Skan 1325190075Sobrien@item -freg-struct-return 1325290075Sobrien@opindex freg-struct-return 1325390075SobrienReturn @code{struct} and @code{union} values in registers when possible. 1325490075SobrienThis is more efficient for small structures than 1325590075Sobrien@option{-fpcc-struct-return}. 1325690075Sobrien 1325790075SobrienIf you specify neither @option{-fpcc-struct-return} nor 1325890075Sobrien@option{-freg-struct-return}, GCC defaults to whichever convention is 1325990075Sobrienstandard for the target. If there is no standard convention, GCC 1326090075Sobriendefaults to @option{-fpcc-struct-return}, except on targets where GCC is 1326190075Sobrienthe principal compiler. In those cases, we can choose the standard, and 1326290075Sobrienwe chose the more efficient register return alternative. 1326390075Sobrien 13264103445Skan@strong{Warning:} code compiled with the @option{-freg-struct-return} 13265103445Skanswitch is not binary compatible with code compiled with the 13266103445Skan@option{-fpcc-struct-return} switch. 13267103445SkanUse it to conform to a non-default application binary interface. 13268103445Skan 1326990075Sobrien@item -fshort-enums 1327090075Sobrien@opindex fshort-enums 1327190075SobrienAllocate to an @code{enum} type only as many bytes as it needs for the 1327290075Sobriendeclared range of possible values. Specifically, the @code{enum} type 1327390075Sobrienwill be equivalent to the smallest integer type which has enough room. 1327490075Sobrien 13275103445Skan@strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate 13276103445Skancode that is not binary compatible with code generated without that switch. 13277103445SkanUse it to conform to a non-default application binary interface. 13278103445Skan 1327990075Sobrien@item -fshort-double 1328090075Sobrien@opindex fshort-double 1328190075SobrienUse the same size for @code{double} as for @code{float}. 1328290075Sobrien 13283103445Skan@strong{Warning:} the @option{-fshort-double} switch causes GCC to generate 13284103445Skancode that is not binary compatible with code generated without that switch. 13285103445SkanUse it to conform to a non-default application binary interface. 13286103445Skan 13287103445Skan@item -fshort-wchar 13288103445Skan@opindex fshort-wchar 13289103445SkanOverride the underlying type for @samp{wchar_t} to be @samp{short 13290103445Skanunsigned int} instead of the default for the target. This option is 13291103445Skanuseful for building programs to run under WINE@. 13292103445Skan 13293103445Skan@strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate 13294103445Skancode that is not binary compatible with code generated without that switch. 13295103445SkanUse it to conform to a non-default application binary interface. 13296103445Skan 1329790075Sobrien@item -fno-common 1329890075Sobrien@opindex fno-common 1329990075SobrienIn C, allocate even uninitialized global variables in the data section of the 1330090075Sobrienobject file, rather than generating them as common blocks. This has the 1330190075Sobrieneffect that if the same variable is declared (without @code{extern}) in 1330290075Sobrientwo different compilations, you will get an error when you link them. 1330390075SobrienThe only reason this might be useful is if you wish to verify that the 1330490075Sobrienprogram will work on other systems which always work this way. 1330590075Sobrien 1330690075Sobrien@item -fno-ident 1330790075Sobrien@opindex fno-ident 1330890075SobrienIgnore the @samp{#ident} directive. 1330990075Sobrien 1331090075Sobrien@item -finhibit-size-directive 1331190075Sobrien@opindex finhibit-size-directive 1331290075SobrienDon't output a @code{.size} assembler directive, or anything else that 1331390075Sobrienwould cause trouble if the function is split in the middle, and the 1331490075Sobrientwo halves are placed at locations far apart in memory. This option is 1331590075Sobrienused when compiling @file{crtstuff.c}; you should not need to use it 1331690075Sobrienfor anything else. 1331790075Sobrien 1331890075Sobrien@item -fverbose-asm 1331990075Sobrien@opindex fverbose-asm 1332090075SobrienPut extra commentary information in the generated assembly code to 1332190075Sobrienmake it more readable. This option is generally only of use to those 1332290075Sobrienwho actually need to read the generated assembly code (perhaps while 1332390075Sobriendebugging the compiler itself). 1332490075Sobrien 1332590075Sobrien@option{-fno-verbose-asm}, the default, causes the 1332690075Sobrienextra information to be omitted and is useful when comparing two assembler 1332790075Sobrienfiles. 1332890075Sobrien 1332990075Sobrien@item -fpic 1333090075Sobrien@opindex fpic 1333190075Sobrien@cindex global offset table 1333290075Sobrien@cindex PIC 1333390075SobrienGenerate position-independent code (PIC) suitable for use in a shared 1333490075Sobrienlibrary, if supported for the target machine. Such code accesses all 1333590075Sobrienconstant addresses through a global offset table (GOT)@. The dynamic 1333690075Sobrienloader resolves the GOT entries when the program starts (the dynamic 1333790075Sobrienloader is not part of GCC; it is part of the operating system). If 1333890075Sobrienthe GOT size for the linked executable exceeds a machine-specific 1333990075Sobrienmaximum size, you get an error message from the linker indicating that 1334090075Sobrien@option{-fpic} does not work; in that case, recompile with @option{-fPIC} 13341132718Skaninstead. (These maximums are 8k on the SPARC and 32k 1334290075Sobrienon the m68k and RS/6000. The 386 has no such limit.) 1334390075Sobrien 1334490075SobrienPosition-independent code requires special support, and therefore works 1334590075Sobrienonly on certain machines. For the 386, GCC supports PIC for System V 1334690075Sobrienbut not for the Sun 386i. Code generated for the IBM RS/6000 is always 1334790075Sobrienposition-independent. 1334890075Sobrien 13349169689SkanWhen this flag is set, the macros @code{__pic__} and @code{__PIC__} 13350169689Skanare defined to 1. 13351169689Skan 1335290075Sobrien@item -fPIC 1335390075Sobrien@opindex fPIC 1335490075SobrienIf supported for the target machine, emit position-independent code, 1335590075Sobriensuitable for dynamic linking and avoiding any limit on the size of the 13356169689Skanglobal offset table. This option makes a difference on the m68k, 13357169689SkanPowerPC and SPARC@. 1335890075Sobrien 1335990075SobrienPosition-independent code requires special support, and therefore works 1336090075Sobrienonly on certain machines. 1336190075Sobrien 13362169689SkanWhen this flag is set, the macros @code{__pic__} and @code{__PIC__} 13363169689Skanare defined to 2. 13364169689Skan 13365132718Skan@item -fpie 13366132718Skan@itemx -fPIE 13367132718Skan@opindex fpie 13368132718Skan@opindex fPIE 13369132718SkanThese options are similar to @option{-fpic} and @option{-fPIC}, but 13370132718Skangenerated position independent code can be only linked into executables. 13371132718SkanUsually these options are used when @option{-pie} GCC option will be 13372132718Skanused during linking. 13373132718Skan 13374169689Skan@item -fno-jump-tables 13375169689Skan@opindex fno-jump-tables 13376169689SkanDo not use jump tables for switch statements even where it would be 13377169689Skanmore efficient than other code generation strategies. This option is 13378169689Skanof use in conjunction with @option{-fpic} or @option{-fPIC} for 13379169689Skanbuilding code which forms part of a dynamic linker and cannot 13380169689Skanreference the address of a jump table. On some targets, jump tables 13381169689Skando not require a GOT and this option is not needed. 13382169689Skan 1338390075Sobrien@item -ffixed-@var{reg} 1338490075Sobrien@opindex ffixed 1338590075SobrienTreat the register named @var{reg} as a fixed register; generated code 1338690075Sobrienshould never refer to it (except perhaps as a stack pointer, frame 1338790075Sobrienpointer or in some other fixed role). 1338890075Sobrien 1338990075Sobrien@var{reg} must be the name of a register. The register names accepted 1339090075Sobrienare machine-specific and are defined in the @code{REGISTER_NAMES} 1339190075Sobrienmacro in the machine description macro file. 1339290075Sobrien 1339390075SobrienThis flag does not have a negative form, because it specifies a 1339490075Sobrienthree-way choice. 1339590075Sobrien 1339690075Sobrien@item -fcall-used-@var{reg} 1339790075Sobrien@opindex fcall-used 1339890075SobrienTreat the register named @var{reg} as an allocable register that is 1339990075Sobrienclobbered by function calls. It may be allocated for temporaries or 1340090075Sobrienvariables that do not live across a call. Functions compiled this way 1340190075Sobrienwill not save and restore the register @var{reg}. 1340290075Sobrien 1340390075SobrienIt is an error to used this flag with the frame pointer or stack pointer. 1340490075SobrienUse of this flag for other registers that have fixed pervasive roles in 1340590075Sobrienthe machine's execution model will produce disastrous results. 1340690075Sobrien 1340790075SobrienThis flag does not have a negative form, because it specifies a 1340890075Sobrienthree-way choice. 1340990075Sobrien 1341090075Sobrien@item -fcall-saved-@var{reg} 1341190075Sobrien@opindex fcall-saved 1341290075SobrienTreat the register named @var{reg} as an allocable register saved by 1341390075Sobrienfunctions. It may be allocated even for temporaries or variables that 1341490075Sobrienlive across a call. Functions compiled this way will save and restore 1341590075Sobrienthe register @var{reg} if they use it. 1341690075Sobrien 1341790075SobrienIt is an error to used this flag with the frame pointer or stack pointer. 1341890075SobrienUse of this flag for other registers that have fixed pervasive roles in 1341990075Sobrienthe machine's execution model will produce disastrous results. 1342090075Sobrien 1342190075SobrienA different sort of disaster will result from the use of this flag for 1342290075Sobriena register in which function values may be returned. 1342390075Sobrien 1342490075SobrienThis flag does not have a negative form, because it specifies a 1342590075Sobrienthree-way choice. 1342690075Sobrien 13427169689Skan@item -fpack-struct[=@var{n}] 1342890075Sobrien@opindex fpack-struct 13429169689SkanWithout a value specified, pack all structure members together without 13430169689Skanholes. When a value is specified (which must be a small power of two), pack 13431169689Skanstructure members according to this value, representing the maximum 13432169689Skanalignment (that is, objects with default alignment requirements larger than 13433169689Skanthis will be output potentially unaligned at the next fitting location. 1343490075Sobrien 13435103445Skan@strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate 13436103445Skancode that is not binary compatible with code generated without that switch. 13437117395SkanAdditionally, it makes the code suboptimal. 13438103445SkanUse it to conform to a non-default application binary interface. 13439103445Skan 1344090075Sobrien@item -finstrument-functions 1344190075Sobrien@opindex finstrument-functions 1344290075SobrienGenerate instrumentation calls for entry and exit to functions. Just 1344390075Sobrienafter function entry and just before function exit, the following 1344490075Sobrienprofiling functions will be called with the address of the current 1344590075Sobrienfunction and its call site. (On some platforms, 1344690075Sobrien@code{__builtin_return_address} does not work beyond the current 1344790075Sobrienfunction, so the call site information may not be available to the 1344890075Sobrienprofiling functions otherwise.) 1344990075Sobrien 13450132718Skan@smallexample 1345190075Sobrienvoid __cyg_profile_func_enter (void *this_fn, 1345290075Sobrien void *call_site); 1345390075Sobrienvoid __cyg_profile_func_exit (void *this_fn, 1345490075Sobrien void *call_site); 13455132718Skan@end smallexample 1345690075Sobrien 1345790075SobrienThe first argument is the address of the start of the current function, 1345890075Sobrienwhich may be looked up exactly in the symbol table. 1345990075Sobrien 13460169689SkanThis instrumentation is also done for functions expanded inline in other 13461169689Skanfunctions. The profiling calls will indicate where, conceptually, the 13462169689Skaninline function is entered and exited. This means that addressable 13463169689Skanversions of such functions must be available. If all your uses of a 13464169689Skanfunction are expanded inline, this may mean an additional expansion of 13465169689Skancode size. If you use @samp{extern inline} in your C code, an 13466169689Skanaddressable version of such functions must be provided. (This is 13467169689Skannormally the case anyways, but if you get lucky and the optimizer always 13468169689Skanexpands the functions inline, you might have gotten away without 13469169689Skanproviding static copies.) 1347090075Sobrien 1347190075SobrienA function may be given the attribute @code{no_instrument_function}, in 1347290075Sobrienwhich case this instrumentation will not be done. This can be used, for 1347390075Sobrienexample, for the profiling functions listed above, high-priority 1347490075Sobrieninterrupt routines, and any functions from which the profiling functions 1347590075Sobriencannot safely be called (perhaps signal handlers, if the profiling 1347690075Sobrienroutines generate output or allocate memory). 1347790075Sobrien 13478259405Spfg@item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} 13479259405Spfg@opindex finstrument-functions-exclude-file-list 13480259405Spfg 13481259405SpfgSet the list of functions that are excluded from instrumentation (see 13482259405Spfgthe description of @code{-finstrument-functions}). If the file that 13483259405Spfgcontains a function definition matches with one of @var{file}, then 13484259405Spfgthat function is not instrumented. The match is done on substrings: 13485259405Spfgif the @var{file} parameter is a substring of the file name, it is 13486259405Spfgconsidered to be a match. 13487259405Spfg 13488259405SpfgFor example, 13489259405Spfg@code{-finstrument-functions-exclude-file-list=/bits/stl,include/sys} 13490259405Spfgwill exclude any inline function defined in files whose pathnames 13491259405Spfgcontain @code{/bits/stl} or @code{include/sys}. 13492259405Spfg 13493259405SpfgIf, for some reason, you want to include letter @code{','} in one of 13494259405Spfg@var{sym}, write @code{'\,'}. For example, 13495259405Spfg@code{-finstrument-functions-exclude-file-list='\,\,tmp'} 13496259405Spfg(note the single quote surrounding the option). 13497259405Spfg 13498259405Spfg@item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} 13499259405Spfg@opindex finstrument-functions-exclude-function-list 13500259405Spfg 13501259405SpfgThis is similar to @code{-finstrument-functions-exclude-file-list}, 13502259405Spfgbut this option sets the list of function names to be excluded from 13503259405Spfginstrumentation. The function name to be matched is its user-visible 13504259405Spfgname, such as @code{vector<int> blah(const vector<int> &)}, not the 13505259405Spfginternal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The 13506259405Spfgmatch is done on substrings: if the @var{sym} parameter is a substring 13507259405Spfgof the function name, it is considered to be a match. 13508259405Spfg 1350990075Sobrien@item -fstack-check 1351090075Sobrien@opindex fstack-check 1351190075SobrienGenerate code to verify that you do not go beyond the boundary of the 1351290075Sobrienstack. You should specify this flag if you are running in an 1351390075Sobrienenvironment with multiple threads, but only rarely need to specify it in 1351490075Sobriena single-threaded environment since stack overflow is automatically 1351590075Sobriendetected on nearly all systems if there is only one stack. 1351690075Sobrien 1351790075SobrienNote that this switch does not actually cause checking to be done; the 1351890075Sobrienoperating system must do that. The switch causes generation of code 1351990075Sobriento ensure that the operating system sees the stack being extended. 1352090075Sobrien 1352190075Sobrien@item -fstack-limit-register=@var{reg} 1352290075Sobrien@itemx -fstack-limit-symbol=@var{sym} 1352390075Sobrien@itemx -fno-stack-limit 1352490075Sobrien@opindex fstack-limit-register 1352590075Sobrien@opindex fstack-limit-symbol 1352690075Sobrien@opindex fno-stack-limit 1352790075SobrienGenerate code to ensure that the stack does not grow beyond a certain value, 1352890075Sobrieneither the value of a register or the address of a symbol. If the stack 1352990075Sobrienwould grow beyond the value, a signal is raised. For most targets, 1353090075Sobrienthe signal is raised before the stack overruns the boundary, so 1353190075Sobrienit is possible to catch the signal without taking special precautions. 1353290075Sobrien 1353390075SobrienFor instance, if the stack starts at absolute address @samp{0x80000000} 1353490075Sobrienand grows downwards, you can use the flags 1353590075Sobrien@option{-fstack-limit-symbol=__stack_limit} and 1353690075Sobrien@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit 1353790075Sobrienof 128KB@. Note that this may only work with the GNU linker. 1353890075Sobrien 1353990075Sobrien@cindex aliasing of parameters 1354090075Sobrien@cindex parameters, aliased 1354190075Sobrien@item -fargument-alias 1354290075Sobrien@itemx -fargument-noalias 1354390075Sobrien@itemx -fargument-noalias-global 13544169689Skan@itemx -fargument-noalias-anything 1354590075Sobrien@opindex fargument-alias 1354690075Sobrien@opindex fargument-noalias 1354790075Sobrien@opindex fargument-noalias-global 13548169689Skan@opindex fargument-noalias-anything 1354990075SobrienSpecify the possible relationships among parameters and between 1355090075Sobrienparameters and global data. 1355190075Sobrien 1355290075Sobrien@option{-fargument-alias} specifies that arguments (parameters) may 1355390075Sobrienalias each other and may alias global storage.@* 1355490075Sobrien@option{-fargument-noalias} specifies that arguments do not alias 1355590075Sobrieneach other, but may alias global storage.@* 1355690075Sobrien@option{-fargument-noalias-global} specifies that arguments do not 1355790075Sobrienalias each other and do not alias global storage. 13558169689Skan@option{-fargument-noalias-anything} specifies that arguments do not 13559169689Skanalias any other storage. 1356090075Sobrien 1356190075SobrienEach language will automatically use whatever option is required by 1356290075Sobrienthe language standard. You should not need to use these options yourself. 1356390075Sobrien 1356490075Sobrien@item -fleading-underscore 1356590075Sobrien@opindex fleading-underscore 1356690075SobrienThis option and its counterpart, @option{-fno-leading-underscore}, forcibly 1356790075Sobrienchange the way C symbols are represented in the object file. One use 1356890075Sobrienis to help link with legacy assembly code. 1356990075Sobrien 13570103445Skan@strong{Warning:} the @option{-fleading-underscore} switch causes GCC to 13571103445Skangenerate code that is not binary compatible with code generated without that 13572103445Skanswitch. Use it to conform to a non-default application binary interface. 13573103445SkanNot all targets provide complete support for this switch. 13574117395Skan 13575117395Skan@item -ftls-model=@var{model} 13576117395SkanAlter the thread-local storage model to be used (@pxref{Thread-Local}). 13577117395SkanThe @var{model} argument should be one of @code{global-dynamic}, 13578117395Skan@code{local-dynamic}, @code{initial-exec} or @code{local-exec}. 13579117395Skan 13580117395SkanThe default without @option{-fpic} is @code{initial-exec}; with 13581117395Skan@option{-fpic} the default is @code{global-dynamic}. 13582169689Skan 13583169689Skan@item -fvisibility=@var{default|internal|hidden|protected} 13584169689Skan@opindex fvisibility 13585169689SkanSet the default ELF image symbol visibility to the specified option---all 13586169689Skansymbols will be marked with this unless overridden within the code. 13587169689SkanUsing this feature can very substantially improve linking and 13588169689Skanload times of shared object libraries, produce more optimized 13589169689Skancode, provide near-perfect API export and prevent symbol clashes. 13590169689SkanIt is @strong{strongly} recommended that you use this in any shared objects 13591169689Skanyou distribute. 13592169689Skan 13593169689SkanDespite the nomenclature, @code{default} always means public ie; 13594169689Skanavailable to be linked against from outside the shared object. 13595169689Skan@code{protected} and @code{internal} are pretty useless in real-world 13596169689Skanusage so the only other commonly used option will be @code{hidden}. 13597169689SkanThe default if @option{-fvisibility} isn't specified is 13598169689Skan@code{default}, i.e., make every 13599169689Skansymbol public---this causes the same behavior as previous versions of 13600169689SkanGCC@. 13601169689Skan 13602169689SkanA good explanation of the benefits offered by ensuring ELF 13603169689Skansymbols have the correct visibility is given by ``How To Write 13604169689SkanShared Libraries'' by Ulrich Drepper (which can be found at 13605169689Skan@w{@uref{http://people.redhat.com/~drepper/}})---however a superior 13606169689Skansolution made possible by this option to marking things hidden when 13607169689Skanthe default is public is to make the default hidden and mark things 13608169689Skanpublic. This is the norm with DLL's on Windows and with @option{-fvisibility=hidden} 13609169689Skanand @code{__attribute__ ((visibility("default")))} instead of 13610169689Skan@code{__declspec(dllexport)} you get almost identical semantics with 13611169689Skanidentical syntax. This is a great boon to those working with 13612169689Skancross-platform projects. 13613169689Skan 13614169689SkanFor those adding visibility support to existing code, you may find 13615169689Skan@samp{#pragma GCC visibility} of use. This works by you enclosing 13616169689Skanthe declarations you wish to set visibility for with (for example) 13617169689Skan@samp{#pragma GCC visibility push(hidden)} and 13618169689Skan@samp{#pragma GCC visibility pop}. 13619169689SkanBear in mind that symbol visibility should be viewed @strong{as 13620169689Skanpart of the API interface contract} and thus all new code should 13621169689Skanalways specify visibility when it is not the default ie; declarations 13622169689Skanonly for use within the local DSO should @strong{always} be marked explicitly 13623169689Skanas hidden as so to avoid PLT indirection overheads---making this 13624169689Skanabundantly clear also aids readability and self-documentation of the code. 13625169689SkanNote that due to ISO C++ specification requirements, operator new and 13626169689Skanoperator delete must always be of default visibility. 13627169689Skan 13628169689SkanBe aware that headers from outside your project, in particular system 13629169689Skanheaders and headers from any other library you use, may not be 13630169689Skanexpecting to be compiled with visibility other than the default. You 13631169689Skanmay need to explicitly say @samp{#pragma GCC visibility push(default)} 13632169689Skanbefore including any such headers. 13633169689Skan 13634169689Skan@samp{extern} declarations are not affected by @samp{-fvisibility}, so 13635169689Skana lot of code can be recompiled with @samp{-fvisibility=hidden} with 13636169689Skanno modifications. However, this means that calls to @samp{extern} 13637169689Skanfunctions with no explicit visibility will use the PLT, so it is more 13638169689Skaneffective to use @samp{__attribute ((visibility))} and/or 13639169689Skan@samp{#pragma GCC visibility} to tell the compiler which @samp{extern} 13640169689Skandeclarations should be treated as hidden. 13641169689Skan 13642169689SkanNote that @samp{-fvisibility} does affect C++ vague linkage 13643169689Skanentities. This means that, for instance, an exception class that will 13644169689Skanbe thrown between DSOs must be explicitly marked with default 13645169689Skanvisibility so that the @samp{type_info} nodes will be unified between 13646169689Skanthe DSOs. 13647169689Skan 13648169689SkanAn overview of these techniques, their benefits and how to use them 13649169689Skanis at @w{@uref{http://gcc.gnu.org/wiki/Visibility}}. 13650169689Skan 1365190075Sobrien@end table 1365290075Sobrien 1365390075Sobrien@c man end 1365490075Sobrien 1365590075Sobrien@node Environment Variables 1365690075Sobrien@section Environment Variables Affecting GCC 1365790075Sobrien@cindex environment variables 1365890075Sobrien 1365990075Sobrien@c man begin ENVIRONMENT 1366090075SobrienThis section describes several environment variables that affect how GCC 1366190075Sobrienoperates. Some of them work by specifying directories or prefixes to use 1366290075Sobrienwhen searching for various kinds of files. Some are used to specify other 1366390075Sobrienaspects of the compilation environment. 1366490075Sobrien 1366590075SobrienNote that you can also specify places to search using options such as 1366690075Sobrien@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These 1366790075Sobrientake precedence over places specified using environment variables, which 1366890075Sobrienin turn take precedence over those specified by the configuration of GCC@. 1366990075Sobrien@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint, 1367090075SobrienGNU Compiler Collection (GCC) Internals}. 1367190075Sobrien 1367290075Sobrien@table @env 1367390075Sobrien@item LANG 1367490075Sobrien@itemx LC_CTYPE 1367590075Sobrien@c @itemx LC_COLLATE 1367690075Sobrien@itemx LC_MESSAGES 1367790075Sobrien@c @itemx LC_MONETARY 1367890075Sobrien@c @itemx LC_NUMERIC 1367990075Sobrien@c @itemx LC_TIME 1368090075Sobrien@itemx LC_ALL 1368190075Sobrien@findex LANG 1368290075Sobrien@findex LC_CTYPE 1368390075Sobrien@c @findex LC_COLLATE 1368490075Sobrien@findex LC_MESSAGES 1368590075Sobrien@c @findex LC_MONETARY 1368690075Sobrien@c @findex LC_NUMERIC 1368790075Sobrien@c @findex LC_TIME 1368890075Sobrien@findex LC_ALL 1368990075Sobrien@cindex locale 1369090075SobrienThese environment variables control the way that GCC uses 1369190075Sobrienlocalization information that allow GCC to work with different 1369290075Sobriennational conventions. GCC inspects the locale categories 1369390075Sobrien@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do 1369490075Sobrienso. These locale categories can be set to any value supported by your 13695146895Skaninstallation. A typical value is @samp{en_GB.UTF-8} for English in the United 13696146895SkanKingdom encoded in UTF-8. 1369790075Sobrien 1369890075SobrienThe @env{LC_CTYPE} environment variable specifies character 1369990075Sobrienclassification. GCC uses it to determine the character boundaries in 1370090075Sobriena string; this is needed for some multibyte encodings that contain quote 1370190075Sobrienand escape characters that would otherwise be interpreted as a string 1370290075Sobrienend or escape. 1370390075Sobrien 1370490075SobrienThe @env{LC_MESSAGES} environment variable specifies the language to 1370590075Sobrienuse in diagnostic messages. 1370690075Sobrien 1370790075SobrienIf the @env{LC_ALL} environment variable is set, it overrides the value 1370890075Sobrienof @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE} 1370990075Sobrienand @env{LC_MESSAGES} default to the value of the @env{LANG} 1371090075Sobrienenvironment variable. If none of these variables are set, GCC 1371190075Sobriendefaults to traditional C English behavior. 1371290075Sobrien 1371390075Sobrien@item TMPDIR 1371490075Sobrien@findex TMPDIR 1371590075SobrienIf @env{TMPDIR} is set, it specifies the directory to use for temporary 1371690075Sobrienfiles. GCC uses temporary files to hold the output of one stage of 1371790075Sobriencompilation which is to be used as input to the next stage: for example, 1371890075Sobrienthe output of the preprocessor, which is the input to the compiler 1371990075Sobrienproper. 1372090075Sobrien 1372190075Sobrien@item GCC_EXEC_PREFIX 1372290075Sobrien@findex GCC_EXEC_PREFIX 1372390075SobrienIf @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the 1372490075Sobriennames of the subprograms executed by the compiler. No slash is added 1372590075Sobrienwhen this prefix is combined with the name of a subprogram, but you can 1372690075Sobrienspecify a prefix that ends with a slash if you wish. 1372790075Sobrien 1372890075SobrienIf @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out 1372990075Sobrienan appropriate prefix to use based on the pathname it was invoked with. 1373090075Sobrien 1373190075SobrienIf GCC cannot find the subprogram using the specified prefix, it 1373290075Sobrientries looking in the usual places for the subprogram. 1373390075Sobrien 1373490075SobrienThe default value of @env{GCC_EXEC_PREFIX} is 13735132718Skan@file{@var{prefix}/lib/gcc/} where @var{prefix} is the value 1373690075Sobrienof @code{prefix} when you ran the @file{configure} script. 1373790075Sobrien 1373890075SobrienOther prefixes specified with @option{-B} take precedence over this prefix. 1373990075Sobrien 1374090075SobrienThis prefix is also used for finding files such as @file{crt0.o} that are 1374190075Sobrienused for linking. 1374290075Sobrien 1374390075SobrienIn addition, the prefix is used in an unusual way in finding the 1374490075Sobriendirectories to search for header files. For each of the standard 13745132718Skandirectories whose name normally begins with @samp{/usr/local/lib/gcc} 1374690075Sobrien(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries 1374790075Sobrienreplacing that beginning with the specified prefix to produce an 1374890075Sobrienalternate directory name. Thus, with @option{-Bfoo/}, GCC will search 1374990075Sobrien@file{foo/bar} where it would normally search @file{/usr/local/lib/bar}. 1375090075SobrienThese alternate directories are searched first; the standard directories 1375190075Sobriencome next. 1375290075Sobrien 1375390075Sobrien@item COMPILER_PATH 1375490075Sobrien@findex COMPILER_PATH 1375590075SobrienThe value of @env{COMPILER_PATH} is a colon-separated list of 1375690075Sobriendirectories, much like @env{PATH}. GCC tries the directories thus 1375790075Sobrienspecified when searching for subprograms, if it can't find the 1375890075Sobriensubprograms using @env{GCC_EXEC_PREFIX}. 1375990075Sobrien 1376090075Sobrien@item LIBRARY_PATH 1376190075Sobrien@findex LIBRARY_PATH 1376290075SobrienThe value of @env{LIBRARY_PATH} is a colon-separated list of 1376390075Sobriendirectories, much like @env{PATH}. When configured as a native compiler, 1376490075SobrienGCC tries the directories thus specified when searching for special 1376590075Sobrienlinker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking 1376690075Sobrienusing GCC also uses these directories when searching for ordinary 1376790075Sobrienlibraries for the @option{-l} option (but directories specified with 1376890075Sobrien@option{-L} come first). 1376990075Sobrien 1377090075Sobrien@item LANG 1377190075Sobrien@findex LANG 1377290075Sobrien@cindex locale definition 1377390075SobrienThis variable is used to pass locale information to the compiler. One way in 1377490075Sobrienwhich this information is used is to determine the character set to be used 1377590075Sobrienwhen character literals, string literals and comments are parsed in C and C++. 1377690075SobrienWhen the compiler is configured to allow multibyte characters, 1377790075Sobrienthe following values for @env{LANG} are recognized: 1377890075Sobrien 1377990075Sobrien@table @samp 1378090075Sobrien@item C-JIS 1378190075SobrienRecognize JIS characters. 1378290075Sobrien@item C-SJIS 1378390075SobrienRecognize SJIS characters. 1378490075Sobrien@item C-EUCJP 1378590075SobrienRecognize EUCJP characters. 1378690075Sobrien@end table 1378790075Sobrien 1378890075SobrienIf @env{LANG} is not defined, or if it has some other value, then the 1378990075Sobriencompiler will use mblen and mbtowc as defined by the default locale to 1379090075Sobrienrecognize and translate multibyte characters. 1379190075Sobrien@end table 1379290075Sobrien 1379396263Sobrien@noindent 1379496263SobrienSome additional environments variables affect the behavior of the 1379596263Sobrienpreprocessor. 1379696263Sobrien 1379796263Sobrien@include cppenv.texi 1379896263Sobrien 1379990075Sobrien@c man end 1380090075Sobrien 13801132718Skan@node Precompiled Headers 13802132718Skan@section Using Precompiled Headers 13803132718Skan@cindex precompiled headers 13804132718Skan@cindex speed of compilation 13805132718Skan 13806132718SkanOften large projects have many header files that are included in every 13807132718Skansource file. The time the compiler takes to process these header files 13808132718Skanover and over again can account for nearly all of the time required to 13809132718Skanbuild the project. To make builds faster, GCC allows users to 13810132718Skan`precompile' a header file; then, if builds can use the precompiled 13811132718Skanheader file they will be much faster. 13812132718Skan 13813132718SkanTo create a precompiled header file, simply compile it as you would any 13814132718Skanother file, if necessary using the @option{-x} option to make the driver 13815132718Skantreat it as a C or C++ header file. You will probably want to use a 13816132718Skantool like @command{make} to keep the precompiled header up-to-date when 13817132718Skanthe headers it contains change. 13818132718Skan 13819132718SkanA precompiled header file will be searched for when @code{#include} is 13820132718Skanseen in the compilation. As it searches for the included file 13821132718Skan(@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the 13822132718Skancompiler looks for a precompiled header in each directory just before it 13823132718Skanlooks for the include file in that directory. The name searched for is 13824132718Skanthe name specified in the @code{#include} with @samp{.gch} appended. If 13825132718Skanthe precompiled header file can't be used, it is ignored. 13826132718Skan 13827132718SkanFor instance, if you have @code{#include "all.h"}, and you have 13828132718Skan@file{all.h.gch} in the same directory as @file{all.h}, then the 13829132718Skanprecompiled header file will be used if possible, and the original 13830132718Skanheader will be used otherwise. 13831132718Skan 13832132718SkanAlternatively, you might decide to put the precompiled header file in a 13833132718Skandirectory and use @option{-I} to ensure that directory is searched 13834132718Skanbefore (or instead of) the directory containing the original header. 13835132718SkanThen, if you want to check that the precompiled header file is always 13836132718Skanused, you can put a file of the same name as the original header in this 13837132718Skandirectory containing an @code{#error} command. 13838132718Skan 13839132718SkanThis also works with @option{-include}. So yet another way to use 13840132718Skanprecompiled headers, good for projects not designed with precompiled 13841132718Skanheader files in mind, is to simply take most of the header files used by 13842132718Skana project, include them from another header file, precompile that header 13843132718Skanfile, and @option{-include} the precompiled header. If the header files 13844132718Skanhave guards against multiple inclusion, they will be skipped because 13845132718Skanthey've already been included (in the precompiled header). 13846132718Skan 13847132718SkanIf you need to precompile the same header file for different 13848132718Skanlanguages, targets, or compiler options, you can instead make a 13849132718Skan@emph{directory} named like @file{all.h.gch}, and put each precompiled 13850169689Skanheader in the directory, perhaps using @option{-o}. It doesn't matter 13851169689Skanwhat you call the files in the directory, every precompiled header in 13852169689Skanthe directory will be considered. The first precompiled header 13853169689Skanencountered in the directory that is valid for this compilation will 13854169689Skanbe used; they're searched in no particular order. 13855132718Skan 13856132718SkanThere are many other possibilities, limited only by your imagination, 13857132718Skangood sense, and the constraints of your build system. 13858132718Skan 13859132718SkanA precompiled header file can be used only when these conditions apply: 13860132718Skan 13861132718Skan@itemize 13862132718Skan@item 13863132718SkanOnly one precompiled header can be used in a particular compilation. 13864169689Skan 13865132718Skan@item 13866132718SkanA precompiled header can't be used once the first C token is seen. You 13867132718Skancan have preprocessor directives before a precompiled header; you can 13868132718Skaneven include a precompiled header from inside another header, so long as 13869132718Skanthere are no C tokens before the @code{#include}. 13870169689Skan 13871132718Skan@item 13872132718SkanThe precompiled header file must be produced for the same language as 13873132718Skanthe current compilation. You can't use a C precompiled header for a C++ 13874132718Skancompilation. 13875169689Skan 13876132718Skan@item 13877169689SkanThe precompiled header file must have been produced by the same compiler 13878169689Skanbinary as the current compilation is using. 13879169689Skan 13880132718Skan@item 13881169689SkanAny macros defined before the precompiled header is included must 13882169689Skaneither be defined in the same way as when the precompiled header was 13883169689Skangenerated, or must not affect the precompiled header, which usually 13884169689Skanmeans that they don't appear in the precompiled header at all. 13885169689Skan 13886169689SkanThe @option{-D} option is one way to define a macro before a 13887169689Skanprecompiled header is included; using a @code{#define} can also do it. 13888169689SkanThere are also some options that define macros implicitly, like 13889169689Skan@option{-O} and @option{-Wdeprecated}; the same rule applies to macros 13890169689Skandefined this way. 13891169689Skan 13892169689Skan@item If debugging information is output when using the precompiled 13893169689Skanheader, using @option{-g} or similar, the same kind of debugging information 13894169689Skanmust have been output when building the precompiled header. However, 13895169689Skana precompiled header built using @option{-g} can be used in a compilation 13896169689Skanwhen no debugging information is being output. 13897169689Skan 13898169689Skan@item The same @option{-m} options must generally be used when building 13899169689Skanand using the precompiled header. @xref{Submodel Options}, 13900169689Skanfor any cases where this rule is relaxed. 13901169689Skan 13902169689Skan@item Each of the following options must be the same when building and using 13903169689Skanthe precompiled header: 13904169689Skan 13905169689Skan@gccoptlist{-fexceptions -funit-at-a-time} 13906169689Skan 13907132718Skan@item 13908169689SkanSome other command-line options starting with @option{-f}, 13909169689Skan@option{-p}, or @option{-O} must be defined in the same way as when 13910169689Skanthe precompiled header was generated. At present, it's not clear 13911169689Skanwhich options are safe to change and which are not; the safest choice 13912169689Skanis to use exactly the same options when generating and using the 13913169689Skanprecompiled header. The following are known to be safe: 13914169689Skan 13915169689Skan@gccoptlist{-fmessage-length= -fpreprocessed 13916169689Skan-fsched-interblock -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous 13917169689Skan-fsched-verbose=<number> -fschedule-insns -fvisibility= 13918169689Skan-pedantic-errors} 13919169689Skan 13920132718Skan@end itemize 13921132718Skan 13922169689SkanFor all of these except the last, the compiler will automatically 13923169689Skanignore the precompiled header if the conditions aren't met. If you 13924169689Skanfind an option combination that doesn't work and doesn't cause the 13925169689Skanprecompiled header to be ignored, please consider filing a bug report, 13926169689Skansee @ref{Bugs}. 13927132718Skan 13928169689SkanIf you do use differing options when generating and using the 13929169689Skanprecompiled header, the actual behavior will be a mixture of the 13930169689Skanbehavior for the options. For instance, if you use @option{-g} to 13931169689Skangenerate the precompiled header but not when using it, you may or may 13932169689Skannot get debugging information for routines in the precompiled header. 13933169689Skan 1393490075Sobrien@node Running Protoize 1393590075Sobrien@section Running Protoize 1393690075Sobrien 1393790075SobrienThe program @code{protoize} is an optional part of GCC@. You can use 1393890075Sobrienit to add prototypes to a program, thus converting the program to ISO 1393990075SobrienC in one respect. The companion program @code{unprotoize} does the 1394090075Sobrienreverse: it removes argument types from any prototypes that are found. 1394190075Sobrien 1394290075SobrienWhen you run these programs, you must specify a set of source files as 1394390075Sobriencommand line arguments. The conversion programs start out by compiling 1394490075Sobrienthese files to see what functions they define. The information gathered 1394590075Sobrienabout a file @var{foo} is saved in a file named @file{@var{foo}.X}. 1394690075Sobrien 1394790075SobrienAfter scanning comes actual conversion. The specified files are all 1394890075Sobrieneligible to be converted; any files they include (whether sources or 1394990075Sobrienjust headers) are eligible as well. 1395090075Sobrien 1395190075SobrienBut not all the eligible files are converted. By default, 1395290075Sobrien@code{protoize} and @code{unprotoize} convert only source and header 1395390075Sobrienfiles in the current directory. You can specify additional directories 1395490075Sobrienwhose files should be converted with the @option{-d @var{directory}} 1395590075Sobrienoption. You can also specify particular files to exclude with the 1395690075Sobrien@option{-x @var{file}} option. A file is converted if it is eligible, its 1395790075Sobriendirectory name matches one of the specified directory names, and its 1395890075Sobrienname within the directory has not been excluded. 1395990075Sobrien 1396090075SobrienBasic conversion with @code{protoize} consists of rewriting most 1396190075Sobrienfunction definitions and function declarations to specify the types of 1396290075Sobrienthe arguments. The only ones not rewritten are those for varargs 1396390075Sobrienfunctions. 1396490075Sobrien 1396590075Sobrien@code{protoize} optionally inserts prototype declarations at the 1396690075Sobrienbeginning of the source file, to make them available for any calls that 1396790075Sobrienprecede the function's definition. Or it can insert prototype 1396890075Sobriendeclarations with block scope in the blocks where undeclared functions 1396990075Sobrienare called. 1397090075Sobrien 1397190075SobrienBasic conversion with @code{unprotoize} consists of rewriting most 1397290075Sobrienfunction declarations to remove any argument types, and rewriting 1397390075Sobrienfunction definitions to the old-style pre-ISO form. 1397490075Sobrien 1397590075SobrienBoth conversion programs print a warning for any function declaration or 1397690075Sobriendefinition that they can't convert. You can suppress these warnings 1397790075Sobrienwith @option{-q}. 1397890075Sobrien 1397990075SobrienThe output from @code{protoize} or @code{unprotoize} replaces the 1398090075Sobrienoriginal source file. The original file is renamed to a name ending 1398190075Sobrienwith @samp{.save} (for DOS, the saved filename ends in @samp{.sav} 1398290075Sobrienwithout the original @samp{.c} suffix). If the @samp{.save} (@samp{.sav} 1398390075Sobrienfor DOS) file already exists, then the source file is simply discarded. 1398490075Sobrien 1398590075Sobrien@code{protoize} and @code{unprotoize} both depend on GCC itself to 1398690075Sobrienscan the program and collect information about the functions it uses. 1398790075SobrienSo neither of these programs will work until GCC is installed. 1398890075Sobrien 1398990075SobrienHere is a table of the options you can use with @code{protoize} and 1399090075Sobrien@code{unprotoize}. Each option works with both programs unless 1399190075Sobrienotherwise stated. 1399290075Sobrien 1399390075Sobrien@table @code 1399490075Sobrien@item -B @var{directory} 1399590075SobrienLook for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the 1399690075Sobrienusual directory (normally @file{/usr/local/lib}). This file contains 1399790075Sobrienprototype information about standard system functions. This option 1399890075Sobrienapplies only to @code{protoize}. 1399990075Sobrien 1400090075Sobrien@item -c @var{compilation-options} 14001117395SkanUse @var{compilation-options} as the options when running @command{gcc} to 1400290075Sobrienproduce the @samp{.X} files. The special option @option{-aux-info} is 14003117395Skanalways passed in addition, to tell @command{gcc} to write a @samp{.X} file. 1400490075Sobrien 1400590075SobrienNote that the compilation options must be given as a single argument to 1400690075Sobrien@code{protoize} or @code{unprotoize}. If you want to specify several 14007117395Skan@command{gcc} options, you must quote the entire set of compilation options 1400890075Sobriento make them a single word in the shell. 1400990075Sobrien 14010117395SkanThere are certain @command{gcc} arguments that you cannot use, because they 1401190075Sobrienwould produce the wrong kind of output. These include @option{-g}, 1401290075Sobrien@option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in 1401390075Sobrienthe @var{compilation-options}, they are ignored. 1401490075Sobrien 1401590075Sobrien@item -C 1401690075SobrienRename files to end in @samp{.C} (@samp{.cc} for DOS-based file 1401790075Sobriensystems) instead of @samp{.c}. This is convenient if you are converting 1401890075Sobriena C program to C++. This option applies only to @code{protoize}. 1401990075Sobrien 1402090075Sobrien@item -g 1402190075SobrienAdd explicit global declarations. This means inserting explicit 1402290075Sobriendeclarations at the beginning of each source file for each function 1402390075Sobrienthat is called in the file and was not declared. These declarations 1402490075Sobrienprecede the first function definition that contains a call to an 1402590075Sobrienundeclared function. This option applies only to @code{protoize}. 1402690075Sobrien 1402790075Sobrien@item -i @var{string} 1402890075SobrienIndent old-style parameter declarations with the string @var{string}. 1402990075SobrienThis option applies only to @code{protoize}. 1403090075Sobrien 1403190075Sobrien@code{unprotoize} converts prototyped function definitions to old-style 1403290075Sobrienfunction definitions, where the arguments are declared between the 1403390075Sobrienargument list and the initial @samp{@{}. By default, @code{unprotoize} 1403490075Sobrienuses five spaces as the indentation. If you want to indent with just 1403590075Sobrienone space instead, use @option{-i " "}. 1403690075Sobrien 1403790075Sobrien@item -k 1403890075SobrienKeep the @samp{.X} files. Normally, they are deleted after conversion 1403990075Sobrienis finished. 1404090075Sobrien 1404190075Sobrien@item -l 1404290075SobrienAdd explicit local declarations. @code{protoize} with @option{-l} inserts 1404390075Sobriena prototype declaration for each function in each block which calls the 1404490075Sobrienfunction without any declaration. This option applies only to 1404590075Sobrien@code{protoize}. 1404690075Sobrien 1404790075Sobrien@item -n 1404890075SobrienMake no real changes. This mode just prints information about the conversions 1404990075Sobrienthat would have been done without @option{-n}. 1405090075Sobrien 1405190075Sobrien@item -N 1405290075SobrienMake no @samp{.save} files. The original files are simply deleted. 1405390075SobrienUse this option with caution. 1405490075Sobrien 1405590075Sobrien@item -p @var{program} 1405690075SobrienUse the program @var{program} as the compiler. Normally, the name 1405790075Sobrien@file{gcc} is used. 1405890075Sobrien 1405990075Sobrien@item -q 1406090075SobrienWork quietly. Most warnings are suppressed. 1406190075Sobrien 1406290075Sobrien@item -v 14063117395SkanPrint the version number, just like @option{-v} for @command{gcc}. 1406490075Sobrien@end table 1406590075Sobrien 1406690075SobrienIf you need special compiler options to compile one of your program's 1406790075Sobriensource files, then you should generate that file's @samp{.X} file 14068117395Skanspecially, by running @command{gcc} on that source file with the 1406990075Sobrienappropriate options and the option @option{-aux-info}. Then run 1407090075Sobrien@code{protoize} on the entire set of files. @code{protoize} will use 1407190075Sobrienthe existing @samp{.X} file because it is newer than the source file. 1407290075SobrienFor example: 1407390075Sobrien 14074132718Skan@smallexample 1407590075Sobriengcc -Dfoo=bar file1.c -aux-info file1.X 1407690075Sobrienprotoize *.c 14077132718Skan@end smallexample 1407890075Sobrien 1407990075Sobrien@noindent 1408090075SobrienYou need to include the special files along with the rest in the 1408190075Sobrien@code{protoize} command, even though their @samp{.X} files already 1408290075Sobrienexist, because otherwise they won't get converted. 1408390075Sobrien 1408490075Sobrien@xref{Protoize Caveats}, for more information on how to use 1408590075Sobrien@code{protoize} successfully. 14086259405Spfg 14087