invoke.texi revision 119256
1@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2@c 2000, 2001, 2002, 2003 Free Software Foundation, Inc. 3@c This is part of the GCC manual. 4@c For copying conditions, see the file gcc.texi. 5 6@ignore 7@c man begin COPYRIGHT 8Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 91998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. 10 11Permission is granted to copy, distribute and/or modify this document 12under the terms of the GNU Free Documentation License, Version 1.2 or 13any later version published by the Free Software Foundation; with the 14Invariant Sections being ``GNU General Public License'' and ``Funding 15Free Software'', the Front-Cover texts being (a) (see below), and with 16the Back-Cover Texts being (b) (see below). A copy of the license is 17included in the gfdl(7) man page. 18 19(a) The FSF's Front-Cover Text is: 20 21 A GNU Manual 22 23(b) The FSF's Back-Cover Text is: 24 25 You have freedom to copy and modify this GNU Manual, like GNU 26 software. Copies published by the Free Software Foundation raise 27 funds for GNU development. 28@c man end 29@c Set file name and title for the man page. 30@setfilename gcc 31@settitle GNU project C and C++ compiler 32@c man begin SYNOPSIS 33gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}] 34 [@option{-g}] [@option{-pg}] [@option{-O}@var{level}] 35 [@option{-W}@var{warn}@dots{}] [@option{-pedantic}] 36 [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}] 37 [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}] 38 [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}] 39 [@option{-o} @var{outfile}] @var{infile}@dots{} 40 41Only the most useful options are listed here; see below for the 42remainder. @samp{g++} accepts mostly the same options as @samp{gcc}. 43@c man end 44@c man begin SEEALSO 45gpl(7), gfdl(7), fsf-funding(7), 46cpp(1), gcov(1), g77(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1) 47and the Info entries for @file{gcc}, @file{cpp}, @file{g77}, @file{as}, 48@file{ld}, @file{binutils} and @file{gdb}. 49@c man end 50@c man begin BUGS 51For instructions on reporting bugs, see 52@w{@uref{http://gcc.gnu.org/bugs.html}}. Use of the @command{gccbug} 53script to report bugs is recommended. 54@c man end 55@c man begin AUTHOR 56See the Info entry for @command{gcc}, or 57@w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}}, 58for contributors to GCC@. 59@c man end 60@end ignore 61 62@node Invoking GCC 63@chapter GCC Command Options 64@cindex GCC command options 65@cindex command options 66@cindex options, GCC command 67 68@c man begin DESCRIPTION 69When you invoke GCC, it normally does preprocessing, compilation, 70assembly and linking. The ``overall options'' allow you to stop this 71process at an intermediate stage. For example, the @option{-c} option 72says not to run the linker. Then the output consists of object files 73output by the assembler. 74 75Other options are passed on to one stage of processing. Some options 76control the preprocessor and others the compiler itself. Yet other 77options control the assembler and linker; most of these are not 78documented here, since you rarely need to use any of them. 79 80@cindex C compilation options 81Most of the command line options that you can use with GCC are useful 82for C programs; when an option is only useful with another language 83(usually C++), the explanation says so explicitly. If the description 84for a particular option does not mention a source language, you can use 85that option with all supported languages. 86 87@cindex C++ compilation options 88@xref{Invoking G++,,Compiling C++ Programs}, for a summary of special 89options for compiling C++ programs. 90 91@cindex grouping options 92@cindex options, grouping 93The @command{gcc} program accepts options and file names as operands. Many 94options have multi-letter names; therefore multiple single-letter options 95may @emph{not} be grouped: @option{-dr} is very different from @w{@samp{-d 96-r}}. 97 98@cindex order of options 99@cindex options, order 100You can mix options and other arguments. For the most part, the order 101you use doesn't matter. Order does matter when you use several options 102of the same kind; for example, if you specify @option{-L} more than once, 103the directories are searched in the order specified. 104 105Many options have long names starting with @samp{-f} or with 106@samp{-W}---for example, @option{-fforce-mem}, 107@option{-fstrength-reduce}, @option{-Wformat} and so on. Most of 108these have both positive and negative forms; the negative form of 109@option{-ffoo} would be @option{-fno-foo}. This manual documents 110only one of these two forms, whichever one is not the default. 111 112@c man end 113 114@xref{Option Index}, for an index to GCC's options. 115 116@menu 117* Option Summary:: Brief list of all options, without explanations. 118* Overall Options:: Controlling the kind of output: 119 an executable, object files, assembler files, 120 or preprocessed source. 121* Invoking G++:: Compiling C++ programs. 122* C Dialect Options:: Controlling the variant of C language compiled. 123* C++ Dialect Options:: Variations on C++. 124* Objective-C Dialect Options:: Variations on Objective-C. 125* Language Independent Options:: Controlling how diagnostics should be 126 formatted. 127* Warning Options:: How picky should the compiler be? 128* Debugging Options:: Symbol tables, measurements, and debugging dumps. 129* Optimize Options:: How much optimization? 130* Preprocessor Options:: Controlling header files and macro definitions. 131 Also, getting dependency information for Make. 132* Assembler Options:: Passing options to the assembler. 133* Link Options:: Specifying libraries and so on. 134* Directory Options:: Where to find header files and libraries. 135 Where to find the compiler executable files. 136* Spec Files:: How to pass switches to sub-processes. 137* Target Options:: Running a cross-compiler, or an old version of GCC. 138* Submodel Options:: Specifying minor hardware or convention variations, 139 such as 68010 vs 68020. 140* Code Gen Options:: Specifying conventions for function calls, data layout 141 and register usage. 142* Environment Variables:: Env vars that affect GCC. 143* Running Protoize:: Automatically adding or removing function prototypes. 144@end menu 145 146@c man begin OPTIONS 147 148@node Option Summary 149@section Option Summary 150 151Here is a summary of all the options, grouped by type. Explanations are 152in the following sections. 153 154@table @emph 155@item Overall Options 156@xref{Overall Options,,Options Controlling the Kind of Output}. 157@gccoptlist{-c -S -E -o @var{file} -pipe -pass-exit-codes @gol 158-x @var{language} -v -### --help --target-help --version} 159 160@item C Language Options 161@xref{C Dialect Options,,Options Controlling C Dialect}. 162@gccoptlist{-ansi -std=@var{standard} -aux-info @var{filename} @gol 163-fno-asm -fno-builtin -fno-builtin-@var{function} @gol 164-fhosted -ffreestanding -fms-extensions @gol 165-trigraphs -no-integrated-cpp -traditional -traditional-cpp @gol 166-fallow-single-precision -fcond-mismatch @gol 167-fsigned-bitfields -fsigned-char @gol 168-funsigned-bitfields -funsigned-char @gol 169-fwritable-strings} 170 171@item C++ Language Options 172@xref{C++ Dialect Options,,Options Controlling C++ Dialect}. 173@gccoptlist{-fabi-version=@var{n} -fno-access-control -fcheck-new @gol 174-fconserve-space -fno-const-strings -fdollars-in-identifiers @gol 175-fno-elide-constructors @gol 176-fno-enforce-eh-specs -fexternal-templates @gol 177-falt-external-templates @gol 178-ffor-scope -fno-for-scope -fno-gnu-keywords @gol 179-fno-implicit-templates @gol 180-fno-implicit-inline-templates @gol 181-fno-implement-inlines -fms-extensions @gol 182-fno-nonansi-builtins -fno-operator-names @gol 183-fno-optional-diags -fpermissive @gol 184-frepo -fno-rtti -fstats -ftemplate-depth-@var{n} @gol 185-fuse-cxa-atexit -fvtable-gc -fno-weak -nostdinc++ @gol 186-fno-default-inline -Wabi -Wctor-dtor-privacy @gol 187-Wnon-virtual-dtor -Wreorder @gol 188-Weffc++ -Wno-deprecated @gol 189-Wno-non-template-friend -Wold-style-cast @gol 190-Woverloaded-virtual -Wno-pmf-conversions @gol 191-Wsign-promo -Wsynth} 192 193@item Objective-C Language Options 194@xref{Objective-C Dialect Options,,Options Controlling Objective-C Dialect}. 195@gccoptlist{-fconstant-string-class=@var{class-name} @gol 196-fgnu-runtime -fnext-runtime -gen-decls @gol 197-Wno-protocol -Wselector -Wundeclared-selector} 198 199@item Language Independent Options 200@xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}. 201@gccoptlist{-fmessage-length=@var{n} @gol 202-fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}} 203 204@item Warning Options 205@xref{Warning Options,,Options to Request or Suppress Warnings}. 206@gccoptlist{-fsyntax-only -pedantic -pedantic-errors @gol 207-w -W -Wall -Waggregate-return @gol 208-Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment @gol 209-Wconversion -Wno-deprecated-declarations @gol 210-Wdisabled-optimization -Wno-div-by-zero -Werror @gol 211-Wfloat-equal -Wformat -Wformat=2 @gol 212-Wformat-nonliteral -Wformat-security @gol 213-Wimplicit -Wimplicit-int @gol 214-Wimplicit-function-declaration @gol 215-Werror-implicit-function-declaration @gol 216-Wimport -Winline -Wno-endif-labels @gol 217-Wlarger-than-@var{len} -Wlong-long @gol 218-Wmain -Wmissing-braces @gol 219-Wmissing-format-attribute -Wmissing-noreturn @gol 220-Wno-multichar -Wno-format-extra-args -Wno-format-y2k @gol 221-Wno-import -Wnonnull -Wpacked -Wpadded @gol 222-Wparentheses -Wpointer-arith -Wredundant-decls @gol 223-Wreturn-type -Wsequence-point -Wshadow @gol 224-Wsign-compare -Wstrict-aliasing @gol 225-Wswitch -Wswitch-default -Wswitch-enum @gol 226-Wsystem-headers -Wtrigraphs -Wundef -Wuninitialized @gol 227-Wunknown-pragmas -Wunreachable-code @gol 228-Wunused -Wunused-function -Wunused-label -Wunused-parameter @gol 229-Wunused-value -Wunused-variable -Wwrite-strings} 230 231@item C-only Warning Options 232@gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol 233-Wmissing-prototypes -Wnested-externs @gol 234-Wstrict-prototypes -Wtraditional} 235 236@item Debugging Options 237@xref{Debugging Options,,Options for Debugging Your Program or GCC}. 238@gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol 239-fdump-unnumbered -fdump-translation-unit@r{[}-@var{n}@r{]} @gol 240-fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol 241-fdump-tree-original@r{[}-@var{n}@r{]} @gol 242-fdump-tree-optimized@r{[}-@var{n}@r{]} @gol 243-fdump-tree-inlined@r{[}-@var{n}@r{]} @gol 244-feliminate-dwarf2-dups -fmem-report @gol 245-fprofile-arcs -frandom-seed=@var{n} @gol 246-fsched-verbose=@var{n} -ftest-coverage -ftime-report @gol 247-g -g@var{level} -gcoff -gdwarf -gdwarf-1 -gdwarf-1+ -gdwarf-2 @gol 248-ggdb -gstabs -gstabs+ -gvms -gxcoff -gxcoff+ @gol 249-p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol 250-print-multi-directory -print-multi-lib @gol 251-print-prog-name=@var{program} -print-search-dirs -Q @gol 252-save-temps -time} 253 254@item Optimization Options 255@xref{Optimize Options,,Options that Control Optimization}. 256@gccoptlist{-falign-functions=@var{n} -falign-jumps=@var{n} @gol 257-falign-labels=@var{n} -falign-loops=@var{n} @gol 258-fbranch-probabilities -fcaller-saves -fcprop-registers @gol 259-fcse-follow-jumps -fcse-skip-blocks -fdata-sections @gol 260-fdelayed-branch -fdelete-null-pointer-checks @gol 261-fexpensive-optimizations -ffast-math -ffloat-store @gol 262-fforce-addr -fforce-mem -ffunction-sections @gol 263-fgcse -fgcse-lm -fgcse-sm -floop-optimize -fcrossjumping @gol 264-fif-conversion -fif-conversion2 @gol 265-finline-functions -finline-limit=@var{n} -fkeep-inline-functions @gol 266-fkeep-static-consts -fmerge-constants -fmerge-all-constants @gol 267-fmove-all-movables -fnew-ra -fno-branch-count-reg @gol 268-fno-default-inline -fno-defer-pop @gol 269-fno-function-cse -fno-guess-branch-probability @gol 270-fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol 271-funsafe-math-optimizations -ffinite-math-only @gol 272-fno-trapping-math -fno-zero-initialized-in-bss @gol 273-fomit-frame-pointer -foptimize-register-move @gol 274-foptimize-sibling-calls -fprefetch-loop-arrays @gol 275-freduce-all-givs -fregmove -frename-registers @gol 276-freorder-blocks -freorder-functions @gol 277-frerun-cse-after-loop -frerun-loop-opt @gol 278-fschedule-insns -fschedule-insns2 @gol 279-fno-sched-interblock -fno-sched-spec -fsched-spec-load @gol 280-fsched-spec-load-dangerous -fsignaling-nans @gol 281-fsingle-precision-constant -fssa -fssa-ccp -fssa-dce @gol 282-fstrength-reduce -fstrict-aliasing -ftracer -fthread-jumps @gol 283-funroll-all-loops -funroll-loops @gol 284--param @var{name}=@var{value} @gol 285-O -O0 -O1 -O2 -O3 -Os} 286 287@item Preprocessor Options 288@xref{Preprocessor Options,,Options Controlling the Preprocessor}. 289@gccoptlist{-$ -A@var{question}=@var{answer} @gol 290-A-@var{question}@r{[}=@var{answer}@r{]} @gol 291-C -dD -dI -dM -dN @gol 292-D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol 293-idirafter @var{dir} @gol 294-include @var{file} -imacros @var{file} @gol 295-iprefix @var{file} -iwithprefix @var{dir} @gol 296-iwithprefixbefore @var{dir} -isystem @var{dir} @gol 297-M -MM -MF -MG -MP -MQ -MT -nostdinc -P -remap @gol 298-trigraphs -undef -U@var{macro} -Wp,@var{option}} 299 300@item Assembler Option 301@xref{Assembler Options,,Passing Options to the Assembler}. 302@gccoptlist{-Wa,@var{option}} 303 304@item Linker Options 305@xref{Link Options,,Options for Linking}. 306@gccoptlist{@var{object-file-name} -l@var{library} @gol 307-nostartfiles -nodefaultlibs -nostdlib @gol 308-s -static -static-libgcc -shared -shared-libgcc -symbolic @gol 309-Wl,@var{option} -Xlinker @var{option} @gol 310-u @var{symbol}} 311 312@item Directory Options 313@xref{Directory Options,,Options for Directory Search}. 314@gccoptlist{-B@var{prefix} -I@var{dir} -I- -L@var{dir} -specs=@var{file}} 315 316@item Target Options 317@c I wrote this xref this way to avoid overfull hbox. -- rms 318@xref{Target Options}. 319@gccoptlist{-V @var{version} -b @var{machine}} 320 321@item Machine Dependent Options 322@xref{Submodel Options,,Hardware Models and Configurations}. 323 324@emph{M680x0 Options} 325@gccoptlist{-m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol 326-m68060 -mcpu32 -m5200 -m68881 -mbitfield -mc68000 -mc68020 @gol 327-mfpa -mnobitfield -mrtd -mshort -msoft-float -mpcrel @gol 328-malign-int -mstrict-align} 329 330@emph{M68hc1x Options} 331@gccoptlist{-m6811 -m6812 -m68hc11 -m68hc12 -m68hcs12 @gol 332-mauto-incdec -minmax -mlong-calls -mshort @gol 333-msoft-reg-count=@var{count}} 334 335@emph{VAX Options} 336@gccoptlist{-mg -mgnu -munix} 337 338@emph{SPARC Options} 339@gccoptlist{-mcpu=@var{cpu-type} @gol 340-mtune=@var{cpu-type} @gol 341-mcmodel=@var{code-model} @gol 342-m32 -m64 @gol 343-mapp-regs -mbroken-saverestore -mcypress @gol 344-mfaster-structs -mflat @gol 345-mfpu -mhard-float -mhard-quad-float @gol 346-mimpure-text -mlittle-endian -mlive-g0 -mno-app-regs @gol 347-mno-faster-structs -mno-flat -mno-fpu @gol 348-mno-impure-text -mno-stack-bias -mno-unaligned-doubles @gol 349-msoft-float -msoft-quad-float -msparclite -mstack-bias @gol 350-msupersparc -munaligned-doubles -mv8} 351 352@emph{ARM Options} 353@gccoptlist{-mapcs-frame -mno-apcs-frame @gol 354-mapcs-26 -mapcs-32 @gol 355-mapcs-stack-check -mno-apcs-stack-check @gol 356-mapcs-float -mno-apcs-float @gol 357-mapcs-reentrant -mno-apcs-reentrant @gol 358-msched-prolog -mno-sched-prolog @gol 359-mlittle-endian -mbig-endian -mwords-little-endian @gol 360-malignment-traps -mno-alignment-traps @gol 361-msoft-float -mhard-float -mfpe @gol 362-mthumb-interwork -mno-thumb-interwork @gol 363-mcpu=@var{name} -march=@var{name} -mfpe=@var{name} @gol 364-mstructure-size-boundary=@var{n} @gol 365-mabort-on-noreturn @gol 366-mlong-calls -mno-long-calls @gol 367-msingle-pic-base -mno-single-pic-base @gol 368-mpic-register=@var{reg} @gol 369-mnop-fun-dllimport @gol 370-mpoke-function-name @gol 371-mthumb -marm @gol 372-mtpcs-frame -mtpcs-leaf-frame @gol 373-mcaller-super-interworking -mcallee-super-interworking} 374 375@emph{MN10200 Options} 376@gccoptlist{-mrelax} 377 378@emph{MN10300 Options} 379@gccoptlist{-mmult-bug -mno-mult-bug @gol 380-mam33 -mno-am33 @gol 381-mno-crt0 -mrelax} 382 383@emph{M32R/D Options} 384@gccoptlist{-m32rx -m32r -mcode-model=@var{model-type} @gol 385-msdata=@var{sdata-type} -G @var{num}} 386 387@emph{M88K Options} 388@gccoptlist{-m88000 -m88100 -m88110 -mbig-pic @gol 389-mcheck-zero-division -mhandle-large-shift @gol 390-midentify-revision -mno-check-zero-division @gol 391-mno-ocs-debug-info -mno-ocs-frame-position @gol 392-mno-optimize-arg-area -mno-serialize-volatile @gol 393-mno-underscores -mocs-debug-info @gol 394-mocs-frame-position -moptimize-arg-area @gol 395-mserialize-volatile -mshort-data-@var{num} -msvr3 @gol 396-msvr4 -mtrap-large-shift -muse-div-instruction @gol 397-mversion-03.00 -mwarn-passed-structs} 398 399@emph{RS/6000 and PowerPC Options} 400@gccoptlist{-mcpu=@var{cpu-type} @gol 401-mtune=@var{cpu-type} @gol 402-mpower -mno-power -mpower2 -mno-power2 @gol 403-mpowerpc -mpowerpc64 -mno-powerpc @gol 404-maltivec -mno-altivec @gol 405-mpowerpc-gpopt -mno-powerpc-gpopt @gol 406-mpowerpc-gfxopt -mno-powerpc-gfxopt @gol 407-mnew-mnemonics -mold-mnemonics @gol 408-mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol 409-m64 -m32 -mxl-call -mno-xl-call -mpe @gol 410-msoft-float -mhard-float -mmultiple -mno-multiple @gol 411-mstring -mno-string -mupdate -mno-update @gol 412-mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol 413-mstrict-align -mno-strict-align -mrelocatable @gol 414-mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol 415-mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol 416-mcall-aix -mcall-sysv -mcall-netbsd @gol 417-maix-struct-return -msvr4-struct-return @gol 418-mabi=altivec -mabi=no-altivec @gol 419-mabi=spe -mabi=no-spe @gol 420-misel=yes -misel=no @gol 421-mprototype -mno-prototype @gol 422-msim -mmvme -mads -myellowknife -memb -msdata @gol 423-msdata=@var{opt} -mvxworks -mwindiss -G @var{num} -pthread} 424 425@emph{Darwin Options} 426@gccoptlist{ 427-all_load -allowable_client -arch -arch_errors_fatal @gol 428-arch_only -bind_at_load -bundle -bundle_loader @gol 429-client_name -compatibility_version -current_version @gol 430-dependency-file -dylib_file -dylinker_install_name @gol 431-dynamic -dynamiclib -exported_symbols_list @gol 432-filelist -flat_namespace -force_cpusubtype_ALL @gol 433-force_flat_namespace -headerpad_max_install_names @gol 434-image_base -init -install_name -keep_private_externs @gol 435-multi_module -multiply_defined -multiply_defined_unused @gol 436-noall_load -nomultidefs -noprebind -noseglinkedit @gol 437-pagezero_size -prebind -prebind_all_twolevel_modules @gol 438-private_bundle -read_only_relocs -sectalign @gol 439-sectobjectsymbols -whyload -seg1addr @gol 440-sectcreate -sectobjectsymbols -sectorder @gol 441-seg_addr_table -seg_addr_table_filename -seglinkedit @gol 442-segprot -segs_read_only_addr -segs_read_write_addr @gol 443-single_module -static -sub_library -sub_umbrella @gol 444-twolevel_namespace -umbrella -undefined @gol 445-unexported_symbols_list -weak_reference_mismatches -whatsloaded} 446 447@emph{RT Options} 448@gccoptlist{-mcall-lib-mul -mfp-arg-in-fpregs -mfp-arg-in-gregs @gol 449-mfull-fp-blocks -mhc-struct-return -min-line-mul @gol 450-mminimum-fp-blocks -mnohc-struct-return} 451 452@emph{MIPS Options} 453@gccoptlist{-mabicalls -march=@var{cpu-type} -mtune=@var{cpu=type} @gol 454-mcpu=@var{cpu-type} -membedded-data -muninit-const-in-rodata @gol 455-membedded-pic -mfp32 -mfp64 -mfused-madd -mno-fused-madd @gol 456-mgas -mgp32 -mgp64 @gol 457-mgpopt -mhalf-pic -mhard-float -mint64 -mips1 @gol 458-mips2 -mips3 -mips4 -mlong64 -mlong32 -mlong-calls -mmemcpy @gol 459-mmips-as -mmips-tfile -mno-abicalls @gol 460-mno-embedded-data -mno-uninit-const-in-rodata @gol 461-mno-embedded-pic -mno-gpopt -mno-long-calls @gol 462-mno-memcpy -mno-mips-tfile -mno-rnames -mno-stats @gol 463-mrnames -msoft-float @gol 464-m4650 -msingle-float -mmad @gol 465-mstats -EL -EB -G @var{num} -nocpp @gol 466-mabi=32 -mabi=n32 -mabi=64 -mabi=eabi @gol 467-mfix7000 -mno-crt0 -mflush-func=@var{func} -mno-flush-func @gol 468-mbranch-likely -mno-branch-likely} 469 470@emph{i386 and x86-64 Options} 471@gccoptlist{-mcpu=@var{cpu-type} -march=@var{cpu-type} @gol 472-mfpmath=@var{unit} -masm=@var{dialect} -mno-fancy-math-387 @gol 473-mno-fp-ret-in-387 -msoft-float -msvr3-shlib @gol 474-mno-wide-multiply -mrtd -malign-double @gol 475-mpreferred-stack-boundary=@var{num} @gol 476-mmmx -msse -msse2 -m3dnow @gol 477-mthreads -mno-align-stringops -minline-all-stringops @gol 478-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol 479-m96bit-long-double -mregparm=@var{num} -momit-leaf-frame-pointer @gol 480-mno-red-zone@gol 481-mcmodel=@var{code-model} @gol 482-m32 -m64} 483 484@emph{HPPA Options} 485@gccoptlist{-march=@var{architecture-type} @gol 486-mbig-switch -mdisable-fpregs -mdisable-indexing @gol 487-mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol 488-mjump-in-delay -mlinker-opt -mlong-calls @gol 489-mlong-load-store -mno-big-switch -mno-disable-fpregs @gol 490-mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol 491-mno-jump-in-delay -mno-long-load-store @gol 492-mno-portable-runtime -mno-soft-float @gol 493-mno-space-regs -msoft-float -mpa-risc-1-0 @gol 494-mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol 495-mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol 496-nolibdld -static -threads} 497 498@emph{Intel 960 Options} 499@gccoptlist{-m@var{cpu-type} -masm-compat -mclean-linkage @gol 500-mcode-align -mcomplex-addr -mleaf-procedures @gol 501-mic-compat -mic2.0-compat -mic3.0-compat @gol 502-mintel-asm -mno-clean-linkage -mno-code-align @gol 503-mno-complex-addr -mno-leaf-procedures @gol 504-mno-old-align -mno-strict-align -mno-tail-call @gol 505-mnumerics -mold-align -msoft-float -mstrict-align @gol 506-mtail-call} 507 508@emph{DEC Alpha Options} 509@gccoptlist{-mno-fp-regs -msoft-float -malpha-as -mgas @gol 510-mieee -mieee-with-inexact -mieee-conformant @gol 511-mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol 512-mtrap-precision=@var{mode} -mbuild-constants @gol 513-mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol 514-mbwx -mmax -mfix -mcix @gol 515-mfloat-vax -mfloat-ieee @gol 516-mexplicit-relocs -msmall-data -mlarge-data @gol 517-mmemory-latency=@var{time}} 518 519@emph{DEC Alpha/VMS Options} 520@gccoptlist{-mvms-return-codes} 521 522@emph{H8/300 Options} 523@gccoptlist{-mrelax -mh -ms -mn -mint32 -malign-300} 524 525@emph{SH Options} 526@gccoptlist{-m1 -m2 -m3 -m3e @gol 527-m4-nofpu -m4-single-only -m4-single -m4 @gol 528-m5-64media -m5-64media-nofpu @gol 529-m5-32media -m5-32media-nofpu @gol 530-m5-compact -m5-compact-nofpu @gol 531-mb -ml -mdalign -mrelax @gol 532-mbigtable -mfmovd -mhitachi -mnomacsave @gol 533-mieee -misize -mpadstruct -mspace @gol 534-mprefergot -musermode} 535 536@emph{System V Options} 537@gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}} 538 539@emph{ARC Options} 540@gccoptlist{-EB -EL @gol 541-mmangle-cpu -mcpu=@var{cpu} -mtext=@var{text-section} @gol 542-mdata=@var{data-section} -mrodata=@var{readonly-data-section}} 543 544@emph{TMS320C3x/C4x Options} 545@gccoptlist{-mcpu=@var{cpu} -mbig -msmall -mregparm -mmemparm @gol 546-mfast-fix -mmpyi -mbk -mti -mdp-isr-reload @gol 547-mrpts=@var{count} -mrptb -mdb -mloop-unsigned @gol 548-mparallel-insns -mparallel-mpy -mpreserve-float} 549 550@emph{V850 Options} 551@gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol 552-mprolog-function -mno-prolog-function -mspace @gol 553-mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol 554-mapp-regs -mno-app-regs @gol 555-mdisable-callt -mno-disable-callt @gol 556-mv850e @gol 557-mv850 -mbig-switch} 558 559@emph{NS32K Options} 560@gccoptlist{-m32032 -m32332 -m32532 -m32081 -m32381 @gol 561-mmult-add -mnomult-add -msoft-float -mrtd -mnortd @gol 562-mregparam -mnoregparam -msb -mnosb @gol 563-mbitfield -mnobitfield -mhimem -mnohimem} 564 565@emph{AVR Options} 566@gccoptlist{-mmcu=@var{mcu} -msize -minit-stack=@var{n} -mno-interrupts @gol 567-mcall-prologues -mno-tablejump -mtiny-stack} 568 569@emph{MCore Options} 570@gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol 571-mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol 572-m4byte-functions -mno-4byte-functions -mcallgraph-data @gol 573-mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol 574-mlittle-endian -mbig-endian -m210 -m340 -mstack-increment} 575 576@emph{MMIX Options} 577@gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol 578-mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol 579-melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol 580-mno-base-addresses -msingle-exit -mno-single-exit} 581 582@emph{IA-64 Options} 583@gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol 584-mvolatile-asm-stop -mb-step -mregister-names -mno-sdata @gol 585-mconstant-gp -mauto-pic -minline-float-divide-min-latency @gol 586-minline-float-divide-max-throughput @gol 587-minline-int-divide-min-latency @gol 588-minline-int-divide-max-throughput -mno-dwarf2-asm @gol 589-mfixed-range=@var{register-range}} 590 591@emph{D30V Options} 592@gccoptlist{-mextmem -mextmemory -monchip -mno-asm-optimize @gol 593-masm-optimize -mbranch-cost=@var{n} -mcond-exec=@var{n}} 594 595@emph{S/390 and zSeries Options} 596@gccoptlist{-mhard-float -msoft-float -mbackchain -mno-backchain @gol 597-msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol 598-m64 -m31 -mdebug -mno-debug} 599 600@emph{CRIS Options} 601@gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol 602-mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol 603-metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol 604-mstack-align -mdata-align -mconst-align @gol 605-m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol 606-melf -maout -melinux -mlinux -sim -sim2} 607 608@emph{PDP-11 Options} 609@gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol 610-mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol 611-mint16 -mno-int32 -mfloat32 -mno-float64 @gol 612-mfloat64 -mno-float32 -mabshi -mno-abshi @gol 613-mbranch-expensive -mbranch-cheap @gol 614-msplit -mno-split -munix-asm -mdec-asm} 615 616@emph{Xstormy16 Options} 617@gccoptlist{-msim} 618 619@emph{Xtensa Options} 620@gccoptlist{-mbig-endian -mlittle-endian @gol 621-mdensity -mno-density @gol 622-mmac16 -mno-mac16 @gol 623-mmul16 -mno-mul16 @gol 624-mmul32 -mno-mul32 @gol 625-mnsa -mno-nsa @gol 626-mminmax -mno-minmax @gol 627-msext -mno-sext @gol 628-mbooleans -mno-booleans @gol 629-mhard-float -msoft-float @gol 630-mfused-madd -mno-fused-madd @gol 631-mserialize-volatile -mno-serialize-volatile @gol 632-mtext-section-literals -mno-text-section-literals @gol 633-mtarget-align -mno-target-align @gol 634-mlongcalls -mno-longcalls} 635 636@emph{FRV Options} 637@gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol 638-mhard-float -msoft-float -malloc-cc -mfixed-cc @gol 639-mdword -mno-dword -mdouble -mno-double @gol 640-mmedia -mno-media -mmuladd -mno-muladd -mlibrary-pic @gol 641-macc-4 -macc-8 -mpack -mno-pack -mno-eflags @gol 642-mcond-move -mno-cond-move -mscc -mno-scc @gol 643-mcond-exec -mno-cond-exec -mvliw-branch -mno-vliw-branch @gol 644-mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol 645-mno-nested-cond-exec -mtomcat-stats @gol 646-mcpu=@var{cpu}} 647 648 649 650@item Code Generation Options 651@xref{Code Gen Options,,Options for Code Generation Conventions}. 652@gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol 653-ffixed-@var{reg} -fexceptions @gol 654-fnon-call-exceptions -funwind-tables @gol 655-fasynchronous-unwind-tables @gol 656-finhibit-size-directive -finstrument-functions @gol 657-fno-common -fno-ident -fno-gnu-linker @gol 658-fpcc-struct-return -fpic -fPIC @gol 659-freg-struct-return -fshared-data -fshort-enums @gol 660-fshort-double -fshort-wchar -fvolatile @gol 661-fvolatile-global -fvolatile-static @gol 662-fverbose-asm -fpack-struct -fstack-check @gol 663-fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol 664-fargument-alias -fargument-noalias @gol 665-fargument-noalias-global -fleading-underscore @gol 666-ftls-model=@var{model} @gol 667-ftrapv -fbounds-check} 668@end table 669 670@menu 671* Overall Options:: Controlling the kind of output: 672 an executable, object files, assembler files, 673 or preprocessed source. 674* C Dialect Options:: Controlling the variant of C language compiled. 675* C++ Dialect Options:: Variations on C++. 676* Objective-C Dialect Options:: Variations on Objective-C. 677* Language Independent Options:: Controlling how diagnostics should be 678 formatted. 679* Warning Options:: How picky should the compiler be? 680* Debugging Options:: Symbol tables, measurements, and debugging dumps. 681* Optimize Options:: How much optimization? 682* Preprocessor Options:: Controlling header files and macro definitions. 683 Also, getting dependency information for Make. 684* Assembler Options:: Passing options to the assembler. 685* Link Options:: Specifying libraries and so on. 686* Directory Options:: Where to find header files and libraries. 687 Where to find the compiler executable files. 688* Spec Files:: How to pass switches to sub-processes. 689* Target Options:: Running a cross-compiler, or an old version of GCC. 690@end menu 691 692@node Overall Options 693@section Options Controlling the Kind of Output 694 695Compilation can involve up to four stages: preprocessing, compilation 696proper, assembly and linking, always in that order. The first three 697stages apply to an individual source file, and end by producing an 698object file; linking combines all the object files (those newly 699compiled, and those specified as input) into an executable file. 700 701@cindex file name suffix 702For any given input file, the file name suffix determines what kind of 703compilation is done: 704 705@table @gcctabopt 706@item @var{file}.c 707C source code which must be preprocessed. 708 709@item @var{file}.i 710C source code which should not be preprocessed. 711 712@item @var{file}.ii 713C++ source code which should not be preprocessed. 714 715@item @var{file}.m 716Objective-C source code. Note that you must link with the library 717@file{libobjc.a} to make an Objective-C program work. 718 719@item @var{file}.mi 720Objective-C source code which should not be preprocessed. 721 722@item @var{file}.h 723C header file (not to be compiled or linked). 724 725@item @var{file}.cc 726@itemx @var{file}.cp 727@itemx @var{file}.cxx 728@itemx @var{file}.cpp 729@itemx @var{file}.c++ 730@itemx @var{file}.C 731C++ source code which must be preprocessed. Note that in @samp{.cxx}, 732the last two letters must both be literally @samp{x}. Likewise, 733@samp{.C} refers to a literal capital C@. 734 735@item @var{file}.f 736@itemx @var{file}.for 737@itemx @var{file}.FOR 738Fortran source code which should not be preprocessed. 739 740@item @var{file}.F 741@itemx @var{file}.fpp 742@itemx @var{file}.FPP 743Fortran source code which must be preprocessed (with the traditional 744preprocessor). 745 746@item @var{file}.r 747Fortran source code which must be preprocessed with a RATFOR 748preprocessor (not included with GCC)@. 749 750@xref{Overall Options,,Options Controlling the Kind of Output, g77, 751Using and Porting GNU Fortran}, for more details of the handling of 752Fortran input files. 753 754@c FIXME: Descriptions of Java file types. 755@c @var{file}.java 756@c @var{file}.class 757@c @var{file}.zip 758@c @var{file}.jar 759 760@item @var{file}.ads 761Ada source code file which contains a library unit declaration (a 762declaration of a package, subprogram, or generic, or a generic 763instantiation), or a library unit renaming declaration (a package, 764generic, or subprogram renaming declaration). Such files are also 765called @dfn{specs}. 766 767@itemx @var{file}.adb 768Ada source code file containing a library unit body (a subprogram or 769package body). Such files are also called @dfn{bodies}. 770 771@c GCC also knows about some suffixes for languages not yet included: 772@c Pascal: 773@c @var{file}.p 774@c @var{file}.pas 775 776@item @var{file}.s 777Assembler code. 778 779@item @var{file}.S 780Assembler code which must be preprocessed. 781 782@item @var{other} 783An object file to be fed straight into linking. 784Any file name with no recognized suffix is treated this way. 785@end table 786 787@opindex x 788You can specify the input language explicitly with the @option{-x} option: 789 790@table @gcctabopt 791@item -x @var{language} 792Specify explicitly the @var{language} for the following input files 793(rather than letting the compiler choose a default based on the file 794name suffix). This option applies to all following input files until 795the next @option{-x} option. Possible values for @var{language} are: 796@example 797c c-header cpp-output 798c++ c++-cpp-output 799objective-c objc-cpp-output 800assembler assembler-with-cpp 801ada 802f77 f77-cpp-input ratfor 803java 804treelang 805@end example 806 807@item -x none 808Turn off any specification of a language, so that subsequent files are 809handled according to their file name suffixes (as they are if @option{-x} 810has not been used at all). 811 812@item -pass-exit-codes 813@opindex pass-exit-codes 814Normally the @command{gcc} program will exit with the code of 1 if any 815phase of the compiler returns a non-success return code. If you specify 816@option{-pass-exit-codes}, the @command{gcc} program will instead return with 817numerically highest error produced by any phase that returned an error 818indication. 819@end table 820 821If you only want some of the stages of compilation, you can use 822@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and 823one of the options @option{-c}, @option{-S}, or @option{-E} to say where 824@command{gcc} is to stop. Note that some combinations (for example, 825@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all. 826 827@table @gcctabopt 828@item -c 829@opindex c 830Compile or assemble the source files, but do not link. The linking 831stage simply is not done. The ultimate output is in the form of an 832object file for each source file. 833 834By default, the object file name for a source file is made by replacing 835the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}. 836 837Unrecognized input files, not requiring compilation or assembly, are 838ignored. 839 840@item -S 841@opindex S 842Stop after the stage of compilation proper; do not assemble. The output 843is in the form of an assembler code file for each non-assembler input 844file specified. 845 846By default, the assembler file name for a source file is made by 847replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}. 848 849Input files that don't require compilation are ignored. 850 851@item -E 852@opindex E 853Stop after the preprocessing stage; do not run the compiler proper. The 854output is in the form of preprocessed source code, which is sent to the 855standard output. 856 857Input files which don't require preprocessing are ignored. 858 859@cindex output file option 860@item -o @var{file} 861@opindex o 862Place output in file @var{file}. This applies regardless to whatever 863sort of output is being produced, whether it be an executable file, 864an object file, an assembler file or preprocessed C code. 865 866Since only one output file can be specified, it does not make sense to 867use @option{-o} when compiling more than one input file, unless you are 868producing an executable file as output. 869 870If @option{-o} is not specified, the default is to put an executable file 871in @file{a.out}, the object file for @file{@var{source}.@var{suffix}} in 872@file{@var{source}.o}, its assembler file in @file{@var{source}.s}, and 873all preprocessed C source on standard output. 874 875@item -v 876@opindex v 877Print (on standard error output) the commands executed to run the stages 878of compilation. Also print the version number of the compiler driver 879program and of the preprocessor and the compiler proper. 880 881@item -### 882@opindex ### 883Like @option{-v} except the commands are not executed and all command 884arguments are quoted. This is useful for shell scripts to capture the 885driver-generated command lines. 886 887@item -pipe 888@opindex pipe 889Use pipes rather than temporary files for communication between the 890various stages of compilation. This fails to work on some systems where 891the assembler is unable to read from a pipe; but the GNU assembler has 892no trouble. 893 894@item --help 895@opindex help 896Print (on the standard output) a description of the command line options 897understood by @command{gcc}. If the @option{-v} option is also specified 898then @option{--help} will also be passed on to the various processes 899invoked by @command{gcc}, so that they can display the command line options 900they accept. If the @option{-W} option is also specified then command 901line options which have no documentation associated with them will also 902be displayed. 903 904@item --target-help 905@opindex target-help 906Print (on the standard output) a description of target specific command 907line options for each tool. 908 909@item --version 910@opindex version 911Display the version number and copyrights of the invoked GCC. 912@end table 913 914@node Invoking G++ 915@section Compiling C++ Programs 916 917@cindex suffixes for C++ source 918@cindex C++ source file suffixes 919C++ source files conventionally use one of the suffixes @samp{.C}, 920@samp{.cc}, @samp{.cpp}, @samp{.c++}, @samp{.cp}, or @samp{.cxx}; 921preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes 922files with these names and compiles them as C++ programs even if you 923call the compiler the same way as for compiling C programs (usually with 924the name @command{gcc}). 925 926@findex g++ 927@findex c++ 928However, C++ programs often require class libraries as well as a 929compiler that understands the C++ language---and under some 930circumstances, you might want to compile programs from standard input, 931or otherwise without a suffix that flags them as C++ programs. 932@command{g++} is a program that calls GCC with the default language 933set to C++, and automatically specifies linking against the C++ 934library. On many systems, @command{g++} is also 935installed with the name @command{c++}. 936 937@cindex invoking @command{g++} 938When you compile C++ programs, you may specify many of the same 939command-line options that you use for compiling programs in any 940language; or command-line options meaningful for C and related 941languages; or options that are meaningful only for C++ programs. 942@xref{C Dialect Options,,Options Controlling C Dialect}, for 943explanations of options for languages related to C@. 944@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for 945explanations of options that are meaningful only for C++ programs. 946 947@node C Dialect Options 948@section Options Controlling C Dialect 949@cindex dialect options 950@cindex language dialect options 951@cindex options, dialect 952 953The following options control the dialect of C (or languages derived 954from C, such as C++ and Objective-C) that the compiler accepts: 955 956@table @gcctabopt 957@cindex ANSI support 958@cindex ISO support 959@item -ansi 960@opindex ansi 961In C mode, support all ISO C90 programs. In C++ mode, 962remove GNU extensions that conflict with ISO C++. 963 964This turns off certain features of GCC that are incompatible with ISO 965C90 (when compiling C code), or of standard C++ (when compiling C++ code), 966such as the @code{asm} and @code{typeof} keywords, and 967predefined macros such as @code{unix} and @code{vax} that identify the 968type of system you are using. It also enables the undesirable and 969rarely used ISO trigraph feature. For the C compiler, 970it disables recognition of C++ style @samp{//} comments as well as 971the @code{inline} keyword. 972 973The alternate keywords @code{__asm__}, @code{__extension__}, 974@code{__inline__} and @code{__typeof__} continue to work despite 975@option{-ansi}. You would not want to use them in an ISO C program, of 976course, but it is useful to put them in header files that might be included 977in compilations done with @option{-ansi}. Alternate predefined macros 978such as @code{__unix__} and @code{__vax__} are also available, with or 979without @option{-ansi}. 980 981The @option{-ansi} option does not cause non-ISO programs to be 982rejected gratuitously. For that, @option{-pedantic} is required in 983addition to @option{-ansi}. @xref{Warning Options}. 984 985The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi} 986option is used. Some header files may notice this macro and refrain 987from declaring certain functions or defining certain macros that the 988ISO standard doesn't call for; this is to avoid interfering with any 989programs that might use these names for other things. 990 991Functions which would normally be built in but do not have semantics 992defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in 993functions with @option{-ansi} is used. @xref{Other Builtins,,Other 994built-in functions provided by GCC}, for details of the functions 995affected. 996 997@item -std= 998@opindex std 999Determine the language standard. This option is currently only 1000supported when compiling C or C++. A value for this option must be 1001provided; possible values are 1002 1003@table @samp 1004@item c89 1005@itemx iso9899:1990 1006ISO C90 (same as @option{-ansi}). 1007 1008@item iso9899:199409 1009ISO C90 as modified in amendment 1. 1010 1011@item c99 1012@itemx c9x 1013@itemx iso9899:1999 1014@itemx iso9899:199x 1015ISO C99. Note that this standard is not yet fully supported; see 1016@w{@uref{http://gcc.gnu.org/gcc-3.3/c99status.html}} for more information. The 1017names @samp{c9x} and @samp{iso9899:199x} are deprecated. 1018 1019@item gnu89 1020Default, ISO C90 plus GNU extensions (including some C99 features). 1021 1022@item gnu99 1023@item gnu9x 1024ISO C99 plus GNU extensions. When ISO C99 is fully implemented in GCC, 1025this will become the default. The name @samp{gnu9x} is deprecated. 1026 1027@item c++98 1028The 1998 ISO C++ standard plus amendments. 1029 1030@item gnu++98 1031The same as @option{-std=c++98} plus GNU extensions. This is the 1032default for C++ code. 1033@end table 1034 1035Even when this option is not specified, you can still use some of the 1036features of newer standards in so far as they do not conflict with 1037previous C standards. For example, you may use @code{__restrict__} even 1038when @option{-std=c99} is not specified. 1039 1040The @option{-std} options specifying some version of ISO C have the same 1041effects as @option{-ansi}, except that features that were not in ISO C90 1042but are in the specified version (for example, @samp{//} comments and 1043the @code{inline} keyword in ISO C99) are not disabled. 1044 1045@xref{Standards,,Language Standards Supported by GCC}, for details of 1046these standard versions. 1047 1048@item -aux-info @var{filename} 1049@opindex aux-info 1050Output to the given filename prototyped declarations for all functions 1051declared and/or defined in a translation unit, including those in header 1052files. This option is silently ignored in any language other than C@. 1053 1054Besides declarations, the file indicates, in comments, the origin of 1055each declaration (source file and line), whether the declaration was 1056implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or 1057@samp{O} for old, respectively, in the first character after the line 1058number and the colon), and whether it came from a declaration or a 1059definition (@samp{C} or @samp{F}, respectively, in the following 1060character). In the case of function definitions, a K&R-style list of 1061arguments followed by their declarations is also provided, inside 1062comments, after the declaration. 1063 1064@item -fno-asm 1065@opindex fno-asm 1066Do not recognize @code{asm}, @code{inline} or @code{typeof} as a 1067keyword, so that code can use these words as identifiers. You can use 1068the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__} 1069instead. @option{-ansi} implies @option{-fno-asm}. 1070 1071In C++, this switch only affects the @code{typeof} keyword, since 1072@code{asm} and @code{inline} are standard keywords. You may want to 1073use the @option{-fno-gnu-keywords} flag instead, which has the same 1074effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this 1075switch only affects the @code{asm} and @code{typeof} keywords, since 1076@code{inline} is a standard keyword in ISO C99. 1077 1078@item -fno-builtin 1079@itemx -fno-builtin-@var{function} 1080@opindex fno-builtin 1081@cindex built-in functions 1082Don't recognize built-in functions that do not begin with 1083@samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in 1084functions provided by GCC}, for details of the functions affected, 1085including those which are not built-in functions when @option{-ansi} or 1086@option{-std} options for strict ISO C conformance are used because they 1087do not have an ISO standard meaning. 1088 1089GCC normally generates special code to handle certain built-in functions 1090more efficiently; for instance, calls to @code{alloca} may become single 1091instructions that adjust the stack directly, and calls to @code{memcpy} 1092may become inline copy loops. The resulting code is often both smaller 1093and faster, but since the function calls no longer appear as such, you 1094cannot set a breakpoint on those calls, nor can you change the behavior 1095of the functions by linking with a different library. 1096 1097With the @option{-fno-builtin-@var{function}} option 1098only the built-in function @var{function} is 1099disabled. @var{function} must not begin with @samp{__builtin_}. If a 1100function is named this is not built-in in this version of GCC, this 1101option is ignored. There is no corresponding 1102@option{-fbuiltin-@var{function}} option; if you wish to enable 1103built-in functions selectively when using @option{-fno-builtin} or 1104@option{-ffreestanding}, you may define macros such as: 1105 1106@smallexample 1107#define abs(n) __builtin_abs ((n)) 1108#define strcpy(d, s) __builtin_strcpy ((d), (s)) 1109@end smallexample 1110 1111@item -fhosted 1112@opindex fhosted 1113@cindex hosted environment 1114 1115Assert that compilation takes place in a hosted environment. This implies 1116@option{-fbuiltin}. A hosted environment is one in which the 1117entire standard library is available, and in which @code{main} has a return 1118type of @code{int}. Examples are nearly everything except a kernel. 1119This is equivalent to @option{-fno-freestanding}. 1120 1121@item -ffreestanding 1122@opindex ffreestanding 1123@cindex hosted environment 1124 1125Assert that compilation takes place in a freestanding environment. This 1126implies @option{-fno-builtin}. A freestanding environment 1127is one in which the standard library may not exist, and program startup may 1128not necessarily be at @code{main}. The most obvious example is an OS kernel. 1129This is equivalent to @option{-fno-hosted}. 1130 1131@xref{Standards,,Language Standards Supported by GCC}, for details of 1132freestanding and hosted environments. 1133 1134@item -fms-extensions 1135@opindex fms-extensions 1136Accept some non-standard constructs used in Microsoft header files. 1137 1138@item -trigraphs 1139@opindex trigraphs 1140Support ISO C trigraphs. The @option{-ansi} option (and @option{-std} 1141options for strict ISO C conformance) implies @option{-trigraphs}. 1142 1143@item -no-integrated-cpp 1144@opindex no-integrated-cpp 1145Performs a compilation in two passes: preprocessing and compiling. This 1146option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the 1147@option{-B} option. The user supplied compilation step can then add in 1148an additional preprocessing step after normal preprocessing but before 1149compiling. The default is to use the integrated cpp (internal cpp) 1150 1151The semantics of this option will change if "cc1", "cc1plus", and 1152"cc1obj" are merged. 1153 1154@cindex traditional C language 1155@cindex C language, traditional 1156@item -traditional 1157@itemx -traditional-cpp 1158@opindex traditional-cpp 1159@opindex traditional 1160Formerly, these options caused GCC to attempt to emulate a pre-standard 1161C compiler. They are now only supported with the @option{-E} switch. 1162The preprocessor continues to support a pre-standard mode. See the GNU 1163CPP manual for details. 1164 1165@item -fcond-mismatch 1166@opindex fcond-mismatch 1167Allow conditional expressions with mismatched types in the second and 1168third arguments. The value of such an expression is void. This option 1169is not supported for C++. 1170 1171@item -funsigned-char 1172@opindex funsigned-char 1173Let the type @code{char} be unsigned, like @code{unsigned char}. 1174 1175Each kind of machine has a default for what @code{char} should 1176be. It is either like @code{unsigned char} by default or like 1177@code{signed char} by default. 1178 1179Ideally, a portable program should always use @code{signed char} or 1180@code{unsigned char} when it depends on the signedness of an object. 1181But many programs have been written to use plain @code{char} and 1182expect it to be signed, or expect it to be unsigned, depending on the 1183machines they were written for. This option, and its inverse, let you 1184make such a program work with the opposite default. 1185 1186The type @code{char} is always a distinct type from each of 1187@code{signed char} or @code{unsigned char}, even though its behavior 1188is always just like one of those two. 1189 1190@item -fsigned-char 1191@opindex fsigned-char 1192Let the type @code{char} be signed, like @code{signed char}. 1193 1194Note that this is equivalent to @option{-fno-unsigned-char}, which is 1195the negative form of @option{-funsigned-char}. Likewise, the option 1196@option{-fno-signed-char} is equivalent to @option{-funsigned-char}. 1197 1198@item -fsigned-bitfields 1199@itemx -funsigned-bitfields 1200@itemx -fno-signed-bitfields 1201@itemx -fno-unsigned-bitfields 1202@opindex fsigned-bitfields 1203@opindex funsigned-bitfields 1204@opindex fno-signed-bitfields 1205@opindex fno-unsigned-bitfields 1206These options control whether a bit-field is signed or unsigned, when the 1207declaration does not use either @code{signed} or @code{unsigned}. By 1208default, such a bit-field is signed, because this is consistent: the 1209basic integer types such as @code{int} are signed types. 1210 1211@item -fwritable-strings 1212@opindex fwritable-strings 1213Store string constants in the writable data segment and don't uniquize 1214them. This is for compatibility with old programs which assume they can 1215write into string constants. 1216 1217Writing into string constants is a very bad idea; ``constants'' should 1218be constant. 1219@end table 1220 1221@node C++ Dialect Options 1222@section Options Controlling C++ Dialect 1223 1224@cindex compiler options, C++ 1225@cindex C++ options, command line 1226@cindex options, C++ 1227This section describes the command-line options that are only meaningful 1228for C++ programs; but you can also use most of the GNU compiler options 1229regardless of what language your program is in. For example, you 1230might compile a file @code{firstClass.C} like this: 1231 1232@example 1233g++ -g -frepo -O -c firstClass.C 1234@end example 1235 1236@noindent 1237In this example, only @option{-frepo} is an option meant 1238only for C++ programs; you can use the other options with any 1239language supported by GCC@. 1240 1241Here is a list of options that are @emph{only} for compiling C++ programs: 1242 1243@table @gcctabopt 1244 1245@item -fabi-version=@var{n} 1246@opindex fabi-version 1247Use version @var{n} of the C++ ABI. Version 1 is the version of the C++ 1248ABI that first appeared in G++ 3.2. Version 0 will always be the 1249version that conforms most closely to the C++ ABI specification. 1250Therefore, the ABI obtained using version 0 will change as ABI bugs are 1251fixed. 1252 1253The default is version 1. 1254 1255@item -fno-access-control 1256@opindex fno-access-control 1257Turn off all access checking. This switch is mainly useful for working 1258around bugs in the access control code. 1259 1260@item -fcheck-new 1261@opindex fcheck-new 1262Check that the pointer returned by @code{operator new} is non-null 1263before attempting to modify the storage allocated. This check is 1264normally unnecessary because the C++ standard specifies that 1265@code{operator new} will only return @code{0} if it is declared 1266@samp{throw()}, in which case the compiler will always check the 1267return value even without this option. In all other cases, when 1268@code{operator new} has a non-empty exception specification, memory 1269exhaustion is signalled by throwing @code{std::bad_alloc}. See also 1270@samp{new (nothrow)}. 1271 1272@item -fconserve-space 1273@opindex fconserve-space 1274Put uninitialized or runtime-initialized global variables into the 1275common segment, as C does. This saves space in the executable at the 1276cost of not diagnosing duplicate definitions. If you compile with this 1277flag and your program mysteriously crashes after @code{main()} has 1278completed, you may have an object that is being destroyed twice because 1279two definitions were merged. 1280 1281This option is no longer useful on most targets, now that support has 1282been added for putting variables into BSS without making them common. 1283 1284@item -fno-const-strings 1285@opindex fno-const-strings 1286Give string constants type @code{char *} instead of type @code{const 1287char *}. By default, G++ uses type @code{const char *} as required by 1288the standard. Even if you use @option{-fno-const-strings}, you cannot 1289actually modify the value of a string constant, unless you also use 1290@option{-fwritable-strings}. 1291 1292This option might be removed in a future release of G++. For maximum 1293portability, you should structure your code so that it works with 1294string constants that have type @code{const char *}. 1295 1296@item -fdollars-in-identifiers 1297@opindex fdollars-in-identifiers 1298Accept @samp{$} in identifiers. You can also explicitly prohibit use of 1299@samp{$} with the option @option{-fno-dollars-in-identifiers}. (GNU C allows 1300@samp{$} by default on most target systems, but there are a few exceptions.) 1301Traditional C allowed the character @samp{$} to form part of 1302identifiers. However, ISO C and C++ forbid @samp{$} in identifiers. 1303 1304@item -fno-elide-constructors 1305@opindex fno-elide-constructors 1306The C++ standard allows an implementation to omit creating a temporary 1307which is only used to initialize another object of the same type. 1308Specifying this option disables that optimization, and forces G++ to 1309call the copy constructor in all cases. 1310 1311@item -fno-enforce-eh-specs 1312@opindex fno-enforce-eh-specs 1313Don't check for violation of exception specifications at runtime. This 1314option violates the C++ standard, but may be useful for reducing code 1315size in production builds, much like defining @samp{NDEBUG}. The compiler 1316will still optimize based on the exception specifications. 1317 1318@item -fexternal-templates 1319@opindex fexternal-templates 1320 1321Cause @samp{#pragma interface} and @samp{implementation} to apply to 1322template instantiation; template instances are emitted or not according 1323to the location of the template definition. @xref{Template 1324Instantiation}, for more information. 1325 1326This option is deprecated. 1327 1328@item -falt-external-templates 1329@opindex falt-external-templates 1330Similar to @option{-fexternal-templates}, but template instances are 1331emitted or not according to the place where they are first instantiated. 1332@xref{Template Instantiation}, for more information. 1333 1334This option is deprecated. 1335 1336@item -ffor-scope 1337@itemx -fno-for-scope 1338@opindex ffor-scope 1339@opindex fno-for-scope 1340If @option{-ffor-scope} is specified, the scope of variables declared in 1341a @i{for-init-statement} is limited to the @samp{for} loop itself, 1342as specified by the C++ standard. 1343If @option{-fno-for-scope} is specified, the scope of variables declared in 1344a @i{for-init-statement} extends to the end of the enclosing scope, 1345as was the case in old versions of G++, and other (traditional) 1346implementations of C++. 1347 1348The default if neither flag is given to follow the standard, 1349but to allow and give a warning for old-style code that would 1350otherwise be invalid, or have different behavior. 1351 1352@item -fno-gnu-keywords 1353@opindex fno-gnu-keywords 1354Do not recognize @code{typeof} as a keyword, so that code can use this 1355word as an identifier. You can use the keyword @code{__typeof__} instead. 1356@option{-ansi} implies @option{-fno-gnu-keywords}. 1357 1358@item -fno-implicit-templates 1359@opindex fno-implicit-templates 1360Never emit code for non-inline templates which are instantiated 1361implicitly (i.e.@: by use); only emit code for explicit instantiations. 1362@xref{Template Instantiation}, for more information. 1363 1364@item -fno-implicit-inline-templates 1365@opindex fno-implicit-inline-templates 1366Don't emit code for implicit instantiations of inline templates, either. 1367The default is to handle inlines differently so that compiles with and 1368without optimization will need the same set of explicit instantiations. 1369 1370@item -fno-implement-inlines 1371@opindex fno-implement-inlines 1372To save space, do not emit out-of-line copies of inline functions 1373controlled by @samp{#pragma implementation}. This will cause linker 1374errors if these functions are not inlined everywhere they are called. 1375 1376@item -fms-extensions 1377@opindex fms-extensions 1378Disable pedantic warnings about constructs used in MFC, such as implicit 1379int and getting a pointer to member function via non-standard syntax. 1380 1381@item -fno-nonansi-builtins 1382@opindex fno-nonansi-builtins 1383Disable built-in declarations of functions that are not mandated by 1384ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit}, 1385@code{index}, @code{bzero}, @code{conjf}, and other related functions. 1386 1387@item -fno-operator-names 1388@opindex fno-operator-names 1389Do not treat the operator name keywords @code{and}, @code{bitand}, 1390@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as 1391synonyms as keywords. 1392 1393@item -fno-optional-diags 1394@opindex fno-optional-diags 1395Disable diagnostics that the standard says a compiler does not need to 1396issue. Currently, the only such diagnostic issued by G++ is the one for 1397a name having multiple meanings within a class. 1398 1399@item -fpermissive 1400@opindex fpermissive 1401Downgrade some diagnostics about nonconformant code from errors to 1402warnings. Thus, using @option{-fpermissive} will allow some 1403nonconforming code to compile. 1404 1405@item -frepo 1406@opindex frepo 1407Enable automatic template instantiation at link time. This option also 1408implies @option{-fno-implicit-templates}. @xref{Template 1409Instantiation}, for more information. 1410 1411@item -fno-rtti 1412@opindex fno-rtti 1413Disable generation of information about every class with virtual 1414functions for use by the C++ runtime type identification features 1415(@samp{dynamic_cast} and @samp{typeid}). If you don't use those parts 1416of the language, you can save some space by using this flag. Note that 1417exception handling uses the same information, but it will generate it as 1418needed. 1419 1420@item -fstats 1421@opindex fstats 1422Emit statistics about front-end processing at the end of the compilation. 1423This information is generally only useful to the G++ development team. 1424 1425@item -ftemplate-depth-@var{n} 1426@opindex ftemplate-depth 1427Set the maximum instantiation depth for template classes to @var{n}. 1428A limit on the template instantiation depth is needed to detect 1429endless recursions during template class instantiation. ANSI/ISO C++ 1430conforming programs must not rely on a maximum depth greater than 17. 1431 1432@item -fuse-cxa-atexit 1433@opindex fuse-cxa-atexit 1434Register destructors for objects with static storage duration with the 1435@code{__cxa_atexit} function rather than the @code{atexit} function. 1436This option is required for fully standards-compliant handling of static 1437destructors, but will only work if your C library supports 1438@code{__cxa_atexit}. 1439 1440@item -fvtable-gc 1441@opindex fvtable-gc 1442Emit special relocations for vtables and virtual function references 1443so that the linker can identify unused virtual functions and zero out 1444vtable slots that refer to them. This is most useful with 1445@option{-ffunction-sections} and @option{-Wl,--gc-sections}, in order to 1446also discard the functions themselves. 1447 1448This optimization requires GNU as and GNU ld. Not all systems support 1449this option. @option{-Wl,--gc-sections} is ignored without @option{-static}. 1450 1451@item -fno-weak 1452@opindex fno-weak 1453Do not use weak symbol support, even if it is provided by the linker. 1454By default, G++ will use weak symbols if they are available. This 1455option exists only for testing, and should not be used by end-users; 1456it will result in inferior code and has no benefits. This option may 1457be removed in a future release of G++. 1458 1459@item -nostdinc++ 1460@opindex nostdinc++ 1461Do not search for header files in the standard directories specific to 1462C++, but do still search the other standard directories. (This option 1463is used when building the C++ library.) 1464@end table 1465 1466In addition, these optimization, warning, and code generation options 1467have meanings only for C++ programs: 1468 1469@table @gcctabopt 1470@item -fno-default-inline 1471@opindex fno-default-inline 1472Do not assume @samp{inline} for functions defined inside a class scope. 1473@xref{Optimize Options,,Options That Control Optimization}. Note that these 1474functions will have linkage like inline functions; they just won't be 1475inlined by default. 1476 1477@item -Wabi @r{(C++ only)} 1478@opindex Wabi 1479Warn when G++ generates code that is probably not compatible with the 1480vendor-neutral C++ ABI. Although an effort has been made to warn about 1481all such cases, there are probably some cases that are not warned about, 1482even though G++ is generating incompatible code. There may also be 1483cases where warnings are emitted even though the code that is generated 1484will be compatible. 1485 1486You should rewrite your code to avoid these warnings if you are 1487concerned about the fact that code generated by G++ may not be binary 1488compatible with code generated by other compilers. 1489 1490The known incompatibilities at this point include: 1491 1492@itemize @bullet 1493 1494@item 1495Incorrect handling of tail-padding for bit-fields. G++ may attempt to 1496pack data into the same byte as a base class. For example: 1497 1498@smallexample 1499struct A @{ virtual void f(); int f1 : 1; @}; 1500struct B : public A @{ int f2 : 1; @}; 1501@end smallexample 1502 1503@noindent 1504In this case, G++ will place @code{B::f2} into the same byte 1505as@code{A::f1}; other compilers will not. You can avoid this problem 1506by explicitly padding @code{A} so that its size is a multiple of the 1507byte size on your platform; that will cause G++ and other compilers to 1508layout @code{B} identically. 1509 1510@item 1511Incorrect handling of tail-padding for virtual bases. G++ does not use 1512tail padding when laying out virtual bases. For example: 1513 1514@smallexample 1515struct A @{ virtual void f(); char c1; @}; 1516struct B @{ B(); char c2; @}; 1517struct C : public A, public virtual B @{@}; 1518@end smallexample 1519 1520@noindent 1521In this case, G++ will not place @code{B} into the tail-padding for 1522@code{A}; other compilers will. You can avoid this problem by 1523explicitly padding @code{A} so that its size is a multiple of its 1524alignment (ignoring virtual base classes); that will cause G++ and other 1525compilers to layout @code{C} identically. 1526 1527@item 1528Incorrect handling of bit-fields with declared widths greater than that 1529of their underlying types, when the bit-fields appear in a union. For 1530example: 1531 1532@smallexample 1533union U @{ int i : 4096; @}; 1534@end smallexample 1535 1536@noindent 1537Assuming that an @code{int} does not have 4096 bits, G++ will make the 1538union too small by the number of bits in an @code{int}. 1539 1540@item 1541Empty classes can be placed at incorrect offsets. For example: 1542 1543@smallexample 1544struct A @{@}; 1545 1546struct B @{ 1547 A a; 1548 virtual void f (); 1549@}; 1550 1551struct C : public B, public A @{@}; 1552@end smallexample 1553 1554@noindent 1555G++ will place the @code{A} base class of @code{C} at a nonzero offset; 1556it should be placed at offset zero. G++ mistakenly believes that the 1557@code{A} data member of @code{B} is already at offset zero. 1558 1559@item 1560Names of template functions whose types involve @code{typename} or 1561template template parameters can be mangled incorrectly. 1562 1563@smallexample 1564template <typename Q> 1565void f(typename Q::X) @{@} 1566 1567template <template <typename> class Q> 1568void f(typename Q<int>::X) @{@} 1569@end smallexample 1570 1571@noindent 1572Instantiations of these templates may be mangled incorrectly. 1573 1574@end itemize 1575 1576@item -Wctor-dtor-privacy @r{(C++ only)} 1577@opindex Wctor-dtor-privacy 1578Warn when a class seems unusable because all the constructors or 1579destructors in that class are private, and it has neither friends nor 1580public static member functions. This warning is enabled by default. 1581 1582@item -Wnon-virtual-dtor @r{(C++ only)} 1583@opindex Wnon-virtual-dtor 1584Warn when a class appears to be polymorphic, thereby requiring a virtual 1585destructor, yet it declares a non-virtual one. 1586This warning is enabled by @option{-Wall}. 1587 1588@item -Wreorder @r{(C++ only)} 1589@opindex Wreorder 1590@cindex reordering, warning 1591@cindex warning for reordering of member initializers 1592Warn when the order of member initializers given in the code does not 1593match the order in which they must be executed. For instance: 1594 1595@smallexample 1596struct A @{ 1597 int i; 1598 int j; 1599 A(): j (0), i (1) @{ @} 1600@}; 1601@end smallexample 1602 1603The compiler will rearrange the member initializers for @samp{i} 1604and @samp{j} to match the declaration order of the members, emitting 1605a warning to that effect. This warning is enabled by @option{-Wall}. 1606@end table 1607 1608The following @option{-W@dots{}} options are not affected by @option{-Wall}. 1609 1610@table @gcctabopt 1611@item -Weffc++ @r{(C++ only)} 1612@opindex Weffc++ 1613Warn about violations of the following style guidelines from Scott Meyers' 1614@cite{Effective C++} book: 1615 1616@itemize @bullet 1617@item 1618Item 11: Define a copy constructor and an assignment operator for classes 1619with dynamically allocated memory. 1620 1621@item 1622Item 12: Prefer initialization to assignment in constructors. 1623 1624@item 1625Item 14: Make destructors virtual in base classes. 1626 1627@item 1628Item 15: Have @code{operator=} return a reference to @code{*this}. 1629 1630@item 1631Item 23: Don't try to return a reference when you must return an object. 1632 1633@end itemize 1634 1635Also warn about violations of the following style guidelines from 1636Scott Meyers' @cite{More Effective C++} book: 1637 1638@itemize @bullet 1639@item 1640Item 6: Distinguish between prefix and postfix forms of increment and 1641decrement operators. 1642 1643@item 1644Item 7: Never overload @code{&&}, @code{||}, or @code{,}. 1645 1646@end itemize 1647 1648When selecting this option, be aware that the standard library 1649headers do not obey all of these guidelines; use @samp{grep -v} 1650to filter out those warnings. 1651 1652@item -Wno-deprecated @r{(C++ only)} 1653@opindex Wno-deprecated 1654Do not warn about usage of deprecated features. @xref{Deprecated Features}. 1655 1656@item -Wno-non-template-friend @r{(C++ only)} 1657@opindex Wno-non-template-friend 1658Disable warnings when non-templatized friend functions are declared 1659within a template. Since the advent of explicit template specification 1660support in G++, if the name of the friend is an unqualified-id (i.e., 1661@samp{friend foo(int)}), the C++ language specification demands that the 1662friend declare or define an ordinary, nontemplate function. (Section 166314.5.3). Before G++ implemented explicit specification, unqualified-ids 1664could be interpreted as a particular specialization of a templatized 1665function. Because this non-conforming behavior is no longer the default 1666behavior for G++, @option{-Wnon-template-friend} allows the compiler to 1667check existing code for potential trouble spots and is on by default. 1668This new compiler behavior can be turned off with 1669@option{-Wno-non-template-friend} which keeps the conformant compiler code 1670but disables the helpful warning. 1671 1672@item -Wold-style-cast @r{(C++ only)} 1673@opindex Wold-style-cast 1674Warn if an old-style (C-style) cast to a non-void type is used within 1675a C++ program. The new-style casts (@samp{static_cast}, 1676@samp{reinterpret_cast}, and @samp{const_cast}) are less vulnerable to 1677unintended effects and much easier to search for. 1678 1679@item -Woverloaded-virtual @r{(C++ only)} 1680@opindex Woverloaded-virtual 1681@cindex overloaded virtual fn, warning 1682@cindex warning for overloaded virtual fn 1683Warn when a function declaration hides virtual functions from a 1684base class. For example, in: 1685 1686@smallexample 1687struct A @{ 1688 virtual void f(); 1689@}; 1690 1691struct B: public A @{ 1692 void f(int); 1693@}; 1694@end smallexample 1695 1696the @code{A} class version of @code{f} is hidden in @code{B}, and code 1697like: 1698 1699@smallexample 1700B* b; 1701b->f(); 1702@end smallexample 1703 1704will fail to compile. 1705 1706@item -Wno-pmf-conversions @r{(C++ only)} 1707@opindex Wno-pmf-conversions 1708Disable the diagnostic for converting a bound pointer to member function 1709to a plain pointer. 1710 1711@item -Wsign-promo @r{(C++ only)} 1712@opindex Wsign-promo 1713Warn when overload resolution chooses a promotion from unsigned or 1714enumeral type to a signed type, over a conversion to an unsigned type of 1715the same size. Previous versions of G++ would try to preserve 1716unsignedness, but the standard mandates the current behavior. 1717 1718@item -Wsynth @r{(C++ only)} 1719@opindex Wsynth 1720@cindex warning for synthesized methods 1721@cindex synthesized methods, warning 1722Warn when G++'s synthesis behavior does not match that of cfront. For 1723instance: 1724 1725@smallexample 1726struct A @{ 1727 operator int (); 1728 A& operator = (int); 1729@}; 1730 1731main () 1732@{ 1733 A a,b; 1734 a = b; 1735@} 1736@end smallexample 1737 1738In this example, G++ will synthesize a default @samp{A& operator = 1739(const A&);}, while cfront will use the user-defined @samp{operator =}. 1740@end table 1741 1742@node Objective-C Dialect Options 1743@section Options Controlling Objective-C Dialect 1744 1745@cindex compiler options, Objective-C 1746@cindex Objective-C options, command line 1747@cindex options, Objective-C 1748This section describes the command-line options that are only meaningful 1749for Objective-C programs, but you can also use most of the GNU compiler 1750options regardless of what language your program is in. For example, 1751you might compile a file @code{some_class.m} like this: 1752 1753@example 1754gcc -g -fgnu-runtime -O -c some_class.m 1755@end example 1756 1757@noindent 1758In this example, @option{-fgnu-runtime} is an option meant only for 1759Objective-C programs; you can use the other options with any language 1760supported by GCC@. 1761 1762Here is a list of options that are @emph{only} for compiling Objective-C 1763programs: 1764 1765@table @gcctabopt 1766@item -fconstant-string-class=@var{class-name} 1767@opindex fconstant-string-class 1768Use @var{class-name} as the name of the class to instantiate for each 1769literal string specified with the syntax @code{@@"@dots{}"}. The default 1770class name is @code{NXConstantString}. 1771 1772@item -fgnu-runtime 1773@opindex fgnu-runtime 1774Generate object code compatible with the standard GNU Objective-C 1775runtime. This is the default for most types of systems. 1776 1777@item -fnext-runtime 1778@opindex fnext-runtime 1779Generate output compatible with the NeXT runtime. This is the default 1780for NeXT-based systems, including Darwin and Mac OS X@. The macro 1781@code{__NEXT_RUNTIME__} is predefined if (and only if) this option is 1782used. 1783 1784@item -gen-decls 1785@opindex gen-decls 1786Dump interface declarations for all classes seen in the source file to a 1787file named @file{@var{sourcename}.decl}. 1788 1789@item -Wno-protocol 1790@opindex Wno-protocol 1791If a class is declared to implement a protocol, a warning is issued for 1792every method in the protocol that is not implemented by the class. The 1793default behavior is to issue a warning for every method not explicitly 1794implemented in the class, even if a method implementation is inherited 1795from the superclass. If you use the @code{-Wno-protocol} option, then 1796methods inherited from the superclass are considered to be implemented, 1797and no warning is issued for them. 1798 1799@item -Wselector 1800@opindex Wselector 1801Warn if multiple methods of different types for the same selector are 1802found during compilation. The check is performed on the list of methods 1803in the final stage of compilation. Additionally, a check is performed 1804for each selector appearing in a @code{@@selector(@dots{})} 1805expression, and a corresponding method for that selector has been found 1806during compilation. Because these checks scan the method table only at 1807the end of compilation, these warnings are not produced if the final 1808stage of compilation is not reached, for example because an error is 1809found during compilation, or because the @code{-fsyntax-only} option is 1810being used. 1811 1812@item -Wundeclared-selector 1813@opindex Wundeclared-selector 1814Warn if a @code{@@selector(@dots{})} expression referring to an 1815undeclared selector is found. A selector is considered undeclared if no 1816method with that name has been declared before the 1817@code{@@selector(@dots{})} expression, either explicitly in an 1818@code{@@interface} or @code{@@protocol} declaration, or implicitly in 1819an @code{@@implementation} section. This option always performs its 1820checks as soon as a @code{@@selector(@dots{})} expression is found, 1821while @code{-Wselector} only performs its checks in the final stage of 1822compilation. This also enforces the coding style convention 1823that methods and selectors must be declared before being used. 1824 1825@c not documented because only avail via -Wp 1826@c @item -print-objc-runtime-info 1827 1828@end table 1829 1830@node Language Independent Options 1831@section Options to Control Diagnostic Messages Formatting 1832@cindex options to control diagnostics formatting 1833@cindex diagnostic messages 1834@cindex message formatting 1835 1836Traditionally, diagnostic messages have been formatted irrespective of 1837the output device's aspect (e.g.@: its width, @dots{}). The options described 1838below can be used to control the diagnostic messages formatting 1839algorithm, e.g.@: how many characters per line, how often source location 1840information should be reported. Right now, only the C++ front end can 1841honor these options. However it is expected, in the near future, that 1842the remaining front ends would be able to digest them correctly. 1843 1844@table @gcctabopt 1845@item -fmessage-length=@var{n} 1846@opindex fmessage-length 1847Try to format error messages so that they fit on lines of about @var{n} 1848characters. The default is 72 characters for @command{g++} and 0 for the rest of 1849the front ends supported by GCC@. If @var{n} is zero, then no 1850line-wrapping will be done; each error message will appear on a single 1851line. 1852 1853@opindex fdiagnostics-show-location 1854@item -fdiagnostics-show-location=once 1855Only meaningful in line-wrapping mode. Instructs the diagnostic messages 1856reporter to emit @emph{once} source location information; that is, in 1857case the message is too long to fit on a single physical line and has to 1858be wrapped, the source location won't be emitted (as prefix) again, 1859over and over, in subsequent continuation lines. This is the default 1860behavior. 1861 1862@item -fdiagnostics-show-location=every-line 1863Only meaningful in line-wrapping mode. Instructs the diagnostic 1864messages reporter to emit the same source location information (as 1865prefix) for physical lines that result from the process of breaking 1866a message which is too long to fit on a single line. 1867 1868@end table 1869 1870@node Warning Options 1871@section Options to Request or Suppress Warnings 1872@cindex options to control warnings 1873@cindex warning messages 1874@cindex messages, warning 1875@cindex suppressing warnings 1876 1877Warnings are diagnostic messages that report constructions which 1878are not inherently erroneous but which are risky or suggest there 1879may have been an error. 1880 1881You can request many specific warnings with options beginning @samp{-W}, 1882for example @option{-Wimplicit} to request warnings on implicit 1883declarations. Each of these specific warning options also has a 1884negative form beginning @samp{-Wno-} to turn off warnings; 1885for example, @option{-Wno-implicit}. This manual lists only one of the 1886two forms, whichever is not the default. 1887 1888The following options control the amount and kinds of warnings produced 1889by GCC; for further, language-specific options also refer to 1890@ref{C++ Dialect Options} and @ref{Objective-C Dialect Options}. 1891 1892@table @gcctabopt 1893@cindex syntax checking 1894@item -fsyntax-only 1895@opindex fsyntax-only 1896Check the code for syntax errors, but don't do anything beyond that. 1897 1898@item -pedantic 1899@opindex pedantic 1900Issue all the warnings demanded by strict ISO C and ISO C++; 1901reject all programs that use forbidden extensions, and some other 1902programs that do not follow ISO C and ISO C++. For ISO C, follows the 1903version of the ISO C standard specified by any @option{-std} option used. 1904 1905Valid ISO C and ISO C++ programs should compile properly with or without 1906this option (though a rare few will require @option{-ansi} or a 1907@option{-std} option specifying the required version of ISO C)@. However, 1908without this option, certain GNU extensions and traditional C and C++ 1909features are supported as well. With this option, they are rejected. 1910 1911@option{-pedantic} does not cause warning messages for use of the 1912alternate keywords whose names begin and end with @samp{__}. Pedantic 1913warnings are also disabled in the expression that follows 1914@code{__extension__}. However, only system header files should use 1915these escape routes; application programs should avoid them. 1916@xref{Alternate Keywords}. 1917 1918Some users try to use @option{-pedantic} to check programs for strict ISO 1919C conformance. They soon find that it does not do quite what they want: 1920it finds some non-ISO practices, but not all---only those for which 1921ISO C @emph{requires} a diagnostic, and some others for which 1922diagnostics have been added. 1923 1924A feature to report any failure to conform to ISO C might be useful in 1925some instances, but would require considerable additional work and would 1926be quite different from @option{-pedantic}. We don't have plans to 1927support such a feature in the near future. 1928 1929Where the standard specified with @option{-std} represents a GNU 1930extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a 1931corresponding @dfn{base standard}, the version of ISO C on which the GNU 1932extended dialect is based. Warnings from @option{-pedantic} are given 1933where they are required by the base standard. (It would not make sense 1934for such warnings to be given only for features not in the specified GNU 1935C dialect, since by definition the GNU dialects of C include all 1936features the compiler supports with the given option, and there would be 1937nothing to warn about.) 1938 1939@item -pedantic-errors 1940@opindex pedantic-errors 1941Like @option{-pedantic}, except that errors are produced rather than 1942warnings. 1943 1944@item -w 1945@opindex w 1946Inhibit all warning messages. 1947 1948@item -Wno-import 1949@opindex Wno-import 1950Inhibit warning messages about the use of @samp{#import}. 1951 1952@item -Wchar-subscripts 1953@opindex Wchar-subscripts 1954Warn if an array subscript has type @code{char}. This is a common cause 1955of error, as programmers often forget that this type is signed on some 1956machines. 1957 1958@item -Wcomment 1959@opindex Wcomment 1960Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*} 1961comment, or whenever a Backslash-Newline appears in a @samp{//} comment. 1962 1963@item -Wformat 1964@opindex Wformat 1965Check calls to @code{printf} and @code{scanf}, etc., to make sure that 1966the arguments supplied have types appropriate to the format string 1967specified, and that the conversions specified in the format string make 1968sense. This includes standard functions, and others specified by format 1969attributes (@pxref{Function Attributes}), in the @code{printf}, 1970@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension, 1971not in the C standard) families. 1972 1973The formats are checked against the format features supported by GNU 1974libc version 2.2. These include all ISO C90 and C99 features, as well 1975as features from the Single Unix Specification and some BSD and GNU 1976extensions. Other library implementations may not support all these 1977features; GCC does not support warning about features that go beyond a 1978particular library's limitations. However, if @option{-pedantic} is used 1979with @option{-Wformat}, warnings will be given about format features not 1980in the selected standard version (but not for @code{strfmon} formats, 1981since those are not in any version of the C standard). @xref{C Dialect 1982Options,,Options Controlling C Dialect}. 1983 1984Since @option{-Wformat} also checks for null format arguments for 1985several functions, @option{-Wformat} also implies @option{-Wnonnull}. 1986 1987@option{-Wformat} is included in @option{-Wall}. For more control over some 1988aspects of format checking, the options @option{-Wno-format-y2k}, 1989@option{-Wno-format-extra-args}, @option{-Wno-format-zero-length}, 1990@option{-Wformat-nonliteral}, @option{-Wformat-security}, and 1991@option{-Wformat=2} are available, but are not included in @option{-Wall}. 1992 1993@item -Wno-format-y2k 1994@opindex Wno-format-y2k 1995If @option{-Wformat} is specified, do not warn about @code{strftime} 1996formats which may yield only a two-digit year. 1997 1998@item -Wno-format-extra-args 1999@opindex Wno-format-extra-args 2000If @option{-Wformat} is specified, do not warn about excess arguments to a 2001@code{printf} or @code{scanf} format function. The C standard specifies 2002that such arguments are ignored. 2003 2004Where the unused arguments lie between used arguments that are 2005specified with @samp{$} operand number specifications, normally 2006warnings are still given, since the implementation could not know what 2007type to pass to @code{va_arg} to skip the unused arguments. However, 2008in the case of @code{scanf} formats, this option will suppress the 2009warning if the unused arguments are all pointers, since the Single 2010Unix Specification says that such unused arguments are allowed. 2011 2012@item -Wno-format-zero-length 2013@opindex Wno-format-zero-length 2014If @option{-Wformat} is specified, do not warn about zero-length formats. 2015The C standard specifies that zero-length formats are allowed. 2016 2017@item -Wformat-nonliteral 2018@opindex Wformat-nonliteral 2019If @option{-Wformat} is specified, also warn if the format string is not a 2020string literal and so cannot be checked, unless the format function 2021takes its format arguments as a @code{va_list}. 2022 2023@item -Wformat-security 2024@opindex Wformat-security 2025If @option{-Wformat} is specified, also warn about uses of format 2026functions that represent possible security problems. At present, this 2027warns about calls to @code{printf} and @code{scanf} functions where the 2028format string is not a string literal and there are no format arguments, 2029as in @code{printf (foo);}. This may be a security hole if the format 2030string came from untrusted input and contains @samp{%n}. (This is 2031currently a subset of what @option{-Wformat-nonliteral} warns about, but 2032in future warnings may be added to @option{-Wformat-security} that are not 2033included in @option{-Wformat-nonliteral}.) 2034 2035@item -Wformat=2 2036@opindex Wformat=2 2037Enable @option{-Wformat} plus format checks not included in 2038@option{-Wformat}. Currently equivalent to @samp{-Wformat 2039-Wformat-nonliteral -Wformat-security}. 2040 2041@item -Wnonnull 2042@opindex Wnonnull 2043Enable warning about passing a null pointer for arguments marked as 2044requiring a non-null value by the @code{nonnull} function attribute. 2045 2046@option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It 2047can be disabled with the @option{-Wno-nonnull} option. 2048 2049@item -Wimplicit-int 2050@opindex Wimplicit-int 2051Warn when a declaration does not specify a type. 2052 2053@item -Wimplicit-function-declaration 2054@itemx -Werror-implicit-function-declaration 2055@opindex Wimplicit-function-declaration 2056@opindex Werror-implicit-function-declaration 2057Give a warning (or error) whenever a function is used before being 2058declared. 2059 2060@item -Wimplicit 2061@opindex Wimplicit 2062Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}. 2063 2064@item -Wmain 2065@opindex Wmain 2066Warn if the type of @samp{main} is suspicious. @samp{main} should be a 2067function with external linkage, returning int, taking either zero 2068arguments, two, or three arguments of appropriate types. 2069 2070@item -Wmissing-braces 2071@opindex Wmissing-braces 2072Warn if an aggregate or union initializer is not fully bracketed. In 2073the following example, the initializer for @samp{a} is not fully 2074bracketed, but that for @samp{b} is fully bracketed. 2075 2076@smallexample 2077int a[2][2] = @{ 0, 1, 2, 3 @}; 2078int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @}; 2079@end smallexample 2080 2081@item -Wparentheses 2082@opindex Wparentheses 2083Warn if parentheses are omitted in certain contexts, such 2084as when there is an assignment in a context where a truth value 2085is expected, or when operators are nested whose precedence people 2086often get confused about. 2087 2088Also warn about constructions where there may be confusion to which 2089@code{if} statement an @code{else} branch belongs. Here is an example of 2090such a case: 2091 2092@smallexample 2093@group 2094@{ 2095 if (a) 2096 if (b) 2097 foo (); 2098 else 2099 bar (); 2100@} 2101@end group 2102@end smallexample 2103 2104In C, every @code{else} branch belongs to the innermost possible @code{if} 2105statement, which in this example is @code{if (b)}. This is often not 2106what the programmer expected, as illustrated in the above example by 2107indentation the programmer chose. When there is the potential for this 2108confusion, GCC will issue a warning when this flag is specified. 2109To eliminate the warning, add explicit braces around the innermost 2110@code{if} statement so there is no way the @code{else} could belong to 2111the enclosing @code{if}. The resulting code would look like this: 2112 2113@smallexample 2114@group 2115@{ 2116 if (a) 2117 @{ 2118 if (b) 2119 foo (); 2120 else 2121 bar (); 2122 @} 2123@} 2124@end group 2125@end smallexample 2126 2127@item -Wsequence-point 2128@opindex Wsequence-point 2129Warn about code that may have undefined semantics because of violations 2130of sequence point rules in the C standard. 2131 2132The C standard defines the order in which expressions in a C program are 2133evaluated in terms of @dfn{sequence points}, which represent a partial 2134ordering between the execution of parts of the program: those executed 2135before the sequence point, and those executed after it. These occur 2136after the evaluation of a full expression (one which is not part of a 2137larger expression), after the evaluation of the first operand of a 2138@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a 2139function is called (but after the evaluation of its arguments and the 2140expression denoting the called function), and in certain other places. 2141Other than as expressed by the sequence point rules, the order of 2142evaluation of subexpressions of an expression is not specified. All 2143these rules describe only a partial order rather than a total order, 2144since, for example, if two functions are called within one expression 2145with no sequence point between them, the order in which the functions 2146are called is not specified. However, the standards committee have 2147ruled that function calls do not overlap. 2148 2149It is not specified when between sequence points modifications to the 2150values of objects take effect. Programs whose behavior depends on this 2151have undefined behavior; the C standard specifies that ``Between the 2152previous and next sequence point an object shall have its stored value 2153modified at most once by the evaluation of an expression. Furthermore, 2154the prior value shall be read only to determine the value to be 2155stored.''. If a program breaks these rules, the results on any 2156particular implementation are entirely unpredictable. 2157 2158Examples of code with undefined behavior are @code{a = a++;}, @code{a[n] 2159= b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not 2160diagnosed by this option, and it may give an occasional false positive 2161result, but in general it has been found fairly effective at detecting 2162this sort of problem in programs. 2163 2164The present implementation of this option only works for C programs. A 2165future implementation may also work for C++ programs. 2166 2167The C standard is worded confusingly, therefore there is some debate 2168over the precise meaning of the sequence point rules in subtle cases. 2169Links to discussions of the problem, including proposed formal 2170definitions, may be found on our readings page, at 2171@w{@uref{http://gcc.gnu.org/readings.html}}. 2172 2173@item -Wreturn-type 2174@opindex Wreturn-type 2175Warn whenever a function is defined with a return-type that defaults to 2176@code{int}. Also warn about any @code{return} statement with no 2177return-value in a function whose return-type is not @code{void}. 2178 2179For C++, a function without return type always produces a diagnostic 2180message, even when @option{-Wno-return-type} is specified. The only 2181exceptions are @samp{main} and functions defined in system headers. 2182 2183@item -Wswitch 2184@opindex Wswitch 2185Warn whenever a @code{switch} statement has an index of enumeral type 2186and lacks a @code{case} for one or more of the named codes of that 2187enumeration. (The presence of a @code{default} label prevents this 2188warning.) @code{case} labels outside the enumeration range also 2189provoke warnings when this option is used. 2190 2191@item -Wswitch-default 2192@opindex Wswitch-switch 2193Warn whenever a @code{switch} statement does not have a @code{default} 2194case. 2195 2196@item -Wswitch-enum 2197@opindex Wswitch-enum 2198Warn whenever a @code{switch} statement has an index of enumeral type 2199and lacks a @code{case} for one or more of the named codes of that 2200enumeration. @code{case} labels outside the enumeration range also 2201provoke warnings when this option is used. 2202 2203@item -Wtrigraphs 2204@opindex Wtrigraphs 2205Warn if any trigraphs are encountered that might change the meaning of 2206the program (trigraphs within comments are not warned about). 2207 2208@item -Wunused-function 2209@opindex Wunused-function 2210Warn whenever a static function is declared but not defined or a 2211non\-inline static function is unused. 2212 2213@item -Wunused-label 2214@opindex Wunused-label 2215Warn whenever a label is declared but not used. 2216 2217To suppress this warning use the @samp{unused} attribute 2218(@pxref{Variable Attributes}). 2219 2220@item -Wunused-parameter 2221@opindex Wunused-parameter 2222Warn whenever a function parameter is unused aside from its declaration. 2223 2224To suppress this warning use the @samp{unused} attribute 2225(@pxref{Variable Attributes}). 2226 2227@item -Wunused-variable 2228@opindex Wunused-variable 2229Warn whenever a local variable or non-constant static variable is unused 2230aside from its declaration 2231 2232To suppress this warning use the @samp{unused} attribute 2233(@pxref{Variable Attributes}). 2234 2235@item -Wunused-value 2236@opindex Wunused-value 2237Warn whenever a statement computes a result that is explicitly not used. 2238 2239To suppress this warning cast the expression to @samp{void}. 2240 2241@item -Wunused 2242@opindex Wunused 2243All the above @option{-Wunused} options combined. 2244 2245In order to get a warning about an unused function parameter, you must 2246either specify @samp{-W -Wunused} or separately specify 2247@option{-Wunused-parameter}. 2248 2249@item -Wuninitialized 2250@opindex Wuninitialized 2251Warn if an automatic variable is used without first being initialized or 2252if a variable may be clobbered by a @code{setjmp} call. 2253 2254These warnings are possible only in optimizing compilation, 2255because they require data flow information that is computed only 2256when optimizing. If you don't specify @option{-O}, you simply won't 2257get these warnings. 2258 2259These warnings occur only for variables that are candidates for 2260register allocation. Therefore, they do not occur for a variable that 2261is declared @code{volatile}, or whose address is taken, or whose size 2262is other than 1, 2, 4 or 8 bytes. Also, they do not occur for 2263structures, unions or arrays, even when they are in registers. 2264 2265Note that there may be no warning about a variable that is used only 2266to compute a value that itself is never used, because such 2267computations may be deleted by data flow analysis before the warnings 2268are printed. 2269 2270These warnings are made optional because GCC is not smart 2271enough to see all the reasons why the code might be correct 2272despite appearing to have an error. Here is one example of how 2273this can happen: 2274 2275@smallexample 2276@group 2277@{ 2278 int x; 2279 switch (y) 2280 @{ 2281 case 1: x = 1; 2282 break; 2283 case 2: x = 4; 2284 break; 2285 case 3: x = 5; 2286 @} 2287 foo (x); 2288@} 2289@end group 2290@end smallexample 2291 2292@noindent 2293If the value of @code{y} is always 1, 2 or 3, then @code{x} is 2294always initialized, but GCC doesn't know this. Here is 2295another common case: 2296 2297@smallexample 2298@{ 2299 int save_y; 2300 if (change_y) save_y = y, y = new_y; 2301 @dots{} 2302 if (change_y) y = save_y; 2303@} 2304@end smallexample 2305 2306@noindent 2307This has no bug because @code{save_y} is used only if it is set. 2308 2309@cindex @code{longjmp} warnings 2310This option also warns when a non-volatile automatic variable might be 2311changed by a call to @code{longjmp}. These warnings as well are possible 2312only in optimizing compilation. 2313 2314The compiler sees only the calls to @code{setjmp}. It cannot know 2315where @code{longjmp} will be called; in fact, a signal handler could 2316call it at any point in the code. As a result, you may get a warning 2317even when there is in fact no problem because @code{longjmp} cannot 2318in fact be called at the place which would cause a problem. 2319 2320Some spurious warnings can be avoided if you declare all the functions 2321you use that never return as @code{noreturn}. @xref{Function 2322Attributes}. 2323 2324@item -Wunknown-pragmas 2325@opindex Wunknown-pragmas 2326@cindex warning for unknown pragmas 2327@cindex unknown pragmas, warning 2328@cindex pragmas, warning of unknown 2329Warn when a #pragma directive is encountered which is not understood by 2330GCC@. If this command line option is used, warnings will even be issued 2331for unknown pragmas in system header files. This is not the case if 2332the warnings were only enabled by the @option{-Wall} command line option. 2333 2334@item -Wstrict-aliasing 2335@opindex Wstrict-aliasing 2336This option is only active when @option{-fstrict-aliasing} is active. 2337It warns about code which might break the strict aliasing rules that the 2338compiler is using for optimization. The warning does not catch all 2339cases, but does attempt to catch the more common pitfalls. It is 2340included in @option{-Wall}. 2341 2342@item -Wall 2343@opindex Wall 2344All of the above @samp{-W} options combined. This enables all the 2345warnings about constructions that some users consider questionable, and 2346that are easy to avoid (or modify to prevent the warning), even in 2347conjunction with macros. This also enables some language-specific 2348warnings described in @ref{C++ Dialect Options} and 2349@ref{Objective-C Dialect Options}. 2350@end table 2351 2352The following @option{-W@dots{}} options are not implied by @option{-Wall}. 2353Some of them warn about constructions that users generally do not 2354consider questionable, but which occasionally you might wish to check 2355for; others warn about constructions that are necessary or hard to avoid 2356in some cases, and there is no simple way to modify the code to suppress 2357the warning. 2358 2359@table @gcctabopt 2360@item -W 2361@opindex W 2362Print extra warning messages for these events: 2363 2364@itemize @bullet 2365@item 2366A function can return either with or without a value. (Falling 2367off the end of the function body is considered returning without 2368a value.) For example, this function would evoke such a 2369warning: 2370 2371@smallexample 2372@group 2373foo (a) 2374@{ 2375 if (a > 0) 2376 return a; 2377@} 2378@end group 2379@end smallexample 2380 2381@item 2382An expression-statement or the left-hand side of a comma expression 2383contains no side effects. 2384To suppress the warning, cast the unused expression to void. 2385For example, an expression such as @samp{x[i,j]} will cause a warning, 2386but @samp{x[(void)i,j]} will not. 2387 2388@item 2389An unsigned value is compared against zero with @samp{<} or @samp{>=}. 2390 2391@item 2392A comparison like @samp{x<=y<=z} appears; this is equivalent to 2393@samp{(x<=y ? 1 : 0) <= z}, which is a different interpretation from 2394that of ordinary mathematical notation. 2395 2396@item 2397Storage-class specifiers like @code{static} are not the first things in 2398a declaration. According to the C Standard, this usage is obsolescent. 2399 2400@item 2401The return type of a function has a type qualifier such as @code{const}. 2402Such a type qualifier has no effect, since the value returned by a 2403function is not an lvalue. (But don't warn about the GNU extension of 2404@code{volatile void} return types. That extension will be warned about 2405if @option{-pedantic} is specified.) 2406 2407@item 2408If @option{-Wall} or @option{-Wunused} is also specified, warn about unused 2409arguments. 2410 2411@item 2412A comparison between signed and unsigned values could produce an 2413incorrect result when the signed value is converted to unsigned. 2414(But don't warn if @option{-Wno-sign-compare} is also specified.) 2415 2416@item 2417An aggregate has a partly bracketed initializer. 2418For example, the following code would evoke such a warning, 2419because braces are missing around the initializer for @code{x.h}: 2420 2421@smallexample 2422struct s @{ int f, g; @}; 2423struct t @{ struct s h; int i; @}; 2424struct t x = @{ 1, 2, 3 @}; 2425@end smallexample 2426 2427@item 2428An aggregate has an initializer which does not initialize all members. 2429For example, the following code would cause such a warning, because 2430@code{x.h} would be implicitly initialized to zero: 2431 2432@smallexample 2433struct s @{ int f, g, h; @}; 2434struct s x = @{ 3, 4 @}; 2435@end smallexample 2436@end itemize 2437 2438@item -Wno-div-by-zero 2439@opindex Wno-div-by-zero 2440@opindex Wdiv-by-zero 2441Do not warn about compile-time integer division by zero. Floating point 2442division by zero is not warned about, as it can be a legitimate way of 2443obtaining infinities and NaNs. 2444 2445@item -Wsystem-headers 2446@opindex Wsystem-headers 2447@cindex warnings from system headers 2448@cindex system headers, warnings from 2449Print warning messages for constructs found in system header files. 2450Warnings from system headers are normally suppressed, on the assumption 2451that they usually do not indicate real problems and would only make the 2452compiler output harder to read. Using this command line option tells 2453GCC to emit warnings from system headers as if they occurred in user 2454code. However, note that using @option{-Wall} in conjunction with this 2455option will @emph{not} warn about unknown pragmas in system 2456headers---for that, @option{-Wunknown-pragmas} must also be used. 2457 2458@item -Wfloat-equal 2459@opindex Wfloat-equal 2460Warn if floating point values are used in equality comparisons. 2461 2462The idea behind this is that sometimes it is convenient (for the 2463programmer) to consider floating-point values as approximations to 2464infinitely precise real numbers. If you are doing this, then you need 2465to compute (by analyzing the code, or in some other way) the maximum or 2466likely maximum error that the computation introduces, and allow for it 2467when performing comparisons (and when producing output, but that's a 2468different problem). In particular, instead of testing for equality, you 2469would check to see whether the two values have ranges that overlap; and 2470this is done with the relational operators, so equality comparisons are 2471probably mistaken. 2472 2473@item -Wtraditional @r{(C only)} 2474@opindex Wtraditional 2475Warn about certain constructs that behave differently in traditional and 2476ISO C@. Also warn about ISO C constructs that have no traditional C 2477equivalent, and/or problematic constructs which should be avoided. 2478 2479@itemize @bullet 2480@item 2481Macro parameters that appear within string literals in the macro body. 2482In traditional C macro replacement takes place within string literals, 2483but does not in ISO C@. 2484 2485@item 2486In traditional C, some preprocessor directives did not exist. 2487Traditional preprocessors would only consider a line to be a directive 2488if the @samp{#} appeared in column 1 on the line. Therefore 2489@option{-Wtraditional} warns about directives that traditional C 2490understands but would ignore because the @samp{#} does not appear as the 2491first character on the line. It also suggests you hide directives like 2492@samp{#pragma} not understood by traditional C by indenting them. Some 2493traditional implementations would not recognize @samp{#elif}, so it 2494suggests avoiding it altogether. 2495 2496@item 2497A function-like macro that appears without arguments. 2498 2499@item 2500The unary plus operator. 2501 2502@item 2503The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point 2504constant suffixes. (Traditional C does support the @samp{L} suffix on integer 2505constants.) Note, these suffixes appear in macros defined in the system 2506headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}. 2507Use of these macros in user code might normally lead to spurious 2508warnings, however gcc's integrated preprocessor has enough context to 2509avoid warning in these cases. 2510 2511@item 2512A function declared external in one block and then used after the end of 2513the block. 2514 2515@item 2516A @code{switch} statement has an operand of type @code{long}. 2517 2518@item 2519A non-@code{static} function declaration follows a @code{static} one. 2520This construct is not accepted by some traditional C compilers. 2521 2522@item 2523The ISO type of an integer constant has a different width or 2524signedness from its traditional type. This warning is only issued if 2525the base of the constant is ten. I.e.@: hexadecimal or octal values, which 2526typically represent bit patterns, are not warned about. 2527 2528@item 2529Usage of ISO string concatenation is detected. 2530 2531@item 2532Initialization of automatic aggregates. 2533 2534@item 2535Identifier conflicts with labels. Traditional C lacks a separate 2536namespace for labels. 2537 2538@item 2539Initialization of unions. If the initializer is zero, the warning is 2540omitted. This is done under the assumption that the zero initializer in 2541user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing 2542initializer warnings and relies on default initialization to zero in the 2543traditional C case. 2544 2545@item 2546Conversions by prototypes between fixed/floating point values and vice 2547versa. The absence of these prototypes when compiling with traditional 2548C would cause serious problems. This is a subset of the possible 2549conversion warnings, for the full set use @option{-Wconversion}. 2550 2551@item 2552Use of ISO C style function definitions. This warning intentionally is 2553@emph{not} issued for prototype declarations or variadic functions 2554because these ISO C features will appear in your code when using 2555libiberty's traditional C compatibility macros, @code{PARAMS} and 2556@code{VPARAMS}. This warning is also bypassed for nested functions 2557because that feature is already a gcc extension and thus not relevant to 2558traditional C compatibility. 2559@end itemize 2560 2561@item -Wundef 2562@opindex Wundef 2563Warn if an undefined identifier is evaluated in an @samp{#if} directive. 2564 2565@item -Wendif-labels 2566@opindex Wendif-labels 2567Warn whenever an @samp{#else} or an @samp{#endif} are followed by text. 2568 2569@item -Wshadow 2570@opindex Wshadow 2571Warn whenever a local variable shadows another local variable, parameter or 2572global variable or whenever a built-in function is shadowed. 2573 2574@item -Wlarger-than-@var{len} 2575@opindex Wlarger-than 2576Warn whenever an object of larger than @var{len} bytes is defined. 2577 2578@item -Wpointer-arith 2579@opindex Wpointer-arith 2580Warn about anything that depends on the ``size of'' a function type or 2581of @code{void}. GNU C assigns these types a size of 1, for 2582convenience in calculations with @code{void *} pointers and pointers 2583to functions. 2584 2585@item -Wbad-function-cast @r{(C only)} 2586@opindex Wbad-function-cast 2587Warn whenever a function call is cast to a non-matching type. 2588For example, warn if @code{int malloc()} is cast to @code{anything *}. 2589 2590@item -Wcast-qual 2591@opindex Wcast-qual 2592Warn whenever a pointer is cast so as to remove a type qualifier from 2593the target type. For example, warn if a @code{const char *} is cast 2594to an ordinary @code{char *}. 2595 2596@item -Wcast-align 2597@opindex Wcast-align 2598Warn whenever a pointer is cast such that the required alignment of the 2599target is increased. For example, warn if a @code{char *} is cast to 2600an @code{int *} on machines where integers can only be accessed at 2601two- or four-byte boundaries. 2602 2603@item -Wwrite-strings 2604@opindex Wwrite-strings 2605When compiling C, give string constants the type @code{const 2606char[@var{length}]} so that 2607copying the address of one into a non-@code{const} @code{char *} 2608pointer will get a warning; when compiling C++, warn about the 2609deprecated conversion from string constants to @code{char *}. 2610These warnings will help you find at 2611compile time code that can try to write into a string constant, but 2612only if you have been very careful about using @code{const} in 2613declarations and prototypes. Otherwise, it will just be a nuisance; 2614this is why we did not make @option{-Wall} request these warnings. 2615 2616@item -Wconversion 2617@opindex Wconversion 2618Warn if a prototype causes a type conversion that is different from what 2619would happen to the same argument in the absence of a prototype. This 2620includes conversions of fixed point to floating and vice versa, and 2621conversions changing the width or signedness of a fixed point argument 2622except when the same as the default promotion. 2623 2624Also, warn if a negative integer constant expression is implicitly 2625converted to an unsigned type. For example, warn about the assignment 2626@code{x = -1} if @code{x} is unsigned. But do not warn about explicit 2627casts like @code{(unsigned) -1}. 2628 2629@item -Wsign-compare 2630@opindex Wsign-compare 2631@cindex warning for comparison of signed and unsigned values 2632@cindex comparison of signed and unsigned values, warning 2633@cindex signed and unsigned values, comparison warning 2634Warn when a comparison between signed and unsigned values could produce 2635an incorrect result when the signed value is converted to unsigned. 2636This warning is enabled by @option{-W}, and by @option{-Wall} 2637in C++ only. 2638 2639@item -Waggregate-return 2640@opindex Waggregate-return 2641Warn if any functions that return structures or unions are defined or 2642called. (In languages where you can return an array, this also elicits 2643a warning.) 2644 2645@item -Wstrict-prototypes @r{(C only)} 2646@opindex Wstrict-prototypes 2647Warn if a function is declared or defined without specifying the 2648argument types. (An old-style function definition is permitted without 2649a warning if preceded by a declaration which specifies the argument 2650types.) 2651 2652@item -Wmissing-prototypes @r{(C only)} 2653@opindex Wmissing-prototypes 2654Warn if a global function is defined without a previous prototype 2655declaration. This warning is issued even if the definition itself 2656provides a prototype. The aim is to detect global functions that fail 2657to be declared in header files. 2658 2659@item -Wmissing-declarations @r{(C only)} 2660@opindex Wmissing-declarations 2661Warn if a global function is defined without a previous declaration. 2662Do so even if the definition itself provides a prototype. 2663Use this option to detect global functions that are not declared in 2664header files. 2665 2666@item -Wmissing-noreturn 2667@opindex Wmissing-noreturn 2668Warn about functions which might be candidates for attribute @code{noreturn}. 2669Note these are only possible candidates, not absolute ones. Care should 2670be taken to manually verify functions actually do not ever return before 2671adding the @code{noreturn} attribute, otherwise subtle code generation 2672bugs could be introduced. You will not get a warning for @code{main} in 2673hosted C environments. 2674 2675@item -Wmissing-format-attribute 2676@opindex Wmissing-format-attribute 2677@opindex Wformat 2678If @option{-Wformat} is enabled, also warn about functions which might be 2679candidates for @code{format} attributes. Note these are only possible 2680candidates, not absolute ones. GCC will guess that @code{format} 2681attributes might be appropriate for any function that calls a function 2682like @code{vprintf} or @code{vscanf}, but this might not always be the 2683case, and some functions for which @code{format} attributes are 2684appropriate may not be detected. This option has no effect unless 2685@option{-Wformat} is enabled (possibly by @option{-Wall}). 2686 2687@item -Wno-multichar 2688@opindex Wno-multichar 2689@opindex Wmultichar 2690Do not warn if a multicharacter constant (@samp{'FOOF'}) is used. 2691Usually they indicate a typo in the user's code, as they have 2692implementation-defined values, and should not be used in portable code. 2693 2694@item -Wno-deprecated-declarations 2695@opindex Wno-deprecated-declarations 2696Do not warn about uses of functions, variables, and types marked as 2697deprecated by using the @code{deprecated} attribute. 2698(@pxref{Function Attributes}, @pxref{Variable Attributes}, 2699@pxref{Type Attributes}.) 2700 2701@item -Wpacked 2702@opindex Wpacked 2703Warn if a structure is given the packed attribute, but the packed 2704attribute has no effect on the layout or size of the structure. 2705Such structures may be mis-aligned for little benefit. For 2706instance, in this code, the variable @code{f.x} in @code{struct bar} 2707will be misaligned even though @code{struct bar} does not itself 2708have the packed attribute: 2709 2710@smallexample 2711@group 2712struct foo @{ 2713 int x; 2714 char a, b, c, d; 2715@} __attribute__((packed)); 2716struct bar @{ 2717 char z; 2718 struct foo f; 2719@}; 2720@end group 2721@end smallexample 2722 2723@item -Wpadded 2724@opindex Wpadded 2725Warn if padding is included in a structure, either to align an element 2726of the structure or to align the whole structure. Sometimes when this 2727happens it is possible to rearrange the fields of the structure to 2728reduce the padding and so make the structure smaller. 2729 2730@item -Wredundant-decls 2731@opindex Wredundant-decls 2732Warn if anything is declared more than once in the same scope, even in 2733cases where multiple declaration is valid and changes nothing. 2734 2735@item -Wnested-externs @r{(C only)} 2736@opindex Wnested-externs 2737Warn if an @code{extern} declaration is encountered within a function. 2738 2739@item -Wunreachable-code 2740@opindex Wunreachable-code 2741Warn if the compiler detects that code will never be executed. 2742 2743This option is intended to warn when the compiler detects that at 2744least a whole line of source code will never be executed, because 2745some condition is never satisfied or because it is after a 2746procedure that never returns. 2747 2748It is possible for this option to produce a warning even though there 2749are circumstances under which part of the affected line can be executed, 2750so care should be taken when removing apparently-unreachable code. 2751 2752For instance, when a function is inlined, a warning may mean that the 2753line is unreachable in only one inlined copy of the function. 2754 2755This option is not made part of @option{-Wall} because in a debugging 2756version of a program there is often substantial code which checks 2757correct functioning of the program and is, hopefully, unreachable 2758because the program does work. Another common use of unreachable 2759code is to provide behavior which is selectable at compile-time. 2760 2761@item -Winline 2762@opindex Winline 2763Warn if a function can not be inlined and it was declared as inline. 2764Even with this option, the compiler will not warn about failures to 2765inline functions declared in system headers. 2766 2767The compiler uses a variety of heuristics to determine whether or not 2768to inline a function. For example, the compiler takes into account 2769the size of the function being inlined and the the amount of inlining 2770that has already been done in the current function. Therefore, 2771seemingly insignificant changes in the source program can cause the 2772warnings produced by @option{-Winline} to appear or disappear. 2773 2774@item -Wlong-long 2775@opindex Wlong-long 2776@opindex Wno-long-long 2777Warn if @samp{long long} type is used. This is default. To inhibit 2778the warning messages, use @option{-Wno-long-long}. Flags 2779@option{-Wlong-long} and @option{-Wno-long-long} are taken into account 2780only when @option{-pedantic} flag is used. 2781 2782@item -Wdisabled-optimization 2783@opindex Wdisabled-optimization 2784Warn if a requested optimization pass is disabled. This warning does 2785not generally indicate that there is anything wrong with your code; it 2786merely indicates that GCC's optimizers were unable to handle the code 2787effectively. Often, the problem is that your code is too big or too 2788complex; GCC will refuse to optimize programs when the optimization 2789itself is likely to take inordinate amounts of time. 2790 2791@item -Werror 2792@opindex Werror 2793Make all warnings into errors. 2794@end table 2795 2796@node Debugging Options 2797@section Options for Debugging Your Program or GCC 2798@cindex options, debugging 2799@cindex debugging information options 2800 2801GCC has various special options that are used for debugging 2802either your program or GCC: 2803 2804@table @gcctabopt 2805@item -g 2806@opindex g 2807Produce debugging information in the operating system's native format 2808(stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging 2809information. 2810 2811On most systems that use stabs format, @option{-g} enables use of extra 2812debugging information that only GDB can use; this extra information 2813makes debugging work better in GDB but will probably make other debuggers 2814crash or 2815refuse to read the program. If you want to control for certain whether 2816to generate the extra information, use @option{-gstabs+}, @option{-gstabs}, 2817@option{-gxcoff+}, @option{-gxcoff}, @option{-gdwarf-1+}, @option{-gdwarf-1}, 2818or @option{-gvms} (see below). 2819 2820Unlike most other C compilers, GCC allows you to use @option{-g} with 2821@option{-O}. The shortcuts taken by optimized code may occasionally 2822produce surprising results: some variables you declared may not exist 2823at all; flow of control may briefly move where you did not expect it; 2824some statements may not be executed because they compute constant 2825results or their values were already at hand; some statements may 2826execute in different places because they were moved out of loops. 2827 2828Nevertheless it proves possible to debug optimized output. This makes 2829it reasonable to use the optimizer for programs that might have bugs. 2830 2831The following options are useful when GCC is generated with the 2832capability for more than one debugging format. 2833 2834@item -ggdb 2835@opindex ggdb 2836Produce debugging information for use by GDB@. This means to use the 2837most expressive format available (DWARF 2, stabs, or the native format 2838if neither of those are supported), including GDB extensions if at all 2839possible. 2840 2841@item -gstabs 2842@opindex gstabs 2843Produce debugging information in stabs format (if that is supported), 2844without GDB extensions. This is the format used by DBX on most BSD 2845systems. On MIPS, Alpha and System V Release 4 systems this option 2846produces stabs debugging output which is not understood by DBX or SDB@. 2847On System V Release 4 systems this option requires the GNU assembler. 2848 2849@item -gstabs+ 2850@opindex gstabs+ 2851Produce debugging information in stabs format (if that is supported), 2852using GNU extensions understood only by the GNU debugger (GDB)@. The 2853use of these extensions is likely to make other debuggers crash or 2854refuse to read the program. 2855 2856@item -gcoff 2857@opindex gcoff 2858Produce debugging information in COFF format (if that is supported). 2859This is the format used by SDB on most System V systems prior to 2860System V Release 4. 2861 2862@item -gxcoff 2863@opindex gxcoff 2864Produce debugging information in XCOFF format (if that is supported). 2865This is the format used by the DBX debugger on IBM RS/6000 systems. 2866 2867@item -gxcoff+ 2868@opindex gxcoff+ 2869Produce debugging information in XCOFF format (if that is supported), 2870using GNU extensions understood only by the GNU debugger (GDB)@. The 2871use of these extensions is likely to make other debuggers crash or 2872refuse to read the program, and may cause assemblers other than the GNU 2873assembler (GAS) to fail with an error. 2874 2875@item -gdwarf 2876@opindex gdwarf 2877Produce debugging information in DWARF version 1 format (if that is 2878supported). This is the format used by SDB on most System V Release 4 2879systems. 2880 2881This option is deprecated. 2882 2883@item -gdwarf+ 2884@opindex gdwarf+ 2885Produce debugging information in DWARF version 1 format (if that is 2886supported), using GNU extensions understood only by the GNU debugger 2887(GDB)@. The use of these extensions is likely to make other debuggers 2888crash or refuse to read the program. 2889 2890This option is deprecated. 2891 2892@item -gdwarf-2 2893@opindex gdwarf-2 2894Produce debugging information in DWARF version 2 format (if that is 2895supported). This is the format used by DBX on IRIX 6. 2896 2897@item -gvms 2898@opindex gvms 2899Produce debugging information in VMS debug format (if that is 2900supported). This is the format used by DEBUG on VMS systems. 2901 2902@item -g@var{level} 2903@itemx -ggdb@var{level} 2904@itemx -gstabs@var{level} 2905@itemx -gcoff@var{level} 2906@itemx -gxcoff@var{level} 2907@itemx -gvms@var{level} 2908Request debugging information and also use @var{level} to specify how 2909much information. The default level is 2. 2910 2911Level 1 produces minimal information, enough for making backtraces in 2912parts of the program that you don't plan to debug. This includes 2913descriptions of functions and external variables, but no information 2914about local variables and no line numbers. 2915 2916Level 3 includes extra information, such as all the macro definitions 2917present in the program. Some debuggers support macro expansion when 2918you use @option{-g3}. 2919 2920Note that in order to avoid confusion between DWARF1 debug level 2, 2921and DWARF2, neither @option{-gdwarf} nor @option{-gdwarf-2} accept 2922a concatenated debug level. Instead use an additional @option{-g@var{level}} 2923option to change the debug level for DWARF1 or DWARF2. 2924 2925@item -feliminate-dwarf2-dups 2926@opindex feliminate-dwarf2-dups 2927Compress DWARF2 debugging information by eliminating duplicated 2928information about each symbol. This option only makes sense when 2929generating DWARF2 debugging information with @option{-gdwarf-2}. 2930 2931@cindex @command{prof} 2932@item -p 2933@opindex p 2934Generate extra code to write profile information suitable for the 2935analysis program @command{prof}. You must use this option when compiling 2936the source files you want data about, and you must also use it when 2937linking. 2938 2939@cindex @command{gprof} 2940@item -pg 2941@opindex pg 2942Generate extra code to write profile information suitable for the 2943analysis program @command{gprof}. You must use this option when compiling 2944the source files you want data about, and you must also use it when 2945linking. 2946 2947@item -Q 2948@opindex Q 2949Makes the compiler print out each function name as it is compiled, and 2950print some statistics about each pass when it finishes. 2951 2952@item -ftime-report 2953@opindex ftime-report 2954Makes the compiler print some statistics about the time consumed by each 2955pass when it finishes. 2956 2957@item -fmem-report 2958@opindex fmem-report 2959Makes the compiler print some statistics about permanent memory 2960allocation when it finishes. 2961 2962@item -fprofile-arcs 2963@opindex fprofile-arcs 2964Instrument @dfn{arcs} during compilation to generate coverage data or 2965for profile-directed block ordering. During execution the program 2966records how many times each branch is executed and how many times it is 2967taken. When the compiled program exits it saves this data to a file 2968called @file{@var{auxname}.da} for each source file. @var{auxname} is 2969generated from the name of the output file, if explicitly specified and 2970it is not the final executable, otherwise it is the basename of the 2971source file. In both cases any suffix is removed (e.g. @file{foo.da} 2972for input file @file{dir/foo.c}, or @file{dir/foo.da} for output file 2973specified as @option{-o dir/foo.o}). 2974 2975For profile-directed block ordering, compile the program with 2976@option{-fprofile-arcs} plus optimization and code generation options, 2977generate the arc profile information by running the program on a 2978selected workload, and then compile the program again with the same 2979optimization and code generation options plus 2980@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that 2981Control Optimization}). 2982 2983The other use of @option{-fprofile-arcs} is for use with @command{gcov}, 2984when it is used with the @option{-ftest-coverage} option. 2985 2986With @option{-fprofile-arcs}, for each function of your program GCC 2987creates a program flow graph, then finds a spanning tree for the graph. 2988Only arcs that are not on the spanning tree have to be instrumented: the 2989compiler adds code to count the number of times that these arcs are 2990executed. When an arc is the only exit or only entrance to a block, the 2991instrumentation code can be added to the block; otherwise, a new basic 2992block must be created to hold the instrumentation code. 2993 2994@need 2000 2995@item -ftest-coverage 2996@opindex ftest-coverage 2997Create data files for the @command{gcov} code-coverage utility 2998(@pxref{Gcov,, @command{gcov}---a Test Coverage Program}). See 2999@option{-fprofile-arcs} option above for a description of @var{auxname}. 3000 3001@table @gcctabopt 3002@item @var{auxname}.bb 3003A mapping from basic blocks to line numbers, which @command{gcov} uses to 3004associate basic block execution counts with line numbers. 3005 3006@item @var{auxname}.bbg 3007A list of all arcs in the program flow graph. This allows @command{gcov} 3008to reconstruct the program flow graph, so that it can compute all basic 3009block and arc execution counts from the information in the 3010@file{@var{auxname}.da} file. 3011@end table 3012 3013Use @option{-ftest-coverage} with @option{-fprofile-arcs}; the latter 3014option adds instrumentation to the program, which then writes 3015execution counts to another data file: 3016 3017@table @gcctabopt 3018@item @var{auxname}.da 3019Runtime arc execution counts, used in conjunction with the arc 3020information in the file @file{@var{auxname}.bbg}. 3021@end table 3022 3023Coverage data will map better to the source files if 3024@option{-ftest-coverage} is used without optimization. 3025 3026@item -d@var{letters} 3027@opindex d 3028Says to make debugging dumps during compilation at times specified by 3029@var{letters}. This is used for debugging the compiler. The file names 3030for most of the dumps are made by appending a pass number and a word to 3031the @var{dumpname}. @var{dumpname} is generated from the name of the 3032output file, if explicitly specified and it is not an executable, 3033otherwise it is the basename of the source file. In both cases any 3034suffix is removed (e.g. @file{foo.00.rtl} or @file{foo.01.sibling}). 3035Here are the possible letters for use in @var{letters}, and their 3036meanings: 3037 3038@table @samp 3039@item A 3040@opindex dA 3041Annotate the assembler output with miscellaneous debugging information. 3042@item b 3043@opindex db 3044Dump after computing branch probabilities, to @file{@var{file}.14.bp}. 3045@item B 3046@opindex dB 3047Dump after block reordering, to @file{@var{file}.32.bbro}. 3048@item c 3049@opindex dc 3050Dump after instruction combination, to the file @file{@var{file}.19.combine}. 3051@item C 3052@opindex dC 3053Dump after the first if conversion, to the file @file{@var{file}.15.ce1}. 3054@item d 3055@opindex dd 3056Dump after delayed branch scheduling, to @file{@var{file}.34.dbr}. 3057@item D 3058@opindex dD 3059Dump all macro definitions, at the end of preprocessing, in addition to 3060normal output. 3061@item e 3062@opindex de 3063Dump after SSA optimizations, to @file{@var{file}.04.ssa} and 3064@file{@var{file}.07.ussa}. 3065@item E 3066@opindex dE 3067Dump after the second if conversion, to @file{@var{file}.29.ce3}. 3068@item f 3069@opindex df 3070Dump after control and data flow analysis, to @file{@var{file}.14.cfg}. 3071Also dump after life analysis, to @file{@var{file}.18.life}. 3072@item F 3073@opindex dF 3074Dump after purging @code{ADDRESSOF} codes, to @file{@var{file}.10.addressof}. 3075@item g 3076@opindex dg 3077Dump after global register allocation, to @file{@var{file}.24.greg}. 3078@item G 3079@opindex dG 3080Dump after GCSE, to @file{@var{file}.11.gcse}. 3081@item h 3082@opindex dh 3083Dump after finalization of EH handling code, to @file{@var{file}.02.eh}. 3084@item i 3085@opindex di 3086Dump after sibling call optimizations, to @file{@var{file}.01.sibling}. 3087@item j 3088@opindex dj 3089Dump after the first jump optimization, to @file{@var{file}.03.jump}. 3090@item k 3091@opindex dk 3092Dump after conversion from registers to stack, to @file{@var{file}.31.stack}. 3093@item l 3094@opindex dl 3095Dump after local register allocation, to @file{@var{file}.23.lreg}. 3096@item L 3097@opindex dL 3098Dump after loop optimization, to @file{@var{file}.12.loop}. 3099@item M 3100@opindex dM 3101Dump after performing the machine dependent reorganization pass, to 3102@file{@var{file}.33.mach}. 3103@item n 3104@opindex dn 3105Dump after register renumbering, to @file{@var{file}.28.rnreg}. 3106@item N 3107@opindex dN 3108Dump after the register move pass, to @file{@var{file}.21.regmove}. 3109@item o 3110@opindex do 3111Dump after post-reload optimizations, to @file{@var{file}.25.postreload}. 3112@item r 3113@opindex dr 3114Dump after RTL generation, to @file{@var{file}.00.rtl}. 3115@item R 3116@opindex dR 3117Dump after the second scheduling pass, to @file{@var{file}.30.sched2}. 3118@item s 3119@opindex ds 3120Dump after CSE (including the jump optimization that sometimes follows 3121CSE), to @file{@var{file}.09.cse}. 3122@item S 3123@opindex dS 3124Dump after the first scheduling pass, to @file{@var{file}.22.sched}. 3125@item t 3126@opindex dt 3127Dump after the second CSE pass (including the jump optimization that 3128sometimes follows CSE), to @file{@var{file}.17.cse2}. 3129@item T 3130@opindex dT 3131Dump after running tracer, to @file{@var{file}.16.tracer}. 3132@item u 3133@opindex du 3134Dump after null pointer elimination pass to @file{@var{file}.08.null}. 3135@item w 3136@opindex dw 3137Dump after the second flow pass, to @file{@var{file}.26.flow2}. 3138@item W 3139@opindex dW 3140Dump after SSA conditional constant propagation, to 3141@file{@var{file}.05.ssaccp}. 3142@item X 3143@opindex dX 3144Dump after SSA dead code elimination, to @file{@var{file}.06.ssadce}. 3145@item z 3146@opindex dz 3147Dump after the peephole pass, to @file{@var{file}.27.peephole2}. 3148@item a 3149@opindex da 3150Produce all the dumps listed above. 3151@item m 3152@opindex dm 3153Print statistics on memory usage, at the end of the run, to 3154standard error. 3155@item p 3156@opindex dp 3157Annotate the assembler output with a comment indicating which 3158pattern and alternative was used. The length of each instruction is 3159also printed. 3160@item P 3161@opindex dP 3162Dump the RTL in the assembler output as a comment before each instruction. 3163Also turns on @option{-dp} annotation. 3164@item v 3165@opindex dv 3166For each of the other indicated dump files (except for 3167@file{@var{file}.00.rtl}), dump a representation of the control flow graph 3168suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}. 3169@item x 3170@opindex dx 3171Just generate RTL for a function instead of compiling it. Usually used 3172with @samp{r}. 3173@item y 3174@opindex dy 3175Dump debugging information during parsing, to standard error. 3176@end table 3177 3178@item -fdump-unnumbered 3179@opindex fdump-unnumbered 3180When doing debugging dumps (see @option{-d} option above), suppress instruction 3181numbers and line number note output. This makes it more feasible to 3182use diff on debugging dumps for compiler invocations with different 3183options, in particular with and without @option{-g}. 3184 3185@item -fdump-translation-unit @r{(C and C++ only)} 3186@itemx -fdump-translation-unit-@var{options} @r{(C and C++ only)} 3187@opindex fdump-translation-unit 3188Dump a representation of the tree structure for the entire translation 3189unit to a file. The file name is made by appending @file{.tu} to the 3190source file name. If the @samp{-@var{options}} form is used, @var{options} 3191controls the details of the dump as described for the 3192@option{-fdump-tree} options. 3193 3194@item -fdump-class-hierarchy @r{(C++ only)} 3195@itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)} 3196@opindex fdump-class-hierarchy 3197Dump a representation of each class's hierarchy and virtual function 3198table layout to a file. The file name is made by appending @file{.class} 3199to the source file name. If the @samp{-@var{options}} form is used, 3200@var{options} controls the details of the dump as described for the 3201@option{-fdump-tree} options. 3202 3203@item -fdump-tree-@var{switch} @r{(C++ only)} 3204@itemx -fdump-tree-@var{switch}-@var{options} @r{(C++ only)} 3205@opindex fdump-tree 3206Control the dumping at various stages of processing the intermediate 3207language tree to a file. The file name is generated by appending a switch 3208specific suffix to the source file name. If the @samp{-@var{options}} 3209form is used, @var{options} is a list of @samp{-} separated options that 3210control the details of the dump. Not all options are applicable to all 3211dumps, those which are not meaningful will be ignored. The following 3212options are available 3213 3214@table @samp 3215@item address 3216Print the address of each node. Usually this is not meaningful as it 3217changes according to the environment and source file. Its primary use 3218is for tying up a dump file with a debug environment. 3219@item slim 3220Inhibit dumping of members of a scope or body of a function merely 3221because that scope has been reached. Only dump such items when they 3222are directly reachable by some other path. 3223@item all 3224Turn on all options. 3225@end table 3226 3227The following tree dumps are possible: 3228@table @samp 3229@item original 3230Dump before any tree based optimization, to @file{@var{file}.original}. 3231@item optimized 3232Dump after all tree based optimization, to @file{@var{file}.optimized}. 3233@item inlined 3234Dump after function inlining, to @file{@var{file}.inlined}. 3235@end table 3236 3237@item -frandom-seed=@var{string} 3238@opindex frandom-string 3239This option provides a seed that GCC uses when it would otherwise use 3240random numbers. At present, this is used to generate certain symbol names 3241that have to be different in every compiled file. 3242 3243The @var{string} should be different for every file you compile. 3244 3245@item -fsched-verbose=@var{n} 3246@opindex fsched-verbose 3247On targets that use instruction scheduling, this option controls the 3248amount of debugging output the scheduler prints. This information is 3249written to standard error, unless @option{-dS} or @option{-dR} is 3250specified, in which case it is output to the usual dump 3251listing file, @file{.sched} or @file{.sched2} respectively. However 3252for @var{n} greater than nine, the output is always printed to standard 3253error. 3254 3255For @var{n} greater than zero, @option{-fsched-verbose} outputs the 3256same information as @option{-dRS}. For @var{n} greater than one, it 3257also output basic block probabilities, detailed ready list information 3258and unit/insn info. For @var{n} greater than two, it includes RTL 3259at abort point, control-flow and regions info. And for @var{n} over 3260four, @option{-fsched-verbose} also includes dependence info. 3261 3262@item -save-temps 3263@opindex save-temps 3264Store the usual ``temporary'' intermediate files permanently; place them 3265in the current directory and name them based on the source file. Thus, 3266compiling @file{foo.c} with @samp{-c -save-temps} would produce files 3267@file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a 3268preprocessed @file{foo.i} output file even though the compiler now 3269normally uses an integrated preprocessor. 3270 3271@item -time 3272@opindex time 3273Report the CPU time taken by each subprocess in the compilation 3274sequence. For C source files, this is the compiler proper and assembler 3275(plus the linker if linking is done). The output looks like this: 3276 3277@smallexample 3278# cc1 0.12 0.01 3279# as 0.00 0.01 3280@end smallexample 3281 3282The first number on each line is the ``user time,'' that is time spent 3283executing the program itself. The second number is ``system time,'' 3284time spent executing operating system routines on behalf of the program. 3285Both numbers are in seconds. 3286 3287@item -print-file-name=@var{library} 3288@opindex print-file-name 3289Print the full absolute name of the library file @var{library} that 3290would be used when linking---and don't do anything else. With this 3291option, GCC does not compile or link anything; it just prints the 3292file name. 3293 3294@item -print-multi-directory 3295@opindex print-multi-directory 3296Print the directory name corresponding to the multilib selected by any 3297other switches present in the command line. This directory is supposed 3298to exist in @env{GCC_EXEC_PREFIX}. 3299 3300@item -print-multi-lib 3301@opindex print-multi-lib 3302Print the mapping from multilib directory names to compiler switches 3303that enable them. The directory name is separated from the switches by 3304@samp{;}, and each switch starts with an @samp{@@} instead of the 3305@samp{-}, without spaces between multiple switches. This is supposed to 3306ease shell-processing. 3307 3308@item -print-prog-name=@var{program} 3309@opindex print-prog-name 3310Like @option{-print-file-name}, but searches for a program such as @samp{cpp}. 3311 3312@item -print-libgcc-file-name 3313@opindex print-libgcc-file-name 3314Same as @option{-print-file-name=libgcc.a}. 3315 3316This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs} 3317but you do want to link with @file{libgcc.a}. You can do 3318 3319@example 3320gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name` 3321@end example 3322 3323@item -print-search-dirs 3324@opindex print-search-dirs 3325Print the name of the configured installation directory and a list of 3326program and library directories gcc will search---and don't do anything else. 3327 3328This is useful when gcc prints the error message 3329@samp{installation problem, cannot exec cpp0: No such file or directory}. 3330To resolve this you either need to put @file{cpp0} and the other compiler 3331components where gcc expects to find them, or you can set the environment 3332variable @env{GCC_EXEC_PREFIX} to the directory where you installed them. 3333Don't forget the trailing '/'. 3334@xref{Environment Variables}. 3335 3336@item -dumpmachine 3337@opindex dumpmachine 3338Print the compiler's target machine (for example, 3339@samp{i686-pc-linux-gnu})---and don't do anything else. 3340 3341@item -dumpversion 3342@opindex dumpversion 3343Print the compiler version (for example, @samp{3.0})---and don't do 3344anything else. 3345 3346@item -dumpspecs 3347@opindex dumpspecs 3348Print the compiler's built-in specs---and don't do anything else. (This 3349is used when GCC itself is being built.) @xref{Spec Files}. 3350@end table 3351 3352@node Optimize Options 3353@section Options That Control Optimization 3354@cindex optimize options 3355@cindex options, optimization 3356 3357These options control various sorts of optimizations. 3358 3359Without any optimization option, the compiler's goal is to reduce the 3360cost of compilation and to make debugging produce the expected 3361results. Statements are independent: if you stop the program with a 3362breakpoint between statements, you can then assign a new value to any 3363variable or change the program counter to any other statement in the 3364function and get exactly the results you would expect from the source 3365code. 3366 3367Turning on optimization flags makes the compiler attempt to improve 3368the performance and/or code size at the expense of compilation time 3369and possibly the ability to debug the program. 3370 3371Not all optimizations are controlled directly by a flag. Only 3372optimizations that have a flag are listed. 3373 3374@table @gcctabopt 3375@item -O 3376@itemx -O1 3377@opindex O 3378@opindex O1 3379Optimize. Optimizing compilation takes somewhat more time, and a lot 3380more memory for a large function. 3381 3382With @option{-O}, the compiler tries to reduce code size and execution 3383time, without performing any optimizations that take a great deal of 3384compilation time. 3385 3386@option{-O} turns on the following optimization flags: 3387@gccoptlist{-fdefer-pop @gol 3388-fmerge-constants @gol 3389-fthread-jumps @gol 3390-floop-optimize @gol 3391-fcrossjumping @gol 3392-fif-conversion @gol 3393-fif-conversion2 @gol 3394-fdelayed-branch @gol 3395-fguess-branch-probability @gol 3396-fcprop-registers} 3397 3398@option{-O} also turns on @option{-fomit-frame-pointer} on machines 3399where doing so does not interfere with debugging. 3400 3401@item -O2 3402@opindex O2 3403Optimize even more. GCC performs nearly all supported optimizations 3404that do not involve a space-speed tradeoff. The compiler does not 3405perform loop unrolling or function inlining when you specify @option{-O2}. 3406As compared to @option{-O}, this option increases both compilation time 3407and the performance of the generated code. 3408 3409@option{-O2} turns on all optimization flags specified by @option{-O}. It 3410also turns on the following optimization flags: 3411@gccoptlist{-fforce-mem @gol 3412-foptimize-sibling-calls @gol 3413-fstrength-reduce @gol 3414-fcse-follow-jumps -fcse-skip-blocks @gol 3415-frerun-cse-after-loop -frerun-loop-opt @gol 3416-fgcse -fgcse-lm -fgcse-sm @gol 3417-fdelete-null-pointer-checks @gol 3418-fexpensive-optimizations @gol 3419-fregmove @gol 3420-fschedule-insns -fschedule-insns2 @gol 3421-fsched-interblock -fsched-spec @gol 3422-fcaller-saves @gol 3423-fpeephole2 @gol 3424-freorder-blocks -freorder-functions @gol 3425-fstrict-aliasing @gol 3426-falign-functions -falign-jumps @gol 3427-falign-loops -falign-labels} 3428 3429Please note the warning under @option{-fgcse} about 3430invoking @option{-O2} on programs that use computed gotos. 3431 3432@item -O3 3433@opindex O3 3434Optimize yet more. @option{-O3} turns on all optimizations specified by 3435@option{-O2} and also turns on the @option{-finline-functions} and 3436@option{-frename-registers} options. 3437 3438@item -O0 3439@opindex O0 3440Do not optimize. This is the default. 3441 3442@item -Os 3443@opindex Os 3444Optimize for size. @option{-Os} enables all @option{-O2} optimizations that 3445do not typically increase code size. It also performs further 3446optimizations designed to reduce code size. 3447 3448@option{-Os} disables the following optimization flags: 3449@gccoptlist{-falign-functions -falign-jumps -falign-loops @gol 3450-falign-labels -freorder-blocks -fprefetch-loop-arrays} 3451 3452If you use multiple @option{-O} options, with or without level numbers, 3453the last such option is the one that is effective. 3454@end table 3455 3456Options of the form @option{-f@var{flag}} specify machine-independent 3457flags. Most flags have both positive and negative forms; the negative 3458form of @option{-ffoo} would be @option{-fno-foo}. In the table 3459below, only one of the forms is listed---the one you typically will 3460use. You can figure out the other form by either removing @samp{no-} 3461or adding it. 3462 3463The following options control specific optimizations. They are either 3464activated by @option{-O} options or are related to ones that are. You 3465can use the following flags in the rare cases when ``fine-tuning'' of 3466optimizations to be performed is desired. 3467 3468@table @gcctabopt 3469@item -fno-default-inline 3470@opindex fno-default-inline 3471Do not make member functions inline by default merely because they are 3472defined inside the class scope (C++ only). Otherwise, when you specify 3473@w{@option{-O}}, member functions defined inside class scope are compiled 3474inline by default; i.e., you don't need to add @samp{inline} in front of 3475the member function name. 3476 3477@item -fno-defer-pop 3478@opindex fno-defer-pop 3479Always pop the arguments to each function call as soon as that function 3480returns. For machines which must pop arguments after a function call, 3481the compiler normally lets arguments accumulate on the stack for several 3482function calls and pops them all at once. 3483 3484Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 3485 3486@item -fforce-mem 3487@opindex fforce-mem 3488Force memory operands to be copied into registers before doing 3489arithmetic on them. This produces better code by making all memory 3490references potential common subexpressions. When they are not common 3491subexpressions, instruction combination should eliminate the separate 3492register-load. 3493 3494Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 3495 3496@item -fforce-addr 3497@opindex fforce-addr 3498Force memory address constants to be copied into registers before 3499doing arithmetic on them. This may produce better code just as 3500@option{-fforce-mem} may. 3501 3502@item -fomit-frame-pointer 3503@opindex fomit-frame-pointer 3504Don't keep the frame pointer in a register for functions that 3505don't need one. This avoids the instructions to save, set up and 3506restore frame pointers; it also makes an extra register available 3507in many functions. @strong{It also makes debugging impossible on 3508some machines.} 3509 3510On some machines, such as the VAX, this flag has no effect, because 3511the standard calling sequence automatically handles the frame pointer 3512and nothing is saved by pretending it doesn't exist. The 3513machine-description macro @code{FRAME_POINTER_REQUIRED} controls 3514whether a target machine supports this flag. @xref{Registers,,Register 3515Usage, gccint, GNU Compiler Collection (GCC) Internals}. 3516 3517Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 3518 3519@item -foptimize-sibling-calls 3520@opindex foptimize-sibling-calls 3521Optimize sibling and tail recursive calls. 3522 3523Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 3524 3525@item -fno-inline 3526@opindex fno-inline 3527Don't pay attention to the @code{inline} keyword. Normally this option 3528is used to keep the compiler from expanding any functions inline. 3529Note that if you are not optimizing, no functions can be expanded inline. 3530 3531@item -finline-functions 3532@opindex finline-functions 3533Integrate all simple functions into their callers. The compiler 3534heuristically decides which functions are simple enough to be worth 3535integrating in this way. 3536 3537If all calls to a given function are integrated, and the function is 3538declared @code{static}, then the function is normally not output as 3539assembler code in its own right. 3540 3541Enabled at level @option{-O3}. 3542 3543@item -finline-limit=@var{n} 3544@opindex finline-limit 3545By default, gcc limits the size of functions that can be inlined. This flag 3546allows the control of this limit for functions that are explicitly marked as 3547inline (i.e., marked with the inline keyword or defined within the class 3548definition in c++). @var{n} is the size of functions that can be inlined in 3549number of pseudo instructions (not counting parameter handling). The default 3550value of @var{n} is 600. 3551Increasing this value can result in more inlined code at 3552the cost of compilation time and memory consumption. Decreasing usually makes 3553the compilation faster and less code will be inlined (which presumably 3554means slower programs). This option is particularly useful for programs that 3555use inlining heavily such as those based on recursive templates with C++. 3556 3557Inlining is actually controlled by a number of parameters, which may be 3558specified individually by using @option{--param @var{name}=@var{value}}. 3559The @option{-finline-limit=@var{n}} option sets some of these parameters 3560as follows: 3561 3562@table @gcctabopt 3563 @item max-inline-insns 3564 is set to @var{n}. 3565 @item max-inline-insns-single 3566 is set to @var{n}/2. 3567 @item max-inline-insns-auto 3568 is set to @var{n}/2. 3569 @item min-inline-insns 3570 is set to 130 or @var{n}/4, whichever is smaller. 3571 @item max-inline-insns-rtl 3572 is set to @var{n}. 3573@end table 3574 3575Using @option{-finline-limit=600} thus results in the default settings 3576for these parameters. See below for a documentation of the individual 3577parameters controlling inlining. 3578 3579@emph{Note:} pseudo instruction represents, in this particular context, an 3580abstract measurement of function's size. In no way, it represents a count 3581of assembly instructions and as such its exact meaning might change from one 3582release to an another. 3583 3584@item -fkeep-inline-functions 3585@opindex fkeep-inline-functions 3586Even if all calls to a given function are integrated, and the function 3587is declared @code{static}, nevertheless output a separate run-time 3588callable version of the function. This switch does not affect 3589@code{extern inline} functions. 3590 3591@item -fkeep-static-consts 3592@opindex fkeep-static-consts 3593Emit variables declared @code{static const} when optimization isn't turned 3594on, even if the variables aren't referenced. 3595 3596GCC enables this option by default. If you want to force the compiler to 3597check if the variable was referenced, regardless of whether or not 3598optimization is turned on, use the @option{-fno-keep-static-consts} option. 3599 3600@item -fmerge-constants 3601Attempt to merge identical constants (string constants and floating point 3602constants) across compilation units. 3603 3604This option is the default for optimized compilation if the assembler and 3605linker support it. Use @option{-fno-merge-constants} to inhibit this 3606behavior. 3607 3608Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 3609 3610@item -fmerge-all-constants 3611Attempt to merge identical constants and identical variables. 3612 3613This option implies @option{-fmerge-constants}. In addition to 3614@option{-fmerge-constants} this considers e.g. even constant initialized 3615arrays or initialized constant variables with integral or floating point 3616types. Languages like C or C++ require each non-automatic variable to 3617have distinct location, so using this option will result in non-conforming 3618behavior. 3619 3620@item -fno-branch-count-reg 3621@opindex fno-branch-count-reg 3622Do not use ``decrement and branch'' instructions on a count register, 3623but instead generate a sequence of instructions that decrement a 3624register, compare it against zero, then branch based upon the result. 3625This option is only meaningful on architectures that support such 3626instructions, which include x86, PowerPC, IA-64 and S/390. 3627 3628The default is @option{-fbranch-count-reg}, enabled when 3629@option{-fstrength-reduce} is enabled. 3630 3631@item -fno-function-cse 3632@opindex fno-function-cse 3633Do not put function addresses in registers; make each instruction that 3634calls a constant function contain the function's address explicitly. 3635 3636This option results in less efficient code, but some strange hacks 3637that alter the assembler output may be confused by the optimizations 3638performed when this option is not used. 3639 3640The default is @option{-ffunction-cse} 3641 3642@item -fno-zero-initialized-in-bss 3643@opindex fno-zero-initialized-in-bss 3644If the target supports a BSS section, GCC by default puts variables that 3645are initialized to zero into BSS@. This can save space in the resulting 3646code. 3647 3648This option turns off this behavior because some programs explicitly 3649rely on variables going to the data section. E.g., so that the 3650resulting executable can find the beginning of that section and/or make 3651assumptions based on that. 3652 3653The default is @option{-fzero-initialized-in-bss}. 3654 3655@item -fstrength-reduce 3656@opindex fstrength-reduce 3657Perform the optimizations of loop strength reduction and 3658elimination of iteration variables. 3659 3660Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 3661 3662@item -fthread-jumps 3663@opindex fthread-jumps 3664Perform optimizations where we check to see if a jump branches to a 3665location where another comparison subsumed by the first is found. If 3666so, the first branch is redirected to either the destination of the 3667second branch or a point immediately following it, depending on whether 3668the condition is known to be true or false. 3669 3670Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 3671 3672@item -fcse-follow-jumps 3673@opindex fcse-follow-jumps 3674In common subexpression elimination, scan through jump instructions 3675when the target of the jump is not reached by any other path. For 3676example, when CSE encounters an @code{if} statement with an 3677@code{else} clause, CSE will follow the jump when the condition 3678tested is false. 3679 3680Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 3681 3682@item -fcse-skip-blocks 3683@opindex fcse-skip-blocks 3684This is similar to @option{-fcse-follow-jumps}, but causes CSE to 3685follow jumps which conditionally skip over blocks. When CSE 3686encounters a simple @code{if} statement with no else clause, 3687@option{-fcse-skip-blocks} causes CSE to follow the jump around the 3688body of the @code{if}. 3689 3690Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 3691 3692@item -frerun-cse-after-loop 3693@opindex frerun-cse-after-loop 3694Re-run common subexpression elimination after loop optimizations has been 3695performed. 3696 3697Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 3698 3699@item -frerun-loop-opt 3700@opindex frerun-loop-opt 3701Run the loop optimizer twice. 3702 3703Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 3704 3705@item -fgcse 3706@opindex fgcse 3707Perform a global common subexpression elimination pass. 3708This pass also performs global constant and copy propagation. 3709 3710@emph{Note:} When compiling a program using computed gotos, a GCC 3711extension, you may get better runtime performance if you disable 3712the global common subexpression elimination pass by adding 3713@option{-fno-gcse} to the command line. 3714 3715Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 3716 3717@item -fgcse-lm 3718@opindex fgcse-lm 3719When @option{-fgcse-lm} is enabled, global common subexpression elimination will 3720attempt to move loads which are only killed by stores into themselves. This 3721allows a loop containing a load/store sequence to be changed to a load outside 3722the loop, and a copy/store within the loop. 3723 3724Enabled by default when gcse is enabled. 3725 3726@item -fgcse-sm 3727@opindex fgcse-sm 3728When @option{-fgcse-sm} is enabled, A store motion pass is run after global common 3729subexpression elimination. This pass will attempt to move stores out of loops. 3730When used in conjunction with @option{-fgcse-lm}, loops containing a load/store sequence 3731can be changed to a load before the loop and a store after the loop. 3732 3733Enabled by default when gcse is enabled. 3734 3735@item -floop-optimize 3736@opindex floop-optimize 3737Perform loop optimizations: move constant expressions out of loops, simplify 3738exit test conditions and optionally do strength-reduction and loop unrolling as 3739well. 3740 3741Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 3742 3743@item -fcrossjumping 3744@opindex crossjumping 3745Perform cross-jumping transformation. This transformation unifies equivalent code and save code size. The 3746resulting code may or may not perform better than without cross-jumping. 3747 3748Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 3749 3750@item -fif-conversion 3751@opindex if-conversion 3752Attempt to transform conditional jumps into branch-less equivalents. This 3753include use of conditional moves, min, max, set flags and abs instructions, and 3754some tricks doable by standard arithmetics. The use of conditional execution 3755on chips where it is available is controlled by @code{if-conversion2}. 3756 3757Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 3758 3759@item -fif-conversion2 3760@opindex if-conversion2 3761Use conditional execution (where available) to transform conditional jumps into 3762branch-less equivalents. 3763 3764Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 3765 3766@item -fdelete-null-pointer-checks 3767@opindex fdelete-null-pointer-checks 3768Use global dataflow analysis to identify and eliminate useless checks 3769for null pointers. The compiler assumes that dereferencing a null 3770pointer would have halted the program. If a pointer is checked after 3771it has already been dereferenced, it cannot be null. 3772 3773In some environments, this assumption is not true, and programs can 3774safely dereference null pointers. Use 3775@option{-fno-delete-null-pointer-checks} to disable this optimization 3776for programs which depend on that behavior. 3777 3778Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 3779 3780@item -fexpensive-optimizations 3781@opindex fexpensive-optimizations 3782Perform a number of minor optimizations that are relatively expensive. 3783 3784Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 3785 3786@item -foptimize-register-move 3787@itemx -fregmove 3788@opindex foptimize-register-move 3789@opindex fregmove 3790Attempt to reassign register numbers in move instructions and as 3791operands of other simple instructions in order to maximize the amount of 3792register tying. This is especially helpful on machines with two-operand 3793instructions. 3794 3795Note @option{-fregmove} and @option{-foptimize-register-move} are the same 3796optimization. 3797 3798Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 3799 3800@item -fdelayed-branch 3801@opindex fdelayed-branch 3802If supported for the target machine, attempt to reorder instructions 3803to exploit instruction slots available after delayed branch 3804instructions. 3805 3806Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 3807 3808@item -fschedule-insns 3809@opindex fschedule-insns 3810If supported for the target machine, attempt to reorder instructions to 3811eliminate execution stalls due to required data being unavailable. This 3812helps machines that have slow floating point or memory load instructions 3813by allowing other instructions to be issued until the result of the load 3814or floating point instruction is required. 3815 3816Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 3817 3818@item -fschedule-insns2 3819@opindex fschedule-insns2 3820Similar to @option{-fschedule-insns}, but requests an additional pass of 3821instruction scheduling after register allocation has been done. This is 3822especially useful on machines with a relatively small number of 3823registers and where memory load instructions take more than one cycle. 3824 3825Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 3826 3827@item -fno-sched-interblock 3828@opindex fno-sched-interblock 3829Don't schedule instructions across basic blocks. This is normally 3830enabled by default when scheduling before register allocation, i.e.@: 3831with @option{-fschedule-insns} or at @option{-O2} or higher. 3832 3833@item -fno-sched-spec 3834@opindex fno-sched-spec 3835Don't allow speculative motion of non-load instructions. This is normally 3836enabled by default when scheduling before register allocation, i.e.@: 3837with @option{-fschedule-insns} or at @option{-O2} or higher. 3838 3839@item -fsched-spec-load 3840@opindex fsched-spec-load 3841Allow speculative motion of some load instructions. This only makes 3842sense when scheduling before register allocation, i.e.@: with 3843@option{-fschedule-insns} or at @option{-O2} or higher. 3844 3845@item -fsched-spec-load-dangerous 3846@opindex fsched-spec-load-dangerous 3847Allow speculative motion of more load instructions. This only makes 3848sense when scheduling before register allocation, i.e.@: with 3849@option{-fschedule-insns} or at @option{-O2} or higher. 3850 3851@item -fcaller-saves 3852@opindex fcaller-saves 3853Enable values to be allocated in registers that will be clobbered by 3854function calls, by emitting extra instructions to save and restore the 3855registers around such calls. Such allocation is done only when it 3856seems to result in better code than would otherwise be produced. 3857 3858This option is always enabled by default on certain machines, usually 3859those which have no call-preserved registers to use instead. 3860 3861Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 3862 3863@item -fmove-all-movables 3864@opindex fmove-all-movables 3865Forces all invariant computations in loops to be moved 3866outside the loop. 3867 3868@item -freduce-all-givs 3869@opindex freduce-all-givs 3870Forces all general-induction variables in loops to be 3871strength-reduced. 3872 3873@emph{Note:} When compiling programs written in Fortran, 3874@option{-fmove-all-movables} and @option{-freduce-all-givs} are enabled 3875by default when you use the optimizer. 3876 3877These options may generate better or worse code; results are highly 3878dependent on the structure of loops within the source code. 3879 3880These two options are intended to be removed someday, once 3881they have helped determine the efficacy of various 3882approaches to improving loop optimizations. 3883 3884Please let us (@w{@email{gcc@@gcc.gnu.org}} and @w{@email{fortran@@gnu.org}}) 3885know how use of these options affects 3886the performance of your production code. 3887We're very interested in code that runs @emph{slower} 3888when these options are @emph{enabled}. 3889 3890@item -fno-peephole 3891@itemx -fno-peephole2 3892@opindex fno-peephole 3893@opindex fno-peephole2 3894Disable any machine-specific peephole optimizations. The difference 3895between @option{-fno-peephole} and @option{-fno-peephole2} is in how they 3896are implemented in the compiler; some targets use one, some use the 3897other, a few use both. 3898 3899@option{-fpeephole} is enabled by default. 3900@option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 3901 3902@item -fbranch-probabilities 3903@item -fno-guess-branch-probability 3904@opindex fno-guess-branch-probability 3905Do not guess branch probabilities using a randomized model. 3906 3907Sometimes gcc will opt to use a randomized model to guess branch 3908probabilities, when none are available from either profiling feedback 3909(@option{-fprofile-arcs}) or @samp{__builtin_expect}. This means that 3910different runs of the compiler on the same program may produce different 3911object code. 3912 3913In a hard real-time system, people don't want different runs of the 3914compiler to produce code that has different behavior; minimizing 3915non-determinism is of paramount import. This switch allows users to 3916reduce non-determinism, possibly at the expense of inferior 3917optimization. 3918 3919The default is @option{-fguess-branch-probability} at levels 3920@option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 3921 3922@item -freorder-blocks 3923@opindex freorder-blocks 3924Reorder basic blocks in the compiled function in order to reduce number of 3925taken branches and improve code locality. 3926 3927Enabled at levels @option{-O2}, @option{-O3}. 3928 3929@item -freorder-functions 3930@opindex freorder-functions 3931Reorder basic blocks in the compiled function in order to reduce number of 3932taken branches and improve code locality. This is implemented by using special 3933subsections @code{text.hot} for most frequently executed functions and 3934@code{text.unlikely} for unlikely executed functions. Reordering is done by 3935the linker so object file format must support named sections and linker must 3936place them in a reasonable way. 3937 3938Also profile feedback must be available in to make this option effective. See 3939@option{-fprofile-arcs} for details. 3940 3941Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 3942 3943@item -fstrict-aliasing 3944@opindex fstrict-aliasing 3945Allows the compiler to assume the strictest aliasing rules applicable to 3946the language being compiled. For C (and C++), this activates 3947optimizations based on the type of expressions. In particular, an 3948object of one type is assumed never to reside at the same address as an 3949object of a different type, unless the types are almost the same. For 3950example, an @code{unsigned int} can alias an @code{int}, but not a 3951@code{void*} or a @code{double}. A character type may alias any other 3952type. 3953 3954Pay special attention to code like this: 3955@example 3956union a_union @{ 3957 int i; 3958 double d; 3959@}; 3960 3961int f() @{ 3962 a_union t; 3963 t.d = 3.0; 3964 return t.i; 3965@} 3966@end example 3967The practice of reading from a different union member than the one most 3968recently written to (called ``type-punning'') is common. Even with 3969@option{-fstrict-aliasing}, type-punning is allowed, provided the memory 3970is accessed through the union type. So, the code above will work as 3971expected. However, this code might not: 3972@example 3973int f() @{ 3974 a_union t; 3975 int* ip; 3976 t.d = 3.0; 3977 ip = &t.i; 3978 return *ip; 3979@} 3980@end example 3981 3982Every language that wishes to perform language-specific alias analysis 3983should define a function that computes, given an @code{tree} 3984node, an alias set for the node. Nodes in different alias sets are not 3985allowed to alias. For an example, see the C front-end function 3986@code{c_get_alias_set}. 3987 3988Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 3989 3990@item -falign-functions 3991@itemx -falign-functions=@var{n} 3992@opindex falign-functions 3993Align the start of functions to the next power-of-two greater than 3994@var{n}, skipping up to @var{n} bytes. For instance, 3995@option{-falign-functions=32} aligns functions to the next 32-byte 3996boundary, but @option{-falign-functions=24} would align to the next 399732-byte boundary only if this can be done by skipping 23 bytes or less. 3998 3999@option{-fno-align-functions} and @option{-falign-functions=1} are 4000equivalent and mean that functions will not be aligned. 4001 4002Some assemblers only support this flag when @var{n} is a power of two; 4003in that case, it is rounded up. 4004 4005If @var{n} is not specified or is zero, use a machine-dependent default. 4006 4007Enabled at levels @option{-O2}, @option{-O3}. 4008 4009@item -falign-labels 4010@itemx -falign-labels=@var{n} 4011@opindex falign-labels 4012Align all branch targets to a power-of-two boundary, skipping up to 4013@var{n} bytes like @option{-falign-functions}. This option can easily 4014make code slower, because it must insert dummy operations for when the 4015branch target is reached in the usual flow of the code. 4016 4017@option{-fno-align-labels} and @option{-falign-labels=1} are 4018equivalent and mean that labels will not be aligned. 4019 4020If @option{-falign-loops} or @option{-falign-jumps} are applicable and 4021are greater than this value, then their values are used instead. 4022 4023If @var{n} is not specified or is zero, use a machine-dependent default 4024which is very likely to be @samp{1}, meaning no alignment. 4025 4026Enabled at levels @option{-O2}, @option{-O3}. 4027 4028@item -falign-loops 4029@itemx -falign-loops=@var{n} 4030@opindex falign-loops 4031Align loops to a power-of-two boundary, skipping up to @var{n} bytes 4032like @option{-falign-functions}. The hope is that the loop will be 4033executed many times, which will make up for any execution of the dummy 4034operations. 4035 4036@option{-fno-align-loops} and @option{-falign-loops=1} are 4037equivalent and mean that loops will not be aligned. 4038 4039If @var{n} is not specified or is zero, use a machine-dependent default. 4040 4041Enabled at levels @option{-O2}, @option{-O3}. 4042 4043@item -falign-jumps 4044@itemx -falign-jumps=@var{n} 4045@opindex falign-jumps 4046Align branch targets to a power-of-two boundary, for branch targets 4047where the targets can only be reached by jumping, skipping up to @var{n} 4048bytes like @option{-falign-functions}. In this case, no dummy operations 4049need be executed. 4050 4051@option{-fno-align-jumps} and @option{-falign-jumps=1} are 4052equivalent and mean that loops will not be aligned. 4053 4054If @var{n} is not specified or is zero, use a machine-dependent default. 4055 4056Enabled at levels @option{-O2}, @option{-O3}. 4057 4058@item -frename-registers 4059@opindex frename-registers 4060Attempt to avoid false dependencies in scheduled code by making use 4061of registers left over after register allocation. This optimization 4062will most benefit processors with lots of registers. It can, however, 4063make debugging impossible, since variables will no longer stay in 4064a ``home register''. 4065 4066Enabled at levels @option{-O3}. 4067 4068@item -fno-cprop-registers 4069@opindex fno-cprop-registers 4070After register allocation and post-register allocation instruction splitting, 4071we perform a copy-propagation pass to try to reduce scheduling dependencies 4072and occasionally eliminate the copy. 4073 4074Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4075 4076@end table 4077 4078The following options control compiler behavior regarding floating 4079point arithmetic. These options trade off between speed and 4080correctness. All must be specifically enabled. 4081 4082@table @gcctabopt 4083@item -ffloat-store 4084@opindex ffloat-store 4085Do not store floating point variables in registers, and inhibit other 4086options that might change whether a floating point value is taken from a 4087register or memory. 4088 4089@cindex floating point precision 4090This option prevents undesirable excess precision on machines such as 4091the 68000 where the floating registers (of the 68881) keep more 4092precision than a @code{double} is supposed to have. Similarly for the 4093x86 architecture. For most programs, the excess precision does only 4094good, but a few programs rely on the precise definition of IEEE floating 4095point. Use @option{-ffloat-store} for such programs, after modifying 4096them to store all pertinent intermediate computations into variables. 4097 4098@item -ffast-math 4099@opindex ffast-math 4100Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, @* 4101@option{-fno-trapping-math}, @option{-ffinite-math-only} and @* 4102@option{-fno-signaling-nans}. 4103 4104This option causes the preprocessor macro @code{__FAST_MATH__} to be defined. 4105 4106This option should never be turned on by any @option{-O} option since 4107it can result in incorrect output for programs which depend on 4108an exact implementation of IEEE or ISO rules/specifications for 4109math functions. 4110 4111@item -fno-math-errno 4112@opindex fno-math-errno 4113Do not set ERRNO after calling math functions that are executed 4114with a single instruction, e.g., sqrt. A program that relies on 4115IEEE exceptions for math error handling may want to use this flag 4116for speed while maintaining IEEE arithmetic compatibility. 4117 4118This option should never be turned on by any @option{-O} option since 4119it can result in incorrect output for programs which depend on 4120an exact implementation of IEEE or ISO rules/specifications for 4121math functions. 4122 4123The default is @option{-fmath-errno}. 4124 4125@item -funsafe-math-optimizations 4126@opindex funsafe-math-optimizations 4127Allow optimizations for floating-point arithmetic that (a) assume 4128that arguments and results are valid and (b) may violate IEEE or 4129ANSI standards. When used at link-time, it may include libraries 4130or startup files that change the default FPU control word or other 4131similar optimizations. 4132 4133This option should never be turned on by any @option{-O} option since 4134it can result in incorrect output for programs which depend on 4135an exact implementation of IEEE or ISO rules/specifications for 4136math functions. 4137 4138The default is @option{-fno-unsafe-math-optimizations}. 4139 4140@item -ffinite-math-only 4141@opindex ffinite-math-only 4142Allow optimizations for floating-point arithmetic that assume 4143that arguments and results are not NaNs or +-Infs. 4144 4145This option should never be turned on by any @option{-O} option since 4146it can result in incorrect output for programs which depend on 4147an exact implementation of IEEE or ISO rules/specifications. 4148 4149The default is @option{-fno-finite-math-only}. 4150 4151@item -fno-trapping-math 4152@opindex fno-trapping-math 4153Compile code assuming that floating-point operations cannot generate 4154user-visible traps. These traps include division by zero, overflow, 4155underflow, inexact result and invalid operation. This option implies 4156@option{-fno-signaling-nans}. Setting this option may allow faster 4157code if one relies on ``non-stop'' IEEE arithmetic, for example. 4158 4159This option should never be turned on by any @option{-O} option since 4160it can result in incorrect output for programs which depend on 4161an exact implementation of IEEE or ISO rules/specifications for 4162math functions. 4163 4164The default is @option{-ftrapping-math}. 4165 4166@item -fsignaling-nans 4167@opindex fsignaling-nans 4168Compile code assuming that IEEE signaling NaNs may generate user-visible 4169traps during floating-point operations. Setting this option disables 4170optimizations that may change the number of exceptions visible with 4171signaling NaNs. This option implies @option{-ftrapping-math}. 4172 4173This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to 4174be defined. 4175 4176The default is @option{-fno-signaling-nans}. 4177 4178This option is experimental and does not currently guarantee to 4179disable all GCC optimizations that affect signaling NaN behavior. 4180 4181@item -fsingle-precision-constant 4182@opindex fsingle-precision-constant 4183Treat floating point constant as single precision constant instead of 4184implicitly converting it to double precision constant. 4185 4186 4187@end table 4188 4189The following options control optimizations that may improve 4190performance, but are not enabled by any @option{-O} options. This 4191section includes experimental options that may produce broken code. 4192 4193@table @gcctabopt 4194@item -fbranch-probabilities 4195@opindex fbranch-probabilities 4196After running a program compiled with @option{-fprofile-arcs} 4197(@pxref{Debugging Options,, Options for Debugging Your Program or 4198@command{gcc}}), you can compile it a second time using 4199@option{-fbranch-probabilities}, to improve optimizations based on 4200the number of times each branch was taken. When the program 4201compiled with @option{-fprofile-arcs} exits it saves arc execution 4202counts to a file called @file{@var{sourcename}.da} for each source 4203file The information in this data file is very dependent on the 4204structure of the generated code, so you must use the same source code 4205and the same optimization options for both compilations. 4206 4207With @option{-fbranch-probabilities}, GCC puts a 4208@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}. 4209These can be used to improve optimization. Currently, they are only 4210used in one place: in @file{reorg.c}, instead of guessing which path a 4211branch is mostly to take, the @samp{REG_BR_PROB} values are used to 4212exactly determine which path is taken more often. 4213 4214@item -fnew-ra 4215@opindex fnew-ra 4216Use a graph coloring register allocator. Currently this option is meant 4217for testing, so we are interested to hear about miscompilations with 4218@option{-fnew-ra}. 4219 4220@item -ftracer 4221@opindex ftracer 4222Perform tail duplication to enlarge superblock size. This transformation 4223simplifies the control flow of the function allowing other optimizations to do 4224better job. 4225 4226@item -funroll-loops 4227@opindex funroll-loops 4228Unroll loops whose number of iterations can be determined at compile 4229time or upon entry to the loop. @option{-funroll-loops} implies both 4230@option{-fstrength-reduce} and @option{-frerun-cse-after-loop}. This 4231option makes code larger, and may or may not make it run faster. 4232 4233@item -funroll-all-loops 4234@opindex funroll-all-loops 4235Unroll all loops, even if their number of iterations is uncertain when 4236the loop is entered. This usually makes programs run more slowly. 4237@option{-funroll-all-loops} implies the same options as 4238@option{-funroll-loops}, 4239 4240@item -fprefetch-loop-arrays 4241@opindex fprefetch-loop-arrays 4242If supported by the target machine, generate instructions to prefetch 4243memory to improve the performance of loops that access large arrays. 4244 4245Disabled at level @option{-Os}. 4246 4247@item -ffunction-sections 4248@itemx -fdata-sections 4249@opindex ffunction-sections 4250@opindex fdata-sections 4251Place each function or data item into its own section in the output 4252file if the target supports arbitrary sections. The name of the 4253function or the name of the data item determines the section's name 4254in the output file. 4255 4256Use these options on systems where the linker can perform optimizations 4257to improve locality of reference in the instruction space. Most systems 4258using the ELF object format and SPARC processors running Solaris 2 have 4259linkers with such optimizations. AIX may have these optimizations in 4260the future. 4261 4262Only use these options when there are significant benefits from doing 4263so. When you specify these options, the assembler and linker will 4264create larger object and executable files and will also be slower. 4265You will not be able to use @code{gprof} on all systems if you 4266specify this option and you may have problems with debugging if 4267you specify both this option and @option{-g}. 4268 4269@item -fssa 4270@opindex fssa 4271Perform optimizations in static single assignment form. Each function's 4272flow graph is translated into SSA form, optimizations are performed, and 4273the flow graph is translated back from SSA form. Users should not 4274specify this option, since it is not yet ready for production use. 4275 4276@item -fssa-ccp 4277@opindex fssa-ccp 4278Perform Sparse Conditional Constant Propagation in SSA form. Requires 4279@option{-fssa}. Like @option{-fssa}, this is an experimental feature. 4280 4281@item -fssa-dce 4282@opindex fssa-dce 4283Perform aggressive dead-code elimination in SSA form. Requires @option{-fssa}. 4284Like @option{-fssa}, this is an experimental feature. 4285 4286 4287@item --param @var{name}=@var{value} 4288@opindex param 4289In some places, GCC uses various constants to control the amount of 4290optimization that is done. For example, GCC will not inline functions 4291that contain more that a certain number of instructions. You can 4292control some of these constants on the command-line using the 4293@option{--param} option. 4294 4295In each case, the @var{value} is an integer. The allowable choices for 4296@var{name} are given in the following table: 4297 4298@table @gcctabopt 4299@item max-crossjump-edges 4300The maximum number of incoming edges to consider for crossjumping. 4301The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in 4302the number of edges incoming to each block. Increasing values mean 4303more aggressive optimization, making the compile time increase with 4304probably small improvement in executable size. 4305 4306@item max-delay-slot-insn-search 4307The maximum number of instructions to consider when looking for an 4308instruction to fill a delay slot. If more than this arbitrary number of 4309instructions is searched, the time savings from filling the delay slot 4310will be minimal so stop searching. Increasing values mean more 4311aggressive optimization, making the compile time increase with probably 4312small improvement in executable run time. 4313 4314@item max-delay-slot-live-search 4315When trying to fill delay slots, the maximum number of instructions to 4316consider when searching for a block with valid live register 4317information. Increasing this arbitrarily chosen value means more 4318aggressive optimization, increasing the compile time. This parameter 4319should be removed when the delay slot code is rewritten to maintain the 4320control-flow graph. 4321 4322@item max-gcse-memory 4323The approximate maximum amount of memory that will be allocated in 4324order to perform the global common subexpression elimination 4325optimization. If more memory than specified is required, the 4326optimization will not be done. 4327 4328@item max-gcse-passes 4329The maximum number of passes of GCSE to run. 4330 4331@item max-pending-list-length 4332The maximum number of pending dependencies scheduling will allow 4333before flushing the current state and starting over. Large functions 4334with few branches or calls can create excessively large lists which 4335needlessly consume memory and resources. 4336 4337@item max-inline-insns-single 4338Several parameters control the tree inliner used in gcc. 4339This number sets the maximum number of instructions (counted in gcc's 4340internal representation) in a single function that the tree inliner 4341will consider for inlining. This only affects functions declared 4342inline and methods implemented in a class declaration (C++). 4343The default value is 300. 4344 4345@item max-inline-insns-auto 4346When you use @option{-finline-functions} (included in @option{-O3}), 4347a lot of functions that would otherwise not be considered for inlining 4348by the compiler will be investigated. To those functions, a different 4349(more restrictive) limit compared to functions declared inline can 4350be applied. 4351The default value is 300. 4352 4353@item max-inline-insns 4354The tree inliner does decrease the allowable size for single functions 4355to be inlined after we already inlined the number of instructions 4356given here by repeated inlining. This number should be a factor of 4357two or more larger than the single function limit. 4358Higher numbers result in better runtime performance, but incur higher 4359compile-time resource (CPU time, memory) requirements and result in 4360larger binaries. Very high values are not advisable, as too large 4361binaries may adversely affect runtime performance. 4362The default value is 600. 4363 4364@item max-inline-slope 4365After exceeding the maximum number of inlined instructions by repeated 4366inlining, a linear function is used to decrease the allowable size 4367for single functions. The slope of that function is the negative 4368reciprocal of the number specified here. 4369The default value is 32. 4370 4371@item min-inline-insns 4372The repeated inlining is throttled more and more by the linear function 4373after exceeding the limit. To avoid too much throttling, a minimum for 4374this function is specified here to allow repeated inlining for very small 4375functions even when a lot of repeated inlining already has been done. 4376The default value is 130. 4377 4378@item max-inline-insns-rtl 4379For languages that use the RTL inliner (this happens at a later stage 4380than tree inlining), you can set the maximum allowable size (counted 4381in RTL instructions) for the RTL inliner with this parameter. 4382The default value is 600. 4383 4384 4385@item max-unrolled-insns 4386The maximum number of instructions that a loop should have if that loop 4387is unrolled, and if the loop is unrolled, it determines how many times 4388the loop code is unrolled. 4389 4390@item hot-bb-count-fraction 4391Select fraction of the maximal count of repetitions of basic block in program 4392given basic block needs to have to be considered hot. 4393 4394@item hot-bb-frequency-fraction 4395Select fraction of the maximal frequency of executions of basic block in 4396function given basic block needs to have to be considered hot 4397 4398@item tracer-dynamic-coverage 4399@itemx tracer-dynamic-coverage-feedback 4400 4401This value is used to limit superblock formation once the given percentage of 4402executed instructions is covered. This limits unnecessary code size 4403expansion. 4404 4405The @option{tracer-dynamic-coverage-feedback} is used only when profile 4406feedback is available. The real profiles (as opposed to statically estimated 4407ones) are much less balanced allowing the threshold to be larger value. 4408 4409@item tracer-max-code-growth 4410Stop tail duplication once code growth has reached given percentage. This is 4411rather hokey argument, as most of the duplicates will be eliminated later in 4412cross jumping, so it may be set to much higher values than is the desired code 4413growth. 4414 4415@item tracer-min-branch-ratio 4416 4417Stop reverse growth when the reverse probability of best edge is less than this 4418threshold (in percent). 4419 4420@item tracer-min-branch-ratio 4421@itemx tracer-min-branch-ratio-feedback 4422 4423Stop forward growth if the best edge do have probability lower than this 4424threshold. 4425 4426Similarly to @option{tracer-dynamic-coverage} two values are present, one for 4427compilation for profile feedback and one for compilation without. The value 4428for compilation with profile feedback needs to be more conservative (higher) in 4429order to make tracer effective. 4430 4431@item ggc-min-expand 4432 4433GCC uses a garbage collector to manage its own memory allocation. This 4434parameter specifies the minimum percentage by which the garbage 4435collector's heap should be allowed to expand between collections. 4436Tuning this may improve compilation speed; it has no effect on code 4437generation. 4438 4439The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when 4440RAM >= 1GB. If @code{getrlimit} is available, the notion of "RAM" is 4441the smallest of actual RAM, RLIMIT_RSS, RLIMIT_DATA and RLIMIT_AS. If 4442GCC is not able to calculate RAM on a particular platform, the lower 4443bound of 30% is used. Setting this parameter and 4444@option{ggc-min-heapsize} to zero causes a full collection to occur at 4445every opportunity. This is extremely slow, but can be useful for 4446debugging. 4447 4448@item ggc-min-heapsize 4449 4450Minimum size of the garbage collector's heap before it begins bothering 4451to collect garbage. The first collection occurs after the heap expands 4452by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again, 4453tuning this may improve compilation speed, and has no effect on code 4454generation. 4455 4456The default is RAM/8, with a lower bound of 4096 (four megabytes) and an 4457upper bound of 131072 (128 megabytes). If @code{getrlimit} is 4458available, the notion of "RAM" is the smallest of actual RAM, 4459RLIMIT_RSS, RLIMIT_DATA and RLIMIT_AS. If GCC is not able to calculate 4460RAM on a particular platform, the lower bound is used. Setting this 4461parameter very large effectively disables garbage collection. Setting 4462this parameter and @option{ggc-min-expand} to zero causes a full 4463collection to occur at every opportunity. 4464 4465@end table 4466@end table 4467 4468@node Preprocessor Options 4469@section Options Controlling the Preprocessor 4470@cindex preprocessor options 4471@cindex options, preprocessor 4472 4473These options control the C preprocessor, which is run on each C source 4474file before actual compilation. 4475 4476If you use the @option{-E} option, nothing is done except preprocessing. 4477Some of these options make sense only together with @option{-E} because 4478they cause the preprocessor output to be unsuitable for actual 4479compilation. 4480 4481@opindex Wp 4482You can use @option{-Wp,@var{option}} to bypass the compiler driver 4483and pass @var{option} directly through to the preprocessor. If 4484@var{option} contains commas, it is split into multiple options at the 4485commas. However, many options are modified, translated or interpreted 4486by the compiler driver before being passed to the preprocessor, and 4487@option{-Wp} forcibly bypasses this phase. The preprocessor's direct 4488interface is undocumented and subject to change, so whenever possible 4489you should avoid using @option{-Wp} and let the driver handle the 4490options instead. 4491 4492@include cppopts.texi 4493 4494@node Assembler Options 4495@section Passing Options to the Assembler 4496 4497@c prevent bad page break with this line 4498You can pass options to the assembler. 4499 4500@table @gcctabopt 4501@item -Wa,@var{option} 4502@opindex Wa 4503Pass @var{option} as an option to the assembler. If @var{option} 4504contains commas, it is split into multiple options at the commas. 4505@end table 4506 4507@node Link Options 4508@section Options for Linking 4509@cindex link options 4510@cindex options, linking 4511 4512These options come into play when the compiler links object files into 4513an executable output file. They are meaningless if the compiler is 4514not doing a link step. 4515 4516@table @gcctabopt 4517@cindex file names 4518@item @var{object-file-name} 4519A file name that does not end in a special recognized suffix is 4520considered to name an object file or library. (Object files are 4521distinguished from libraries by the linker according to the file 4522contents.) If linking is done, these object files are used as input 4523to the linker. 4524 4525@item -c 4526@itemx -S 4527@itemx -E 4528@opindex c 4529@opindex S 4530@opindex E 4531If any of these options is used, then the linker is not run, and 4532object file names should not be used as arguments. @xref{Overall 4533Options}. 4534 4535@cindex Libraries 4536@item -l@var{library} 4537@itemx -l @var{library} 4538@opindex l 4539Search the library named @var{library} when linking. (The second 4540alternative with the library as a separate argument is only for 4541POSIX compliance and is not recommended.) 4542 4543It makes a difference where in the command you write this option; the 4544linker searches and processes libraries and object files in the order they 4545are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z} 4546after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers 4547to functions in @samp{z}, those functions may not be loaded. 4548 4549The linker searches a standard list of directories for the library, 4550which is actually a file named @file{lib@var{library}.a}. The linker 4551then uses this file as if it had been specified precisely by name. 4552 4553The directories searched include several standard system directories 4554plus any that you specify with @option{-L}. 4555 4556Normally the files found this way are library files---archive files 4557whose members are object files. The linker handles an archive file by 4558scanning through it for members which define symbols that have so far 4559been referenced but not defined. But if the file that is found is an 4560ordinary object file, it is linked in the usual fashion. The only 4561difference between using an @option{-l} option and specifying a file name 4562is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a} 4563and searches several directories. 4564 4565@item -lobjc 4566@opindex lobjc 4567You need this special case of the @option{-l} option in order to 4568link an Objective-C program. 4569 4570@item -nostartfiles 4571@opindex nostartfiles 4572Do not use the standard system startup files when linking. 4573The standard system libraries are used normally, unless @option{-nostdlib} 4574or @option{-nodefaultlibs} is used. 4575 4576@item -nodefaultlibs 4577@opindex nodefaultlibs 4578Do not use the standard system libraries when linking. 4579Only the libraries you specify will be passed to the linker. 4580The standard startup files are used normally, unless @option{-nostartfiles} 4581is used. The compiler may generate calls to memcmp, memset, and memcpy 4582for System V (and ISO C) environments or to bcopy and bzero for 4583BSD environments. These entries are usually resolved by entries in 4584libc. These entry points should be supplied through some other 4585mechanism when this option is specified. 4586 4587@item -nostdlib 4588@opindex nostdlib 4589Do not use the standard system startup files or libraries when linking. 4590No startup files and only the libraries you specify will be passed to 4591the linker. The compiler may generate calls to memcmp, memset, and memcpy 4592for System V (and ISO C) environments or to bcopy and bzero for 4593BSD environments. These entries are usually resolved by entries in 4594libc. These entry points should be supplied through some other 4595mechanism when this option is specified. 4596 4597@cindex @option{-lgcc}, use with @option{-nostdlib} 4598@cindex @option{-nostdlib} and unresolved references 4599@cindex unresolved references and @option{-nostdlib} 4600@cindex @option{-lgcc}, use with @option{-nodefaultlibs} 4601@cindex @option{-nodefaultlibs} and unresolved references 4602@cindex unresolved references and @option{-nodefaultlibs} 4603One of the standard libraries bypassed by @option{-nostdlib} and 4604@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines 4605that GCC uses to overcome shortcomings of particular machines, or special 4606needs for some languages. 4607(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler 4608Collection (GCC) Internals}, 4609for more discussion of @file{libgcc.a}.) 4610In most cases, you need @file{libgcc.a} even when you want to avoid 4611other standard libraries. In other words, when you specify @option{-nostdlib} 4612or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well. 4613This ensures that you have no unresolved references to internal GCC 4614library subroutines. (For example, @samp{__main}, used to ensure C++ 4615constructors will be called; @pxref{Collect2,,@code{collect2}, gccint, 4616GNU Compiler Collection (GCC) Internals}.) 4617 4618@item -s 4619@opindex s 4620Remove all symbol table and relocation information from the executable. 4621 4622@item -static 4623@opindex static 4624On systems that support dynamic linking, this prevents linking with the shared 4625libraries. On other systems, this option has no effect. 4626 4627@item -shared 4628@opindex shared 4629Produce a shared object which can then be linked with other objects to 4630form an executable. Not all systems support this option. For predictable 4631results, you must also specify the same set of options that were used to 4632generate code (@option{-fpic}, @option{-fPIC}, or model suboptions) 4633when you specify this option.@footnote{On some systems, @samp{gcc -shared} 4634needs to build supplementary stub code for constructors to work. On 4635multi-libbed systems, @samp{gcc -shared} must select the correct support 4636libraries to link against. Failing to supply the correct flags may lead 4637to subtle defects. Supplying them in cases where they are not necessary 4638is innocuous.} 4639 4640@item -shared-libgcc 4641@itemx -static-libgcc 4642@opindex shared-libgcc 4643@opindex static-libgcc 4644On systems that provide @file{libgcc} as a shared library, these options 4645force the use of either the shared or static version respectively. 4646If no shared version of @file{libgcc} was built when the compiler was 4647configured, these options have no effect. 4648 4649There are several situations in which an application should use the 4650shared @file{libgcc} instead of the static version. The most common 4651of these is when the application wishes to throw and catch exceptions 4652across different shared libraries. In that case, each of the libraries 4653as well as the application itself should use the shared @file{libgcc}. 4654 4655Therefore, the G++ and GCJ drivers automatically add 4656@option{-shared-libgcc} whenever you build a shared library or a main 4657executable, because C++ and Java programs typically use exceptions, so 4658this is the right thing to do. 4659 4660If, instead, you use the GCC driver to create shared libraries, you may 4661find that they will not always be linked with the shared @file{libgcc}. 4662If GCC finds, at its configuration time, that you have a GNU linker that 4663does not support option @option{--eh-frame-hdr}, it will link the shared 4664version of @file{libgcc} into shared libraries by default. Otherwise, 4665it will take advantage of the linker and optimize away the linking with 4666the shared version of @file{libgcc}, linking with the static version of 4667libgcc by default. This allows exceptions to propagate through such 4668shared libraries, without incurring relocation costs at library load 4669time. 4670 4671However, if a library or main executable is supposed to throw or catch 4672exceptions, you must link it using the G++ or GCJ driver, as appropriate 4673for the languages used in the program, or using the option 4674@option{-shared-libgcc}, such that it is linked with the shared 4675@file{libgcc}. 4676 4677@item -symbolic 4678@opindex symbolic 4679Bind references to global symbols when building a shared object. Warn 4680about any unresolved references (unless overridden by the link editor 4681option @samp{-Xlinker -z -Xlinker defs}). Only a few systems support 4682this option. 4683 4684@item -Xlinker @var{option} 4685@opindex Xlinker 4686Pass @var{option} as an option to the linker. You can use this to 4687supply system-specific linker options which GCC does not know how to 4688recognize. 4689 4690If you want to pass an option that takes an argument, you must use 4691@option{-Xlinker} twice, once for the option and once for the argument. 4692For example, to pass @option{-assert definitions}, you must write 4693@samp{-Xlinker -assert -Xlinker definitions}. It does not work to write 4694@option{-Xlinker "-assert definitions"}, because this passes the entire 4695string as a single argument, which is not what the linker expects. 4696 4697@item -Wl,@var{option} 4698@opindex Wl 4699Pass @var{option} as an option to the linker. If @var{option} contains 4700commas, it is split into multiple options at the commas. 4701 4702@item -u @var{symbol} 4703@opindex u 4704Pretend the symbol @var{symbol} is undefined, to force linking of 4705library modules to define it. You can use @option{-u} multiple times with 4706different symbols to force loading of additional library modules. 4707@end table 4708 4709@node Directory Options 4710@section Options for Directory Search 4711@cindex directory options 4712@cindex options, directory search 4713@cindex search path 4714 4715These options specify directories to search for header files, for 4716libraries and for parts of the compiler: 4717 4718@table @gcctabopt 4719@item -I@var{dir} 4720@opindex I 4721Add the directory @var{dir} to the head of the list of directories to be 4722searched for header files. This can be used to override a system header 4723file, substituting your own version, since these directories are 4724searched before the system header file directories. However, you should 4725not use this option to add directories that contain vendor-supplied 4726system header files (use @option{-isystem} for that). If you use more than 4727one @option{-I} option, the directories are scanned in left-to-right 4728order; the standard system directories come after. 4729 4730If a standard system include directory, or a directory specified with 4731@option{-isystem}, is also specified with @option{-I}, the @option{-I} 4732option will be ignored. The directory will still be searched but as a 4733system directory at its normal position in the system include chain. 4734This is to ensure that GCC's procedure to fix buggy system headers and 4735the ordering for the include_next directive are not inadvertently changed. 4736If you really need to change the search order for system directories, 4737use the @option{-nostdinc} and/or @option{-isystem} options. 4738 4739@item -I- 4740@opindex I- 4741Any directories you specify with @option{-I} options before the @option{-I-} 4742option are searched only for the case of @samp{#include "@var{file}"}; 4743they are not searched for @samp{#include <@var{file}>}. 4744 4745If additional directories are specified with @option{-I} options after 4746the @option{-I-}, these directories are searched for all @samp{#include} 4747directives. (Ordinarily @emph{all} @option{-I} directories are used 4748this way.) 4749 4750In addition, the @option{-I-} option inhibits the use of the current 4751directory (where the current input file came from) as the first search 4752directory for @samp{#include "@var{file}"}. There is no way to 4753override this effect of @option{-I-}. With @option{-I.} you can specify 4754searching the directory which was current when the compiler was 4755invoked. That is not exactly the same as what the preprocessor does 4756by default, but it is often satisfactory. 4757 4758@option{-I-} does not inhibit the use of the standard system directories 4759for header files. Thus, @option{-I-} and @option{-nostdinc} are 4760independent. 4761 4762@item -L@var{dir} 4763@opindex L 4764Add directory @var{dir} to the list of directories to be searched 4765for @option{-l}. 4766 4767@item -B@var{prefix} 4768@opindex B 4769This option specifies where to find the executables, libraries, 4770include files, and data files of the compiler itself. 4771 4772The compiler driver program runs one or more of the subprograms 4773@file{cpp}, @file{cc1}, @file{as} and @file{ld}. It tries 4774@var{prefix} as a prefix for each program it tries to run, both with and 4775without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}). 4776 4777For each subprogram to be run, the compiler driver first tries the 4778@option{-B} prefix, if any. If that name is not found, or if @option{-B} 4779was not specified, the driver tries two standard prefixes, which are 4780@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc-lib/}. If neither of 4781those results in a file name that is found, the unmodified program 4782name is searched for using the directories specified in your 4783@env{PATH} environment variable. 4784 4785The compiler will check to see if the path provided by the @option{-B} 4786refers to a directory, and if necessary it will add a directory 4787separator character at the end of the path. 4788 4789@option{-B} prefixes that effectively specify directory names also apply 4790to libraries in the linker, because the compiler translates these 4791options into @option{-L} options for the linker. They also apply to 4792includes files in the preprocessor, because the compiler translates these 4793options into @option{-isystem} options for the preprocessor. In this case, 4794the compiler appends @samp{include} to the prefix. 4795 4796The run-time support file @file{libgcc.a} can also be searched for using 4797the @option{-B} prefix, if needed. If it is not found there, the two 4798standard prefixes above are tried, and that is all. The file is left 4799out of the link if it is not found by those means. 4800 4801Another way to specify a prefix much like the @option{-B} prefix is to use 4802the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment 4803Variables}. 4804 4805As a special kludge, if the path provided by @option{-B} is 4806@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to 48079, then it will be replaced by @file{[dir/]include}. This is to help 4808with boot-strapping the compiler. 4809 4810@item -specs=@var{file} 4811@opindex specs 4812Process @var{file} after the compiler reads in the standard @file{specs} 4813file, in order to override the defaults that the @file{gcc} driver 4814program uses when determining what switches to pass to @file{cc1}, 4815@file{cc1plus}, @file{as}, @file{ld}, etc. More than one 4816@option{-specs=@var{file}} can be specified on the command line, and they 4817are processed in order, from left to right. 4818@end table 4819 4820@c man end 4821 4822@node Spec Files 4823@section Specifying subprocesses and the switches to pass to them 4824@cindex Spec Files 4825 4826@command{gcc} is a driver program. It performs its job by invoking a 4827sequence of other programs to do the work of compiling, assembling and 4828linking. GCC interprets its command-line parameters and uses these to 4829deduce which programs it should invoke, and which command-line options 4830it ought to place on their command lines. This behavior is controlled 4831by @dfn{spec strings}. In most cases there is one spec string for each 4832program that GCC can invoke, but a few programs have multiple spec 4833strings to control their behavior. The spec strings built into GCC can 4834be overridden by using the @option{-specs=} command-line switch to specify 4835a spec file. 4836 4837@dfn{Spec files} are plaintext files that are used to construct spec 4838strings. They consist of a sequence of directives separated by blank 4839lines. The type of directive is determined by the first non-whitespace 4840character on the line and it can be one of the following: 4841 4842@table @code 4843@item %@var{command} 4844Issues a @var{command} to the spec file processor. The commands that can 4845appear here are: 4846 4847@table @code 4848@item %include <@var{file}> 4849@cindex %include 4850Search for @var{file} and insert its text at the current point in the 4851specs file. 4852 4853@item %include_noerr <@var{file}> 4854@cindex %include_noerr 4855Just like @samp{%include}, but do not generate an error message if the include 4856file cannot be found. 4857 4858@item %rename @var{old_name} @var{new_name} 4859@cindex %rename 4860Rename the spec string @var{old_name} to @var{new_name}. 4861 4862@end table 4863 4864@item *[@var{spec_name}]: 4865This tells the compiler to create, override or delete the named spec 4866string. All lines after this directive up to the next directive or 4867blank line are considered to be the text for the spec string. If this 4868results in an empty string then the spec will be deleted. (Or, if the 4869spec did not exist, then nothing will happened.) Otherwise, if the spec 4870does not currently exist a new spec will be created. If the spec does 4871exist then its contents will be overridden by the text of this 4872directive, unless the first character of that text is the @samp{+} 4873character, in which case the text will be appended to the spec. 4874 4875@item [@var{suffix}]: 4876Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive 4877and up to the next directive or blank line are considered to make up the 4878spec string for the indicated suffix. When the compiler encounters an 4879input file with the named suffix, it will processes the spec string in 4880order to work out how to compile that file. For example: 4881 4882@smallexample 4883.ZZ: 4884z-compile -input %i 4885@end smallexample 4886 4887This says that any input file whose name ends in @samp{.ZZ} should be 4888passed to the program @samp{z-compile}, which should be invoked with the 4889command-line switch @option{-input} and with the result of performing the 4890@samp{%i} substitution. (See below.) 4891 4892As an alternative to providing a spec string, the text that follows a 4893suffix directive can be one of the following: 4894 4895@table @code 4896@item @@@var{language} 4897This says that the suffix is an alias for a known @var{language}. This is 4898similar to using the @option{-x} command-line switch to GCC to specify a 4899language explicitly. For example: 4900 4901@smallexample 4902.ZZ: 4903@@c++ 4904@end smallexample 4905 4906Says that .ZZ files are, in fact, C++ source files. 4907 4908@item #@var{name} 4909This causes an error messages saying: 4910 4911@smallexample 4912@var{name} compiler not installed on this system. 4913@end smallexample 4914@end table 4915 4916GCC already has an extensive list of suffixes built into it. 4917This directive will add an entry to the end of the list of suffixes, but 4918since the list is searched from the end backwards, it is effectively 4919possible to override earlier entries using this technique. 4920 4921@end table 4922 4923GCC has the following spec strings built into it. Spec files can 4924override these strings or create their own. Note that individual 4925targets can also add their own spec strings to this list. 4926 4927@smallexample 4928asm Options to pass to the assembler 4929asm_final Options to pass to the assembler post-processor 4930cpp Options to pass to the C preprocessor 4931cc1 Options to pass to the C compiler 4932cc1plus Options to pass to the C++ compiler 4933endfile Object files to include at the end of the link 4934link Options to pass to the linker 4935lib Libraries to include on the command line to the linker 4936libgcc Decides which GCC support library to pass to the linker 4937linker Sets the name of the linker 4938predefines Defines to be passed to the C preprocessor 4939signed_char Defines to pass to CPP to say whether @code{char} is signed 4940 by default 4941startfile Object files to include at the start of the link 4942@end smallexample 4943 4944Here is a small example of a spec file: 4945 4946@smallexample 4947%rename lib old_lib 4948 4949*lib: 4950--start-group -lgcc -lc -leval1 --end-group %(old_lib) 4951@end smallexample 4952 4953This example renames the spec called @samp{lib} to @samp{old_lib} and 4954then overrides the previous definition of @samp{lib} with a new one. 4955The new definition adds in some extra command-line options before 4956including the text of the old definition. 4957 4958@dfn{Spec strings} are a list of command-line options to be passed to their 4959corresponding program. In addition, the spec strings can contain 4960@samp{%}-prefixed sequences to substitute variable text or to 4961conditionally insert text into the command line. Using these constructs 4962it is possible to generate quite complex command lines. 4963 4964Here is a table of all defined @samp{%}-sequences for spec 4965strings. Note that spaces are not generated automatically around the 4966results of expanding these sequences. Therefore you can concatenate them 4967together or combine them with constant text in a single argument. 4968 4969@table @code 4970@item %% 4971Substitute one @samp{%} into the program name or argument. 4972 4973@item %i 4974Substitute the name of the input file being processed. 4975 4976@item %b 4977Substitute the basename of the input file being processed. 4978This is the substring up to (and not including) the last period 4979and not including the directory. 4980 4981@item %B 4982This is the same as @samp{%b}, but include the file suffix (text after 4983the last period). 4984 4985@item %d 4986Marks the argument containing or following the @samp{%d} as a 4987temporary file name, so that that file will be deleted if GCC exits 4988successfully. Unlike @samp{%g}, this contributes no text to the 4989argument. 4990 4991@item %g@var{suffix} 4992Substitute a file name that has suffix @var{suffix} and is chosen 4993once per compilation, and mark the argument in the same way as 4994@samp{%d}. To reduce exposure to denial-of-service attacks, the file 4995name is now chosen in a way that is hard to predict even when previously 4996chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s} 4997might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches 4998the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is 4999treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g} 5000was simply substituted with a file name chosen once per compilation, 5001without regard to any appended suffix (which was therefore treated 5002just like ordinary text), making such attacks more likely to succeed. 5003 5004@item %u@var{suffix} 5005Like @samp{%g}, but generates a new temporary file name even if 5006@samp{%u@var{suffix}} was already seen. 5007 5008@item %U@var{suffix} 5009Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a 5010new one if there is no such last file name. In the absence of any 5011@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share 5012the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s} 5013would involve the generation of two distinct file names, one 5014for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was 5015simply substituted with a file name chosen for the previous @samp{%u}, 5016without regard to any appended suffix. 5017 5018@item %j@var{suffix} 5019Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is 5020writable, and if save-temps is off; otherwise, substitute the name 5021of a temporary file, just like @samp{%u}. This temporary file is not 5022meant for communication between processes, but rather as a junk 5023disposal mechanism. 5024 5025@item %.@var{SUFFIX} 5026Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args 5027when it is subsequently output with @samp{%*}. @var{SUFFIX} is 5028terminated by the next space or %. 5029 5030@item %w 5031Marks the argument containing or following the @samp{%w} as the 5032designated output file of this compilation. This puts the argument 5033into the sequence of arguments that @samp{%o} will substitute later. 5034 5035@item %o 5036Substitutes the names of all the output files, with spaces 5037automatically placed around them. You should write spaces 5038around the @samp{%o} as well or the results are undefined. 5039@samp{%o} is for use in the specs for running the linker. 5040Input files whose names have no recognized suffix are not compiled 5041at all, but they are included among the output files, so they will 5042be linked. 5043 5044@item %O 5045Substitutes the suffix for object files. Note that this is 5046handled specially when it immediately follows @samp{%g, %u, or %U}, 5047because of the need for those to form complete file names. The 5048handling is such that @samp{%O} is treated exactly as if it had already 5049been substituted, except that @samp{%g, %u, and %U} do not currently 5050support additional @var{suffix} characters following @samp{%O} as they would 5051following, for example, @samp{.o}. 5052 5053@item %p 5054Substitutes the standard macro predefinitions for the 5055current target machine. Use this when running @code{cpp}. 5056 5057@item %P 5058Like @samp{%p}, but puts @samp{__} before and after the name of each 5059predefined macro, except for macros that start with @samp{__} or with 5060@samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO 5061C@. 5062 5063@item %I 5064Substitute a @option{-iprefix} option made from @env{GCC_EXEC_PREFIX}. 5065 5066@item %s 5067Current argument is the name of a library or startup file of some sort. 5068Search for that file in a standard list of directories and substitute 5069the full name found. 5070 5071@item %e@var{str} 5072Print @var{str} as an error message. @var{str} is terminated by a newline. 5073Use this when inconsistent options are detected. 5074 5075@item %| 5076Output @samp{-} if the input for the current command is coming from a pipe. 5077 5078@item %(@var{name}) 5079Substitute the contents of spec string @var{name} at this point. 5080 5081@item %[@var{name}] 5082Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments. 5083 5084@item %x@{@var{option}@} 5085Accumulate an option for @samp{%X}. 5086 5087@item %X 5088Output the accumulated linker options specified by @option{-Wl} or a @samp{%x} 5089spec string. 5090 5091@item %Y 5092Output the accumulated assembler options specified by @option{-Wa}. 5093 5094@item %Z 5095Output the accumulated preprocessor options specified by @option{-Wp}. 5096 5097@item %v1 5098Substitute the major version number of GCC@. 5099(For version 2.9.5, this is 2.) 5100 5101@item %v2 5102Substitute the minor version number of GCC@. 5103(For version 2.9.5, this is 9.) 5104 5105@item %v3 5106Substitute the patch level number of GCC@. 5107(For version 2.9.5, this is 5.) 5108 5109@item %a 5110Process the @code{asm} spec. This is used to compute the 5111switches to be passed to the assembler. 5112 5113@item %A 5114Process the @code{asm_final} spec. This is a spec string for 5115passing switches to an assembler post-processor, if such a program is 5116needed. 5117 5118@item %l 5119Process the @code{link} spec. This is the spec for computing the 5120command line passed to the linker. Typically it will make use of the 5121@samp{%L %G %S %D and %E} sequences. 5122 5123@item %D 5124Dump out a @option{-L} option for each directory that GCC believes might 5125contain startup files. If the target supports multilibs then the 5126current multilib directory will be prepended to each of these paths. 5127 5128@item %M 5129Output the multilib directory with directory separators replaced with 5130@samp{_}. If multilib directories are not set, or the multilib directory is 5131@file{.} then this option emits nothing. 5132 5133@item %L 5134Process the @code{lib} spec. This is a spec string for deciding which 5135libraries should be included on the command line to the linker. 5136 5137@item %G 5138Process the @code{libgcc} spec. This is a spec string for deciding 5139which GCC support library should be included on the command line to the linker. 5140 5141@item %S 5142Process the @code{startfile} spec. This is a spec for deciding which 5143object files should be the first ones passed to the linker. Typically 5144this might be a file named @file{crt0.o}. 5145 5146@item %E 5147Process the @code{endfile} spec. This is a spec string that specifies 5148the last object files that will be passed to the linker. 5149 5150@item %C 5151Process the @code{cpp} spec. This is used to construct the arguments 5152to be passed to the C preprocessor. 5153 5154@item %c 5155Process the @code{signed_char} spec. This is intended to be used 5156to tell cpp whether a char is signed. It typically has the definition: 5157@smallexample 5158%@{funsigned-char:-D__CHAR_UNSIGNED__@} 5159@end smallexample 5160 5161@item %1 5162Process the @code{cc1} spec. This is used to construct the options to be 5163passed to the actual C compiler (@samp{cc1}). 5164 5165@item %2 5166Process the @code{cc1plus} spec. This is used to construct the options to be 5167passed to the actual C++ compiler (@samp{cc1plus}). 5168 5169@item %* 5170Substitute the variable part of a matched option. See below. 5171Note that each comma in the substituted string is replaced by 5172a single space. 5173 5174@item %:@var{function}(@var{args}) 5175Call the named function @var{function}, passing it @var{args}. 5176@var{args} is first processed as a nested spec string, then split 5177into an argument vector in the usual fashion. The function returns 5178a string which is processed as if it had appeared literally as part 5179of the current spec. 5180 5181The following built-in spec functions are provided: 5182 5183@table @code 5184@item @code{if-exists} 5185The @code{if-exists} spec function takes one argument, an absolute 5186pathname to a file. If the file exists, @code{if-exists} returns the 5187pathname. Here is a small example of its usage: 5188 5189@smallexample 5190*startfile: 5191crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s 5192@end smallexample 5193 5194@item @code{if-exists-else} 5195The @code{if-exists-else} spec function is similar to the @code{if-exists} 5196spec function, except that it takes two arguments. The first argument is 5197an absolute pathname to a file. If the file exists, @code{if-exists-else} 5198returns the pathname. If it does not exist, it returns the second argument. 5199This way, @code{if-exists-else} can be used to select one file or another, 5200based on the existence of the first. Here is a small example of its usage: 5201 5202@smallexample 5203*startfile: 5204crt0%O%s %:if-exists(crti%O%s) \ 5205%:if-exists-else(crtbeginT%O%s crtbegin%O%s) 5206@end smallexample 5207@end table 5208 5209@item %@{@code{S}@} 5210Substitutes the @code{-S} switch, if that switch was given to GCC@. 5211If that switch was not specified, this substitutes nothing. Note that 5212the leading dash is omitted when specifying this option, and it is 5213automatically inserted if the substitution is performed. Thus the spec 5214string @samp{%@{foo@}} would match the command-line option @option{-foo} 5215and would output the command line option @option{-foo}. 5216 5217@item %W@{@code{S}@} 5218Like %@{@code{S}@} but mark last argument supplied within as a file to be 5219deleted on failure. 5220 5221@item %@{@code{S}*@} 5222Substitutes all the switches specified to GCC whose names start 5223with @code{-S}, but which also take an argument. This is used for 5224switches like @option{-o}, @option{-D}, @option{-I}, etc. 5225GCC considers @option{-o foo} as being 5226one switch whose names starts with @samp{o}. %@{o*@} would substitute this 5227text, including the space. Thus two arguments would be generated. 5228 5229@item %@{^@code{S}*@} 5230Like %@{@code{S}*@}, but don't put a blank between a switch and its 5231argument. Thus %@{^o*@} would only generate one argument, not two. 5232 5233@item %@{@code{S}*&@code{T}*@} 5234Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options 5235(the order of @code{S} and @code{T} in the spec is not significant). 5236There can be any number of ampersand-separated variables; for each the 5237wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}. 5238 5239@item %@{<@code{S}@} 5240Remove all occurrences of @code{-S} from the command line. Note---this 5241command is position dependent. @samp{%} commands in the spec string 5242before this option will see @code{-S}, @samp{%} commands in the spec 5243string after this option will not. 5244 5245@item %@{@code{S}*:@code{X}@} 5246Substitutes @code{X} if one or more switches whose names start with 5247@code{-S} are specified to GCC@. Note that the tail part of the 5248@code{-S} option (i.e.@: the part matched by the @samp{*}) will be substituted 5249for each occurrence of @samp{%*} within @code{X}. 5250 5251@item %@{@code{S}:@code{X}@} 5252Substitutes @code{X}, but only if the @samp{-S} switch was given to GCC@. 5253 5254@item %@{!@code{S}:@code{X}@} 5255Substitutes @code{X}, but only if the @samp{-S} switch was @emph{not} given to GCC@. 5256 5257@item %@{|@code{S}:@code{X}@} 5258Like %@{@code{S}:@code{X}@}, but if no @code{S} switch, substitute @samp{-}. 5259 5260@item %@{|!@code{S}:@code{X}@} 5261Like %@{!@code{S}:@code{X}@}, but if there is an @code{S} switch, substitute @samp{-}. 5262 5263@item %@{.@code{S}:@code{X}@} 5264Substitutes @code{X}, but only if processing a file with suffix @code{S}. 5265 5266@item %@{!.@code{S}:@code{X}@} 5267Substitutes @code{X}, but only if @emph{not} processing a file with suffix @code{S}. 5268 5269@item %@{@code{S}|@code{P}:@code{X}@} 5270Substitutes @code{X} if either @code{-S} or @code{-P} was given to GCC@. This may be 5271combined with @samp{!} and @samp{.} sequences as well, although they 5272have a stronger binding than the @samp{|}. For example a spec string 5273like this: 5274 5275@smallexample 5276%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@} 5277@end smallexample 5278 5279will output the following command-line options from the following input 5280command-line options: 5281 5282@smallexample 5283fred.c -foo -baz 5284jim.d -bar -boggle 5285-d fred.c -foo -baz -boggle 5286-d jim.d -bar -baz -boggle 5287@end smallexample 5288 5289@end table 5290 5291The conditional text @code{X} in a %@{@code{S}:@code{X}@} or 5292%@{!@code{S}:@code{X}@} construct may contain other nested @samp{%} constructs 5293or spaces, or even newlines. They are processed as usual, as described 5294above. 5295 5296The @option{-O}, @option{-f}, @option{-m}, and @option{-W} 5297switches are handled specifically in these 5298constructs. If another value of @option{-O} or the negated form of a @option{-f}, @option{-m}, or 5299@option{-W} switch is found later in the command line, the earlier switch 5300value is ignored, except with @{@code{S}*@} where @code{S} is just one 5301letter, which passes all matching options. 5302 5303The character @samp{|} at the beginning of the predicate text is used to indicate 5304that a command should be piped to the following command, but only if @option{-pipe} 5305is specified. 5306 5307It is built into GCC which switches take arguments and which do not. 5308(You might think it would be useful to generalize this to allow each 5309compiler's spec to say which switches take arguments. But this cannot 5310be done in a consistent fashion. GCC cannot even decide which input 5311files have been specified without knowing which switches take arguments, 5312and it must know which input files to compile in order to tell which 5313compilers to run). 5314 5315GCC also knows implicitly that arguments starting in @option{-l} are to be 5316treated as compiler output files, and passed to the linker in their 5317proper position among the other output files. 5318 5319@c man begin OPTIONS 5320 5321@node Target Options 5322@section Specifying Target Machine and Compiler Version 5323@cindex target options 5324@cindex cross compiling 5325@cindex specifying machine version 5326@cindex specifying compiler version and target machine 5327@cindex compiler version, specifying 5328@cindex target machine, specifying 5329 5330The usual way to run GCC is to run the executable called @file{gcc}, or 5331@file{<machine>-gcc} when cross-compiling, or 5332@file{<machine>-gcc-<version>} to run a version other than the one that 5333was installed last. Sometimes this is inconvenient, so GCC provides 5334options that will switch to another cross-compiler or version. 5335 5336@table @gcctabopt 5337@item -b @var{machine} 5338@opindex b 5339The argument @var{machine} specifies the target machine for compilation. 5340 5341The value to use for @var{machine} is the same as was specified as the 5342machine type when configuring GCC as a cross-compiler. For 5343example, if a cross-compiler was configured with @samp{configure 5344i386v}, meaning to compile for an 80386 running System V, then you 5345would specify @option{-b i386v} to run that cross compiler. 5346 5347@item -V @var{version} 5348@opindex V 5349The argument @var{version} specifies which version of GCC to run. 5350This is useful when multiple versions are installed. For example, 5351@var{version} might be @samp{2.0}, meaning to run GCC version 2.0. 5352@end table 5353 5354The @option{-V} and @option{-b} options work by running the 5355@file{<machine>-gcc-<version>} executable, so there's no real reason to 5356use them if you can just run that directly. 5357 5358@node Submodel Options 5359@section Hardware Models and Configurations 5360@cindex submodel options 5361@cindex specifying hardware config 5362@cindex hardware models and configurations, specifying 5363@cindex machine dependent options 5364 5365Earlier we discussed the standard option @option{-b} which chooses among 5366different installed compilers for completely different target 5367machines, such as VAX vs.@: 68000 vs.@: 80386. 5368 5369In addition, each of these target machine types can have its own 5370special options, starting with @samp{-m}, to choose among various 5371hardware models or configurations---for example, 68010 vs 68020, 5372floating coprocessor or none. A single installed version of the 5373compiler can compile for any model or configuration, according to the 5374options specified. 5375 5376Some configurations of the compiler also support additional special 5377options, usually for compatibility with other compilers on the same 5378platform. 5379 5380These options are defined by the macro @code{TARGET_SWITCHES} in the 5381machine description. The default for the options is also defined by 5382that macro, which enables you to change the defaults. 5383 5384@menu 5385* M680x0 Options:: 5386* M68hc1x Options:: 5387* VAX Options:: 5388* SPARC Options:: 5389* ARM Options:: 5390* MN10200 Options:: 5391* MN10300 Options:: 5392* M32R/D Options:: 5393* M88K Options:: 5394* RS/6000 and PowerPC Options:: 5395* Darwin Options:: 5396* RT Options:: 5397* MIPS Options:: 5398* i386 and x86-64 Options:: 5399* HPPA Options:: 5400* Intel 960 Options:: 5401* DEC Alpha Options:: 5402* DEC Alpha/VMS Options:: 5403* H8/300 Options:: 5404* SH Options:: 5405* System V Options:: 5406* TMS320C3x/C4x Options:: 5407* V850 Options:: 5408* ARC Options:: 5409* NS32K Options:: 5410* AVR Options:: 5411* MCore Options:: 5412* IA-64 Options:: 5413* D30V Options:: 5414* S/390 and zSeries Options:: 5415* CRIS Options:: 5416* MMIX Options:: 5417* PDP-11 Options:: 5418* Xstormy16 Options:: 5419* Xtensa Options:: 5420* FRV Options:: 5421@end menu 5422 5423@node M680x0 Options 5424@subsection M680x0 Options 5425@cindex M680x0 options 5426 5427These are the @samp{-m} options defined for the 68000 series. The default 5428values for these options depends on which style of 68000 was selected when 5429the compiler was configured; the defaults for the most common choices are 5430given below. 5431 5432@table @gcctabopt 5433@item -m68000 5434@itemx -mc68000 5435@opindex m68000 5436@opindex mc68000 5437Generate output for a 68000. This is the default 5438when the compiler is configured for 68000-based systems. 5439 5440Use this option for microcontrollers with a 68000 or EC000 core, 5441including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356. 5442 5443@item -m68020 5444@itemx -mc68020 5445@opindex m68020 5446@opindex mc68020 5447Generate output for a 68020. This is the default 5448when the compiler is configured for 68020-based systems. 5449 5450@item -m68881 5451@opindex m68881 5452Generate output containing 68881 instructions for floating point. 5453This is the default for most 68020 systems unless @option{--nfp} was 5454specified when the compiler was configured. 5455 5456@item -m68030 5457@opindex m68030 5458Generate output for a 68030. This is the default when the compiler is 5459configured for 68030-based systems. 5460 5461@item -m68040 5462@opindex m68040 5463Generate output for a 68040. This is the default when the compiler is 5464configured for 68040-based systems. 5465 5466This option inhibits the use of 68881/68882 instructions that have to be 5467emulated by software on the 68040. Use this option if your 68040 does not 5468have code to emulate those instructions. 5469 5470@item -m68060 5471@opindex m68060 5472Generate output for a 68060. This is the default when the compiler is 5473configured for 68060-based systems. 5474 5475This option inhibits the use of 68020 and 68881/68882 instructions that 5476have to be emulated by software on the 68060. Use this option if your 68060 5477does not have code to emulate those instructions. 5478 5479@item -mcpu32 5480@opindex mcpu32 5481Generate output for a CPU32. This is the default 5482when the compiler is configured for CPU32-based systems. 5483 5484Use this option for microcontrollers with a 5485CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334, 548668336, 68340, 68341, 68349 and 68360. 5487 5488@item -m5200 5489@opindex m5200 5490Generate output for a 520X ``coldfire'' family cpu. This is the default 5491when the compiler is configured for 520X-based systems. 5492 5493Use this option for microcontroller with a 5200 core, including 5494the MCF5202, MCF5203, MCF5204 and MCF5202. 5495 5496 5497@item -m68020-40 5498@opindex m68020-40 5499Generate output for a 68040, without using any of the new instructions. 5500This results in code which can run relatively efficiently on either a 550168020/68881 or a 68030 or a 68040. The generated code does use the 550268881 instructions that are emulated on the 68040. 5503 5504@item -m68020-60 5505@opindex m68020-60 5506Generate output for a 68060, without using any of the new instructions. 5507This results in code which can run relatively efficiently on either a 550868020/68881 or a 68030 or a 68040. The generated code does use the 550968881 instructions that are emulated on the 68060. 5510 5511@item -mfpa 5512@opindex mfpa 5513Generate output containing Sun FPA instructions for floating point. 5514 5515@item -msoft-float 5516@opindex msoft-float 5517Generate output containing library calls for floating point. 5518@strong{Warning:} the requisite libraries are not available for all m68k 5519targets. Normally the facilities of the machine's usual C compiler are 5520used, but this can't be done directly in cross-compilation. You must 5521make your own arrangements to provide suitable library functions for 5522cross-compilation. The embedded targets @samp{m68k-*-aout} and 5523@samp{m68k-*-coff} do provide software floating point support. 5524 5525@item -mshort 5526@opindex mshort 5527Consider type @code{int} to be 16 bits wide, like @code{short int}. 5528 5529@item -mnobitfield 5530@opindex mnobitfield 5531Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32} 5532and @option{-m5200} options imply @w{@option{-mnobitfield}}. 5533 5534@item -mbitfield 5535@opindex mbitfield 5536Do use the bit-field instructions. The @option{-m68020} option implies 5537@option{-mbitfield}. This is the default if you use a configuration 5538designed for a 68020. 5539 5540@item -mrtd 5541@opindex mrtd 5542Use a different function-calling convention, in which functions 5543that take a fixed number of arguments return with the @code{rtd} 5544instruction, which pops their arguments while returning. This 5545saves one instruction in the caller since there is no need to pop 5546the arguments there. 5547 5548This calling convention is incompatible with the one normally 5549used on Unix, so you cannot use it if you need to call libraries 5550compiled with the Unix compiler. 5551 5552Also, you must provide function prototypes for all functions that 5553take variable numbers of arguments (including @code{printf}); 5554otherwise incorrect code will be generated for calls to those 5555functions. 5556 5557In addition, seriously incorrect code will result if you call a 5558function with too many arguments. (Normally, extra arguments are 5559harmlessly ignored.) 5560 5561The @code{rtd} instruction is supported by the 68010, 68020, 68030, 556268040, 68060 and CPU32 processors, but not by the 68000 or 5200. 5563 5564@item -malign-int 5565@itemx -mno-align-int 5566@opindex malign-int 5567@opindex mno-align-int 5568Control whether GCC aligns @code{int}, @code{long}, @code{long long}, 5569@code{float}, @code{double}, and @code{long double} variables on a 32-bit 5570boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}). 5571Aligning variables on 32-bit boundaries produces code that runs somewhat 5572faster on processors with 32-bit busses at the expense of more memory. 5573 5574@strong{Warning:} if you use the @option{-malign-int} switch, GCC will 5575align structures containing the above types differently than 5576most published application binary interface specifications for the m68k. 5577 5578@item -mpcrel 5579@opindex mpcrel 5580Use the pc-relative addressing mode of the 68000 directly, instead of 5581using a global offset table. At present, this option implies @option{-fpic}, 5582allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is 5583not presently supported with @option{-mpcrel}, though this could be supported for 558468020 and higher processors. 5585 5586@item -mno-strict-align 5587@itemx -mstrict-align 5588@opindex mno-strict-align 5589@opindex mstrict-align 5590Do not (do) assume that unaligned memory references will be handled by 5591the system. 5592 5593@end table 5594 5595@node M68hc1x Options 5596@subsection M68hc1x Options 5597@cindex M68hc1x options 5598 5599These are the @samp{-m} options defined for the 68hc11 and 68hc12 5600microcontrollers. The default values for these options depends on 5601which style of microcontroller was selected when the compiler was configured; 5602the defaults for the most common choices are given below. 5603 5604@table @gcctabopt 5605@item -m6811 5606@itemx -m68hc11 5607@opindex m6811 5608@opindex m68hc11 5609Generate output for a 68HC11. This is the default 5610when the compiler is configured for 68HC11-based systems. 5611 5612@item -m6812 5613@itemx -m68hc12 5614@opindex m6812 5615@opindex m68hc12 5616Generate output for a 68HC12. This is the default 5617when the compiler is configured for 68HC12-based systems. 5618 5619@item -m68S12 5620@itemx -m68hcs12 5621@opindex m68S12 5622@opindex m68hcs12 5623Generate output for a 68HCS12. 5624 5625@item -mauto-incdec 5626@opindex mauto-incdec 5627Enable the use of 68HC12 pre and post auto-increment and auto-decrement 5628addressing modes. 5629 5630@item -minmax 5631@itemx -nominmax 5632@opindex minmax 5633@opindex mnominmax 5634Enable the use of 68HC12 min and max instructions. 5635 5636@item -mlong-calls 5637@itemx -mno-long-calls 5638@opindex mlong-calls 5639@opindex mno-long-calls 5640Treat all calls as being far away (near). If calls are assumed to be 5641far away, the compiler will use the @code{call} instruction to 5642call a function and the @code{rtc} instruction for returning. 5643 5644@item -mshort 5645@opindex mshort 5646Consider type @code{int} to be 16 bits wide, like @code{short int}. 5647 5648@item -msoft-reg-count=@var{count} 5649@opindex msoft-reg-count 5650Specify the number of pseudo-soft registers which are used for the 5651code generation. The maximum number is 32. Using more pseudo-soft 5652register may or may not result in better code depending on the program. 5653The default is 4 for 68HC11 and 2 for 68HC12. 5654 5655@end table 5656 5657@node VAX Options 5658@subsection VAX Options 5659@cindex VAX options 5660 5661These @samp{-m} options are defined for the VAX: 5662 5663@table @gcctabopt 5664@item -munix 5665@opindex munix 5666Do not output certain jump instructions (@code{aobleq} and so on) 5667that the Unix assembler for the VAX cannot handle across long 5668ranges. 5669 5670@item -mgnu 5671@opindex mgnu 5672Do output those jump instructions, on the assumption that you 5673will assemble with the GNU assembler. 5674 5675@item -mg 5676@opindex mg 5677Output code for g-format floating point numbers instead of d-format. 5678@end table 5679 5680@node SPARC Options 5681@subsection SPARC Options 5682@cindex SPARC options 5683 5684These @samp{-m} switches are supported on the SPARC: 5685 5686@table @gcctabopt 5687@item -mno-app-regs 5688@itemx -mapp-regs 5689@opindex mno-app-regs 5690@opindex mapp-regs 5691Specify @option{-mapp-regs} to generate output using the global registers 56922 through 4, which the SPARC SVR4 ABI reserves for applications. This 5693is the default. 5694 5695To be fully SVR4 ABI compliant at the cost of some performance loss, 5696specify @option{-mno-app-regs}. You should compile libraries and system 5697software with this option. 5698 5699@item -mfpu 5700@itemx -mhard-float 5701@opindex mfpu 5702@opindex mhard-float 5703Generate output containing floating point instructions. This is the 5704default. 5705 5706@item -mno-fpu 5707@itemx -msoft-float 5708@opindex mno-fpu 5709@opindex msoft-float 5710Generate output containing library calls for floating point. 5711@strong{Warning:} the requisite libraries are not available for all SPARC 5712targets. Normally the facilities of the machine's usual C compiler are 5713used, but this cannot be done directly in cross-compilation. You must make 5714your own arrangements to provide suitable library functions for 5715cross-compilation. The embedded targets @samp{sparc-*-aout} and 5716@samp{sparclite-*-*} do provide software floating point support. 5717 5718@option{-msoft-float} changes the calling convention in the output file; 5719therefore, it is only useful if you compile @emph{all} of a program with 5720this option. In particular, you need to compile @file{libgcc.a}, the 5721library that comes with GCC, with @option{-msoft-float} in order for 5722this to work. 5723 5724@item -mhard-quad-float 5725@opindex mhard-quad-float 5726Generate output containing quad-word (long double) floating point 5727instructions. 5728 5729@item -msoft-quad-float 5730@opindex msoft-quad-float 5731Generate output containing library calls for quad-word (long double) 5732floating point instructions. The functions called are those specified 5733in the SPARC ABI@. This is the default. 5734 5735As of this writing, there are no sparc implementations that have hardware 5736support for the quad-word floating point instructions. They all invoke 5737a trap handler for one of these instructions, and then the trap handler 5738emulates the effect of the instruction. Because of the trap handler overhead, 5739this is much slower than calling the ABI library routines. Thus the 5740@option{-msoft-quad-float} option is the default. 5741 5742@item -mno-flat 5743@itemx -mflat 5744@opindex mno-flat 5745@opindex mflat 5746With @option{-mflat}, the compiler does not generate save/restore instructions 5747and will use a ``flat'' or single register window calling convention. 5748This model uses %i7 as the frame pointer and is compatible with the normal 5749register window model. Code from either may be intermixed. 5750The local registers and the input registers (0--5) are still treated as 5751``call saved'' registers and will be saved on the stack as necessary. 5752 5753With @option{-mno-flat} (the default), the compiler emits save/restore 5754instructions (except for leaf functions) and is the normal mode of operation. 5755 5756@item -mno-unaligned-doubles 5757@itemx -munaligned-doubles 5758@opindex mno-unaligned-doubles 5759@opindex munaligned-doubles 5760Assume that doubles have 8 byte alignment. This is the default. 5761 5762With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte 5763alignment only if they are contained in another type, or if they have an 5764absolute address. Otherwise, it assumes they have 4 byte alignment. 5765Specifying this option avoids some rare compatibility problems with code 5766generated by other compilers. It is not the default because it results 5767in a performance loss, especially for floating point code. 5768 5769@item -mno-faster-structs 5770@itemx -mfaster-structs 5771@opindex mno-faster-structs 5772@opindex mfaster-structs 5773With @option{-mfaster-structs}, the compiler assumes that structures 5774should have 8 byte alignment. This enables the use of pairs of 5775@code{ldd} and @code{std} instructions for copies in structure 5776assignment, in place of twice as many @code{ld} and @code{st} pairs. 5777However, the use of this changed alignment directly violates the SPARC 5778ABI@. Thus, it's intended only for use on targets where the developer 5779acknowledges that their resulting code will not be directly in line with 5780the rules of the ABI@. 5781 5782@item -mimpure-text 5783@opindex mimpure-text 5784@option{-mimpure-text}, used in addition to @option{-shared}, tells 5785the compiler to not pass @option{-z text} to the linker when linking a 5786shared object. Using this option, you can link position-dependent 5787code into a shared object. 5788 5789@option{-mimpure-text} suppresses the ``relocations remain against 5790allocatable but non-writable sections'' linker error message. 5791However, the necessary relocations will trigger copy-on-write, and the 5792shared object is not actually shared across processes. Instead of 5793using @option{-mimpure-text}, you should compile all source code with 5794@option{-fpic} or @option{-fPIC}. 5795 5796This option is only available on SunOS and Solaris. 5797 5798@item -mv8 5799@itemx -msparclite 5800@opindex mv8 5801@opindex msparclite 5802These two options select variations on the SPARC architecture. 5803 5804By default (unless specifically configured for the Fujitsu SPARClite), 5805GCC generates code for the v7 variant of the SPARC architecture. 5806 5807@option{-mv8} will give you SPARC v8 code. The only difference from v7 5808code is that the compiler emits the integer multiply and integer 5809divide instructions which exist in SPARC v8 but not in SPARC v7. 5810 5811@option{-msparclite} will give you SPARClite code. This adds the integer 5812multiply, integer divide step and scan (@code{ffs}) instructions which 5813exist in SPARClite but not in SPARC v7. 5814 5815These options are deprecated and will be deleted in a future GCC release. 5816They have been replaced with @option{-mcpu=xxx}. 5817 5818@item -mcypress 5819@itemx -msupersparc 5820@opindex mcypress 5821@opindex msupersparc 5822These two options select the processor for which the code is optimized. 5823 5824With @option{-mcypress} (the default), the compiler optimizes code for the 5825Cypress CY7C602 chip, as used in the SPARCStation/SPARCServer 3xx series. 5826This is also appropriate for the older SPARCStation 1, 2, IPX etc. 5827 5828With @option{-msupersparc} the compiler optimizes code for the SuperSPARC cpu, as 5829used in the SPARCStation 10, 1000 and 2000 series. This flag also enables use 5830of the full SPARC v8 instruction set. 5831 5832These options are deprecated and will be deleted in a future GCC release. 5833They have been replaced with @option{-mcpu=xxx}. 5834 5835@item -mcpu=@var{cpu_type} 5836@opindex mcpu 5837Set the instruction set, register set, and instruction scheduling parameters 5838for machine type @var{cpu_type}. Supported values for @var{cpu_type} are 5839@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite}, 5840@samp{hypersparc}, @samp{sparclite86x}, @samp{f930}, @samp{f934}, 5841@samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc}, and 5842@samp{ultrasparc3}. 5843 5844Default instruction scheduling parameters are used for values that select 5845an architecture and not an implementation. These are @samp{v7}, @samp{v8}, 5846@samp{sparclite}, @samp{sparclet}, @samp{v9}. 5847 5848Here is a list of each supported architecture and their supported 5849implementations. 5850 5851@smallexample 5852 v7: cypress 5853 v8: supersparc, hypersparc 5854 sparclite: f930, f934, sparclite86x 5855 sparclet: tsc701 5856 v9: ultrasparc, ultrasparc3 5857@end smallexample 5858 5859@item -mtune=@var{cpu_type} 5860@opindex mtune 5861Set the instruction scheduling parameters for machine type 5862@var{cpu_type}, but do not set the instruction set or register set that the 5863option @option{-mcpu=@var{cpu_type}} would. 5864 5865The same values for @option{-mcpu=@var{cpu_type}} can be used for 5866@option{-mtune=@var{cpu_type}}, but the only useful values are those 5867that select a particular cpu implementation. Those are @samp{cypress}, 5868@samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934}, 5869@samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc}, and 5870@samp{ultrasparc3}. 5871 5872@end table 5873 5874These @samp{-m} switches are supported in addition to the above 5875on the SPARCLET processor. 5876 5877@table @gcctabopt 5878@item -mlittle-endian 5879@opindex mlittle-endian 5880Generate code for a processor running in little-endian mode. 5881 5882@item -mlive-g0 5883@opindex mlive-g0 5884Treat register @code{%g0} as a normal register. 5885GCC will continue to clobber it as necessary but will not assume 5886it always reads as 0. 5887 5888@item -mbroken-saverestore 5889@opindex mbroken-saverestore 5890Generate code that does not use non-trivial forms of the @code{save} and 5891@code{restore} instructions. Early versions of the SPARCLET processor do 5892not correctly handle @code{save} and @code{restore} instructions used with 5893arguments. They correctly handle them used without arguments. A @code{save} 5894instruction used without arguments increments the current window pointer 5895but does not allocate a new stack frame. It is assumed that the window 5896overflow trap handler will properly handle this case as will interrupt 5897handlers. 5898@end table 5899 5900These @samp{-m} switches are supported in addition to the above 5901on SPARC V9 processors in 64-bit environments. 5902 5903@table @gcctabopt 5904@item -mlittle-endian 5905@opindex mlittle-endian 5906Generate code for a processor running in little-endian mode. It is only 5907available for a few configurations and most notably not on Solaris. 5908 5909@item -m32 5910@itemx -m64 5911@opindex m32 5912@opindex m64 5913Generate code for a 32-bit or 64-bit environment. 5914The 32-bit environment sets int, long and pointer to 32 bits. 5915The 64-bit environment sets int to 32 bits and long and pointer 5916to 64 bits. 5917 5918@item -mcmodel=medlow 5919@opindex mcmodel=medlow 5920Generate code for the Medium/Low code model: the program must be linked 5921in the low 32 bits of the address space. Pointers are 64 bits. 5922Programs can be statically or dynamically linked. 5923 5924@item -mcmodel=medmid 5925@opindex mcmodel=medmid 5926Generate code for the Medium/Middle code model: the program must be linked 5927in the low 44 bits of the address space, the text segment must be less than 59282G bytes, and data segment must be within 2G of the text segment. 5929Pointers are 64 bits. 5930 5931@item -mcmodel=medany 5932@opindex mcmodel=medany 5933Generate code for the Medium/Anywhere code model: the program may be linked 5934anywhere in the address space, the text segment must be less than 59352G bytes, and data segment must be within 2G of the text segment. 5936Pointers are 64 bits. 5937 5938@item -mcmodel=embmedany 5939@opindex mcmodel=embmedany 5940Generate code for the Medium/Anywhere code model for embedded systems: 5941assume a 32-bit text and a 32-bit data segment, both starting anywhere 5942(determined at link time). Register %g4 points to the base of the 5943data segment. Pointers are still 64 bits. 5944Programs are statically linked, PIC is not supported. 5945 5946@item -mstack-bias 5947@itemx -mno-stack-bias 5948@opindex mstack-bias 5949@opindex mno-stack-bias 5950With @option{-mstack-bias}, GCC assumes that the stack pointer, and 5951frame pointer if present, are offset by @minus{}2047 which must be added back 5952when making stack frame references. 5953Otherwise, assume no such offset is present. 5954@end table 5955 5956@node ARM Options 5957@subsection ARM Options 5958@cindex ARM options 5959 5960These @samp{-m} options are defined for Advanced RISC Machines (ARM) 5961architectures: 5962 5963@table @gcctabopt 5964@item -mapcs-frame 5965@opindex mapcs-frame 5966Generate a stack frame that is compliant with the ARM Procedure Call 5967Standard for all functions, even if this is not strictly necessary for 5968correct execution of the code. Specifying @option{-fomit-frame-pointer} 5969with this option will cause the stack frames not to be generated for 5970leaf functions. The default is @option{-mno-apcs-frame}. 5971 5972@item -mapcs 5973@opindex mapcs 5974This is a synonym for @option{-mapcs-frame}. 5975 5976@item -mapcs-26 5977@opindex mapcs-26 5978Generate code for a processor running with a 26-bit program counter, 5979and conforming to the function calling standards for the APCS 26-bit 5980option. This option replaces the @option{-m2} and @option{-m3} options 5981of previous releases of the compiler. 5982 5983@item -mapcs-32 5984@opindex mapcs-32 5985Generate code for a processor running with a 32-bit program counter, 5986and conforming to the function calling standards for the APCS 32-bit 5987option. This option replaces the @option{-m6} option of previous releases 5988of the compiler. 5989 5990@ignore 5991@c not currently implemented 5992@item -mapcs-stack-check 5993@opindex mapcs-stack-check 5994Generate code to check the amount of stack space available upon entry to 5995every function (that actually uses some stack space). If there is 5996insufficient space available then either the function 5997@samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be 5998called, depending upon the amount of stack space required. The run time 5999system is required to provide these functions. The default is 6000@option{-mno-apcs-stack-check}, since this produces smaller code. 6001 6002@c not currently implemented 6003@item -mapcs-float 6004@opindex mapcs-float 6005Pass floating point arguments using the float point registers. This is 6006one of the variants of the APCS@. This option is recommended if the 6007target hardware has a floating point unit or if a lot of floating point 6008arithmetic is going to be performed by the code. The default is 6009@option{-mno-apcs-float}, since integer only code is slightly increased in 6010size if @option{-mapcs-float} is used. 6011 6012@c not currently implemented 6013@item -mapcs-reentrant 6014@opindex mapcs-reentrant 6015Generate reentrant, position independent code. The default is 6016@option{-mno-apcs-reentrant}. 6017@end ignore 6018 6019@item -mthumb-interwork 6020@opindex mthumb-interwork 6021Generate code which supports calling between the ARM and Thumb 6022instruction sets. Without this option the two instruction sets cannot 6023be reliably used inside one program. The default is 6024@option{-mno-thumb-interwork}, since slightly larger code is generated 6025when @option{-mthumb-interwork} is specified. 6026 6027@item -mno-sched-prolog 6028@opindex mno-sched-prolog 6029Prevent the reordering of instructions in the function prolog, or the 6030merging of those instruction with the instructions in the function's 6031body. This means that all functions will start with a recognizable set 6032of instructions (or in fact one of a choice from a small set of 6033different function prologues), and this information can be used to 6034locate the start if functions inside an executable piece of code. The 6035default is @option{-msched-prolog}. 6036 6037@item -mhard-float 6038@opindex mhard-float 6039Generate output containing floating point instructions. This is the 6040default. 6041 6042@item -msoft-float 6043@opindex msoft-float 6044Generate output containing library calls for floating point. 6045@strong{Warning:} the requisite libraries are not available for all ARM 6046targets. Normally the facilities of the machine's usual C compiler are 6047used, but this cannot be done directly in cross-compilation. You must make 6048your own arrangements to provide suitable library functions for 6049cross-compilation. 6050 6051@option{-msoft-float} changes the calling convention in the output file; 6052therefore, it is only useful if you compile @emph{all} of a program with 6053this option. In particular, you need to compile @file{libgcc.a}, the 6054library that comes with GCC, with @option{-msoft-float} in order for 6055this to work. 6056 6057@item -mlittle-endian 6058@opindex mlittle-endian 6059Generate code for a processor running in little-endian mode. This is 6060the default for all standard configurations. 6061 6062@item -mbig-endian 6063@opindex mbig-endian 6064Generate code for a processor running in big-endian mode; the default is 6065to compile code for a little-endian processor. 6066 6067@item -mwords-little-endian 6068@opindex mwords-little-endian 6069This option only applies when generating code for big-endian processors. 6070Generate code for a little-endian word order but a big-endian byte 6071order. That is, a byte order of the form @samp{32107654}. Note: this 6072option should only be used if you require compatibility with code for 6073big-endian ARM processors generated by versions of the compiler prior to 60742.8. 6075 6076@item -malignment-traps 6077@opindex malignment-traps 6078Generate code that will not trap if the MMU has alignment traps enabled. 6079On ARM architectures prior to ARMv4, there were no instructions to 6080access half-word objects stored in memory. However, when reading from 6081memory a feature of the ARM architecture allows a word load to be used, 6082even if the address is unaligned, and the processor core will rotate the 6083data as it is being loaded. This option tells the compiler that such 6084misaligned accesses will cause a MMU trap and that it should instead 6085synthesize the access as a series of byte accesses. The compiler can 6086still use word accesses to load half-word data if it knows that the 6087address is aligned to a word boundary. 6088 6089This option is ignored when compiling for ARM architecture 4 or later, 6090since these processors have instructions to directly access half-word 6091objects in memory. 6092 6093@item -mno-alignment-traps 6094@opindex mno-alignment-traps 6095Generate code that assumes that the MMU will not trap unaligned 6096accesses. This produces better code when the target instruction set 6097does not have half-word memory operations (i.e.@: implementations prior to 6098ARMv4). 6099 6100Note that you cannot use this option to access unaligned word objects, 6101since the processor will only fetch one 32-bit aligned object from 6102memory. 6103 6104The default setting for most targets is @option{-mno-alignment-traps}, since 6105this produces better code when there are no half-word memory 6106instructions available. 6107 6108@item -mshort-load-bytes 6109@itemx -mno-short-load-words 6110@opindex mshort-load-bytes 6111@opindex mno-short-load-words 6112These are deprecated aliases for @option{-malignment-traps}. 6113 6114@item -mno-short-load-bytes 6115@itemx -mshort-load-words 6116@opindex mno-short-load-bytes 6117@opindex mshort-load-words 6118This are deprecated aliases for @option{-mno-alignment-traps}. 6119 6120@item -mcpu=@var{name} 6121@opindex mcpu 6122This specifies the name of the target ARM processor. GCC uses this name 6123to determine what kind of instructions it can emit when generating 6124assembly code. Permissible names are: @samp{arm2}, @samp{arm250}, 6125@samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610}, 6126@samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm}, 6127@samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700}, 6128@samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100}, 6129@samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm8}, 6130@samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100}, 6131@samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920}, 6132@samp{arm920t}, @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, 6133@samp{arm1020t}, @samp{xscale}. 6134 6135@itemx -mtune=@var{name} 6136@opindex mtune 6137This option is very similar to the @option{-mcpu=} option, except that 6138instead of specifying the actual target processor type, and hence 6139restricting which instructions can be used, it specifies that GCC should 6140tune the performance of the code as if the target were of the type 6141specified in this option, but still choosing the instructions that it 6142will generate based on the cpu specified by a @option{-mcpu=} option. 6143For some ARM implementations better performance can be obtained by using 6144this option. 6145 6146@item -march=@var{name} 6147@opindex march 6148This specifies the name of the target ARM architecture. GCC uses this 6149name to determine what kind of instructions it can emit when generating 6150assembly code. This option can be used in conjunction with or instead 6151of the @option{-mcpu=} option. Permissible names are: @samp{armv2}, 6152@samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t}, 6153@samp{armv5}, @samp{armv5t}, @samp{armv5te}. 6154 6155@item -mfpe=@var{number} 6156@itemx -mfp=@var{number} 6157@opindex mfpe 6158@opindex mfp 6159This specifies the version of the floating point emulation available on 6160the target. Permissible values are 2 and 3. @option{-mfp=} is a synonym 6161for @option{-mfpe=}, for compatibility with older versions of GCC@. 6162 6163@item -mstructure-size-boundary=@var{n} 6164@opindex mstructure-size-boundary 6165The size of all structures and unions will be rounded up to a multiple 6166of the number of bits set by this option. Permissible values are 8 and 616732. The default value varies for different toolchains. For the COFF 6168targeted toolchain the default value is 8. Specifying the larger number 6169can produce faster, more efficient code, but can also increase the size 6170of the program. The two values are potentially incompatible. Code 6171compiled with one value cannot necessarily expect to work with code or 6172libraries compiled with the other value, if they exchange information 6173using structures or unions. 6174 6175@item -mabort-on-noreturn 6176@opindex mabort-on-noreturn 6177Generate a call to the function @code{abort} at the end of a 6178@code{noreturn} function. It will be executed if the function tries to 6179return. 6180 6181@item -mlong-calls 6182@itemx -mno-long-calls 6183@opindex mlong-calls 6184@opindex mno-long-calls 6185Tells the compiler to perform function calls by first loading the 6186address of the function into a register and then performing a subroutine 6187call on this register. This switch is needed if the target function 6188will lie outside of the 64 megabyte addressing range of the offset based 6189version of subroutine call instruction. 6190 6191Even if this switch is enabled, not all function calls will be turned 6192into long calls. The heuristic is that static functions, functions 6193which have the @samp{short-call} attribute, functions that are inside 6194the scope of a @samp{#pragma no_long_calls} directive and functions whose 6195definitions have already been compiled within the current compilation 6196unit, will not be turned into long calls. The exception to this rule is 6197that weak function definitions, functions with the @samp{long-call} 6198attribute or the @samp{section} attribute, and functions that are within 6199the scope of a @samp{#pragma long_calls} directive, will always be 6200turned into long calls. 6201 6202This feature is not enabled by default. Specifying 6203@option{-mno-long-calls} will restore the default behavior, as will 6204placing the function calls within the scope of a @samp{#pragma 6205long_calls_off} directive. Note these switches have no effect on how 6206the compiler generates code to handle function calls via function 6207pointers. 6208 6209@item -mnop-fun-dllimport 6210@opindex mnop-fun-dllimport 6211Disable support for the @code{dllimport} attribute. 6212 6213@item -msingle-pic-base 6214@opindex msingle-pic-base 6215Treat the register used for PIC addressing as read-only, rather than 6216loading it in the prologue for each function. The run-time system is 6217responsible for initializing this register with an appropriate value 6218before execution begins. 6219 6220@item -mpic-register=@var{reg} 6221@opindex mpic-register 6222Specify the register to be used for PIC addressing. The default is R10 6223unless stack-checking is enabled, when R9 is used. 6224 6225@item -mpoke-function-name 6226@opindex mpoke-function-name 6227Write the name of each function into the text section, directly 6228preceding the function prologue. The generated code is similar to this: 6229 6230@smallexample 6231 t0 6232 .ascii "arm_poke_function_name", 0 6233 .align 6234 t1 6235 .word 0xff000000 + (t1 - t0) 6236 arm_poke_function_name 6237 mov ip, sp 6238 stmfd sp!, @{fp, ip, lr, pc@} 6239 sub fp, ip, #4 6240@end smallexample 6241 6242When performing a stack backtrace, code can inspect the value of 6243@code{pc} stored at @code{fp + 0}. If the trace function then looks at 6244location @code{pc - 12} and the top 8 bits are set, then we know that 6245there is a function name embedded immediately preceding this location 6246and has length @code{((pc[-3]) & 0xff000000)}. 6247 6248@item -mthumb 6249@opindex mthumb 6250Generate code for the 16-bit Thumb instruction set. The default is to 6251use the 32-bit ARM instruction set. 6252 6253@item -mtpcs-frame 6254@opindex mtpcs-frame 6255Generate a stack frame that is compliant with the Thumb Procedure Call 6256Standard for all non-leaf functions. (A leaf function is one that does 6257not call any other functions.) The default is @option{-mno-tpcs-frame}. 6258 6259@item -mtpcs-leaf-frame 6260@opindex mtpcs-leaf-frame 6261Generate a stack frame that is compliant with the Thumb Procedure Call 6262Standard for all leaf functions. (A leaf function is one that does 6263not call any other functions.) The default is @option{-mno-apcs-leaf-frame}. 6264 6265@item -mcallee-super-interworking 6266@opindex mcallee-super-interworking 6267Gives all externally visible functions in the file being compiled an ARM 6268instruction set header which switches to Thumb mode before executing the 6269rest of the function. This allows these functions to be called from 6270non-interworking code. 6271 6272@item -mcaller-super-interworking 6273@opindex mcaller-super-interworking 6274Allows calls via function pointers (including virtual functions) to 6275execute correctly regardless of whether the target code has been 6276compiled for interworking or not. There is a small overhead in the cost 6277of executing a function pointer if this option is enabled. 6278 6279@end table 6280 6281@node MN10200 Options 6282@subsection MN10200 Options 6283@cindex MN10200 options 6284 6285These @option{-m} options are defined for Matsushita MN10200 architectures: 6286@table @gcctabopt 6287 6288@item -mrelax 6289@opindex mrelax 6290Indicate to the linker that it should perform a relaxation optimization pass 6291to shorten branches, calls and absolute memory addresses. This option only 6292has an effect when used on the command line for the final link step. 6293 6294This option makes symbolic debugging impossible. 6295@end table 6296 6297@node MN10300 Options 6298@subsection MN10300 Options 6299@cindex MN10300 options 6300 6301These @option{-m} options are defined for Matsushita MN10300 architectures: 6302 6303@table @gcctabopt 6304@item -mmult-bug 6305@opindex mmult-bug 6306Generate code to avoid bugs in the multiply instructions for the MN10300 6307processors. This is the default. 6308 6309@item -mno-mult-bug 6310@opindex mno-mult-bug 6311Do not generate code to avoid bugs in the multiply instructions for the 6312MN10300 processors. 6313 6314@item -mam33 6315@opindex mam33 6316Generate code which uses features specific to the AM33 processor. 6317 6318@item -mno-am33 6319@opindex mno-am33 6320Do not generate code which uses features specific to the AM33 processor. This 6321is the default. 6322 6323@item -mno-crt0 6324@opindex mno-crt0 6325Do not link in the C run-time initialization object file. 6326 6327@item -mrelax 6328@opindex mrelax 6329Indicate to the linker that it should perform a relaxation optimization pass 6330to shorten branches, calls and absolute memory addresses. This option only 6331has an effect when used on the command line for the final link step. 6332 6333This option makes symbolic debugging impossible. 6334@end table 6335 6336 6337@node M32R/D Options 6338@subsection M32R/D Options 6339@cindex M32R/D options 6340 6341These @option{-m} options are defined for Mitsubishi M32R/D architectures: 6342 6343@table @gcctabopt 6344@item -m32rx 6345@opindex m32rx 6346Generate code for the M32R/X@. 6347 6348@item -m32r 6349@opindex m32r 6350Generate code for the M32R@. This is the default. 6351 6352@item -mcode-model=small 6353@opindex mcode-model=small 6354Assume all objects live in the lower 16MB of memory (so that their addresses 6355can be loaded with the @code{ld24} instruction), and assume all subroutines 6356are reachable with the @code{bl} instruction. 6357This is the default. 6358 6359The addressability of a particular object can be set with the 6360@code{model} attribute. 6361 6362@item -mcode-model=medium 6363@opindex mcode-model=medium 6364Assume objects may be anywhere in the 32-bit address space (the compiler 6365will generate @code{seth/add3} instructions to load their addresses), and 6366assume all subroutines are reachable with the @code{bl} instruction. 6367 6368@item -mcode-model=large 6369@opindex mcode-model=large 6370Assume objects may be anywhere in the 32-bit address space (the compiler 6371will generate @code{seth/add3} instructions to load their addresses), and 6372assume subroutines may not be reachable with the @code{bl} instruction 6373(the compiler will generate the much slower @code{seth/add3/jl} 6374instruction sequence). 6375 6376@item -msdata=none 6377@opindex msdata=none 6378Disable use of the small data area. Variables will be put into 6379one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the 6380@code{section} attribute has been specified). 6381This is the default. 6382 6383The small data area consists of sections @samp{.sdata} and @samp{.sbss}. 6384Objects may be explicitly put in the small data area with the 6385@code{section} attribute using one of these sections. 6386 6387@item -msdata=sdata 6388@opindex msdata=sdata 6389Put small global and static data in the small data area, but do not 6390generate special code to reference them. 6391 6392@item -msdata=use 6393@opindex msdata=use 6394Put small global and static data in the small data area, and generate 6395special instructions to reference them. 6396 6397@item -G @var{num} 6398@opindex G 6399@cindex smaller data references 6400Put global and static objects less than or equal to @var{num} bytes 6401into the small data or bss sections instead of the normal data or bss 6402sections. The default value of @var{num} is 8. 6403The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use} 6404for this option to have any effect. 6405 6406All modules should be compiled with the same @option{-G @var{num}} value. 6407Compiling with different values of @var{num} may or may not work; if it 6408doesn't the linker will give an error message---incorrect code will not be 6409generated. 6410 6411@end table 6412 6413@node M88K Options 6414@subsection M88K Options 6415@cindex M88k options 6416 6417These @samp{-m} options are defined for Motorola 88k architectures: 6418 6419@table @gcctabopt 6420@item -m88000 6421@opindex m88000 6422Generate code that works well on both the m88100 and the 6423m88110. 6424 6425@item -m88100 6426@opindex m88100 6427Generate code that works best for the m88100, but that also 6428runs on the m88110. 6429 6430@item -m88110 6431@opindex m88110 6432Generate code that works best for the m88110, and may not run 6433on the m88100. 6434 6435@item -mbig-pic 6436@opindex mbig-pic 6437Obsolete option to be removed from the next revision. 6438Use @option{-fPIC}. 6439 6440@item -midentify-revision 6441@opindex midentify-revision 6442@cindex identifying source, compiler (88k) 6443Include an @code{ident} directive in the assembler output recording the 6444source file name, compiler name and version, timestamp, and compilation 6445flags used. 6446 6447@item -mno-underscores 6448@opindex mno-underscores 6449@cindex underscores, avoiding (88k) 6450In assembler output, emit symbol names without adding an underscore 6451character at the beginning of each name. The default is to use an 6452underscore as prefix on each name. 6453 6454@item -mocs-debug-info 6455@itemx -mno-ocs-debug-info 6456@opindex mocs-debug-info 6457@opindex mno-ocs-debug-info 6458@cindex OCS (88k) 6459@cindex debugging, 88k OCS 6460Include (or omit) additional debugging information (about registers used 6461in each stack frame) as specified in the 88open Object Compatibility 6462Standard, ``OCS''@. This extra information allows debugging of code that 6463has had the frame pointer eliminated. The default for SVr4 and Delta 88 6464SVr3.2 is to include this information; other 88k configurations omit this 6465information by default. 6466 6467@item -mocs-frame-position 6468@opindex mocs-frame-position 6469@cindex register positions in frame (88k) 6470When emitting COFF debugging information for automatic variables and 6471parameters stored on the stack, use the offset from the canonical frame 6472address, which is the stack pointer (register 31) on entry to the 6473function. The SVr4 and Delta88 SVr3.2, and BCS configurations use 6474@option{-mocs-frame-position}; other 88k configurations have the default 6475@option{-mno-ocs-frame-position}. 6476 6477@item -mno-ocs-frame-position 6478@opindex mno-ocs-frame-position 6479@cindex register positions in frame (88k) 6480When emitting COFF debugging information for automatic variables and 6481parameters stored on the stack, use the offset from the frame pointer 6482register (register 30). When this option is in effect, the frame 6483pointer is not eliminated when debugging information is selected by the 6484-g switch. 6485 6486@item -moptimize-arg-area 6487@opindex moptimize-arg-area 6488@cindex arguments in frame (88k) 6489Save space by reorganizing the stack frame. This option generates code 6490that does not agree with the 88open specifications, but uses less 6491memory. 6492 6493@itemx -mno-optimize-arg-area 6494@opindex mno-optimize-arg-area 6495Do not reorganize the stack frame to save space. This is the default. 6496The generated conforms to the specification, but uses more memory. 6497 6498@item -mshort-data-@var{num} 6499@opindex mshort-data 6500@cindex smaller data references (88k) 6501@cindex r0-relative references (88k) 6502Generate smaller data references by making them relative to @code{r0}, 6503which allows loading a value using a single instruction (rather than the 6504usual two). You control which data references are affected by 6505specifying @var{num} with this option. For example, if you specify 6506@option{-mshort-data-512}, then the data references affected are those 6507involving displacements of less than 512 bytes. 6508@option{-mshort-data-@var{num}} is not effective for @var{num} greater 6509than 64k. 6510 6511@item -mserialize-volatile 6512@opindex mserialize-volatile 6513@itemx -mno-serialize-volatile 6514@opindex mno-serialize-volatile 6515@cindex sequential consistency on 88k 6516Do, or don't, generate code to guarantee sequential consistency 6517of volatile memory references. By default, consistency is 6518guaranteed. 6519 6520The order of memory references made by the MC88110 processor does 6521not always match the order of the instructions requesting those 6522references. In particular, a load instruction may execute before 6523a preceding store instruction. Such reordering violates 6524sequential consistency of volatile memory references, when there 6525are multiple processors. When consistency must be guaranteed, 6526GCC generates special instructions, as needed, to force 6527execution in the proper order. 6528 6529The MC88100 processor does not reorder memory references and so 6530always provides sequential consistency. However, by default, GCC 6531generates the special instructions to guarantee consistency 6532even when you use @option{-m88100}, so that the code may be run on an 6533MC88110 processor. If you intend to run your code only on the 6534MC88100 processor, you may use @option{-mno-serialize-volatile}. 6535 6536The extra code generated to guarantee consistency may affect the 6537performance of your application. If you know that you can safely 6538forgo this guarantee, you may use @option{-mno-serialize-volatile}. 6539 6540@item -msvr4 6541@itemx -msvr3 6542@opindex msvr4 6543@opindex msvr3 6544@cindex assembler syntax, 88k 6545@cindex SVr4 6546Turn on (@option{-msvr4}) or off (@option{-msvr3}) compiler extensions 6547related to System V release 4 (SVr4). This controls the following: 6548 6549@enumerate 6550@item 6551Which variant of the assembler syntax to emit. 6552@item 6553@option{-msvr4} makes the C preprocessor recognize @samp{#pragma weak} 6554that is used on System V release 4. 6555@item 6556@option{-msvr4} makes GCC issue additional declaration directives used in 6557SVr4. 6558@end enumerate 6559 6560@option{-msvr4} is the default for the m88k-motorola-sysv4 configuration. 6561@option{-msvr3} is the default for all other m88k configurations. 6562 6563@item -mversion-03.00 6564@opindex mversion-03.00 6565This option is obsolete, and is ignored. 6566@c ??? which asm syntax better for GAS? option there too? 6567 6568@item -mno-check-zero-division 6569@itemx -mcheck-zero-division 6570@opindex mno-check-zero-division 6571@opindex mcheck-zero-division 6572@cindex zero division on 88k 6573Do, or don't, generate code to guarantee that integer division by 6574zero will be detected. By default, detection is guaranteed. 6575 6576Some models of the MC88100 processor fail to trap upon integer 6577division by zero under certain conditions. By default, when 6578compiling code that might be run on such a processor, GCC 6579generates code that explicitly checks for zero-valued divisors 6580and traps with exception number 503 when one is detected. Use of 6581@option{-mno-check-zero-division} suppresses such checking for code 6582generated to run on an MC88100 processor. 6583 6584GCC assumes that the MC88110 processor correctly detects all instances 6585of integer division by zero. When @option{-m88110} is specified, no 6586explicit checks for zero-valued divisors are generated, and both 6587@option{-mcheck-zero-division} and @option{-mno-check-zero-division} are 6588ignored. 6589 6590@item -muse-div-instruction 6591@opindex muse-div-instruction 6592@cindex divide instruction, 88k 6593Use the div instruction for signed integer division on the 6594MC88100 processor. By default, the div instruction is not used. 6595 6596On the MC88100 processor the signed integer division instruction 6597div) traps to the operating system on a negative operand. The 6598operating system transparently completes the operation, but at a 6599large cost in execution time. By default, when compiling code 6600that might be run on an MC88100 processor, GCC emulates signed 6601integer division using the unsigned integer division instruction 6602divu), thereby avoiding the large penalty of a trap to the 6603operating system. Such emulation has its own, smaller, execution 6604cost in both time and space. To the extent that your code's 6605important signed integer division operations are performed on two 6606nonnegative operands, it may be desirable to use the div 6607instruction directly. 6608 6609On the MC88110 processor the div instruction (also known as the 6610divs instruction) processes negative operands without trapping to 6611the operating system. When @option{-m88110} is specified, 6612@option{-muse-div-instruction} is ignored, and the div instruction is used 6613for signed integer division. 6614 6615Note that the result of dividing @code{INT_MIN} by @minus{}1 is undefined. In 6616particular, the behavior of such a division with and without 6617@option{-muse-div-instruction} may differ. 6618 6619@item -mtrap-large-shift 6620@itemx -mhandle-large-shift 6621@opindex mtrap-large-shift 6622@opindex mhandle-large-shift 6623@cindex bit shift overflow (88k) 6624@cindex large bit shifts (88k) 6625Include code to detect bit-shifts of more than 31 bits; respectively, 6626trap such shifts or emit code to handle them properly. By default GCC 6627makes no special provision for large bit shifts. 6628 6629@item -mwarn-passed-structs 6630@opindex mwarn-passed-structs 6631@cindex structure passing (88k) 6632Warn when a function passes a struct as an argument or result. 6633Structure-passing conventions have changed during the evolution of the C 6634language, and are often the source of portability problems. By default, 6635GCC issues no such warning. 6636@end table 6637 6638@c break page here to avoid unsightly interparagraph stretch. 6639@c -zw, 2001-8-17 6640@page 6641 6642@node RS/6000 and PowerPC Options 6643@subsection IBM RS/6000 and PowerPC Options 6644@cindex RS/6000 and PowerPC Options 6645@cindex IBM RS/6000 and PowerPC Options 6646 6647These @samp{-m} options are defined for the IBM RS/6000 and PowerPC: 6648@table @gcctabopt 6649@item -mpower 6650@itemx -mno-power 6651@itemx -mpower2 6652@itemx -mno-power2 6653@itemx -mpowerpc 6654@itemx -mno-powerpc 6655@itemx -mpowerpc-gpopt 6656@itemx -mno-powerpc-gpopt 6657@itemx -mpowerpc-gfxopt 6658@itemx -mno-powerpc-gfxopt 6659@itemx -mpowerpc64 6660@itemx -mno-powerpc64 6661@opindex mpower 6662@opindex mno-power 6663@opindex mpower2 6664@opindex mno-power2 6665@opindex mpowerpc 6666@opindex mno-powerpc 6667@opindex mpowerpc-gpopt 6668@opindex mno-powerpc-gpopt 6669@opindex mpowerpc-gfxopt 6670@opindex mno-powerpc-gfxopt 6671@opindex mpowerpc64 6672@opindex mno-powerpc64 6673GCC supports two related instruction set architectures for the 6674RS/6000 and PowerPC@. The @dfn{POWER} instruction set are those 6675instructions supported by the @samp{rios} chip set used in the original 6676RS/6000 systems and the @dfn{PowerPC} instruction set is the 6677architecture of the Motorola MPC5xx, MPC6xx, MPC8xx microprocessors, and 6678the IBM 4xx microprocessors. 6679 6680Neither architecture is a subset of the other. However there is a 6681large common subset of instructions supported by both. An MQ 6682register is included in processors supporting the POWER architecture. 6683 6684You use these options to specify which instructions are available on the 6685processor you are using. The default value of these options is 6686determined when configuring GCC@. Specifying the 6687@option{-mcpu=@var{cpu_type}} overrides the specification of these 6688options. We recommend you use the @option{-mcpu=@var{cpu_type}} option 6689rather than the options listed above. 6690 6691The @option{-mpower} option allows GCC to generate instructions that 6692are found only in the POWER architecture and to use the MQ register. 6693Specifying @option{-mpower2} implies @option{-power} and also allows GCC 6694to generate instructions that are present in the POWER2 architecture but 6695not the original POWER architecture. 6696 6697The @option{-mpowerpc} option allows GCC to generate instructions that 6698are found only in the 32-bit subset of the PowerPC architecture. 6699Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows 6700GCC to use the optional PowerPC architecture instructions in the 6701General Purpose group, including floating-point square root. Specifying 6702@option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to 6703use the optional PowerPC architecture instructions in the Graphics 6704group, including floating-point select. 6705 6706The @option{-mpowerpc64} option allows GCC to generate the additional 670764-bit instructions that are found in the full PowerPC64 architecture 6708and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to 6709@option{-mno-powerpc64}. 6710 6711If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC 6712will use only the instructions in the common subset of both 6713architectures plus some special AIX common-mode calls, and will not use 6714the MQ register. Specifying both @option{-mpower} and @option{-mpowerpc} 6715permits GCC to use any instruction from either architecture and to 6716allow use of the MQ register; specify this for the Motorola MPC601. 6717 6718@item -mnew-mnemonics 6719@itemx -mold-mnemonics 6720@opindex mnew-mnemonics 6721@opindex mold-mnemonics 6722Select which mnemonics to use in the generated assembler code. With 6723@option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for 6724the PowerPC architecture. With @option{-mold-mnemonics} it uses the 6725assembler mnemonics defined for the POWER architecture. Instructions 6726defined in only one architecture have only one mnemonic; GCC uses that 6727mnemonic irrespective of which of these options is specified. 6728 6729GCC defaults to the mnemonics appropriate for the architecture in 6730use. Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the 6731value of these option. Unless you are building a cross-compiler, you 6732should normally not specify either @option{-mnew-mnemonics} or 6733@option{-mold-mnemonics}, but should instead accept the default. 6734 6735@item -mcpu=@var{cpu_type} 6736@opindex mcpu 6737Set architecture type, register usage, choice of mnemonics, and 6738instruction scheduling parameters for machine type @var{cpu_type}. 6739Supported values for @var{cpu_type} are @samp{rios}, @samp{rios1}, 6740@samp{rsc}, @samp{rios2}, @samp{rs64a}, @samp{601}, @samp{602}, 6741@samp{603}, @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, 6742@samp{630}, @samp{740}, @samp{7400}, @samp{7450}, @samp{750}, 6743@samp{power}, @samp{power2}, @samp{powerpc}, @samp{403}, @samp{505}, 6744@samp{801}, @samp{821}, @samp{823}, and @samp{860} and @samp{common}. 6745 6746@option{-mcpu=common} selects a completely generic processor. Code 6747generated under this option will run on any POWER or PowerPC processor. 6748GCC will use only the instructions in the common subset of both 6749architectures, and will not use the MQ register. GCC assumes a generic 6750processor model for scheduling purposes. 6751 6752@option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and 6753@option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit 6754PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine 6755types, with an appropriate, generic processor model assumed for 6756scheduling purposes. 6757 6758The other options specify a specific processor. Code generated under 6759those options will run best on that processor, and may not run at all on 6760others. 6761 6762The @option{-mcpu} options automatically enable or disable other 6763@option{-m} options as follows: 6764 6765@table @samp 6766@item common 6767@option{-mno-power}, @option{-mno-powerpc} 6768 6769@item power 6770@itemx power2 6771@itemx rios1 6772@itemx rios2 6773@itemx rsc 6774@option{-mpower}, @option{-mno-powerpc}, @option{-mno-new-mnemonics} 6775 6776@item powerpc 6777@itemx rs64a 6778@itemx 602 6779@itemx 603 6780@itemx 603e 6781@itemx 604 6782@itemx 620 6783@itemx 630 6784@itemx 740 6785@itemx 7400 6786@itemx 7450 6787@itemx 750 6788@itemx 505 6789@option{-mno-power}, @option{-mpowerpc}, @option{-mnew-mnemonics} 6790 6791@item 601 6792@option{-mpower}, @option{-mpowerpc}, @option{-mnew-mnemonics} 6793 6794@item 403 6795@itemx 821 6796@itemx 860 6797@option{-mno-power}, @option{-mpowerpc}, @option{-mnew-mnemonics}, @option{-msoft-float} 6798@end table 6799 6800@item -mtune=@var{cpu_type} 6801@opindex mtune 6802Set the instruction scheduling parameters for machine type 6803@var{cpu_type}, but do not set the architecture type, register usage, or 6804choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would. The same 6805values for @var{cpu_type} are used for @option{-mtune} as for 6806@option{-mcpu}. If both are specified, the code generated will use the 6807architecture, registers, and mnemonics set by @option{-mcpu}, but the 6808scheduling parameters set by @option{-mtune}. 6809 6810@item -maltivec 6811@itemx -mno-altivec 6812@opindex maltivec 6813@opindex mno-altivec 6814These switches enable or disable the use of built-in functions that 6815allow access to the AltiVec instruction set. You may also need to set 6816@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI 6817enhancements. 6818 6819@item -mabi=spe 6820@opindex mabi=spe 6821Extend the current ABI with SPE ABI extensions. This does not change 6822the default ABI, instead it adds the SPE ABI extensions to the current 6823ABI@. 6824 6825@item -mabi=no-spe 6826@opindex mabi=no-spe 6827Disable Booke SPE ABI extensions for the current ABI. 6828 6829@item -misel=@var{yes/no} 6830@itemx -misel 6831@opindex misel 6832This switch enables or disables the generation of ISEL instructions. 6833 6834@item -mfull-toc 6835@itemx -mno-fp-in-toc 6836@itemx -mno-sum-in-toc 6837@itemx -mminimal-toc 6838@opindex mfull-toc 6839@opindex mno-fp-in-toc 6840@opindex mno-sum-in-toc 6841@opindex mminimal-toc 6842Modify generation of the TOC (Table Of Contents), which is created for 6843every executable file. The @option{-mfull-toc} option is selected by 6844default. In that case, GCC will allocate at least one TOC entry for 6845each unique non-automatic variable reference in your program. GCC 6846will also place floating-point constants in the TOC@. However, only 684716,384 entries are available in the TOC@. 6848 6849If you receive a linker error message that saying you have overflowed 6850the available TOC space, you can reduce the amount of TOC space used 6851with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options. 6852@option{-mno-fp-in-toc} prevents GCC from putting floating-point 6853constants in the TOC and @option{-mno-sum-in-toc} forces GCC to 6854generate code to calculate the sum of an address and a constant at 6855run-time instead of putting that sum into the TOC@. You may specify one 6856or both of these options. Each causes GCC to produce very slightly 6857slower and larger code at the expense of conserving TOC space. 6858 6859If you still run out of space in the TOC even when you specify both of 6860these options, specify @option{-mminimal-toc} instead. This option causes 6861GCC to make only one TOC entry for every file. When you specify this 6862option, GCC will produce code that is slower and larger but which 6863uses extremely little TOC space. You may wish to use this option 6864only on files that contain less frequently executed code. 6865 6866@item -maix64 6867@itemx -maix32 6868@opindex maix64 6869@opindex maix32 6870Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit 6871@code{long} type, and the infrastructure needed to support them. 6872Specifying @option{-maix64} implies @option{-mpowerpc64} and 6873@option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and 6874implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}. 6875 6876@item -mxl-call 6877@itemx -mno-xl-call 6878@opindex mxl-call 6879@opindex mno-xl-call 6880On AIX, pass floating-point arguments to prototyped functions beyond the 6881register save area (RSA) on the stack in addition to argument FPRs. The 6882AIX calling convention was extended but not initially documented to 6883handle an obscure K&R C case of calling a function that takes the 6884address of its arguments with fewer arguments than declared. AIX XL 6885compilers access floating point arguments which do not fit in the 6886RSA from the stack when a subroutine is compiled without 6887optimization. Because always storing floating-point arguments on the 6888stack is inefficient and rarely needed, this option is not enabled by 6889default and only is necessary when calling subroutines compiled by AIX 6890XL compilers without optimization. 6891 6892@item -mpe 6893@opindex mpe 6894Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an 6895application written to use message passing with special startup code to 6896enable the application to run. The system must have PE installed in the 6897standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file 6898must be overridden with the @option{-specs=} option to specify the 6899appropriate directory location. The Parallel Environment does not 6900support threads, so the @option{-mpe} option and the @option{-pthread} 6901option are incompatible. 6902 6903@item -msoft-float 6904@itemx -mhard-float 6905@opindex msoft-float 6906@opindex mhard-float 6907Generate code that does not use (uses) the floating-point register set. 6908Software floating point emulation is provided if you use the 6909@option{-msoft-float} option, and pass the option to GCC when linking. 6910 6911@item -mmultiple 6912@itemx -mno-multiple 6913@opindex mmultiple 6914@opindex mno-multiple 6915Generate code that uses (does not use) the load multiple word 6916instructions and the store multiple word instructions. These 6917instructions are generated by default on POWER systems, and not 6918generated on PowerPC systems. Do not use @option{-mmultiple} on little 6919endian PowerPC systems, since those instructions do not work when the 6920processor is in little endian mode. The exceptions are PPC740 and 6921PPC750 which permit the instructions usage in little endian mode. 6922 6923@item -mstring 6924@itemx -mno-string 6925@opindex mstring 6926@opindex mno-string 6927Generate code that uses (does not use) the load string instructions 6928and the store string word instructions to save multiple registers and 6929do small block moves. These instructions are generated by default on 6930POWER systems, and not generated on PowerPC systems. Do not use 6931@option{-mstring} on little endian PowerPC systems, since those 6932instructions do not work when the processor is in little endian mode. 6933The exceptions are PPC740 and PPC750 which permit the instructions 6934usage in little endian mode. 6935 6936@item -mupdate 6937@itemx -mno-update 6938@opindex mupdate 6939@opindex mno-update 6940Generate code that uses (does not use) the load or store instructions 6941that update the base register to the address of the calculated memory 6942location. These instructions are generated by default. If you use 6943@option{-mno-update}, there is a small window between the time that the 6944stack pointer is updated and the address of the previous frame is 6945stored, which means code that walks the stack frame across interrupts or 6946signals may get corrupted data. 6947 6948@item -mfused-madd 6949@itemx -mno-fused-madd 6950@opindex mfused-madd 6951@opindex mno-fused-madd 6952Generate code that uses (does not use) the floating point multiply and 6953accumulate instructions. These instructions are generated by default if 6954hardware floating is used. 6955 6956@item -mno-bit-align 6957@itemx -mbit-align 6958@opindex mno-bit-align 6959@opindex mbit-align 6960On System V.4 and embedded PowerPC systems do not (do) force structures 6961and unions that contain bit-fields to be aligned to the base type of the 6962bit-field. 6963 6964For example, by default a structure containing nothing but 8 6965@code{unsigned} bit-fields of length 1 would be aligned to a 4 byte 6966boundary and have a size of 4 bytes. By using @option{-mno-bit-align}, 6967the structure would be aligned to a 1 byte boundary and be one byte in 6968size. 6969 6970@item -mno-strict-align 6971@itemx -mstrict-align 6972@opindex mno-strict-align 6973@opindex mstrict-align 6974On System V.4 and embedded PowerPC systems do not (do) assume that 6975unaligned memory references will be handled by the system. 6976 6977@item -mrelocatable 6978@itemx -mno-relocatable 6979@opindex mrelocatable 6980@opindex mno-relocatable 6981On embedded PowerPC systems generate code that allows (does not allow) 6982the program to be relocated to a different address at runtime. If you 6983use @option{-mrelocatable} on any module, all objects linked together must 6984be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}. 6985 6986@item -mrelocatable-lib 6987@itemx -mno-relocatable-lib 6988@opindex mrelocatable-lib 6989@opindex mno-relocatable-lib 6990On embedded PowerPC systems generate code that allows (does not allow) 6991the program to be relocated to a different address at runtime. Modules 6992compiled with @option{-mrelocatable-lib} can be linked with either modules 6993compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or 6994with modules compiled with the @option{-mrelocatable} options. 6995 6996@item -mno-toc 6997@itemx -mtoc 6998@opindex mno-toc 6999@opindex mtoc 7000On System V.4 and embedded PowerPC systems do not (do) assume that 7001register 2 contains a pointer to a global area pointing to the addresses 7002used in the program. 7003 7004@item -mlittle 7005@itemx -mlittle-endian 7006@opindex mlittle 7007@opindex mlittle-endian 7008On System V.4 and embedded PowerPC systems compile code for the 7009processor in little endian mode. The @option{-mlittle-endian} option is 7010the same as @option{-mlittle}. 7011 7012@item -mbig 7013@itemx -mbig-endian 7014@opindex mbig 7015@opindex mbig-endian 7016On System V.4 and embedded PowerPC systems compile code for the 7017processor in big endian mode. The @option{-mbig-endian} option is 7018the same as @option{-mbig}. 7019 7020@item -mcall-sysv 7021@opindex mcall-sysv 7022On System V.4 and embedded PowerPC systems compile code using calling 7023conventions that adheres to the March 1995 draft of the System V 7024Application Binary Interface, PowerPC processor supplement. This is the 7025default unless you configured GCC using @samp{powerpc-*-eabiaix}. 7026 7027@item -mcall-sysv-eabi 7028@opindex mcall-sysv-eabi 7029Specify both @option{-mcall-sysv} and @option{-meabi} options. 7030 7031@item -mcall-sysv-noeabi 7032@opindex mcall-sysv-noeabi 7033Specify both @option{-mcall-sysv} and @option{-mno-eabi} options. 7034 7035@item -mcall-aix 7036@opindex mcall-aix 7037On System V.4 and embedded PowerPC systems compile code using calling 7038conventions that are similar to those used on AIX@. This is the 7039default if you configured GCC using @samp{powerpc-*-eabiaix}. 7040 7041@item -mcall-solaris 7042@opindex mcall-solaris 7043On System V.4 and embedded PowerPC systems compile code for the Solaris 7044operating system. 7045 7046@item -mcall-linux 7047@opindex mcall-linux 7048On System V.4 and embedded PowerPC systems compile code for the 7049Linux-based GNU system. 7050 7051@item -mcall-gnu 7052@opindex mcall-gnu 7053On System V.4 and embedded PowerPC systems compile code for the 7054Hurd-based GNU system. 7055 7056@item -mcall-netbsd 7057@opindex mcall-netbsd 7058On System V.4 and embedded PowerPC systems compile code for the 7059NetBSD operating system. 7060 7061@item -maix-struct-return 7062@opindex maix-struct-return 7063Return all structures in memory (as specified by the AIX ABI)@. 7064 7065@item -msvr4-struct-return 7066@opindex msvr4-struct-return 7067Return structures smaller than 8 bytes in registers (as specified by the 7068SVR4 ABI)@. 7069 7070@item -mabi=altivec 7071@opindex mabi=altivec 7072Extend the current ABI with AltiVec ABI extensions. This does not 7073change the default ABI, instead it adds the AltiVec ABI extensions to 7074the current ABI@. 7075 7076@item -mabi=no-altivec 7077@opindex mabi=no-altivec 7078Disable AltiVec ABI extensions for the current ABI. 7079 7080@item -mprototype 7081@itemx -mno-prototype 7082@opindex mprototype 7083@opindex mno-prototype 7084On System V.4 and embedded PowerPC systems assume that all calls to 7085variable argument functions are properly prototyped. Otherwise, the 7086compiler must insert an instruction before every non prototyped call to 7087set or clear bit 6 of the condition code register (@var{CR}) to 7088indicate whether floating point values were passed in the floating point 7089registers in case the function takes a variable arguments. With 7090@option{-mprototype}, only calls to prototyped variable argument functions 7091will set or clear the bit. 7092 7093@item -msim 7094@opindex msim 7095On embedded PowerPC systems, assume that the startup module is called 7096@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and 7097@file{libc.a}. This is the default for @samp{powerpc-*-eabisim}. 7098configurations. 7099 7100@item -mmvme 7101@opindex mmvme 7102On embedded PowerPC systems, assume that the startup module is called 7103@file{crt0.o} and the standard C libraries are @file{libmvme.a} and 7104@file{libc.a}. 7105 7106@item -mads 7107@opindex mads 7108On embedded PowerPC systems, assume that the startup module is called 7109@file{crt0.o} and the standard C libraries are @file{libads.a} and 7110@file{libc.a}. 7111 7112@item -myellowknife 7113@opindex myellowknife 7114On embedded PowerPC systems, assume that the startup module is called 7115@file{crt0.o} and the standard C libraries are @file{libyk.a} and 7116@file{libc.a}. 7117 7118@item -mvxworks 7119@opindex mvxworks 7120On System V.4 and embedded PowerPC systems, specify that you are 7121compiling for a VxWorks system. 7122 7123@item -mwindiss 7124@opindex mwindiss 7125Specify that you are compiling for the WindISS simulation environment. 7126 7127@item -memb 7128@opindex memb 7129On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags 7130header to indicate that @samp{eabi} extended relocations are used. 7131 7132@item -meabi 7133@itemx -mno-eabi 7134@opindex meabi 7135@opindex mno-eabi 7136On System V.4 and embedded PowerPC systems do (do not) adhere to the 7137Embedded Applications Binary Interface (eabi) which is a set of 7138modifications to the System V.4 specifications. Selecting @option{-meabi} 7139means that the stack is aligned to an 8 byte boundary, a function 7140@code{__eabi} is called to from @code{main} to set up the eabi 7141environment, and the @option{-msdata} option can use both @code{r2} and 7142@code{r13} to point to two separate small data areas. Selecting 7143@option{-mno-eabi} means that the stack is aligned to a 16 byte boundary, 7144do not call an initialization function from @code{main}, and the 7145@option{-msdata} option will only use @code{r13} to point to a single 7146small data area. The @option{-meabi} option is on by default if you 7147configured GCC using one of the @samp{powerpc*-*-eabi*} options. 7148 7149@item -msdata=eabi 7150@opindex msdata=eabi 7151On System V.4 and embedded PowerPC systems, put small initialized 7152@code{const} global and static data in the @samp{.sdata2} section, which 7153is pointed to by register @code{r2}. Put small initialized 7154non-@code{const} global and static data in the @samp{.sdata} section, 7155which is pointed to by register @code{r13}. Put small uninitialized 7156global and static data in the @samp{.sbss} section, which is adjacent to 7157the @samp{.sdata} section. The @option{-msdata=eabi} option is 7158incompatible with the @option{-mrelocatable} option. The 7159@option{-msdata=eabi} option also sets the @option{-memb} option. 7160 7161@item -msdata=sysv 7162@opindex msdata=sysv 7163On System V.4 and embedded PowerPC systems, put small global and static 7164data in the @samp{.sdata} section, which is pointed to by register 7165@code{r13}. Put small uninitialized global and static data in the 7166@samp{.sbss} section, which is adjacent to the @samp{.sdata} section. 7167The @option{-msdata=sysv} option is incompatible with the 7168@option{-mrelocatable} option. 7169 7170@item -msdata=default 7171@itemx -msdata 7172@opindex msdata=default 7173@opindex msdata 7174On System V.4 and embedded PowerPC systems, if @option{-meabi} is used, 7175compile code the same as @option{-msdata=eabi}, otherwise compile code the 7176same as @option{-msdata=sysv}. 7177 7178@item -msdata-data 7179@opindex msdata-data 7180On System V.4 and embedded PowerPC systems, put small global and static 7181data in the @samp{.sdata} section. Put small uninitialized global and 7182static data in the @samp{.sbss} section. Do not use register @code{r13} 7183to address small data however. This is the default behavior unless 7184other @option{-msdata} options are used. 7185 7186@item -msdata=none 7187@itemx -mno-sdata 7188@opindex msdata=none 7189@opindex mno-sdata 7190On embedded PowerPC systems, put all initialized global and static data 7191in the @samp{.data} section, and all uninitialized data in the 7192@samp{.bss} section. 7193 7194@item -G @var{num} 7195@opindex G 7196@cindex smaller data references (PowerPC) 7197@cindex .sdata/.sdata2 references (PowerPC) 7198On embedded PowerPC systems, put global and static items less than or 7199equal to @var{num} bytes into the small data or bss sections instead of 7200the normal data or bss section. By default, @var{num} is 8. The 7201@option{-G @var{num}} switch is also passed to the linker. 7202All modules should be compiled with the same @option{-G @var{num}} value. 7203 7204@item -mregnames 7205@itemx -mno-regnames 7206@opindex mregnames 7207@opindex mno-regnames 7208On System V.4 and embedded PowerPC systems do (do not) emit register 7209names in the assembly language output using symbolic forms. 7210 7211@item -mlongcall 7212@itemx -mno-longcall 7213@opindex mlongcall 7214@opindex mno-longcall 7215Default to making all function calls via pointers, so that functions 7216which reside further than 64 megabytes (67,108,864 bytes) from the 7217current location can be called. This setting can be overridden by the 7218@code{shortcall} function attribute, or by @code{#pragma longcall(0)}. 7219 7220Some linkers are capable of detecting out-of-range calls and generating 7221glue code on the fly. On these systems, long calls are unnecessary and 7222generate slower code. As of this writing, the AIX linker can do this, 7223as can the GNU linker for PowerPC/64. It is planned to add this feature 7224to the GNU linker for 32-bit PowerPC systems as well. 7225 7226In the future, we may cause GCC to ignore all longcall specifications 7227when the linker is known to generate glue. 7228 7229@item -pthread 7230@opindex pthread 7231Adds support for multithreading with the @dfn{pthreads} library. 7232This option sets flags for both the preprocessor and linker. 7233 7234@end table 7235 7236@node Darwin Options 7237@subsection Darwin Options 7238@cindex Darwin options 7239 7240These options are defined for all architectures running the Darwin operating 7241system. They are useful for compatibility with other Mac OS compilers. 7242 7243@table @gcctabopt 7244@item -all_load 7245@opindex all_load 7246Loads all members of static archive libraries. 7247See man ld(1) for more information. 7248 7249@item -arch_errors_fatal 7250@opindex arch_errors_fatal 7251Cause the errors having to do with files that have the wrong architecture 7252to be fatal. 7253 7254@item -bind_at_load 7255@opindex bind_at_load 7256Causes the output file to be marked such that the dynamic linker will 7257bind all undefined references when the file is loaded or launched. 7258 7259@item -bundle 7260@opindex bundle 7261Produce a Mach-o bundle format file. 7262See man ld(1) for more information. 7263 7264@item -bundle_loader @var{executable} 7265@opindex bundle_loader 7266This specifies the @var{executable} that will be loading the build 7267output file being linked. See man ld(1) for more information. 7268 7269@item -allowable_client @var{client_name} 7270@item -arch_only 7271 7272@item -client_name 7273@item -compatibility_version 7274@item -current_version 7275@item -dependency-file 7276@item -dylib_file 7277@item -dylinker_install_name 7278@item -dynamic 7279@item -dynamiclib 7280@item -exported_symbols_list 7281@item -filelist 7282@item -flat_namespace 7283@item -force_cpusubtype_ALL 7284@item -force_flat_namespace 7285@item -headerpad_max_install_names 7286@item -image_base 7287@item -init 7288@item -install_name 7289@item -keep_private_externs 7290@item -multi_module 7291@item -multiply_defined 7292@item -multiply_defined_unused 7293@item -noall_load 7294@item -nomultidefs 7295@item -noprebind 7296@item -noseglinkedit 7297@item -pagezero_size 7298@item -prebind 7299@item -prebind_all_twolevel_modules 7300@item -private_bundle 7301@item -read_only_relocs 7302@item -sectalign 7303@item -sectobjectsymbols 7304@item -whyload 7305@item -seg1addr 7306@item -sectcreate 7307@item -sectobjectsymbols 7308@item -sectorder 7309@item -seg_addr_table 7310@item -seg_addr_table_filename 7311@item -seglinkedit 7312@item -segprot 7313@item -segs_read_only_addr 7314@item -segs_read_write_addr 7315@item -single_module 7316@item -static 7317@item -sub_library 7318@item -sub_umbrella 7319@item -twolevel_namespace 7320@item -umbrella 7321@item -undefined 7322@item -unexported_symbols_list 7323@item -weak_reference_mismatches 7324@item -whatsloaded 7325 7326@opindex allowable_client 7327@opindex arch_only 7328@opindex client_name 7329@opindex compatibility_version 7330@opindex current_version 7331@opindex dependency-file 7332@opindex dylib_file 7333@opindex dylinker_install_name 7334@opindex dynamic 7335@opindex dynamiclib 7336@opindex exported_symbols_list 7337@opindex filelist 7338@opindex flat_namespace 7339@opindex force_cpusubtype_ALL 7340@opindex force_flat_namespace 7341@opindex headerpad_max_install_names 7342@opindex image_base 7343@opindex init 7344@opindex install_name 7345@opindex keep_private_externs 7346@opindex multi_module 7347@opindex multiply_defined 7348@opindex multiply_defined_unused 7349@opindex noall_load 7350@opindex nomultidefs 7351@opindex noprebind 7352@opindex noseglinkedit 7353@opindex pagezero_size 7354@opindex prebind 7355@opindex prebind_all_twolevel_modules 7356@opindex private_bundle 7357@opindex read_only_relocs 7358@opindex sectalign 7359@opindex sectobjectsymbols 7360@opindex whyload 7361@opindex seg1addr 7362@opindex sectcreate 7363@opindex sectobjectsymbols 7364@opindex sectorder 7365@opindex seg_addr_table 7366@opindex seg_addr_table_filename 7367@opindex seglinkedit 7368@opindex segprot 7369@opindex segs_read_only_addr 7370@opindex segs_read_write_addr 7371@opindex single_module 7372@opindex static 7373@opindex sub_library 7374@opindex sub_umbrella 7375@opindex twolevel_namespace 7376@opindex umbrella 7377@opindex undefined 7378@opindex unexported_symbols_list 7379@opindex weak_reference_mismatches 7380@opindex whatsloaded 7381 7382This options are available for Darwin linker. Darwin linker man page 7383describes them in detail. 7384@end table 7385 7386 7387@node RT Options 7388@subsection IBM RT Options 7389@cindex RT options 7390@cindex IBM RT options 7391 7392These @samp{-m} options are defined for the IBM RT PC: 7393 7394@table @gcctabopt 7395@item -min-line-mul 7396@opindex min-line-mul 7397Use an in-line code sequence for integer multiplies. This is the 7398default. 7399 7400@item -mcall-lib-mul 7401@opindex mcall-lib-mul 7402Call @code{lmul$$} for integer multiples. 7403 7404@item -mfull-fp-blocks 7405@opindex mfull-fp-blocks 7406Generate full-size floating point data blocks, including the minimum 7407amount of scratch space recommended by IBM@. This is the default. 7408 7409@item -mminimum-fp-blocks 7410@opindex mminimum-fp-blocks 7411Do not include extra scratch space in floating point data blocks. This 7412results in smaller code, but slower execution, since scratch space must 7413be allocated dynamically. 7414 7415@cindex @file{stdarg.h} and RT PC 7416@item -mfp-arg-in-fpregs 7417@opindex mfp-arg-in-fpregs 7418Use a calling sequence incompatible with the IBM calling convention in 7419which floating point arguments are passed in floating point registers. 7420Note that @code{stdarg.h} will not work with floating point operands 7421if this option is specified. 7422 7423@item -mfp-arg-in-gregs 7424@opindex mfp-arg-in-gregs 7425Use the normal calling convention for floating point arguments. This is 7426the default. 7427 7428@item -mhc-struct-return 7429@opindex mhc-struct-return 7430Return structures of more than one word in memory, rather than in a 7431register. This provides compatibility with the MetaWare HighC (hc) 7432compiler. Use the option @option{-fpcc-struct-return} for compatibility 7433with the Portable C Compiler (pcc). 7434 7435@item -mnohc-struct-return 7436@opindex mnohc-struct-return 7437Return some structures of more than one word in registers, when 7438convenient. This is the default. For compatibility with the 7439IBM-supplied compilers, use the option @option{-fpcc-struct-return} or the 7440option @option{-mhc-struct-return}. 7441@end table 7442 7443@node MIPS Options 7444@subsection MIPS Options 7445@cindex MIPS options 7446 7447These @samp{-m} options are defined for the MIPS family of computers: 7448 7449@table @gcctabopt 7450 7451@item -march=@var{arch} 7452@opindex march 7453Generate code that will run on @var{arch}, which can be the name of a 7454generic MIPS ISA, or the name of a particular processor. The ISA names 7455are: @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4}, @samp{mips32} 7456and @samp{mips64}. The processor names are: @samp{r2000}, 7457@samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{vr4100}, @samp{vr4300}, 7458@samp{r4400}, @samp{r4600}, @samp{r4650}, @samp{vr5000}, @samp{r6000}, 7459@samp{r8000}, @samp{4kc}, @samp{4kp}, @samp{5kc}, @samp{20kc}, 7460@samp{orion}, and @samp{sb1}. The special value @samp{from-abi} selects the 7461most compatible architecture for the selected ABI (that is, 7462@samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@. 7463 7464In processor names, a final @samp{000} can be abbreviated as @samp{k} 7465(for example, @samp{-march=r2k}). Prefixes are optional, and 7466@samp{vr} may be written @samp{r}. 7467 7468GCC defines two macros based on the value of this option. The first 7469is @samp{_MIPS_ARCH}, which gives the name of target architecture, as 7470a string. The second has the form @samp{_MIPS_ARCH_@var{foo}}, 7471where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@. 7472For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH} 7473to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}. 7474 7475Note that the @samp{_MIPS_ARCH} macro uses the processor names given 7476above. In other words, it will have the full prefix and will not 7477abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi}, 7478the macro names the resolved architecture (either @samp{"mips1"} or 7479@samp{"mips3"}). It names the default architecture when no 7480@option{-march} option is given. 7481 7482@item -mtune=@var{arch} 7483@opindex mtune 7484Optimize for @var{arch}. Among other things, this option controls 7485the way instructions are scheduled, and the perceived cost of arithmetic 7486operations. The list of @var{arch} values is the same as for 7487@option{-march}. 7488 7489When this option is not used, GCC will optimize for the processor 7490specified by @option{-march}. By using @option{-march} and 7491@option{-mtune} together, it is possible to generate code that will 7492run on a family of processors, but optimize the code for one 7493particular member of that family. 7494 7495@samp{-mtune} defines the macros @samp{_MIPS_TUNE} and 7496@samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the 7497@samp{-march} ones described above. 7498 7499@item -mips1 7500@opindex mips1 7501Equivalent to @samp{-march=mips1}. 7502 7503@item -mips2 7504@opindex mips2 7505Equivalent to @samp{-march=mips2}. 7506 7507@item -mips3 7508@opindex mips3 7509Equivalent to @samp{-march=mips3}. 7510 7511@item -mips4 7512@opindex mips4 7513Equivalent to @samp{-march=mips4}. 7514 7515@item -mips32 7516@opindex mips32 7517Equivalent to @samp{-march=mips32}. 7518 7519@item -mips64 7520@opindex mips64 7521Equivalent to @samp{-march=mips64}. 7522 7523@item -mfused-madd 7524@itemx -mno-fused-madd 7525@opindex mfused-madd 7526@opindex mno-fused-madd 7527Generate code that uses (does not use) the floating point multiply and 7528accumulate instructions, when they are available. These instructions 7529are generated by default if they are available, but this may be 7530undesirable if the extra precision causes problems or on certain chips 7531in the mode where denormals are rounded to zero where denormals 7532generated by multiply and accumulate instructions cause exceptions 7533anyway. 7534 7535@item -mfp32 7536@opindex mfp32 7537Assume that floating point registers are 32 bits wide. 7538 7539@item -mfp64 7540@opindex mfp64 7541Assume that floating point registers are 64 bits wide. 7542 7543@item -mgp32 7544@opindex mgp32 7545Assume that general purpose registers are 32 bits wide. 7546 7547@item -mgp64 7548@opindex mgp64 7549Assume that general purpose registers are 64 bits wide. 7550 7551@item -mint64 7552@opindex mint64 7553Force int and long types to be 64 bits wide. See @option{-mlong32} for an 7554explanation of the default, and the width of pointers. 7555 7556@item -mlong64 7557@opindex mlong64 7558Force long types to be 64 bits wide. See @option{-mlong32} for an 7559explanation of the default, and the width of pointers. 7560 7561@item -mlong32 7562@opindex mlong32 7563Force long, int, and pointer types to be 32 bits wide. 7564 7565The default size of ints, longs and pointers depends on the ABI@. All 7566the supported ABIs use 32-bit ints. The n64 ABI uses 64-bit longs, as 7567does the 64-bit Cygnus EABI; the others use 32-bit longs. Pointers 7568are the same size as longs, or the same size as integer registers, 7569whichever is smaller. 7570 7571@item -mabi=32 7572@itemx -mabi=o64 7573@itemx -mabi=n32 7574@itemx -mabi=64 7575@itemx -mabi=eabi 7576@itemx -mabi=meabi 7577@opindex mabi=32 7578@opindex mabi=o64 7579@opindex mabi=n32 7580@opindex mabi=64 7581@opindex mabi=eabi 7582@opindex mabi=meabi 7583Generate code for the given ABI@. 7584 7585Note that there are two embedded ABIs: @option{-mabi=eabi} 7586selects the one defined by Cygnus while @option{-meabi=meabi} 7587selects the one defined by MIPS@. Both these ABIs have 758832-bit and 64-bit variants. Normally, GCC will generate 758964-bit code when you select a 64-bit architecture, but you 7590can use @option{-mgp32} to get 32-bit code instead. 7591 7592@item -mmips-as 7593@opindex mmips-as 7594Generate code for the MIPS assembler, and invoke @file{mips-tfile} to 7595add normal debug information. This is the default for all 7596platforms except for the OSF/1 reference platform, using the OSF/rose 7597object format. If the either of the @option{-gstabs} or @option{-gstabs+} 7598switches are used, the @file{mips-tfile} program will encapsulate the 7599stabs within MIPS ECOFF@. 7600 7601@item -mgas 7602@opindex mgas 7603Generate code for the GNU assembler. This is the default on the OSF/1 7604reference platform, using the OSF/rose object format. Also, this is 7605the default if the configure option @option{--with-gnu-as} is used. 7606 7607@item -msplit-addresses 7608@itemx -mno-split-addresses 7609@opindex msplit-addresses 7610@opindex mno-split-addresses 7611Generate code to load the high and low parts of address constants separately. 7612This allows GCC to optimize away redundant loads of the high order 7613bits of addresses. This optimization requires GNU as and GNU ld. 7614This optimization is enabled by default for some embedded targets where 7615GNU as and GNU ld are standard. 7616 7617@item -mrnames 7618@itemx -mno-rnames 7619@opindex mrnames 7620@opindex mno-rnames 7621The @option{-mrnames} switch says to output code using the MIPS software 7622names for the registers, instead of the hardware names (ie, @var{a0} 7623instead of @var{$4}). The only known assembler that supports this option 7624is the Algorithmics assembler. 7625 7626@item -mgpopt 7627@itemx -mno-gpopt 7628@opindex mgpopt 7629@opindex mno-gpopt 7630The @option{-mgpopt} switch says to write all of the data declarations 7631before the instructions in the text section, this allows the MIPS 7632assembler to generate one word memory references instead of using two 7633words for short global or static data items. This is on by default if 7634optimization is selected. 7635 7636@item -mstats 7637@itemx -mno-stats 7638@opindex mstats 7639@opindex mno-stats 7640For each non-inline function processed, the @option{-mstats} switch 7641causes the compiler to emit one line to the standard error file to 7642print statistics about the program (number of registers saved, stack 7643size, etc.). 7644 7645@item -mmemcpy 7646@itemx -mno-memcpy 7647@opindex mmemcpy 7648@opindex mno-memcpy 7649The @option{-mmemcpy} switch makes all block moves call the appropriate 7650string function (@samp{memcpy} or @samp{bcopy}) instead of possibly 7651generating inline code. 7652 7653@item -mmips-tfile 7654@itemx -mno-mips-tfile 7655@opindex mmips-tfile 7656@opindex mno-mips-tfile 7657The @option{-mno-mips-tfile} switch causes the compiler not 7658postprocess the object file with the @file{mips-tfile} program, 7659after the MIPS assembler has generated it to add debug support. If 7660@file{mips-tfile} is not run, then no local variables will be 7661available to the debugger. In addition, @file{stage2} and 7662@file{stage3} objects will have the temporary file names passed to the 7663assembler embedded in the object file, which means the objects will 7664not compare the same. The @option{-mno-mips-tfile} switch should only 7665be used when there are bugs in the @file{mips-tfile} program that 7666prevents compilation. 7667 7668@item -msoft-float 7669@opindex msoft-float 7670Generate output containing library calls for floating point. 7671@strong{Warning:} the requisite libraries are not part of GCC@. 7672Normally the facilities of the machine's usual C compiler are used, but 7673this can't be done directly in cross-compilation. You must make your 7674own arrangements to provide suitable library functions for 7675cross-compilation. 7676 7677@item -mhard-float 7678@opindex mhard-float 7679Generate output containing floating point instructions. This is the 7680default if you use the unmodified sources. 7681 7682@item -mabicalls 7683@itemx -mno-abicalls 7684@opindex mabicalls 7685@opindex mno-abicalls 7686Emit (or do not emit) the pseudo operations @samp{.abicalls}, 7687@samp{.cpload}, and @samp{.cprestore} that some System V.4 ports use for 7688position independent code. 7689 7690@item -mlong-calls 7691@itemx -mno-long-calls 7692@opindex mlong-calls 7693@opindex mno-long-calls 7694Do all calls with the @samp{JALR} instruction, which requires 7695loading up a function's address into a register before the call. 7696You need to use this switch, if you call outside of the current 7697512 megabyte segment to functions that are not through pointers. 7698 7699@item -mhalf-pic 7700@itemx -mno-half-pic 7701@opindex mhalf-pic 7702@opindex mno-half-pic 7703Put pointers to extern references into the data section and load them 7704up, rather than put the references in the text section. 7705 7706@item -membedded-pic 7707@itemx -mno-embedded-pic 7708@opindex membedded-pic 7709@opindex mno-embedded-pic 7710Generate PIC code suitable for some embedded systems. All calls are 7711made using PC relative address, and all data is addressed using the $gp 7712register. No more than 65536 bytes of global data may be used. This 7713requires GNU as and GNU ld which do most of the work. This currently 7714only works on targets which use ECOFF; it does not work with ELF@. 7715 7716@item -membedded-data 7717@itemx -mno-embedded-data 7718@opindex membedded-data 7719@opindex mno-embedded-data 7720Allocate variables to the read-only data section first if possible, then 7721next in the small data section if possible, otherwise in data. This gives 7722slightly slower code than the default, but reduces the amount of RAM required 7723when executing, and thus may be preferred for some embedded systems. 7724 7725@item -muninit-const-in-rodata 7726@itemx -mno-uninit-const-in-rodata 7727@opindex muninit-const-in-rodata 7728@opindex mno-uninit-const-in-rodata 7729When used together with @option{-membedded-data}, it will always store uninitialized 7730const variables in the read-only data section. 7731 7732@item -msingle-float 7733@itemx -mdouble-float 7734@opindex msingle-float 7735@opindex mdouble-float 7736The @option{-msingle-float} switch tells gcc to assume that the floating 7737point coprocessor only supports single precision operations, as on the 7738@samp{r4650} chip. The @option{-mdouble-float} switch permits gcc to use 7739double precision operations. This is the default. 7740 7741@item -mmad 7742@itemx -mno-mad 7743@opindex mmad 7744@opindex mno-mad 7745Permit use of the @samp{mad}, @samp{madu} and @samp{mul} instructions, 7746as on the @samp{r4650} chip. 7747 7748@item -m4650 7749@opindex m4650 7750Turns on @option{-msingle-float}, @option{-mmad}, and, at least for now, 7751@option{-mcpu=r4650}. 7752 7753@item -mips16 7754@itemx -mno-mips16 7755@opindex mips16 7756@opindex mno-mips16 7757Enable 16-bit instructions. 7758 7759@item -mentry 7760@opindex mentry 7761Use the entry and exit pseudo ops. This option can only be used with 7762@option{-mips16}. 7763 7764@item -EL 7765@opindex EL 7766Compile code for the processor in little endian mode. 7767The requisite libraries are assumed to exist. 7768 7769@item -EB 7770@opindex EB 7771Compile code for the processor in big endian mode. 7772The requisite libraries are assumed to exist. 7773 7774@item -G @var{num} 7775@opindex G 7776@cindex smaller data references (MIPS) 7777@cindex gp-relative references (MIPS) 7778Put global and static items less than or equal to @var{num} bytes into 7779the small data or bss sections instead of the normal data or bss 7780section. This allows the assembler to emit one word memory reference 7781instructions based on the global pointer (@var{gp} or @var{$28}), 7782instead of the normal two words used. By default, @var{num} is 8 when 7783the MIPS assembler is used, and 0 when the GNU assembler is used. The 7784@option{-G @var{num}} switch is also passed to the assembler and linker. 7785All modules should be compiled with the same @option{-G @var{num}} 7786value. 7787 7788@item -nocpp 7789@opindex nocpp 7790Tell the MIPS assembler to not run its preprocessor over user 7791assembler files (with a @samp{.s} suffix) when assembling them. 7792 7793@item -mfix7000 7794@opindex mfix7000 7795Pass an option to gas which will cause nops to be inserted if 7796the read of the destination register of an mfhi or mflo instruction 7797occurs in the following two instructions. 7798 7799@item -no-crt0 7800@opindex no-crt0 7801Do not include the default crt0. 7802 7803@item -mflush-func=@var{func} 7804@itemx -mno-flush-func 7805@opindex mflush-func 7806Specifies the function to call to flush the I and D caches, or to not 7807call any such function. If called, the function must take the same 7808arguments as the common @code{_flush_func()}, that is, the address of the 7809memory range for which the cache is being flushed, the size of the 7810memory range, and the number 3 (to flush both caches). The default 7811depends on the target gcc was configured for, but commonly is either 7812@samp{_flush_func} or @samp{__cpu_flush}. 7813 7814@item -mbranch-likely 7815@itemx -mno-branch-likely 7816@opindex mbranch-likely 7817@opindex mno-branch-likely 7818Enable or disable use of Branch Likely instructions, regardless of the 7819default for the selected architecture. By default, Branch Likely 7820instructions may be generated if they are supported by the selected 7821architecture. An exception is for the MIPS32 and MIPS64 architectures 7822and processors which implement those architectures; for those, Branch 7823Likely instructions will not be generated by default because the MIPS32 7824and MIPS64 architectures specifically deprecate their use. 7825@end table 7826 7827@node i386 and x86-64 Options 7828@subsection Intel 386 and AMD x86-64 Options 7829@cindex i386 Options 7830@cindex x86-64 Options 7831@cindex Intel 386 Options 7832@cindex AMD x86-64 Options 7833 7834These @samp{-m} options are defined for the i386 and x86-64 family of 7835computers: 7836 7837@table @gcctabopt 7838@item -mcpu=@var{cpu-type} 7839@opindex mcpu 7840Tune to @var{cpu-type} everything applicable about the generated code, except 7841for the ABI and the set of available instructions. The choices for 7842@var{cpu-type} are @samp{i386}, @samp{i486}, @samp{i586}, @samp{i686}, 7843@samp{pentium}, @samp{pentium-mmx}, @samp{pentiumpro}, @samp{pentium2}, 7844@samp{pentium3}, @samp{pentium4}, @samp{k6}, @samp{k6-2}, @samp{k6-3}, 7845@samp{athlon}, @samp{athlon-tbird}, @samp{athlon-4}, @samp{athlon-xp}, 7846@samp{athlon-mp}, @samp{winchip-c6}, @samp{winchip2} and @samp{c3}. 7847 7848While picking a specific @var{cpu-type} will schedule things appropriately 7849for that particular chip, the compiler will not generate any code that 7850does not run on the i386 without the @option{-march=@var{cpu-type}} option 7851being used. @samp{i586} is equivalent to @samp{pentium} and @samp{i686} 7852is equivalent to @samp{pentiumpro}. @samp{k6} and @samp{athlon} are the 7853AMD chips as opposed to the Intel ones. 7854 7855@item -march=@var{cpu-type} 7856@opindex march 7857Generate instructions for the machine type @var{cpu-type}. The choices 7858for @var{cpu-type} are the same as for @option{-mcpu}. Moreover, 7859specifying @option{-march=@var{cpu-type}} implies @option{-mcpu=@var{cpu-type}}. 7860 7861@item -m386 7862@itemx -m486 7863@itemx -mpentium 7864@itemx -mpentiumpro 7865@opindex m386 7866@opindex m486 7867@opindex mpentium 7868@opindex mpentiumpro 7869These options are synonyms for @option{-mcpu=i386}, @option{-mcpu=i486}, 7870@option{-mcpu=pentium}, and @option{-mcpu=pentiumpro} respectively. 7871These synonyms are deprecated. 7872 7873@item -mfpmath=@var{unit} 7874@opindex march 7875generate floating point arithmetics for selected unit @var{unit}. the choices 7876for @var{unit} are: 7877 7878@table @samp 7879@item 387 7880Use the standard 387 floating point coprocessor present majority of chips and 7881emulated otherwise. Code compiled with this option will run almost everywhere. 7882The temporary results are computed in 80bit precision instead of precision 7883specified by the type resulting in slightly different results compared to most 7884of other chips. See @option{-ffloat-store} for more detailed description. 7885 7886This is the default choice for i386 compiler. 7887 7888@item sse 7889Use scalar floating point instructions present in the SSE instruction set. 7890This instruction set is supported by Pentium3 and newer chips, in the AMD line 7891by Athlon-4, Athlon-xp and Athlon-mp chips. The earlier version of SSE 7892instruction set supports only single precision arithmetics, thus the double and 7893extended precision arithmetics is still done using 387. Later version, present 7894only in Pentium4 and the future AMD x86-64 chips supports double precision 7895arithmetics too. 7896 7897For i387 you need to use @option{-march=@var{cpu-type}}, @option{-msse} or 7898@option{-msse2} switches to enable SSE extensions and make this option 7899effective. For x86-64 compiler, these extensions are enabled by default. 7900 7901The resulting code should be considerably faster in majority of cases and avoid 7902the numerical instability problems of 387 code, but may break some existing 7903code that expects temporaries to be 80bit. 7904 7905This is the default choice for x86-64 compiler. 7906 7907@item sse,387 7908Attempt to utilize both instruction sets at once. This effectively double the 7909amount of available registers and on chips with separate execution units for 7910387 and SSE the execution resources too. Use this option with care, as it is 7911still experimental, because gcc register allocator does not model separate 7912functional units well resulting in instable performance. 7913@end table 7914 7915@item -masm=@var{dialect} 7916@opindex masm=@var{dialect} 7917Output asm instructions using selected @var{dialect}. Supported choices are 7918@samp{intel} or @samp{att} (the default one). 7919 7920@item -mieee-fp 7921@itemx -mno-ieee-fp 7922@opindex mieee-fp 7923@opindex mno-ieee-fp 7924Control whether or not the compiler uses IEEE floating point 7925comparisons. These handle correctly the case where the result of a 7926comparison is unordered. 7927 7928@item -msoft-float 7929@opindex msoft-float 7930Generate output containing library calls for floating point. 7931@strong{Warning:} the requisite libraries are not part of GCC@. 7932Normally the facilities of the machine's usual C compiler are used, but 7933this can't be done directly in cross-compilation. You must make your 7934own arrangements to provide suitable library functions for 7935cross-compilation. 7936 7937On machines where a function returns floating point results in the 80387 7938register stack, some floating point opcodes may be emitted even if 7939@option{-msoft-float} is used. 7940 7941@item -mno-fp-ret-in-387 7942@opindex mno-fp-ret-in-387 7943Do not use the FPU registers for return values of functions. 7944 7945The usual calling convention has functions return values of types 7946@code{float} and @code{double} in an FPU register, even if there 7947is no FPU@. The idea is that the operating system should emulate 7948an FPU@. 7949 7950The option @option{-mno-fp-ret-in-387} causes such values to be returned 7951in ordinary CPU registers instead. 7952 7953@item -mno-fancy-math-387 7954@opindex mno-fancy-math-387 7955Some 387 emulators do not support the @code{sin}, @code{cos} and 7956@code{sqrt} instructions for the 387. Specify this option to avoid 7957generating those instructions. This option is the default on FreeBSD, 7958OpenBSD and NetBSD@. This option is overridden when @option{-march} 7959indicates that the target cpu will always have an FPU and so the 7960instruction will not need emulation. As of revision 2.6.1, these 7961instructions are not generated unless you also use the 7962@option{-funsafe-math-optimizations} switch. 7963 7964@item -malign-double 7965@itemx -mno-align-double 7966@opindex malign-double 7967@opindex mno-align-double 7968Control whether GCC aligns @code{double}, @code{long double}, and 7969@code{long long} variables on a two word boundary or a one word 7970boundary. Aligning @code{double} variables on a two word boundary will 7971produce code that runs somewhat faster on a @samp{Pentium} at the 7972expense of more memory. 7973 7974@strong{Warning:} if you use the @option{-malign-double} switch, 7975structures containing the above types will be aligned differently than 7976the published application binary interface specifications for the 386 7977and will not be binary compatible with structures in code compiled 7978without that switch. 7979 7980@item -m96bit-long-double 7981@item -m128bit-long-double 7982@opindex m96bit-long-double 7983@opindex m128bit-long-double 7984These switches control the size of @code{long double} type. The i386 7985application binary interface specifies the size to be 96 bits, 7986so @option{-m96bit-long-double} is the default in 32 bit mode. 7987 7988Modern architectures (Pentium and newer) would prefer @code{long double} 7989to be aligned to an 8 or 16 byte boundary. In arrays or structures 7990conforming to the ABI, this would not be possible. So specifying a 7991@option{-m128bit-long-double} will align @code{long double} 7992to a 16 byte boundary by padding the @code{long double} with an additional 799332 bit zero. 7994 7995In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as 7996its ABI specifies that @code{long double} is to be aligned on 16 byte boundary. 7997 7998Notice that neither of these options enable any extra precision over the x87 7999standard of 80 bits for a @code{long double}. 8000 8001@strong{Warning:} if you override the default value for your target ABI, the 8002structures and arrays containing @code{long double} will change their size as 8003well as function calling convention for function taking @code{long double} 8004will be modified. Hence they will not be binary compatible with arrays or 8005structures in code compiled without that switch. 8006 8007 8008@item -msvr3-shlib 8009@itemx -mno-svr3-shlib 8010@opindex msvr3-shlib 8011@opindex mno-svr3-shlib 8012Control whether GCC places uninitialized local variables into the 8013@code{bss} or @code{data} segments. @option{-msvr3-shlib} places them 8014into @code{bss}. These options are meaningful only on System V Release 3. 8015 8016@item -mrtd 8017@opindex mrtd 8018Use a different function-calling convention, in which functions that 8019take a fixed number of arguments return with the @code{ret} @var{num} 8020instruction, which pops their arguments while returning. This saves one 8021instruction in the caller since there is no need to pop the arguments 8022there. 8023 8024You can specify that an individual function is called with this calling 8025sequence with the function attribute @samp{stdcall}. You can also 8026override the @option{-mrtd} option by using the function attribute 8027@samp{cdecl}. @xref{Function Attributes}. 8028 8029@strong{Warning:} this calling convention is incompatible with the one 8030normally used on Unix, so you cannot use it if you need to call 8031libraries compiled with the Unix compiler. 8032 8033Also, you must provide function prototypes for all functions that 8034take variable numbers of arguments (including @code{printf}); 8035otherwise incorrect code will be generated for calls to those 8036functions. 8037 8038In addition, seriously incorrect code will result if you call a 8039function with too many arguments. (Normally, extra arguments are 8040harmlessly ignored.) 8041 8042@item -mregparm=@var{num} 8043@opindex mregparm 8044Control how many registers are used to pass integer arguments. By 8045default, no registers are used to pass arguments, and at most 3 8046registers can be used. You can control this behavior for a specific 8047function by using the function attribute @samp{regparm}. 8048@xref{Function Attributes}. 8049 8050@strong{Warning:} if you use this switch, and 8051@var{num} is nonzero, then you must build all modules with the same 8052value, including any libraries. This includes the system libraries and 8053startup modules. 8054 8055@item -mpreferred-stack-boundary=@var{num} 8056@opindex mpreferred-stack-boundary 8057Attempt to keep the stack boundary aligned to a 2 raised to @var{num} 8058byte boundary. If @option{-mpreferred-stack-boundary} is not specified, 8059the default is 4 (16 bytes or 128 bits), except when optimizing for code 8060size (@option{-Os}), in which case the default is the minimum correct 8061alignment (4 bytes for x86, and 8 bytes for x86-64). 8062 8063On Pentium and PentiumPro, @code{double} and @code{long double} values 8064should be aligned to an 8 byte boundary (see @option{-malign-double}) or 8065suffer significant run time performance penalties. On Pentium III, the 8066Streaming SIMD Extension (SSE) data type @code{__m128} suffers similar 8067penalties if it is not 16 byte aligned. 8068 8069To ensure proper alignment of this values on the stack, the stack boundary 8070must be as aligned as that required by any value stored on the stack. 8071Further, every function must be generated such that it keeps the stack 8072aligned. Thus calling a function compiled with a higher preferred 8073stack boundary from a function compiled with a lower preferred stack 8074boundary will most likely misalign the stack. It is recommended that 8075libraries that use callbacks always use the default setting. 8076 8077This extra alignment does consume extra stack space, and generally 8078increases code size. Code that is sensitive to stack space usage, such 8079as embedded systems and operating system kernels, may want to reduce the 8080preferred alignment to @option{-mpreferred-stack-boundary=2}. 8081 8082@item -mmmx 8083@itemx -mno-mmx 8084@item -msse 8085@itemx -mno-sse 8086@item -msse2 8087@itemx -mno-sse2 8088@item -m3dnow 8089@itemx -mno-3dnow 8090@opindex mmmx 8091@opindex mno-mmx 8092@opindex msse 8093@opindex mno-sse 8094@opindex m3dnow 8095@opindex mno-3dnow 8096These switches enable or disable the use of built-in functions that allow 8097direct access to the MMX, SSE and 3Dnow extensions of the instruction set. 8098 8099@xref{X86 Built-in Functions}, for details of the functions enabled 8100and disabled by these switches. 8101 8102To have SSE/SSE2 instructions generated automatically from floating-point 8103code, see @option{-mfpmath=sse}. 8104 8105@item -mpush-args 8106@itemx -mno-push-args 8107@opindex mpush-args 8108@opindex mno-push-args 8109Use PUSH operations to store outgoing parameters. This method is shorter 8110and usually equally fast as method using SUB/MOV operations and is enabled 8111by default. In some cases disabling it may improve performance because of 8112improved scheduling and reduced dependencies. 8113 8114@item -maccumulate-outgoing-args 8115@opindex maccumulate-outgoing-args 8116If enabled, the maximum amount of space required for outgoing arguments will be 8117computed in the function prologue. This is faster on most modern CPUs 8118because of reduced dependencies, improved scheduling and reduced stack usage 8119when preferred stack boundary is not equal to 2. The drawback is a notable 8120increase in code size. This switch implies @option{-mno-push-args}. 8121 8122@item -mthreads 8123@opindex mthreads 8124Support thread-safe exception handling on @samp{Mingw32}. Code that relies 8125on thread-safe exception handling must compile and link all code with the 8126@option{-mthreads} option. When compiling, @option{-mthreads} defines 8127@option{-D_MT}; when linking, it links in a special thread helper library 8128@option{-lmingwthrd} which cleans up per thread exception handling data. 8129 8130@item -mno-align-stringops 8131@opindex mno-align-stringops 8132Do not align destination of inlined string operations. This switch reduces 8133code size and improves performance in case the destination is already aligned, 8134but gcc don't know about it. 8135 8136@item -minline-all-stringops 8137@opindex minline-all-stringops 8138By default GCC inlines string operations only when destination is known to be 8139aligned at least to 4 byte boundary. This enables more inlining, increase code 8140size, but may improve performance of code that depends on fast memcpy, strlen 8141and memset for short lengths. 8142 8143@item -momit-leaf-frame-pointer 8144@opindex momit-leaf-frame-pointer 8145Don't keep the frame pointer in a register for leaf functions. This 8146avoids the instructions to save, set up and restore frame pointers and 8147makes an extra register available in leaf functions. The option 8148@option{-fomit-frame-pointer} removes the frame pointer for all functions 8149which might make debugging harder. 8150@end table 8151 8152These @samp{-m} switches are supported in addition to the above 8153on AMD x86-64 processors in 64-bit environments. 8154 8155@table @gcctabopt 8156@item -m32 8157@itemx -m64 8158@opindex m32 8159@opindex m64 8160Generate code for a 32-bit or 64-bit environment. 8161The 32-bit environment sets int, long and pointer to 32 bits and 8162generates code that runs on any i386 system. 8163The 64-bit environment sets int to 32 bits and long and pointer 8164to 64 bits and generates code for AMD's x86-64 architecture. 8165 8166@item -mno-red-zone 8167@opindex no-red-zone 8168Do not use a so called red zone for x86-64 code. The red zone is mandated 8169by the x86-64 ABI, it is a 128-byte area beyond the location of the 8170stack pointer that will not be modified by signal or interrupt handlers 8171and therefore can be used for temporary data without adjusting the stack 8172pointer. The flag @option{-mno-red-zone} disables this red zone. 8173 8174@item -mcmodel=small 8175@opindex mcmodel=small 8176Generate code for the small code model: the program and its symbols must 8177be linked in the lower 2 GB of the address space. Pointers are 64 bits. 8178Programs can be statically or dynamically linked. This is the default 8179code model. 8180 8181@item -mcmodel=kernel 8182@opindex mcmodel=kernel 8183Generate code for the kernel code model. The kernel runs in the 8184negative 2 GB of the address space. 8185This model has to be used for Linux kernel code. 8186 8187@item -mcmodel=medium 8188@opindex mcmodel=medium 8189Generate code for the medium model: The program is linked in the lower 2 8190GB of the address space but symbols can be located anywhere in the 8191address space. Programs can be statically or dynamically linked, but 8192building of shared libraries are not supported with the medium model. 8193 8194@item -mcmodel=large 8195@opindex mcmodel=large 8196Generate code for the large model: This model makes no assumptions 8197about addresses and sizes of sections. Currently GCC does not implement 8198this model. 8199@end table 8200 8201@node HPPA Options 8202@subsection HPPA Options 8203@cindex HPPA Options 8204 8205These @samp{-m} options are defined for the HPPA family of computers: 8206 8207@table @gcctabopt 8208@item -march=@var{architecture-type} 8209@opindex march 8210Generate code for the specified architecture. The choices for 8211@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA 82121.1, and @samp{2.0} for PA 2.0 processors. Refer to 8213@file{/usr/lib/sched.models} on an HP-UX system to determine the proper 8214architecture option for your machine. Code compiled for lower numbered 8215architectures will run on higher numbered architectures, but not the 8216other way around. 8217 8218PA 2.0 support currently requires gas snapshot 19990413 or later. The 8219next release of binutils (current is 2.9.1) will probably contain PA 2.0 8220support. 8221 8222@item -mpa-risc-1-0 8223@itemx -mpa-risc-1-1 8224@itemx -mpa-risc-2-0 8225@opindex mpa-risc-1-0 8226@opindex mpa-risc-1-1 8227@opindex mpa-risc-2-0 8228Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively. 8229 8230@item -mbig-switch 8231@opindex mbig-switch 8232Generate code suitable for big switch tables. Use this option only if 8233the assembler/linker complain about out of range branches within a switch 8234table. 8235 8236@item -mjump-in-delay 8237@opindex mjump-in-delay 8238Fill delay slots of function calls with unconditional jump instructions 8239by modifying the return pointer for the function call to be the target 8240of the conditional jump. 8241 8242@item -mdisable-fpregs 8243@opindex mdisable-fpregs 8244Prevent floating point registers from being used in any manner. This is 8245necessary for compiling kernels which perform lazy context switching of 8246floating point registers. If you use this option and attempt to perform 8247floating point operations, the compiler will abort. 8248 8249@item -mdisable-indexing 8250@opindex mdisable-indexing 8251Prevent the compiler from using indexing address modes. This avoids some 8252rather obscure problems when compiling MIG generated code under MACH@. 8253 8254@item -mno-space-regs 8255@opindex mno-space-regs 8256Generate code that assumes the target has no space registers. This allows 8257GCC to generate faster indirect calls and use unscaled index address modes. 8258 8259Such code is suitable for level 0 PA systems and kernels. 8260 8261@item -mfast-indirect-calls 8262@opindex mfast-indirect-calls 8263Generate code that assumes calls never cross space boundaries. This 8264allows GCC to emit code which performs faster indirect calls. 8265 8266This option will not work in the presence of shared libraries or nested 8267functions. 8268 8269@item -mlong-load-store 8270@opindex mlong-load-store 8271Generate 3-instruction load and store sequences as sometimes required by 8272the HP-UX 10 linker. This is equivalent to the @samp{+k} option to 8273the HP compilers. 8274 8275@item -mportable-runtime 8276@opindex mportable-runtime 8277Use the portable calling conventions proposed by HP for ELF systems. 8278 8279@item -mgas 8280@opindex mgas 8281Enable the use of assembler directives only GAS understands. 8282 8283@item -mschedule=@var{cpu-type} 8284@opindex mschedule 8285Schedule code according to the constraints for the machine type 8286@var{cpu-type}. The choices for @var{cpu-type} are @samp{700} 8287@samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer 8288to @file{/usr/lib/sched.models} on an HP-UX system to determine the 8289proper scheduling option for your machine. The default scheduling is 8290@samp{8000}. 8291 8292@item -mlinker-opt 8293@opindex mlinker-opt 8294Enable the optimization pass in the HP-UX linker. Note this makes symbolic 8295debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9 8296linkers in which they give bogus error messages when linking some programs. 8297 8298@item -msoft-float 8299@opindex msoft-float 8300Generate output containing library calls for floating point. 8301@strong{Warning:} the requisite libraries are not available for all HPPA 8302targets. Normally the facilities of the machine's usual C compiler are 8303used, but this cannot be done directly in cross-compilation. You must make 8304your own arrangements to provide suitable library functions for 8305cross-compilation. The embedded target @samp{hppa1.1-*-pro} 8306does provide software floating point support. 8307 8308@option{-msoft-float} changes the calling convention in the output file; 8309therefore, it is only useful if you compile @emph{all} of a program with 8310this option. In particular, you need to compile @file{libgcc.a}, the 8311library that comes with GCC, with @option{-msoft-float} in order for 8312this to work. 8313 8314@item -msio 8315@opindex msio 8316Generate the predefine, @code{_SIO}, for server IO. The default is 8317@option{-mwsio}. This generates the predefines, @code{__hp9000s700}, 8318@code{__hp9000s700__} and @code{_WSIO}, for workstation IO. These 8319options are available under HP-UX and HI-UX. 8320 8321@item -mgnu-ld 8322@opindex gnu-ld 8323Use GNU ld specific options. This passes @option{-shared} to ld when 8324building a shared library. It is the default when GCC is configured, 8325explicitly or implicitly, with the GNU linker. This option does not 8326have any affect on which ld is called, it only changes what parameters 8327are passed to that ld. The ld that is called is determined by the 8328@option{--with-ld} configure option, gcc's program search path, and 8329finally by the user's @env{PATH}. The linker used by GCC can be printed 8330using @samp{which `gcc -print-prog-name=ld`}. 8331 8332@item -mhp-ld 8333@opindex hp-ld 8334Use HP ld specific options. This passes @option{-b} to ld when building 8335a shared library and passes @option{+Accept TypeMismatch} to ld on all 8336links. It is the default when GCC is configured, explicitly or 8337implicitly, with the HP linker. This option does not have any affect on 8338which ld is called, it only changes what parameters are passed to that 8339ld. The ld that is called is determined by the @option{--with-ld} 8340configure option, gcc's program search path, and finally by the user's 8341@env{PATH}. The linker used by GCC can be printed using @samp{which 8342`gcc -print-prog-name=ld`}. 8343 8344@item -mlong-calls 8345@opindex mno-long-calls 8346Generate code that uses long call sequences. This ensures that a call 8347is always able to reach linker generated stubs. The default is to generate 8348long calls only when the distance from the call site to the beginning 8349of the function or translation unit, as the case may be, exceeds a 8350predefined limit set by the branch type being used. The limits for 8351normal calls are 7,600,000 and 240,000 bytes, respectively for the 8352PA 2.0 and PA 1.X architectures. Sibcalls are always limited at 8353240,000 bytes. 8354 8355Distances are measured from the beginning of functions when using the 8356@option{-ffunction-sections} option, or when using the @option{-mgas} 8357and @option{-mno-portable-runtime} options together under HP-UX with 8358the SOM linker. 8359 8360It is normally not desirable to use this option as it will degrade 8361performance. However, it may be useful in large applications, 8362particularly when partial linking is used to build the application. 8363 8364The types of long calls used depends on the capabilities of the 8365assembler and linker, and the type of code being generated. The 8366impact on systems that support long absolute calls, and long pic 8367symbol-difference or pc-relative calls should be relatively small. 8368However, an indirect call is used on 32-bit ELF systems in pic code 8369and it is quite long. 8370 8371@item -nolibdld 8372@opindex nolibdld 8373Suppress the generation of link options to search libdld.sl when the 8374@option{-static} option is specified on HP-UX 10 and later. 8375 8376@item -static 8377@opindex static 8378The HP-UX implementation of setlocale in libc has a dependency on 8379libdld.sl. There isn't an archive version of libdld.sl. Thus, 8380when the @option{-static} option is specified, special link options 8381are needed to resolve this dependency. 8382 8383On HP-UX 10 and later, the GCC driver adds the necessary options to 8384link with libdld.sl when the @option{-static} option is specified. 8385This causes the resulting binary to be dynamic. On the 64-bit port, 8386the linkers generate dynamic binaries by default in any case. The 8387@option{-nolibdld} option can be used to prevent the GCC driver from 8388adding these link options. 8389 8390@item -threads 8391@opindex threads 8392Add support for multithreading with the @dfn{dce thread} library 8393under HP-UX. This option sets flags for both the preprocessor and 8394linker. 8395@end table 8396 8397@node Intel 960 Options 8398@subsection Intel 960 Options 8399 8400These @samp{-m} options are defined for the Intel 960 implementations: 8401 8402@table @gcctabopt 8403@item -m@var{cpu-type} 8404@opindex mka 8405@opindex mkb 8406@opindex mmc 8407@opindex mca 8408@opindex mcf 8409@opindex msa 8410@opindex msb 8411Assume the defaults for the machine type @var{cpu-type} for some of 8412the other options, including instruction scheduling, floating point 8413support, and addressing modes. The choices for @var{cpu-type} are 8414@samp{ka}, @samp{kb}, @samp{mc}, @samp{ca}, @samp{cf}, 8415@samp{sa}, and @samp{sb}. 8416The default is 8417@samp{kb}. 8418 8419@item -mnumerics 8420@itemx -msoft-float 8421@opindex mnumerics 8422@opindex msoft-float 8423The @option{-mnumerics} option indicates that the processor does support 8424floating-point instructions. The @option{-msoft-float} option indicates 8425that floating-point support should not be assumed. 8426 8427@item -mleaf-procedures 8428@itemx -mno-leaf-procedures 8429@opindex mleaf-procedures 8430@opindex mno-leaf-procedures 8431Do (or do not) attempt to alter leaf procedures to be callable with the 8432@code{bal} instruction as well as @code{call}. This will result in more 8433efficient code for explicit calls when the @code{bal} instruction can be 8434substituted by the assembler or linker, but less efficient code in other 8435cases, such as calls via function pointers, or using a linker that doesn't 8436support this optimization. 8437 8438@item -mtail-call 8439@itemx -mno-tail-call 8440@opindex mtail-call 8441@opindex mno-tail-call 8442Do (or do not) make additional attempts (beyond those of the 8443machine-independent portions of the compiler) to optimize tail-recursive 8444calls into branches. You may not want to do this because the detection of 8445cases where this is not valid is not totally complete. The default is 8446@option{-mno-tail-call}. 8447 8448@item -mcomplex-addr 8449@itemx -mno-complex-addr 8450@opindex mcomplex-addr 8451@opindex mno-complex-addr 8452Assume (or do not assume) that the use of a complex addressing mode is a 8453win on this implementation of the i960. Complex addressing modes may not 8454be worthwhile on the K-series, but they definitely are on the C-series. 8455The default is currently @option{-mcomplex-addr} for all processors except 8456the CB and CC@. 8457 8458@item -mcode-align 8459@itemx -mno-code-align 8460@opindex mcode-align 8461@opindex mno-code-align 8462Align code to 8-byte boundaries for faster fetching (or don't bother). 8463Currently turned on by default for C-series implementations only. 8464 8465@ignore 8466@item -mclean-linkage 8467@itemx -mno-clean-linkage 8468@opindex mclean-linkage 8469@opindex mno-clean-linkage 8470These options are not fully implemented. 8471@end ignore 8472 8473@item -mic-compat 8474@itemx -mic2.0-compat 8475@itemx -mic3.0-compat 8476@opindex mic-compat 8477@opindex mic2.0-compat 8478@opindex mic3.0-compat 8479Enable compatibility with iC960 v2.0 or v3.0. 8480 8481@item -masm-compat 8482@itemx -mintel-asm 8483@opindex masm-compat 8484@opindex mintel-asm 8485Enable compatibility with the iC960 assembler. 8486 8487@item -mstrict-align 8488@itemx -mno-strict-align 8489@opindex mstrict-align 8490@opindex mno-strict-align 8491Do not permit (do permit) unaligned accesses. 8492 8493@item -mold-align 8494@opindex mold-align 8495Enable structure-alignment compatibility with Intel's gcc release version 84961.3 (based on gcc 1.37). This option implies @option{-mstrict-align}. 8497 8498@item -mlong-double-64 8499@opindex mlong-double-64 8500Implement type @samp{long double} as 64-bit floating point numbers. 8501Without the option @samp{long double} is implemented by 80-bit 8502floating point numbers. The only reason we have it because there is 8503no 128-bit @samp{long double} support in @samp{fp-bit.c} yet. So it 8504is only useful for people using soft-float targets. Otherwise, we 8505should recommend against use of it. 8506 8507@end table 8508 8509@node DEC Alpha Options 8510@subsection DEC Alpha Options 8511 8512These @samp{-m} options are defined for the DEC Alpha implementations: 8513 8514@table @gcctabopt 8515@item -mno-soft-float 8516@itemx -msoft-float 8517@opindex mno-soft-float 8518@opindex msoft-float 8519Use (do not use) the hardware floating-point instructions for 8520floating-point operations. When @option{-msoft-float} is specified, 8521functions in @file{libgcc.a} will be used to perform floating-point 8522operations. Unless they are replaced by routines that emulate the 8523floating-point operations, or compiled in such a way as to call such 8524emulations routines, these routines will issue floating-point 8525operations. If you are compiling for an Alpha without floating-point 8526operations, you must ensure that the library is built so as not to call 8527them. 8528 8529Note that Alpha implementations without floating-point operations are 8530required to have floating-point registers. 8531 8532@item -mfp-reg 8533@itemx -mno-fp-regs 8534@opindex mfp-reg 8535@opindex mno-fp-regs 8536Generate code that uses (does not use) the floating-point register set. 8537@option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point 8538register set is not used, floating point operands are passed in integer 8539registers as if they were integers and floating-point results are passed 8540in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence, 8541so any function with a floating-point argument or return value called by code 8542compiled with @option{-mno-fp-regs} must also be compiled with that 8543option. 8544 8545A typical use of this option is building a kernel that does not use, 8546and hence need not save and restore, any floating-point registers. 8547 8548@item -mieee 8549@opindex mieee 8550The Alpha architecture implements floating-point hardware optimized for 8551maximum performance. It is mostly compliant with the IEEE floating 8552point standard. However, for full compliance, software assistance is 8553required. This option generates code fully IEEE compliant code 8554@emph{except} that the @var{inexact-flag} is not maintained (see below). 8555If this option is turned on, the preprocessor macro @code{_IEEE_FP} is 8556defined during compilation. The resulting code is less efficient but is 8557able to correctly support denormalized numbers and exceptional IEEE 8558values such as not-a-number and plus/minus infinity. Other Alpha 8559compilers call this option @option{-ieee_with_no_inexact}. 8560 8561@item -mieee-with-inexact 8562@opindex mieee-with-inexact 8563This is like @option{-mieee} except the generated code also maintains 8564the IEEE @var{inexact-flag}. Turning on this option causes the 8565generated code to implement fully-compliant IEEE math. In addition to 8566@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor 8567macro. On some Alpha implementations the resulting code may execute 8568significantly slower than the code generated by default. Since there is 8569very little code that depends on the @var{inexact-flag}, you should 8570normally not specify this option. Other Alpha compilers call this 8571option @option{-ieee_with_inexact}. 8572 8573@item -mfp-trap-mode=@var{trap-mode} 8574@opindex mfp-trap-mode 8575This option controls what floating-point related traps are enabled. 8576Other Alpha compilers call this option @option{-fptm @var{trap-mode}}. 8577The trap mode can be set to one of four values: 8578 8579@table @samp 8580@item n 8581This is the default (normal) setting. The only traps that are enabled 8582are the ones that cannot be disabled in software (e.g., division by zero 8583trap). 8584 8585@item u 8586In addition to the traps enabled by @samp{n}, underflow traps are enabled 8587as well. 8588 8589@item su 8590Like @samp{su}, but the instructions are marked to be safe for software 8591completion (see Alpha architecture manual for details). 8592 8593@item sui 8594Like @samp{su}, but inexact traps are enabled as well. 8595@end table 8596 8597@item -mfp-rounding-mode=@var{rounding-mode} 8598@opindex mfp-rounding-mode 8599Selects the IEEE rounding mode. Other Alpha compilers call this option 8600@option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one 8601of: 8602 8603@table @samp 8604@item n 8605Normal IEEE rounding mode. Floating point numbers are rounded towards 8606the nearest machine number or towards the even machine number in case 8607of a tie. 8608 8609@item m 8610Round towards minus infinity. 8611 8612@item c 8613Chopped rounding mode. Floating point numbers are rounded towards zero. 8614 8615@item d 8616Dynamic rounding mode. A field in the floating point control register 8617(@var{fpcr}, see Alpha architecture reference manual) controls the 8618rounding mode in effect. The C library initializes this register for 8619rounding towards plus infinity. Thus, unless your program modifies the 8620@var{fpcr}, @samp{d} corresponds to round towards plus infinity. 8621@end table 8622 8623@item -mtrap-precision=@var{trap-precision} 8624@opindex mtrap-precision 8625In the Alpha architecture, floating point traps are imprecise. This 8626means without software assistance it is impossible to recover from a 8627floating trap and program execution normally needs to be terminated. 8628GCC can generate code that can assist operating system trap handlers 8629in determining the exact location that caused a floating point trap. 8630Depending on the requirements of an application, different levels of 8631precisions can be selected: 8632 8633@table @samp 8634@item p 8635Program precision. This option is the default and means a trap handler 8636can only identify which program caused a floating point exception. 8637 8638@item f 8639Function precision. The trap handler can determine the function that 8640caused a floating point exception. 8641 8642@item i 8643Instruction precision. The trap handler can determine the exact 8644instruction that caused a floating point exception. 8645@end table 8646 8647Other Alpha compilers provide the equivalent options called 8648@option{-scope_safe} and @option{-resumption_safe}. 8649 8650@item -mieee-conformant 8651@opindex mieee-conformant 8652This option marks the generated code as IEEE conformant. You must not 8653use this option unless you also specify @option{-mtrap-precision=i} and either 8654@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect 8655is to emit the line @samp{.eflag 48} in the function prologue of the 8656generated assembly file. Under DEC Unix, this has the effect that 8657IEEE-conformant math library routines will be linked in. 8658 8659@item -mbuild-constants 8660@opindex mbuild-constants 8661Normally GCC examines a 32- or 64-bit integer constant to 8662see if it can construct it from smaller constants in two or three 8663instructions. If it cannot, it will output the constant as a literal and 8664generate code to load it from the data segment at runtime. 8665 8666Use this option to require GCC to construct @emph{all} integer constants 8667using code, even if it takes more instructions (the maximum is six). 8668 8669You would typically use this option to build a shared library dynamic 8670loader. Itself a shared library, it must relocate itself in memory 8671before it can find the variables and constants in its own data segment. 8672 8673@item -malpha-as 8674@itemx -mgas 8675@opindex malpha-as 8676@opindex mgas 8677Select whether to generate code to be assembled by the vendor-supplied 8678assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}. 8679 8680@item -mbwx 8681@itemx -mno-bwx 8682@itemx -mcix 8683@itemx -mno-cix 8684@itemx -mfix 8685@itemx -mno-fix 8686@itemx -mmax 8687@itemx -mno-max 8688@opindex mbwx 8689@opindex mno-bwx 8690@opindex mcix 8691@opindex mno-cix 8692@opindex mfix 8693@opindex mno-fix 8694@opindex mmax 8695@opindex mno-max 8696Indicate whether GCC should generate code to use the optional BWX, 8697CIX, FIX and MAX instruction sets. The default is to use the instruction 8698sets supported by the CPU type specified via @option{-mcpu=} option or that 8699of the CPU on which GCC was built if none was specified. 8700 8701@item -mfloat-vax 8702@itemx -mfloat-ieee 8703@opindex mfloat-vax 8704@opindex mfloat-ieee 8705Generate code that uses (does not use) VAX F and G floating point 8706arithmetic instead of IEEE single and double precision. 8707 8708@item -mexplicit-relocs 8709@itemx -mno-explicit-relocs 8710@opindex mexplicit-relocs 8711@opindex mno-explicit-relocs 8712Older Alpha assemblers provided no way to generate symbol relocations 8713except via assembler macros. Use of these macros does not allow 8714optimal instruction scheduling. GNU binutils as of version 2.12 8715supports a new syntax that allows the compiler to explicitly mark 8716which relocations should apply to which instructions. This option 8717is mostly useful for debugging, as GCC detects the capabilities of 8718the assembler when it is built and sets the default accordingly. 8719 8720@item -msmall-data 8721@itemx -mlarge-data 8722@opindex msmall-data 8723@opindex mlarge-data 8724When @option{-mexplicit-relocs} is in effect, static data is 8725accessed via @dfn{gp-relative} relocations. When @option{-msmall-data} 8726is used, objects 8 bytes long or smaller are placed in a @dfn{small data area} 8727(the @code{.sdata} and @code{.sbss} sections) and are accessed via 872816-bit relocations off of the @code{$gp} register. This limits the 8729size of the small data area to 64KB, but allows the variables to be 8730directly accessed via a single instruction. 8731 8732The default is @option{-mlarge-data}. With this option the data area 8733is limited to just below 2GB. Programs that require more than 2GB of 8734data must use @code{malloc} or @code{mmap} to allocate the data in the 8735heap instead of in the program's data segment. 8736 8737When generating code for shared libraries, @option{-fpic} implies 8738@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}. 8739 8740@item -mcpu=@var{cpu_type} 8741@opindex mcpu 8742Set the instruction set and instruction scheduling parameters for 8743machine type @var{cpu_type}. You can specify either the @samp{EV} 8744style name or the corresponding chip number. GCC supports scheduling 8745parameters for the EV4, EV5 and EV6 family of processors and will 8746choose the default values for the instruction set from the processor 8747you specify. If you do not specify a processor type, GCC will default 8748to the processor on which the compiler was built. 8749 8750Supported values for @var{cpu_type} are 8751 8752@table @samp 8753@item ev4 8754@item ev45 8755@itemx 21064 8756Schedules as an EV4 and has no instruction set extensions. 8757 8758@item ev5 8759@itemx 21164 8760Schedules as an EV5 and has no instruction set extensions. 8761 8762@item ev56 8763@itemx 21164a 8764Schedules as an EV5 and supports the BWX extension. 8765 8766@item pca56 8767@itemx 21164pc 8768@itemx 21164PC 8769Schedules as an EV5 and supports the BWX and MAX extensions. 8770 8771@item ev6 8772@itemx 21264 8773Schedules as an EV6 and supports the BWX, FIX, and MAX extensions. 8774 8775@item ev67 8776@item 21264a 8777Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions. 8778@end table 8779 8780@item -mtune=@var{cpu_type} 8781@opindex mtune 8782Set only the instruction scheduling parameters for machine type 8783@var{cpu_type}. The instruction set is not changed. 8784 8785@item -mmemory-latency=@var{time} 8786@opindex mmemory-latency 8787Sets the latency the scheduler should assume for typical memory 8788references as seen by the application. This number is highly 8789dependent on the memory access patterns used by the application 8790and the size of the external cache on the machine. 8791 8792Valid options for @var{time} are 8793 8794@table @samp 8795@item @var{number} 8796A decimal number representing clock cycles. 8797 8798@item L1 8799@itemx L2 8800@itemx L3 8801@itemx main 8802The compiler contains estimates of the number of clock cycles for 8803``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches 8804(also called Dcache, Scache, and Bcache), as well as to main memory. 8805Note that L3 is only valid for EV5. 8806 8807@end table 8808@end table 8809 8810@node DEC Alpha/VMS Options 8811@subsection DEC Alpha/VMS Options 8812 8813These @samp{-m} options are defined for the DEC Alpha/VMS implementations: 8814 8815@table @gcctabopt 8816@item -mvms-return-codes 8817@opindex mvms-return-codes 8818Return VMS condition codes from main. The default is to return POSIX 8819style condition (e.g.@ error) codes. 8820@end table 8821 8822@node H8/300 Options 8823@subsection H8/300 Options 8824 8825These @samp{-m} options are defined for the H8/300 implementations: 8826 8827@table @gcctabopt 8828@item -mrelax 8829@opindex mrelax 8830Shorten some address references at link time, when possible; uses the 8831linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300, 8832ld.info, Using ld}, for a fuller description. 8833 8834@item -mh 8835@opindex mh 8836Generate code for the H8/300H@. 8837 8838@item -ms 8839@opindex ms 8840Generate code for the H8S@. 8841 8842@item -mn 8843@opindex mn 8844Generate code for the H8S and H8/300H in the normal mode. This switch 8845must be used either with -mh or -ms. 8846 8847@item -ms2600 8848@opindex ms2600 8849Generate code for the H8S/2600. This switch must be used with @option{-ms}. 8850 8851@item -mint32 8852@opindex mint32 8853Make @code{int} data 32 bits by default. 8854 8855@item -malign-300 8856@opindex malign-300 8857On the H8/300H and H8S, use the same alignment rules as for the H8/300. 8858The default for the H8/300H and H8S is to align longs and floats on 4 8859byte boundaries. 8860@option{-malign-300} causes them to be aligned on 2 byte boundaries. 8861This option has no effect on the H8/300. 8862@end table 8863 8864@node SH Options 8865@subsection SH Options 8866 8867These @samp{-m} options are defined for the SH implementations: 8868 8869@table @gcctabopt 8870@item -m1 8871@opindex m1 8872Generate code for the SH1. 8873 8874@item -m2 8875@opindex m2 8876Generate code for the SH2. 8877 8878@item -m3 8879@opindex m3 8880Generate code for the SH3. 8881 8882@item -m3e 8883@opindex m3e 8884Generate code for the SH3e. 8885 8886@item -m4-nofpu 8887@opindex m4-nofpu 8888Generate code for the SH4 without a floating-point unit. 8889 8890@item -m4-single-only 8891@opindex m4-single-only 8892Generate code for the SH4 with a floating-point unit that only 8893supports single-precision arithmetic. 8894 8895@item -m4-single 8896@opindex m4-single 8897Generate code for the SH4 assuming the floating-point unit is in 8898single-precision mode by default. 8899 8900@item -m4 8901@opindex m4 8902Generate code for the SH4. 8903 8904@item -mb 8905@opindex mb 8906Compile code for the processor in big endian mode. 8907 8908@item -ml 8909@opindex ml 8910Compile code for the processor in little endian mode. 8911 8912@item -mdalign 8913@opindex mdalign 8914Align doubles at 64-bit boundaries. Note that this changes the calling 8915conventions, and thus some functions from the standard C library will 8916not work unless you recompile it first with @option{-mdalign}. 8917 8918@item -mrelax 8919@opindex mrelax 8920Shorten some address references at link time, when possible; uses the 8921linker option @option{-relax}. 8922 8923@item -mbigtable 8924@opindex mbigtable 8925Use 32-bit offsets in @code{switch} tables. The default is to use 892616-bit offsets. 8927 8928@item -mfmovd 8929@opindex mfmovd 8930Enable the use of the instruction @code{fmovd}. 8931 8932@item -mhitachi 8933@opindex mhitachi 8934Comply with the calling conventions defined by Renesas. 8935 8936@item -mnomacsave 8937@opindex mnomacsave 8938Mark the @code{MAC} register as call-clobbered, even if 8939@option{-mhitachi} is given. 8940 8941@item -mieee 8942@opindex mieee 8943Increase IEEE-compliance of floating-point code. 8944 8945@item -misize 8946@opindex misize 8947Dump instruction size and location in the assembly code. 8948 8949@item -mpadstruct 8950@opindex mpadstruct 8951This option is deprecated. It pads structures to multiple of 4 bytes, 8952which is incompatible with the SH ABI@. 8953 8954@item -mspace 8955@opindex mspace 8956Optimize for space instead of speed. Implied by @option{-Os}. 8957 8958@item -mprefergot 8959@opindex mprefergot 8960When generating position-independent code, emit function calls using 8961the Global Offset Table instead of the Procedure Linkage Table. 8962 8963@item -musermode 8964@opindex musermode 8965Generate a library function call to invalidate instruction cache 8966entries, after fixing up a trampoline. This library function call 8967doesn't assume it can write to the whole memory address space. This 8968is the default when the target is @code{sh-*-linux*}. 8969@end table 8970 8971@node System V Options 8972@subsection Options for System V 8973 8974These additional options are available on System V Release 4 for 8975compatibility with other compilers on those systems: 8976 8977@table @gcctabopt 8978@item -G 8979@opindex G 8980Create a shared object. 8981It is recommended that @option{-symbolic} or @option{-shared} be used instead. 8982 8983@item -Qy 8984@opindex Qy 8985Identify the versions of each tool used by the compiler, in a 8986@code{.ident} assembler directive in the output. 8987 8988@item -Qn 8989@opindex Qn 8990Refrain from adding @code{.ident} directives to the output file (this is 8991the default). 8992 8993@item -YP,@var{dirs} 8994@opindex YP 8995Search the directories @var{dirs}, and no others, for libraries 8996specified with @option{-l}. 8997 8998@item -Ym,@var{dir} 8999@opindex Ym 9000Look in the directory @var{dir} to find the M4 preprocessor. 9001The assembler uses this option. 9002@c This is supposed to go with a -Yd for predefined M4 macro files, but 9003@c the generic assembler that comes with Solaris takes just -Ym. 9004@end table 9005 9006@node TMS320C3x/C4x Options 9007@subsection TMS320C3x/C4x Options 9008@cindex TMS320C3x/C4x Options 9009 9010These @samp{-m} options are defined for TMS320C3x/C4x implementations: 9011 9012@table @gcctabopt 9013 9014@item -mcpu=@var{cpu_type} 9015@opindex mcpu 9016Set the instruction set, register set, and instruction scheduling 9017parameters for machine type @var{cpu_type}. Supported values for 9018@var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and 9019@samp{c44}. The default is @samp{c40} to generate code for the 9020TMS320C40. 9021 9022@item -mbig-memory 9023@item -mbig 9024@itemx -msmall-memory 9025@itemx -msmall 9026@opindex mbig-memory 9027@opindex mbig 9028@opindex msmall-memory 9029@opindex msmall 9030Generates code for the big or small memory model. The small memory 9031model assumed that all data fits into one 64K word page. At run-time 9032the data page (DP) register must be set to point to the 64K page 9033containing the .bss and .data program sections. The big memory model is 9034the default and requires reloading of the DP register for every direct 9035memory access. 9036 9037@item -mbk 9038@itemx -mno-bk 9039@opindex mbk 9040@opindex mno-bk 9041Allow (disallow) allocation of general integer operands into the block 9042count register BK@. 9043 9044@item -mdb 9045@itemx -mno-db 9046@opindex mdb 9047@opindex mno-db 9048Enable (disable) generation of code using decrement and branch, 9049DBcond(D), instructions. This is enabled by default for the C4x. To be 9050on the safe side, this is disabled for the C3x, since the maximum 9051iteration count on the C3x is @math{2^{23} + 1} (but who iterates loops more than 9052@math{2^{23}} times on the C3x?). Note that GCC will try to reverse a loop so 9053that it can utilize the decrement and branch instruction, but will give 9054up if there is more than one memory reference in the loop. Thus a loop 9055where the loop counter is decremented can generate slightly more 9056efficient code, in cases where the RPTB instruction cannot be utilized. 9057 9058@item -mdp-isr-reload 9059@itemx -mparanoid 9060@opindex mdp-isr-reload 9061@opindex mparanoid 9062Force the DP register to be saved on entry to an interrupt service 9063routine (ISR), reloaded to point to the data section, and restored on 9064exit from the ISR@. This should not be required unless someone has 9065violated the small memory model by modifying the DP register, say within 9066an object library. 9067 9068@item -mmpyi 9069@itemx -mno-mpyi 9070@opindex mmpyi 9071@opindex mno-mpyi 9072For the C3x use the 24-bit MPYI instruction for integer multiplies 9073instead of a library call to guarantee 32-bit results. Note that if one 9074of the operands is a constant, then the multiplication will be performed 9075using shifts and adds. If the @option{-mmpyi} option is not specified for the C3x, 9076then squaring operations are performed inline instead of a library call. 9077 9078@item -mfast-fix 9079@itemx -mno-fast-fix 9080@opindex mfast-fix 9081@opindex mno-fast-fix 9082The C3x/C4x FIX instruction to convert a floating point value to an 9083integer value chooses the nearest integer less than or equal to the 9084floating point value rather than to the nearest integer. Thus if the 9085floating point number is negative, the result will be incorrectly 9086truncated an additional code is necessary to detect and correct this 9087case. This option can be used to disable generation of the additional 9088code required to correct the result. 9089 9090@item -mrptb 9091@itemx -mno-rptb 9092@opindex mrptb 9093@opindex mno-rptb 9094Enable (disable) generation of repeat block sequences using the RPTB 9095instruction for zero overhead looping. The RPTB construct is only used 9096for innermost loops that do not call functions or jump across the loop 9097boundaries. There is no advantage having nested RPTB loops due to the 9098overhead required to save and restore the RC, RS, and RE registers. 9099This is enabled by default with @option{-O2}. 9100 9101@item -mrpts=@var{count} 9102@itemx -mno-rpts 9103@opindex mrpts 9104@opindex mno-rpts 9105Enable (disable) the use of the single instruction repeat instruction 9106RPTS@. If a repeat block contains a single instruction, and the loop 9107count can be guaranteed to be less than the value @var{count}, GCC will 9108emit a RPTS instruction instead of a RPTB@. If no value is specified, 9109then a RPTS will be emitted even if the loop count cannot be determined 9110at compile time. Note that the repeated instruction following RPTS does 9111not have to be reloaded from memory each iteration, thus freeing up the 9112CPU buses for operands. However, since interrupts are blocked by this 9113instruction, it is disabled by default. 9114 9115@item -mloop-unsigned 9116@itemx -mno-loop-unsigned 9117@opindex mloop-unsigned 9118@opindex mno-loop-unsigned 9119The maximum iteration count when using RPTS and RPTB (and DB on the C40) 9120is @math{2^{31} + 1} since these instructions test if the iteration count is 9121negative to terminate the loop. If the iteration count is unsigned 9122there is a possibility than the @math{2^{31} + 1} maximum iteration count may be 9123exceeded. This switch allows an unsigned iteration count. 9124 9125@item -mti 9126@opindex mti 9127Try to emit an assembler syntax that the TI assembler (asm30) is happy 9128with. This also enforces compatibility with the API employed by the TI 9129C3x C compiler. For example, long doubles are passed as structures 9130rather than in floating point registers. 9131 9132@item -mregparm 9133@itemx -mmemparm 9134@opindex mregparm 9135@opindex mmemparm 9136Generate code that uses registers (stack) for passing arguments to functions. 9137By default, arguments are passed in registers where possible rather 9138than by pushing arguments on to the stack. 9139 9140@item -mparallel-insns 9141@itemx -mno-parallel-insns 9142@opindex mparallel-insns 9143@opindex mno-parallel-insns 9144Allow the generation of parallel instructions. This is enabled by 9145default with @option{-O2}. 9146 9147@item -mparallel-mpy 9148@itemx -mno-parallel-mpy 9149@opindex mparallel-mpy 9150@opindex mno-parallel-mpy 9151Allow the generation of MPY||ADD and MPY||SUB parallel instructions, 9152provided @option{-mparallel-insns} is also specified. These instructions have 9153tight register constraints which can pessimize the code generation 9154of large functions. 9155 9156@end table 9157 9158@node V850 Options 9159@subsection V850 Options 9160@cindex V850 Options 9161 9162These @samp{-m} options are defined for V850 implementations: 9163 9164@table @gcctabopt 9165@item -mlong-calls 9166@itemx -mno-long-calls 9167@opindex mlong-calls 9168@opindex mno-long-calls 9169Treat all calls as being far away (near). If calls are assumed to be 9170far away, the compiler will always load the functions address up into a 9171register, and call indirect through the pointer. 9172 9173@item -mno-ep 9174@itemx -mep 9175@opindex mno-ep 9176@opindex mep 9177Do not optimize (do optimize) basic blocks that use the same index 9178pointer 4 or more times to copy pointer into the @code{ep} register, and 9179use the shorter @code{sld} and @code{sst} instructions. The @option{-mep} 9180option is on by default if you optimize. 9181 9182@item -mno-prolog-function 9183@itemx -mprolog-function 9184@opindex mno-prolog-function 9185@opindex mprolog-function 9186Do not use (do use) external functions to save and restore registers 9187at the prologue and epilogue of a function. The external functions 9188are slower, but use less code space if more than one function saves 9189the same number of registers. The @option{-mprolog-function} option 9190is on by default if you optimize. 9191 9192@item -mspace 9193@opindex mspace 9194Try to make the code as small as possible. At present, this just turns 9195on the @option{-mep} and @option{-mprolog-function} options. 9196 9197@item -mtda=@var{n} 9198@opindex mtda 9199Put static or global variables whose size is @var{n} bytes or less into 9200the tiny data area that register @code{ep} points to. The tiny data 9201area can hold up to 256 bytes in total (128 bytes for byte references). 9202 9203@item -msda=@var{n} 9204@opindex msda 9205Put static or global variables whose size is @var{n} bytes or less into 9206the small data area that register @code{gp} points to. The small data 9207area can hold up to 64 kilobytes. 9208 9209@item -mzda=@var{n} 9210@opindex mzda 9211Put static or global variables whose size is @var{n} bytes or less into 9212the first 32 kilobytes of memory. 9213 9214@item -mv850 9215@opindex mv850 9216Specify that the target processor is the V850. 9217 9218@item -mbig-switch 9219@opindex mbig-switch 9220Generate code suitable for big switch tables. Use this option only if 9221the assembler/linker complain about out of range branches within a switch 9222table. 9223 9224@item -mapp-regs 9225@opindex mapp-regs 9226This option will cause r2 and r5 to be used in the code generated by 9227the compiler. This setting is the default. 9228 9229@item -mno-app-regs 9230@opindex mno-app-regs 9231This option will cause r2 and r5 to be treated as fixed registers. 9232 9233@item -mv850e 9234@opindex mv850e 9235Specify that the target processor is the V850E. The preprocessor 9236constant @samp{__v850e__} will be defined if this option is used. 9237 9238If neither @option{-mv850} nor @option{-mv850e} are defined 9239then a default target processor will be chosen and the relevant 9240@samp{__v850*__} preprocessor constant will be defined. 9241 9242The preprocessor constants @samp{__v850} and @samp{__v851__} are always 9243defined, regardless of which processor variant is the target. 9244 9245@item -mdisable-callt 9246@opindex mdisable-callt 9247This option will suppress generation of the CALLT instruction for the 9248v850e flavors of the v850 architecture. The default is 9249@option{-mno-disable-callt} which allows the CALLT instruction to be used. 9250 9251@end table 9252 9253@node ARC Options 9254@subsection ARC Options 9255@cindex ARC Options 9256 9257These options are defined for ARC implementations: 9258 9259@table @gcctabopt 9260@item -EL 9261@opindex EL 9262Compile code for little endian mode. This is the default. 9263 9264@item -EB 9265@opindex EB 9266Compile code for big endian mode. 9267 9268@item -mmangle-cpu 9269@opindex mmangle-cpu 9270Prepend the name of the cpu to all public symbol names. 9271In multiple-processor systems, there are many ARC variants with different 9272instruction and register set characteristics. This flag prevents code 9273compiled for one cpu to be linked with code compiled for another. 9274No facility exists for handling variants that are ``almost identical''. 9275This is an all or nothing option. 9276 9277@item -mcpu=@var{cpu} 9278@opindex mcpu 9279Compile code for ARC variant @var{cpu}. 9280Which variants are supported depend on the configuration. 9281All variants support @option{-mcpu=base}, this is the default. 9282 9283@item -mtext=@var{text-section} 9284@itemx -mdata=@var{data-section} 9285@itemx -mrodata=@var{readonly-data-section} 9286@opindex mtext 9287@opindex mdata 9288@opindex mrodata 9289Put functions, data, and readonly data in @var{text-section}, 9290@var{data-section}, and @var{readonly-data-section} respectively 9291by default. This can be overridden with the @code{section} attribute. 9292@xref{Variable Attributes}. 9293 9294@end table 9295 9296@node NS32K Options 9297@subsection NS32K Options 9298@cindex NS32K options 9299 9300These are the @samp{-m} options defined for the 32000 series. The default 9301values for these options depends on which style of 32000 was selected when 9302the compiler was configured; the defaults for the most common choices are 9303given below. 9304 9305@table @gcctabopt 9306@item -m32032 9307@itemx -m32032 9308@opindex m32032 9309@opindex m32032 9310Generate output for a 32032. This is the default 9311when the compiler is configured for 32032 and 32016 based systems. 9312 9313@item -m32332 9314@itemx -m32332 9315@opindex m32332 9316@opindex m32332 9317Generate output for a 32332. This is the default 9318when the compiler is configured for 32332-based systems. 9319 9320@item -m32532 9321@itemx -m32532 9322@opindex m32532 9323@opindex m32532 9324Generate output for a 32532. This is the default 9325when the compiler is configured for 32532-based systems. 9326 9327@item -m32081 9328@opindex m32081 9329Generate output containing 32081 instructions for floating point. 9330This is the default for all systems. 9331 9332@item -m32381 9333@opindex m32381 9334Generate output containing 32381 instructions for floating point. This 9335also implies @option{-m32081}. The 32381 is only compatible with the 32332 9336and 32532 cpus. This is the default for the pc532-netbsd configuration. 9337 9338@item -mmulti-add 9339@opindex mmulti-add 9340Try and generate multiply-add floating point instructions @code{polyF} 9341and @code{dotF}. This option is only available if the @option{-m32381} 9342option is in effect. Using these instructions requires changes to 9343register allocation which generally has a negative impact on 9344performance. This option should only be enabled when compiling code 9345particularly likely to make heavy use of multiply-add instructions. 9346 9347@item -mnomulti-add 9348@opindex mnomulti-add 9349Do not try and generate multiply-add floating point instructions 9350@code{polyF} and @code{dotF}. This is the default on all platforms. 9351 9352@item -msoft-float 9353@opindex msoft-float 9354Generate output containing library calls for floating point. 9355@strong{Warning:} the requisite libraries may not be available. 9356 9357@item -mieee-compare 9358@itemx -mno-ieee-compare 9359@opindex mieee-compare 9360@opindex mno-ieee-compare 9361Control whether or not the compiler uses IEEE floating point 9362comparisons. These handle correctly the case where the result of a 9363comparison is unordered. 9364@strong{Warning:} the requisite kernel support may not be available. 9365 9366@item -mnobitfield 9367@opindex mnobitfield 9368Do not use the bit-field instructions. On some machines it is faster to 9369use shifting and masking operations. This is the default for the pc532. 9370 9371@item -mbitfield 9372@opindex mbitfield 9373Do use the bit-field instructions. This is the default for all platforms 9374except the pc532. 9375 9376@item -mrtd 9377@opindex mrtd 9378Use a different function-calling convention, in which functions 9379that take a fixed number of arguments return pop their 9380arguments on return with the @code{ret} instruction. 9381 9382This calling convention is incompatible with the one normally 9383used on Unix, so you cannot use it if you need to call libraries 9384compiled with the Unix compiler. 9385 9386Also, you must provide function prototypes for all functions that 9387take variable numbers of arguments (including @code{printf}); 9388otherwise incorrect code will be generated for calls to those 9389functions. 9390 9391In addition, seriously incorrect code will result if you call a 9392function with too many arguments. (Normally, extra arguments are 9393harmlessly ignored.) 9394 9395This option takes its name from the 680x0 @code{rtd} instruction. 9396 9397 9398@item -mregparam 9399@opindex mregparam 9400Use a different function-calling convention where the first two arguments 9401are passed in registers. 9402 9403This calling convention is incompatible with the one normally 9404used on Unix, so you cannot use it if you need to call libraries 9405compiled with the Unix compiler. 9406 9407@item -mnoregparam 9408@opindex mnoregparam 9409Do not pass any arguments in registers. This is the default for all 9410targets. 9411 9412@item -msb 9413@opindex msb 9414It is OK to use the sb as an index register which is always loaded with 9415zero. This is the default for the pc532-netbsd target. 9416 9417@item -mnosb 9418@opindex mnosb 9419The sb register is not available for use or has not been initialized to 9420zero by the run time system. This is the default for all targets except 9421the pc532-netbsd. It is also implied whenever @option{-mhimem} or 9422@option{-fpic} is set. 9423 9424@item -mhimem 9425@opindex mhimem 9426Many ns32000 series addressing modes use displacements of up to 512MB@. 9427If an address is above 512MB then displacements from zero can not be used. 9428This option causes code to be generated which can be loaded above 512MB@. 9429This may be useful for operating systems or ROM code. 9430 9431@item -mnohimem 9432@opindex mnohimem 9433Assume code will be loaded in the first 512MB of virtual address space. 9434This is the default for all platforms. 9435 9436 9437@end table 9438 9439@node AVR Options 9440@subsection AVR Options 9441@cindex AVR Options 9442 9443These options are defined for AVR implementations: 9444 9445@table @gcctabopt 9446@item -mmcu=@var{mcu} 9447@opindex mmcu 9448Specify ATMEL AVR instruction set or MCU type. 9449 9450Instruction set avr1 is for the minimal AVR core, not supported by the C 9451compiler, only for assembler programs (MCU types: at90s1200, attiny10, 9452attiny11, attiny12, attiny15, attiny28). 9453 9454Instruction set avr2 (default) is for the classic AVR core with up to 94558K program memory space (MCU types: at90s2313, at90s2323, attiny22, 9456at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515, 9457at90c8534, at90s8535). 9458 9459Instruction set avr3 is for the classic AVR core with up to 128K program 9460memory space (MCU types: atmega103, atmega603, at43usb320, at76c711). 9461 9462Instruction set avr4 is for the enhanced AVR core with up to 8K program 9463memory space (MCU types: atmega8, atmega83, atmega85). 9464 9465Instruction set avr5 is for the enhanced AVR core with up to 128K program 9466memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323, 9467atmega64, atmega128, at43usb355, at94k). 9468 9469@item -msize 9470@opindex msize 9471Output instruction sizes to the asm file. 9472 9473@item -minit-stack=@var{N} 9474@opindex minit-stack 9475Specify the initial stack address, which may be a symbol or numeric value, 9476@samp{__stack} is the default. 9477 9478@item -mno-interrupts 9479@opindex mno-interrupts 9480Generated code is not compatible with hardware interrupts. 9481Code size will be smaller. 9482 9483@item -mcall-prologues 9484@opindex mcall-prologues 9485Functions prologues/epilogues expanded as call to appropriate 9486subroutines. Code size will be smaller. 9487 9488@item -mno-tablejump 9489@opindex mno-tablejump 9490Do not generate tablejump insns which sometimes increase code size. 9491 9492@item -mtiny-stack 9493@opindex mtiny-stack 9494Change only the low 8 bits of the stack pointer. 9495@end table 9496 9497@node MCore Options 9498@subsection MCore Options 9499@cindex MCore options 9500 9501These are the @samp{-m} options defined for the Motorola M*Core 9502processors. 9503 9504@table @gcctabopt 9505 9506@item -mhardlit 9507@itemx -mno-hardlit 9508@opindex mhardlit 9509@opindex mno-hardlit 9510Inline constants into the code stream if it can be done in two 9511instructions or less. 9512 9513@item -mdiv 9514@itemx -mno-div 9515@opindex mdiv 9516@opindex mno-div 9517Use the divide instruction. (Enabled by default). 9518 9519@item -mrelax-immediate 9520@itemx -mno-relax-immediate 9521@opindex mrelax-immediate 9522@opindex mno-relax-immediate 9523Allow arbitrary sized immediates in bit operations. 9524 9525@item -mwide-bitfields 9526@itemx -mno-wide-bitfields 9527@opindex mwide-bitfields 9528@opindex mno-wide-bitfields 9529Always treat bit-fields as int-sized. 9530 9531@item -m4byte-functions 9532@itemx -mno-4byte-functions 9533@opindex m4byte-functions 9534@opindex mno-4byte-functions 9535Force all functions to be aligned to a four byte boundary. 9536 9537@item -mcallgraph-data 9538@itemx -mno-callgraph-data 9539@opindex mcallgraph-data 9540@opindex mno-callgraph-data 9541Emit callgraph information. 9542 9543@item -mslow-bytes 9544@itemx -mno-slow-bytes 9545@opindex mslow-bytes 9546@opindex mno-slow-bytes 9547Prefer word access when reading byte quantities. 9548 9549@item -mlittle-endian 9550@itemx -mbig-endian 9551@opindex mlittle-endian 9552@opindex mbig-endian 9553Generate code for a little endian target. 9554 9555@item -m210 9556@itemx -m340 9557@opindex m210 9558@opindex m340 9559Generate code for the 210 processor. 9560@end table 9561 9562@node IA-64 Options 9563@subsection IA-64 Options 9564@cindex IA-64 Options 9565 9566These are the @samp{-m} options defined for the Intel IA-64 architecture. 9567 9568@table @gcctabopt 9569@item -mbig-endian 9570@opindex mbig-endian 9571Generate code for a big endian target. This is the default for HP-UX@. 9572 9573@item -mlittle-endian 9574@opindex mlittle-endian 9575Generate code for a little endian target. This is the default for AIX5 9576and Linux. 9577 9578@item -mgnu-as 9579@itemx -mno-gnu-as 9580@opindex mgnu-as 9581@opindex mno-gnu-as 9582Generate (or don't) code for the GNU assembler. This is the default. 9583@c Also, this is the default if the configure option @option{--with-gnu-as} 9584@c is used. 9585 9586@item -mgnu-ld 9587@itemx -mno-gnu-ld 9588@opindex mgnu-ld 9589@opindex mno-gnu-ld 9590Generate (or don't) code for the GNU linker. This is the default. 9591@c Also, this is the default if the configure option @option{--with-gnu-ld} 9592@c is used. 9593 9594@item -mno-pic 9595@opindex mno-pic 9596Generate code that does not use a global pointer register. The result 9597is not position independent code, and violates the IA-64 ABI@. 9598 9599@item -mvolatile-asm-stop 9600@itemx -mno-volatile-asm-stop 9601@opindex mvolatile-asm-stop 9602@opindex mno-volatile-asm-stop 9603Generate (or don't) a stop bit immediately before and after volatile asm 9604statements. 9605 9606@item -mb-step 9607@opindex mb-step 9608Generate code that works around Itanium B step errata. 9609 9610@item -mregister-names 9611@itemx -mno-register-names 9612@opindex mregister-names 9613@opindex mno-register-names 9614Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for 9615the stacked registers. This may make assembler output more readable. 9616 9617@item -mno-sdata 9618@itemx -msdata 9619@opindex mno-sdata 9620@opindex msdata 9621Disable (or enable) optimizations that use the small data section. This may 9622be useful for working around optimizer bugs. 9623 9624@item -mconstant-gp 9625@opindex mconstant-gp 9626Generate code that uses a single constant global pointer value. This is 9627useful when compiling kernel code. 9628 9629@item -mauto-pic 9630@opindex mauto-pic 9631Generate code that is self-relocatable. This implies @option{-mconstant-gp}. 9632This is useful when compiling firmware code. 9633 9634@item -minline-float-divide-min-latency 9635@opindex minline-float-divide-min-latency 9636Generate code for inline divides of floating point values 9637using the minimum latency algorithm. 9638 9639@item -minline-float-divide-max-throughput 9640@opindex minline-float-divide-max-throughput 9641Generate code for inline divides of floating point values 9642using the maximum throughput algorithm. 9643 9644@item -minline-int-divide-min-latency 9645@opindex minline-int-divide-min-latency 9646Generate code for inline divides of integer values 9647using the minimum latency algorithm. 9648 9649@item -minline-int-divide-max-throughput 9650@opindex minline-int-divide-max-throughput 9651Generate code for inline divides of integer values 9652using the maximum throughput algorithm. 9653 9654@item -mno-dwarf2-asm 9655@itemx -mdwarf2-asm 9656@opindex mno-dwarf2-asm 9657@opindex mdwarf2-asm 9658Don't (or do) generate assembler code for the DWARF2 line number debugging 9659info. This may be useful when not using the GNU assembler. 9660 9661@item -mfixed-range=@var{register-range} 9662@opindex mfixed-range 9663Generate code treating the given register range as fixed registers. 9664A fixed register is one that the register allocator can not use. This is 9665useful when compiling kernel code. A register range is specified as 9666two registers separated by a dash. Multiple register ranges can be 9667specified separated by a comma. 9668@end table 9669 9670@node D30V Options 9671@subsection D30V Options 9672@cindex D30V Options 9673 9674These @samp{-m} options are defined for D30V implementations: 9675 9676@table @gcctabopt 9677@item -mextmem 9678@opindex mextmem 9679Link the @samp{.text}, @samp{.data}, @samp{.bss}, @samp{.strings}, 9680@samp{.rodata}, @samp{.rodata1}, @samp{.data1} sections into external 9681memory, which starts at location @code{0x80000000}. 9682 9683@item -mextmemory 9684@opindex mextmemory 9685Same as the @option{-mextmem} switch. 9686 9687@item -monchip 9688@opindex monchip 9689Link the @samp{.text} section into onchip text memory, which starts at 9690location @code{0x0}. Also link @samp{.data}, @samp{.bss}, 9691@samp{.strings}, @samp{.rodata}, @samp{.rodata1}, @samp{.data1} sections 9692into onchip data memory, which starts at location @code{0x20000000}. 9693 9694@item -mno-asm-optimize 9695@itemx -masm-optimize 9696@opindex mno-asm-optimize 9697@opindex masm-optimize 9698Disable (enable) passing @option{-O} to the assembler when optimizing. 9699The assembler uses the @option{-O} option to automatically parallelize 9700adjacent short instructions where possible. 9701 9702@item -mbranch-cost=@var{n} 9703@opindex mbranch-cost 9704Increase the internal costs of branches to @var{n}. Higher costs means 9705that the compiler will issue more instructions to avoid doing a branch. 9706The default is 2. 9707 9708@item -mcond-exec=@var{n} 9709@opindex mcond-exec 9710Specify the maximum number of conditionally executed instructions that 9711replace a branch. The default is 4. 9712@end table 9713 9714@node S/390 and zSeries Options 9715@subsection S/390 and zSeries Options 9716@cindex S/390 and zSeries Options 9717 9718These are the @samp{-m} options defined for the S/390 and zSeries architecture. 9719 9720@table @gcctabopt 9721@item -mhard-float 9722@itemx -msoft-float 9723@opindex mhard-float 9724@opindex msoft-float 9725Use (do not use) the hardware floating-point instructions and registers 9726for floating-point operations. When @option{-msoft-float} is specified, 9727functions in @file{libgcc.a} will be used to perform floating-point 9728operations. When @option{-mhard-float} is specified, the compiler 9729generates IEEE floating-point instructions. This is the default. 9730 9731@item -mbackchain 9732@itemx -mno-backchain 9733@opindex mbackchain 9734@opindex mno-backchain 9735Generate (or do not generate) code which maintains an explicit 9736backchain within the stack frame that points to the caller's frame. 9737This is currently needed to allow debugging. The default is to 9738generate the backchain. 9739 9740@item -msmall-exec 9741@itemx -mno-small-exec 9742@opindex msmall-exec 9743@opindex mno-small-exec 9744Generate (or do not generate) code using the @code{bras} instruction 9745to do subroutine calls. 9746This only works reliably if the total executable size does not 9747exceed 64k. The default is to use the @code{basr} instruction instead, 9748which does not have this limitation. 9749 9750@item -m64 9751@itemx -m31 9752@opindex m64 9753@opindex m31 9754When @option{-m31} is specified, generate code compliant to the 9755Linux for S/390 ABI@. When @option{-m64} is specified, generate 9756code compliant to the Linux for zSeries ABI@. This allows GCC in 9757particular to generate 64-bit instructions. For the @samp{s390} 9758targets, the default is @option{-m31}, while the @samp{s390x} 9759targets default to @option{-m64}. 9760 9761@item -mmvcle 9762@itemx -mno-mvcle 9763@opindex mmvcle 9764@opindex mno-mvcle 9765Generate (or do not generate) code using the @code{mvcle} instruction 9766to perform block moves. When @option{-mno-mvcle} is specified, 9767use a @code{mvc} loop instead. This is the default. 9768 9769@item -mdebug 9770@itemx -mno-debug 9771@opindex mdebug 9772@opindex mno-debug 9773Print (or do not print) additional debug information when compiling. 9774The default is to not print debug information. 9775 9776@end table 9777 9778@node CRIS Options 9779@subsection CRIS Options 9780@cindex CRIS Options 9781 9782These options are defined specifically for the CRIS ports. 9783 9784@table @gcctabopt 9785@item -march=@var{architecture-type} 9786@itemx -mcpu=@var{architecture-type} 9787@opindex march 9788@opindex mcpu 9789Generate code for the specified architecture. The choices for 9790@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for 9791respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX. 9792Default is @samp{v0} except for cris-axis-linux-gnu, where the default is 9793@samp{v10}. 9794 9795@item -mtune=@var{architecture-type} 9796@opindex mtune 9797Tune to @var{architecture-type} everything applicable about the generated 9798code, except for the ABI and the set of available instructions. The 9799choices for @var{architecture-type} are the same as for 9800@option{-march=@var{architecture-type}}. 9801 9802@item -mmax-stack-frame=@var{n} 9803@opindex mmax-stack-frame 9804Warn when the stack frame of a function exceeds @var{n} bytes. 9805 9806@item -melinux-stacksize=@var{n} 9807@opindex melinux-stacksize 9808Only available with the @samp{cris-axis-aout} target. Arranges for 9809indications in the program to the kernel loader that the stack of the 9810program should be set to @var{n} bytes. 9811 9812@item -metrax4 9813@itemx -metrax100 9814@opindex metrax4 9815@opindex metrax100 9816The options @option{-metrax4} and @option{-metrax100} are synonyms for 9817@option{-march=v3} and @option{-march=v8} respectively. 9818 9819@item -mpdebug 9820@opindex mpdebug 9821Enable CRIS-specific verbose debug-related information in the assembly 9822code. This option also has the effect to turn off the @samp{#NO_APP} 9823formatted-code indicator to the assembler at the beginning of the 9824assembly file. 9825 9826@item -mcc-init 9827@opindex mcc-init 9828Do not use condition-code results from previous instruction; always emit 9829compare and test instructions before use of condition codes. 9830 9831@item -mno-side-effects 9832@opindex mno-side-effects 9833Do not emit instructions with side-effects in addressing modes other than 9834post-increment. 9835 9836@item -mstack-align 9837@itemx -mno-stack-align 9838@itemx -mdata-align 9839@itemx -mno-data-align 9840@itemx -mconst-align 9841@itemx -mno-const-align 9842@opindex mstack-align 9843@opindex mno-stack-align 9844@opindex mdata-align 9845@opindex mno-data-align 9846@opindex mconst-align 9847@opindex mno-const-align 9848These options (no-options) arranges (eliminate arrangements) for the 9849stack-frame, individual data and constants to be aligned for the maximum 9850single data access size for the chosen CPU model. The default is to 9851arrange for 32-bit alignment. ABI details such as structure layout are 9852not affected by these options. 9853 9854@item -m32-bit 9855@itemx -m16-bit 9856@itemx -m8-bit 9857@opindex m32-bit 9858@opindex m16-bit 9859@opindex m8-bit 9860Similar to the stack- data- and const-align options above, these options 9861arrange for stack-frame, writable data and constants to all be 32-bit, 986216-bit or 8-bit aligned. The default is 32-bit alignment. 9863 9864@item -mno-prologue-epilogue 9865@itemx -mprologue-epilogue 9866@opindex mno-prologue-epilogue 9867@opindex mprologue-epilogue 9868With @option{-mno-prologue-epilogue}, the normal function prologue and 9869epilogue that sets up the stack-frame are omitted and no return 9870instructions or return sequences are generated in the code. Use this 9871option only together with visual inspection of the compiled code: no 9872warnings or errors are generated when call-saved registers must be saved, 9873or storage for local variable needs to be allocated. 9874 9875@item -mno-gotplt 9876@itemx -mgotplt 9877@opindex mno-gotplt 9878@opindex mgotplt 9879With @option{-fpic} and @option{-fPIC}, don't generate (do generate) 9880instruction sequences that load addresses for functions from the PLT part 9881of the GOT rather than (traditional on other architectures) calls to the 9882PLT. The default is @option{-mgotplt}. 9883 9884@item -maout 9885@opindex maout 9886Legacy no-op option only recognized with the cris-axis-aout target. 9887 9888@item -melf 9889@opindex melf 9890Legacy no-op option only recognized with the cris-axis-elf and 9891cris-axis-linux-gnu targets. 9892 9893@item -melinux 9894@opindex melinux 9895Only recognized with the cris-axis-aout target, where it selects a 9896GNU/linux-like multilib, include files and instruction set for 9897@option{-march=v8}. 9898 9899@item -mlinux 9900@opindex mlinux 9901Legacy no-op option only recognized with the cris-axis-linux-gnu target. 9902 9903@item -sim 9904@opindex sim 9905This option, recognized for the cris-axis-aout and cris-axis-elf arranges 9906to link with input-output functions from a simulator library. Code, 9907initialized data and zero-initialized data are allocated consecutively. 9908 9909@item -sim2 9910@opindex sim2 9911Like @option{-sim}, but pass linker options to locate initialized data at 99120x40000000 and zero-initialized data at 0x80000000. 9913@end table 9914 9915@node MMIX Options 9916@subsection MMIX Options 9917@cindex MMIX Options 9918 9919These options are defined for the MMIX: 9920 9921@table @gcctabopt 9922@item -mlibfuncs 9923@itemx -mno-libfuncs 9924@opindex mlibfuncs 9925@opindex mno-libfuncs 9926Specify that intrinsic library functions are being compiled, passing all 9927values in registers, no matter the size. 9928 9929@item -mepsilon 9930@itemx -mno-epsilon 9931@opindex mepsilon 9932@opindex mno-epsilon 9933Generate floating-point comparison instructions that compare with respect 9934to the @code{rE} epsilon register. 9935 9936@item -mabi=mmixware 9937@itemx -mabi=gnu 9938@opindex mabi-mmixware 9939@opindex mabi=gnu 9940Generate code that passes function parameters and return values that (in 9941the called function) are seen as registers @code{$0} and up, as opposed to 9942the GNU ABI which uses global registers @code{$231} and up. 9943 9944@item -mzero-extend 9945@itemx -mno-zero-extend 9946@opindex mzero-extend 9947@opindex mno-zero-extend 9948When reading data from memory in sizes shorter than 64 bits, use (do not 9949use) zero-extending load instructions by default, rather than 9950sign-extending ones. 9951 9952@item -mknuthdiv 9953@itemx -mno-knuthdiv 9954@opindex mknuthdiv 9955@opindex mno-knuthdiv 9956Make the result of a division yielding a remainder have the same sign as 9957the divisor. With the default, @option{-mno-knuthdiv}, the sign of the 9958remainder follows the sign of the dividend. Both methods are 9959arithmetically valid, the latter being almost exclusively used. 9960 9961@item -mtoplevel-symbols 9962@itemx -mno-toplevel-symbols 9963@opindex mtoplevel-symbols 9964@opindex mno-toplevel-symbols 9965Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly 9966code can be used with the @code{PREFIX} assembly directive. 9967 9968@item -melf 9969@opindex melf 9970Generate an executable in the ELF format, rather than the default 9971@samp{mmo} format used by the @command{mmix} simulator. 9972 9973@item -mbranch-predict 9974@itemx -mno-branch-predict 9975@opindex mbranch-predict 9976@opindex mno-branch-predict 9977Use (do not use) the probable-branch instructions, when static branch 9978prediction indicates a probable branch. 9979 9980@item -mbase-addresses 9981@itemx -mno-base-addresses 9982@opindex mbase-addresses 9983@opindex mno-base-addresses 9984Generate (do not generate) code that uses @emph{base addresses}. Using a 9985base address automatically generates a request (handled by the assembler 9986and the linker) for a constant to be set up in a global register. The 9987register is used for one or more base address requests within the range 0 9988to 255 from the value held in the register. The generally leads to short 9989and fast code, but the number of different data items that can be 9990addressed is limited. This means that a program that uses lots of static 9991data may require @option{-mno-base-addresses}. 9992 9993@item -msingle-exit 9994@itemx -mno-single-exit 9995@opindex msingle-exit 9996@opindex mno-single-exit 9997Force (do not force) generated code to have a single exit point in each 9998function. 9999@end table 10000 10001@node PDP-11 Options 10002@subsection PDP-11 Options 10003@cindex PDP-11 Options 10004 10005These options are defined for the PDP-11: 10006 10007@table @gcctabopt 10008@item -mfpu 10009@opindex mfpu 10010Use hardware FPP floating point. This is the default. (FIS floating 10011point on the PDP-11/40 is not supported.) 10012 10013@item -msoft-float 10014@opindex msoft-float 10015Do not use hardware floating point. 10016 10017@item -mac0 10018@opindex mac0 10019Return floating-point results in ac0 (fr0 in Unix assembler syntax). 10020 10021@item -mno-ac0 10022@opindex mno-ac0 10023Return floating-point results in memory. This is the default. 10024 10025@item -m40 10026@opindex m40 10027Generate code for a PDP-11/40. 10028 10029@item -m45 10030@opindex m45 10031Generate code for a PDP-11/45. This is the default. 10032 10033@item -m10 10034@opindex m10 10035Generate code for a PDP-11/10. 10036 10037@item -mbcopy-builtin 10038@opindex bcopy-builtin 10039Use inline @code{movstrhi} patterns for copying memory. This is the 10040default. 10041 10042@item -mbcopy 10043@opindex mbcopy 10044Do not use inline @code{movstrhi} patterns for copying memory. 10045 10046@item -mint16 10047@itemx -mno-int32 10048@opindex mint16 10049@opindex mno-int32 10050Use 16-bit @code{int}. This is the default. 10051 10052@item -mint32 10053@itemx -mno-int16 10054@opindex mint32 10055@opindex mno-int16 10056Use 32-bit @code{int}. 10057 10058@item -mfloat64 10059@itemx -mno-float32 10060@opindex mfloat64 10061@opindex mno-float32 10062Use 64-bit @code{float}. This is the default. 10063 10064@item -mfloat32 10065@item -mno-float64 10066@opindex mfloat32 10067@opindex mno-float64 10068Use 32-bit @code{float}. 10069 10070@item -mabshi 10071@opindex mabshi 10072Use @code{abshi2} pattern. This is the default. 10073 10074@item -mno-abshi 10075@opindex mno-abshi 10076Do not use @code{abshi2} pattern. 10077 10078@item -mbranch-expensive 10079@opindex mbranch-expensive 10080Pretend that branches are expensive. This is for experimenting with 10081code generation only. 10082 10083@item -mbranch-cheap 10084@opindex mbranch-cheap 10085Do not pretend that branches are expensive. This is the default. 10086 10087@item -msplit 10088@opindex msplit 10089Generate code for a system with split I&D. 10090 10091@item -mno-split 10092@opindex mno-split 10093Generate code for a system without split I&D. This is the default. 10094 10095@item -munix-asm 10096@opindex munix-asm 10097Use Unix assembler syntax. This is the default when configured for 10098@samp{pdp11-*-bsd}. 10099 10100@item -mdec-asm 10101@opindex mdec-asm 10102Use DEC assembler syntax. This is the default when configured for any 10103PDP-11 target other than @samp{pdp11-*-bsd}. 10104@end table 10105 10106@node Xstormy16 Options 10107@subsection Xstormy16 Options 10108@cindex Xstormy16 Options 10109 10110These options are defined for Xstormy16: 10111 10112@table @gcctabopt 10113@item -msim 10114@opindex msim 10115Choose startup files and linker script suitable for the simulator. 10116@end table 10117 10118@node FRV Options 10119@subsection FRV Options 10120@cindex FRV Options 10121 10122@table @gcctabopt 10123@item -mgpr-32 10124@opindex mgpr-32 10125 10126Only use the first 32 general purpose registers. 10127 10128@item -mgpr-64 10129@opindex mgpr-64 10130 10131Use all 64 general purpose registers. 10132 10133@item -mfpr-32 10134@opindex mfpr-32 10135 10136Use only the first 32 floating point registers. 10137 10138@item -mfpr-64 10139@opindex mfpr-64 10140 10141Use all 64 floating point registers 10142 10143@item -mhard-float 10144@opindex mhard-float 10145 10146Use hardware instructions for floating point operations. 10147 10148@item -msoft-float 10149@opindex msoft-float 10150 10151Use library routines for floating point operations. 10152 10153@item -malloc-cc 10154@opindex malloc-cc 10155 10156Dynamically allocate condition code registers. 10157 10158@item -mfixed-cc 10159@opindex mfixed-cc 10160 10161Do not try to dynamically allocate condition code registers, only 10162use @code{icc0} and @code{fcc0}. 10163 10164@item -mdword 10165@opindex mdword 10166 10167Change ABI to use double word insns. 10168 10169@item -mno-dword 10170@opindex mno-dword 10171 10172Do not use double word instructions. 10173 10174@item -mdouble 10175@opindex mdouble 10176 10177Use floating point double instructions. 10178 10179@item -mno-double 10180@opindex mno-double 10181 10182Do not use floating point double instructions. 10183 10184@item -mmedia 10185@opindex mmedia 10186 10187Use media instructions. 10188 10189@item -mno-media 10190@opindex mno-media 10191 10192Do not use media instructions. 10193 10194@item -mmuladd 10195@opindex mmuladd 10196 10197Use multiply and add/subtract instructions. 10198 10199@item -mno-muladd 10200@opindex mno-muladd 10201 10202Do not use multiply and add/subtract instructions. 10203 10204@item -mlibrary-pic 10205@opindex mlibrary-pic 10206 10207Enable PIC support for building libraries 10208 10209@item -macc-4 10210@opindex macc-4 10211 10212Use only the first four media accumulator registers. 10213 10214@item -macc-8 10215@opindex macc-8 10216 10217Use all eight media accumulator registers. 10218 10219@item -mpack 10220@opindex mpack 10221 10222Pack VLIW instructions. 10223 10224@item -mno-pack 10225@opindex mno-pack 10226 10227Do not pack VLIW instructions. 10228 10229@item -mno-eflags 10230@opindex mno-eflags 10231 10232Do not mark ABI switches in e_flags. 10233 10234@item -mcond-move 10235@opindex mcond-move 10236 10237Enable the use of conditional-move instructions (default). 10238 10239This switch is mainly for debugging the compiler and will likely be removed 10240in a future version. 10241 10242@item -mno-cond-move 10243@opindex mno-cond-move 10244 10245Disable the use of conditional-move instructions. 10246 10247This switch is mainly for debugging the compiler and will likely be removed 10248in a future version. 10249 10250@item -mscc 10251@opindex mscc 10252 10253Enable the use of conditional set instructions (default). 10254 10255This switch is mainly for debugging the compiler and will likely be removed 10256in a future version. 10257 10258@item -mno-scc 10259@opindex mno-scc 10260 10261Disable the use of conditional set instructions. 10262 10263This switch is mainly for debugging the compiler and will likely be removed 10264in a future version. 10265 10266@item -mcond-exec 10267@opindex mcond-exec 10268 10269Enable the use of conditional execution (default). 10270 10271This switch is mainly for debugging the compiler and will likely be removed 10272in a future version. 10273 10274@item -mno-cond-exec 10275@opindex mno-cond-exec 10276 10277Disable the use of conditional execution. 10278 10279This switch is mainly for debugging the compiler and will likely be removed 10280in a future version. 10281 10282@item -mvliw-branch 10283@opindex mvliw-branch 10284 10285Run a pass to pack branches into VLIW instructions (default). 10286 10287This switch is mainly for debugging the compiler and will likely be removed 10288in a future version. 10289 10290@item -mno-vliw-branch 10291@opindex mno-vliw-branch 10292 10293Do not run a pass to pack branches into VLIW instructions. 10294 10295This switch is mainly for debugging the compiler and will likely be removed 10296in a future version. 10297 10298@item -mmulti-cond-exec 10299@opindex mmulti-cond-exec 10300 10301Enable optimization of @code{&&} and @code{||} in conditional execution 10302(default). 10303 10304This switch is mainly for debugging the compiler and will likely be removed 10305in a future version. 10306 10307@item -mno-multi-cond-exec 10308@opindex mno-multi-cond-exec 10309 10310Disable optimization of @code{&&} and @code{||} in conditional execution. 10311 10312This switch is mainly for debugging the compiler and will likely be removed 10313in a future version. 10314 10315@item -mnested-cond-exec 10316@opindex mnested-cond-exec 10317 10318Enable nested conditional execution optimizations (default). 10319 10320This switch is mainly for debugging the compiler and will likely be removed 10321in a future version. 10322 10323@item -mno-nested-cond-exec 10324@opindex mno-nested-cond-exec 10325 10326Disable nested conditional execution optimizations. 10327 10328This switch is mainly for debugging the compiler and will likely be removed 10329in a future version. 10330 10331@item -mtomcat-stats 10332@opindex mtomcat-stats 10333 10334Cause gas to print out tomcat statistics. 10335 10336@item -mcpu=@var{cpu} 10337@opindex mcpu 10338 10339Select the processor type for which to generate code. Possible values are 10340@samp{simple}, @samp{tomcat}, @samp{fr500}, @samp{fr400}, @samp{fr300}, 10341@samp{frv}. 10342 10343@end table 10344 10345@node Xtensa Options 10346@subsection Xtensa Options 10347@cindex Xtensa Options 10348 10349The Xtensa architecture is designed to support many different 10350configurations. The compiler's default options can be set to match a 10351particular Xtensa configuration by copying a configuration file into the 10352GCC sources when building GCC@. The options below may be used to 10353override the default options. 10354 10355@table @gcctabopt 10356@item -mbig-endian 10357@itemx -mlittle-endian 10358@opindex mbig-endian 10359@opindex mlittle-endian 10360Specify big-endian or little-endian byte ordering for the target Xtensa 10361processor. 10362 10363@item -mdensity 10364@itemx -mno-density 10365@opindex mdensity 10366@opindex mno-density 10367Enable or disable use of the optional Xtensa code density instructions. 10368 10369@item -mmac16 10370@itemx -mno-mac16 10371@opindex mmac16 10372@opindex mno-mac16 10373Enable or disable use of the Xtensa MAC16 option. When enabled, GCC 10374will generate MAC16 instructions from standard C code, with the 10375limitation that it will use neither the MR register file nor any 10376instruction that operates on the MR registers. When this option is 10377disabled, GCC will translate 16-bit multiply/accumulate operations to a 10378combination of core instructions and library calls, depending on whether 10379any other multiplier options are enabled. 10380 10381@item -mmul16 10382@itemx -mno-mul16 10383@opindex mmul16 10384@opindex mno-mul16 10385Enable or disable use of the 16-bit integer multiplier option. When 10386enabled, the compiler will generate 16-bit multiply instructions for 10387multiplications of 16 bits or smaller in standard C code. When this 10388option is disabled, the compiler will either use 32-bit multiply or 10389MAC16 instructions if they are available or generate library calls to 10390perform the multiply operations using shifts and adds. 10391 10392@item -mmul32 10393@itemx -mno-mul32 10394@opindex mmul32 10395@opindex mno-mul32 10396Enable or disable use of the 32-bit integer multiplier option. When 10397enabled, the compiler will generate 32-bit multiply instructions for 10398multiplications of 32 bits or smaller in standard C code. When this 10399option is disabled, the compiler will generate library calls to perform 10400the multiply operations using either shifts and adds or 16-bit multiply 10401instructions if they are available. 10402 10403@item -mnsa 10404@itemx -mno-nsa 10405@opindex mnsa 10406@opindex mno-nsa 10407Enable or disable use of the optional normalization shift amount 10408(@code{NSA}) instructions to implement the built-in @code{ffs} function. 10409 10410@item -mminmax 10411@itemx -mno-minmax 10412@opindex mminmax 10413@opindex mno-minmax 10414Enable or disable use of the optional minimum and maximum value 10415instructions. 10416 10417@item -msext 10418@itemx -mno-sext 10419@opindex msext 10420@opindex mno-sext 10421Enable or disable use of the optional sign extend (@code{SEXT}) 10422instruction. 10423 10424@item -mbooleans 10425@itemx -mno-booleans 10426@opindex mbooleans 10427@opindex mno-booleans 10428Enable or disable support for the boolean register file used by Xtensa 10429coprocessors. This is not typically useful by itself but may be 10430required for other options that make use of the boolean registers (e.g., 10431the floating-point option). 10432 10433@item -mhard-float 10434@itemx -msoft-float 10435@opindex mhard-float 10436@opindex msoft-float 10437Enable or disable use of the floating-point option. When enabled, GCC 10438generates floating-point instructions for 32-bit @code{float} 10439operations. When this option is disabled, GCC generates library calls 10440to emulate 32-bit floating-point operations using integer instructions. 10441Regardless of this option, 64-bit @code{double} operations are always 10442emulated with calls to library functions. 10443 10444@item -mfused-madd 10445@itemx -mno-fused-madd 10446@opindex mfused-madd 10447@opindex mno-fused-madd 10448Enable or disable use of fused multiply/add and multiply/subtract 10449instructions in the floating-point option. This has no effect if the 10450floating-point option is not also enabled. Disabling fused multiply/add 10451and multiply/subtract instructions forces the compiler to use separate 10452instructions for the multiply and add/subtract operations. This may be 10453desirable in some cases where strict IEEE 754-compliant results are 10454required: the fused multiply add/subtract instructions do not round the 10455intermediate result, thereby producing results with @emph{more} bits of 10456precision than specified by the IEEE standard. Disabling fused multiply 10457add/subtract instructions also ensures that the program output is not 10458sensitive to the compiler's ability to combine multiply and add/subtract 10459operations. 10460 10461@item -mserialize-volatile 10462@itemx -mno-serialize-volatile 10463@opindex mserialize-volatile 10464@opindex mno-serialize-volatile 10465When this option is enabled, GCC inserts @code{MEMW} instructions before 10466@code{volatile} memory references to guarantee sequential consistency. 10467The default is @option{-mserialize-volatile}. Use 10468@option{-mno-serialize-volatile} to omit the @code{MEMW} instructions. 10469 10470@item -mtext-section-literals 10471@itemx -mno-text-section-literals 10472@opindex mtext-section-literals 10473@opindex mno-text-section-literals 10474Control the treatment of literal pools. The default is 10475@option{-mno-text-section-literals}, which places literals in a separate 10476section in the output file. This allows the literal pool to be placed 10477in a data RAM/ROM, and it also allows the linker to combine literal 10478pools from separate object files to remove redundant literals and 10479improve code size. With @option{-mtext-section-literals}, the literals 10480are interspersed in the text section in order to keep them as close as 10481possible to their references. This may be necessary for large assembly 10482files. 10483 10484@item -mtarget-align 10485@itemx -mno-target-align 10486@opindex mtarget-align 10487@opindex mno-target-align 10488When this option is enabled, GCC instructs the assembler to 10489automatically align instructions to reduce branch penalties at the 10490expense of some code density. The assembler attempts to widen density 10491instructions to align branch targets and the instructions following call 10492instructions. If there are not enough preceding safe density 10493instructions to align a target, no widening will be performed. The 10494default is @option{-mtarget-align}. These options do not affect the 10495treatment of auto-aligned instructions like @code{LOOP}, which the 10496assembler will always align, either by widening density instructions or 10497by inserting no-op instructions. 10498 10499@item -mlongcalls 10500@itemx -mno-longcalls 10501@opindex mlongcalls 10502@opindex mno-longcalls 10503When this option is enabled, GCC instructs the assembler to translate 10504direct calls to indirect calls unless it can determine that the target 10505of a direct call is in the range allowed by the call instruction. This 10506translation typically occurs for calls to functions in other source 10507files. Specifically, the assembler translates a direct @code{CALL} 10508instruction into an @code{L32R} followed by a @code{CALLX} instruction. 10509The default is @option{-mno-longcalls}. This option should be used in 10510programs where the call target can potentially be out of range. This 10511option is implemented in the assembler, not the compiler, so the 10512assembly code generated by GCC will still show direct call 10513instructions---look at the disassembled object code to see the actual 10514instructions. Note that the assembler will use an indirect call for 10515every cross-file call, not just those that really will be out of range. 10516@end table 10517 10518@node Code Gen Options 10519@section Options for Code Generation Conventions 10520@cindex code generation conventions 10521@cindex options, code generation 10522@cindex run-time options 10523 10524These machine-independent options control the interface conventions 10525used in code generation. 10526 10527Most of them have both positive and negative forms; the negative form 10528of @option{-ffoo} would be @option{-fno-foo}. In the table below, only 10529one of the forms is listed---the one which is not the default. You 10530can figure out the other form by either removing @samp{no-} or adding 10531it. 10532 10533@table @gcctabopt 10534@item -fbounds-check 10535@opindex fbounds-check 10536For front-ends that support it, generate additional code to check that 10537indices used to access arrays are within the declared range. This is 10538currently only supported by the Java and Fortran 77 front-ends, where 10539this option defaults to true and false respectively. 10540 10541@item -ftrapv 10542@opindex ftrapv 10543This option generates traps for signed overflow on addition, subtraction, 10544multiplication operations. 10545 10546@item -fexceptions 10547@opindex fexceptions 10548Enable exception handling. Generates extra code needed to propagate 10549exceptions. For some targets, this implies GCC will generate frame 10550unwind information for all functions, which can produce significant data 10551size overhead, although it does not affect execution. If you do not 10552specify this option, GCC will enable it by default for languages like 10553C++ which normally require exception handling, and disable it for 10554languages like C that do not normally require it. However, you may need 10555to enable this option when compiling C code that needs to interoperate 10556properly with exception handlers written in C++. You may also wish to 10557disable this option if you are compiling older C++ programs that don't 10558use exception handling. 10559 10560@item -fnon-call-exceptions 10561@opindex fnon-call-exceptions 10562Generate code that allows trapping instructions to throw exceptions. 10563Note that this requires platform-specific runtime support that does 10564not exist everywhere. Moreover, it only allows @emph{trapping} 10565instructions to throw exceptions, i.e.@: memory references or floating 10566point instructions. It does not allow exceptions to be thrown from 10567arbitrary signal handlers such as @code{SIGALRM}. 10568 10569@item -funwind-tables 10570@opindex funwind-tables 10571Similar to @option{-fexceptions}, except that it will just generate any needed 10572static data, but will not affect the generated code in any other way. 10573You will normally not enable this option; instead, a language processor 10574that needs this handling would enable it on your behalf. 10575 10576@item -fasynchronous-unwind-tables 10577@opindex funwind-tables 10578Generate unwind table in dwarf2 format, if supported by target machine. The 10579table is exact at each instruction boundary, so it can be used for stack 10580unwinding from asynchronous events (such as debugger or garbage collector). 10581 10582@item -fpcc-struct-return 10583@opindex fpcc-struct-return 10584Return ``short'' @code{struct} and @code{union} values in memory like 10585longer ones, rather than in registers. This convention is less 10586efficient, but it has the advantage of allowing intercallability between 10587GCC-compiled files and files compiled with other compilers, particularly 10588the Portable C Compiler (pcc). 10589 10590The precise convention for returning structures in memory depends 10591on the target configuration macros. 10592 10593Short structures and unions are those whose size and alignment match 10594that of some integer type. 10595 10596@strong{Warning:} code compiled with the @option{-fpcc-struct-return} 10597switch is not binary compatible with code compiled with the 10598@option{-freg-struct-return} switch. 10599Use it to conform to a non-default application binary interface. 10600 10601@item -freg-struct-return 10602@opindex freg-struct-return 10603Return @code{struct} and @code{union} values in registers when possible. 10604This is more efficient for small structures than 10605@option{-fpcc-struct-return}. 10606 10607If you specify neither @option{-fpcc-struct-return} nor 10608@option{-freg-struct-return}, GCC defaults to whichever convention is 10609standard for the target. If there is no standard convention, GCC 10610defaults to @option{-fpcc-struct-return}, except on targets where GCC is 10611the principal compiler. In those cases, we can choose the standard, and 10612we chose the more efficient register return alternative. 10613 10614@strong{Warning:} code compiled with the @option{-freg-struct-return} 10615switch is not binary compatible with code compiled with the 10616@option{-fpcc-struct-return} switch. 10617Use it to conform to a non-default application binary interface. 10618 10619@item -fshort-enums 10620@opindex fshort-enums 10621Allocate to an @code{enum} type only as many bytes as it needs for the 10622declared range of possible values. Specifically, the @code{enum} type 10623will be equivalent to the smallest integer type which has enough room. 10624 10625@strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate 10626code that is not binary compatible with code generated without that switch. 10627Use it to conform to a non-default application binary interface. 10628 10629@item -fshort-double 10630@opindex fshort-double 10631Use the same size for @code{double} as for @code{float}. 10632 10633@strong{Warning:} the @option{-fshort-double} switch causes GCC to generate 10634code that is not binary compatible with code generated without that switch. 10635Use it to conform to a non-default application binary interface. 10636 10637@item -fshort-wchar 10638@opindex fshort-wchar 10639Override the underlying type for @samp{wchar_t} to be @samp{short 10640unsigned int} instead of the default for the target. This option is 10641useful for building programs to run under WINE@. 10642 10643@strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate 10644code that is not binary compatible with code generated without that switch. 10645Use it to conform to a non-default application binary interface. 10646 10647@item -fshared-data 10648@opindex fshared-data 10649Requests that the data and non-@code{const} variables of this 10650compilation be shared data rather than private data. The distinction 10651makes sense only on certain operating systems, where shared data is 10652shared between processes running the same program, while private data 10653exists in one copy per process. 10654 10655@item -fno-common 10656@opindex fno-common 10657In C, allocate even uninitialized global variables in the data section of the 10658object file, rather than generating them as common blocks. This has the 10659effect that if the same variable is declared (without @code{extern}) in 10660two different compilations, you will get an error when you link them. 10661The only reason this might be useful is if you wish to verify that the 10662program will work on other systems which always work this way. 10663 10664@item -fno-ident 10665@opindex fno-ident 10666Ignore the @samp{#ident} directive. 10667 10668@item -fno-gnu-linker 10669@opindex fno-gnu-linker 10670Do not output global initializations (such as C++ constructors and 10671destructors) in the form used by the GNU linker (on systems where the GNU 10672linker is the standard method of handling them). Use this option when 10673you want to use a non-GNU linker, which also requires using the 10674@command{collect2} program to make sure the system linker includes 10675constructors and destructors. (@command{collect2} is included in the GCC 10676distribution.) For systems which @emph{must} use @command{collect2}, the 10677compiler driver @command{gcc} is configured to do this automatically. 10678 10679@item -finhibit-size-directive 10680@opindex finhibit-size-directive 10681Don't output a @code{.size} assembler directive, or anything else that 10682would cause trouble if the function is split in the middle, and the 10683two halves are placed at locations far apart in memory. This option is 10684used when compiling @file{crtstuff.c}; you should not need to use it 10685for anything else. 10686 10687@item -fverbose-asm 10688@opindex fverbose-asm 10689Put extra commentary information in the generated assembly code to 10690make it more readable. This option is generally only of use to those 10691who actually need to read the generated assembly code (perhaps while 10692debugging the compiler itself). 10693 10694@option{-fno-verbose-asm}, the default, causes the 10695extra information to be omitted and is useful when comparing two assembler 10696files. 10697 10698@item -fvolatile 10699@opindex fvolatile 10700Consider all memory references through pointers to be volatile. 10701 10702@item -fvolatile-global 10703@opindex fvolatile-global 10704Consider all memory references to extern and global data items to 10705be volatile. GCC does not consider static data items to be volatile 10706because of this switch. 10707 10708@item -fvolatile-static 10709@opindex fvolatile-static 10710Consider all memory references to static data to be volatile. 10711 10712@item -fpic 10713@opindex fpic 10714@cindex global offset table 10715@cindex PIC 10716Generate position-independent code (PIC) suitable for use in a shared 10717library, if supported for the target machine. Such code accesses all 10718constant addresses through a global offset table (GOT)@. The dynamic 10719loader resolves the GOT entries when the program starts (the dynamic 10720loader is not part of GCC; it is part of the operating system). If 10721the GOT size for the linked executable exceeds a machine-specific 10722maximum size, you get an error message from the linker indicating that 10723@option{-fpic} does not work; in that case, recompile with @option{-fPIC} 10724instead. (These maximums are 16k on the m88k, 8k on the SPARC, and 32k 10725on the m68k and RS/6000. The 386 has no such limit.) 10726 10727Position-independent code requires special support, and therefore works 10728only on certain machines. For the 386, GCC supports PIC for System V 10729but not for the Sun 386i. Code generated for the IBM RS/6000 is always 10730position-independent. 10731 10732@item -fPIC 10733@opindex fPIC 10734If supported for the target machine, emit position-independent code, 10735suitable for dynamic linking and avoiding any limit on the size of the 10736global offset table. This option makes a difference on the m68k, m88k, 10737and the SPARC. 10738 10739Position-independent code requires special support, and therefore works 10740only on certain machines. 10741 10742@item -ffixed-@var{reg} 10743@opindex ffixed 10744Treat the register named @var{reg} as a fixed register; generated code 10745should never refer to it (except perhaps as a stack pointer, frame 10746pointer or in some other fixed role). 10747 10748@var{reg} must be the name of a register. The register names accepted 10749are machine-specific and are defined in the @code{REGISTER_NAMES} 10750macro in the machine description macro file. 10751 10752This flag does not have a negative form, because it specifies a 10753three-way choice. 10754 10755@item -fcall-used-@var{reg} 10756@opindex fcall-used 10757Treat the register named @var{reg} as an allocable register that is 10758clobbered by function calls. It may be allocated for temporaries or 10759variables that do not live across a call. Functions compiled this way 10760will not save and restore the register @var{reg}. 10761 10762It is an error to used this flag with the frame pointer or stack pointer. 10763Use of this flag for other registers that have fixed pervasive roles in 10764the machine's execution model will produce disastrous results. 10765 10766This flag does not have a negative form, because it specifies a 10767three-way choice. 10768 10769@item -fcall-saved-@var{reg} 10770@opindex fcall-saved 10771Treat the register named @var{reg} as an allocable register saved by 10772functions. It may be allocated even for temporaries or variables that 10773live across a call. Functions compiled this way will save and restore 10774the register @var{reg} if they use it. 10775 10776It is an error to used this flag with the frame pointer or stack pointer. 10777Use of this flag for other registers that have fixed pervasive roles in 10778the machine's execution model will produce disastrous results. 10779 10780A different sort of disaster will result from the use of this flag for 10781a register in which function values may be returned. 10782 10783This flag does not have a negative form, because it specifies a 10784three-way choice. 10785 10786@item -fpack-struct 10787@opindex fpack-struct 10788Pack all structure members together without holes. 10789 10790@strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate 10791code that is not binary compatible with code generated without that switch. 10792Additionally, it makes the code suboptimal. 10793Use it to conform to a non-default application binary interface. 10794 10795@item -finstrument-functions 10796@opindex finstrument-functions 10797Generate instrumentation calls for entry and exit to functions. Just 10798after function entry and just before function exit, the following 10799profiling functions will be called with the address of the current 10800function and its call site. (On some platforms, 10801@code{__builtin_return_address} does not work beyond the current 10802function, so the call site information may not be available to the 10803profiling functions otherwise.) 10804 10805@example 10806void __cyg_profile_func_enter (void *this_fn, 10807 void *call_site); 10808void __cyg_profile_func_exit (void *this_fn, 10809 void *call_site); 10810@end example 10811 10812The first argument is the address of the start of the current function, 10813which may be looked up exactly in the symbol table. 10814 10815This instrumentation is also done for functions expanded inline in other 10816functions. The profiling calls will indicate where, conceptually, the 10817inline function is entered and exited. This means that addressable 10818versions of such functions must be available. If all your uses of a 10819function are expanded inline, this may mean an additional expansion of 10820code size. If you use @samp{extern inline} in your C code, an 10821addressable version of such functions must be provided. (This is 10822normally the case anyways, but if you get lucky and the optimizer always 10823expands the functions inline, you might have gotten away without 10824providing static copies.) 10825 10826A function may be given the attribute @code{no_instrument_function}, in 10827which case this instrumentation will not be done. This can be used, for 10828example, for the profiling functions listed above, high-priority 10829interrupt routines, and any functions from which the profiling functions 10830cannot safely be called (perhaps signal handlers, if the profiling 10831routines generate output or allocate memory). 10832 10833@item -fstack-check 10834@opindex fstack-check 10835Generate code to verify that you do not go beyond the boundary of the 10836stack. You should specify this flag if you are running in an 10837environment with multiple threads, but only rarely need to specify it in 10838a single-threaded environment since stack overflow is automatically 10839detected on nearly all systems if there is only one stack. 10840 10841Note that this switch does not actually cause checking to be done; the 10842operating system must do that. The switch causes generation of code 10843to ensure that the operating system sees the stack being extended. 10844 10845@item -fstack-limit-register=@var{reg} 10846@itemx -fstack-limit-symbol=@var{sym} 10847@itemx -fno-stack-limit 10848@opindex fstack-limit-register 10849@opindex fstack-limit-symbol 10850@opindex fno-stack-limit 10851Generate code to ensure that the stack does not grow beyond a certain value, 10852either the value of a register or the address of a symbol. If the stack 10853would grow beyond the value, a signal is raised. For most targets, 10854the signal is raised before the stack overruns the boundary, so 10855it is possible to catch the signal without taking special precautions. 10856 10857For instance, if the stack starts at absolute address @samp{0x80000000} 10858and grows downwards, you can use the flags 10859@option{-fstack-limit-symbol=__stack_limit} and 10860@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit 10861of 128KB@. Note that this may only work with the GNU linker. 10862 10863@cindex aliasing of parameters 10864@cindex parameters, aliased 10865@item -fargument-alias 10866@itemx -fargument-noalias 10867@itemx -fargument-noalias-global 10868@opindex fargument-alias 10869@opindex fargument-noalias 10870@opindex fargument-noalias-global 10871Specify the possible relationships among parameters and between 10872parameters and global data. 10873 10874@option{-fargument-alias} specifies that arguments (parameters) may 10875alias each other and may alias global storage.@* 10876@option{-fargument-noalias} specifies that arguments do not alias 10877each other, but may alias global storage.@* 10878@option{-fargument-noalias-global} specifies that arguments do not 10879alias each other and do not alias global storage. 10880 10881Each language will automatically use whatever option is required by 10882the language standard. You should not need to use these options yourself. 10883 10884@item -fleading-underscore 10885@opindex fleading-underscore 10886This option and its counterpart, @option{-fno-leading-underscore}, forcibly 10887change the way C symbols are represented in the object file. One use 10888is to help link with legacy assembly code. 10889 10890@strong{Warning:} the @option{-fleading-underscore} switch causes GCC to 10891generate code that is not binary compatible with code generated without that 10892switch. Use it to conform to a non-default application binary interface. 10893Not all targets provide complete support for this switch. 10894 10895@item -ftls-model=@var{model} 10896Alter the thread-local storage model to be used (@pxref{Thread-Local}). 10897The @var{model} argument should be one of @code{global-dynamic}, 10898@code{local-dynamic}, @code{initial-exec} or @code{local-exec}. 10899 10900The default without @option{-fpic} is @code{initial-exec}; with 10901@option{-fpic} the default is @code{global-dynamic}. 10902@end table 10903 10904@c man end 10905 10906@node Environment Variables 10907@section Environment Variables Affecting GCC 10908@cindex environment variables 10909 10910@c man begin ENVIRONMENT 10911This section describes several environment variables that affect how GCC 10912operates. Some of them work by specifying directories or prefixes to use 10913when searching for various kinds of files. Some are used to specify other 10914aspects of the compilation environment. 10915 10916Note that you can also specify places to search using options such as 10917@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These 10918take precedence over places specified using environment variables, which 10919in turn take precedence over those specified by the configuration of GCC@. 10920@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint, 10921GNU Compiler Collection (GCC) Internals}. 10922 10923@table @env 10924@item LANG 10925@itemx LC_CTYPE 10926@c @itemx LC_COLLATE 10927@itemx LC_MESSAGES 10928@c @itemx LC_MONETARY 10929@c @itemx LC_NUMERIC 10930@c @itemx LC_TIME 10931@itemx LC_ALL 10932@findex LANG 10933@findex LC_CTYPE 10934@c @findex LC_COLLATE 10935@findex LC_MESSAGES 10936@c @findex LC_MONETARY 10937@c @findex LC_NUMERIC 10938@c @findex LC_TIME 10939@findex LC_ALL 10940@cindex locale 10941These environment variables control the way that GCC uses 10942localization information that allow GCC to work with different 10943national conventions. GCC inspects the locale categories 10944@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do 10945so. These locale categories can be set to any value supported by your 10946installation. A typical value is @samp{en_UK} for English in the United 10947Kingdom. 10948 10949The @env{LC_CTYPE} environment variable specifies character 10950classification. GCC uses it to determine the character boundaries in 10951a string; this is needed for some multibyte encodings that contain quote 10952and escape characters that would otherwise be interpreted as a string 10953end or escape. 10954 10955The @env{LC_MESSAGES} environment variable specifies the language to 10956use in diagnostic messages. 10957 10958If the @env{LC_ALL} environment variable is set, it overrides the value 10959of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE} 10960and @env{LC_MESSAGES} default to the value of the @env{LANG} 10961environment variable. If none of these variables are set, GCC 10962defaults to traditional C English behavior. 10963 10964@item TMPDIR 10965@findex TMPDIR 10966If @env{TMPDIR} is set, it specifies the directory to use for temporary 10967files. GCC uses temporary files to hold the output of one stage of 10968compilation which is to be used as input to the next stage: for example, 10969the output of the preprocessor, which is the input to the compiler 10970proper. 10971 10972@item GCC_EXEC_PREFIX 10973@findex GCC_EXEC_PREFIX 10974If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the 10975names of the subprograms executed by the compiler. No slash is added 10976when this prefix is combined with the name of a subprogram, but you can 10977specify a prefix that ends with a slash if you wish. 10978 10979If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out 10980an appropriate prefix to use based on the pathname it was invoked with. 10981 10982If GCC cannot find the subprogram using the specified prefix, it 10983tries looking in the usual places for the subprogram. 10984 10985The default value of @env{GCC_EXEC_PREFIX} is 10986@file{@var{prefix}/lib/gcc-lib/} where @var{prefix} is the value 10987of @code{prefix} when you ran the @file{configure} script. 10988 10989Other prefixes specified with @option{-B} take precedence over this prefix. 10990 10991This prefix is also used for finding files such as @file{crt0.o} that are 10992used for linking. 10993 10994In addition, the prefix is used in an unusual way in finding the 10995directories to search for header files. For each of the standard 10996directories whose name normally begins with @samp{/usr/local/lib/gcc-lib} 10997(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries 10998replacing that beginning with the specified prefix to produce an 10999alternate directory name. Thus, with @option{-Bfoo/}, GCC will search 11000@file{foo/bar} where it would normally search @file{/usr/local/lib/bar}. 11001These alternate directories are searched first; the standard directories 11002come next. 11003 11004@item COMPILER_PATH 11005@findex COMPILER_PATH 11006The value of @env{COMPILER_PATH} is a colon-separated list of 11007directories, much like @env{PATH}. GCC tries the directories thus 11008specified when searching for subprograms, if it can't find the 11009subprograms using @env{GCC_EXEC_PREFIX}. 11010 11011@item LIBRARY_PATH 11012@findex LIBRARY_PATH 11013The value of @env{LIBRARY_PATH} is a colon-separated list of 11014directories, much like @env{PATH}. When configured as a native compiler, 11015GCC tries the directories thus specified when searching for special 11016linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking 11017using GCC also uses these directories when searching for ordinary 11018libraries for the @option{-l} option (but directories specified with 11019@option{-L} come first). 11020 11021@item LANG 11022@findex LANG 11023@cindex locale definition 11024This variable is used to pass locale information to the compiler. One way in 11025which this information is used is to determine the character set to be used 11026when character literals, string literals and comments are parsed in C and C++. 11027When the compiler is configured to allow multibyte characters, 11028the following values for @env{LANG} are recognized: 11029 11030@table @samp 11031@item C-JIS 11032Recognize JIS characters. 11033@item C-SJIS 11034Recognize SJIS characters. 11035@item C-EUCJP 11036Recognize EUCJP characters. 11037@end table 11038 11039If @env{LANG} is not defined, or if it has some other value, then the 11040compiler will use mblen and mbtowc as defined by the default locale to 11041recognize and translate multibyte characters. 11042@end table 11043 11044@noindent 11045Some additional environments variables affect the behavior of the 11046preprocessor. 11047 11048@include cppenv.texi 11049 11050@c man end 11051 11052@node Running Protoize 11053@section Running Protoize 11054 11055The program @code{protoize} is an optional part of GCC@. You can use 11056it to add prototypes to a program, thus converting the program to ISO 11057C in one respect. The companion program @code{unprotoize} does the 11058reverse: it removes argument types from any prototypes that are found. 11059 11060When you run these programs, you must specify a set of source files as 11061command line arguments. The conversion programs start out by compiling 11062these files to see what functions they define. The information gathered 11063about a file @var{foo} is saved in a file named @file{@var{foo}.X}. 11064 11065After scanning comes actual conversion. The specified files are all 11066eligible to be converted; any files they include (whether sources or 11067just headers) are eligible as well. 11068 11069But not all the eligible files are converted. By default, 11070@code{protoize} and @code{unprotoize} convert only source and header 11071files in the current directory. You can specify additional directories 11072whose files should be converted with the @option{-d @var{directory}} 11073option. You can also specify particular files to exclude with the 11074@option{-x @var{file}} option. A file is converted if it is eligible, its 11075directory name matches one of the specified directory names, and its 11076name within the directory has not been excluded. 11077 11078Basic conversion with @code{protoize} consists of rewriting most 11079function definitions and function declarations to specify the types of 11080the arguments. The only ones not rewritten are those for varargs 11081functions. 11082 11083@code{protoize} optionally inserts prototype declarations at the 11084beginning of the source file, to make them available for any calls that 11085precede the function's definition. Or it can insert prototype 11086declarations with block scope in the blocks where undeclared functions 11087are called. 11088 11089Basic conversion with @code{unprotoize} consists of rewriting most 11090function declarations to remove any argument types, and rewriting 11091function definitions to the old-style pre-ISO form. 11092 11093Both conversion programs print a warning for any function declaration or 11094definition that they can't convert. You can suppress these warnings 11095with @option{-q}. 11096 11097The output from @code{protoize} or @code{unprotoize} replaces the 11098original source file. The original file is renamed to a name ending 11099with @samp{.save} (for DOS, the saved filename ends in @samp{.sav} 11100without the original @samp{.c} suffix). If the @samp{.save} (@samp{.sav} 11101for DOS) file already exists, then the source file is simply discarded. 11102 11103@code{protoize} and @code{unprotoize} both depend on GCC itself to 11104scan the program and collect information about the functions it uses. 11105So neither of these programs will work until GCC is installed. 11106 11107Here is a table of the options you can use with @code{protoize} and 11108@code{unprotoize}. Each option works with both programs unless 11109otherwise stated. 11110 11111@table @code 11112@item -B @var{directory} 11113Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the 11114usual directory (normally @file{/usr/local/lib}). This file contains 11115prototype information about standard system functions. This option 11116applies only to @code{protoize}. 11117 11118@item -c @var{compilation-options} 11119Use @var{compilation-options} as the options when running @command{gcc} to 11120produce the @samp{.X} files. The special option @option{-aux-info} is 11121always passed in addition, to tell @command{gcc} to write a @samp{.X} file. 11122 11123Note that the compilation options must be given as a single argument to 11124@code{protoize} or @code{unprotoize}. If you want to specify several 11125@command{gcc} options, you must quote the entire set of compilation options 11126to make them a single word in the shell. 11127 11128There are certain @command{gcc} arguments that you cannot use, because they 11129would produce the wrong kind of output. These include @option{-g}, 11130@option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in 11131the @var{compilation-options}, they are ignored. 11132 11133@item -C 11134Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file 11135systems) instead of @samp{.c}. This is convenient if you are converting 11136a C program to C++. This option applies only to @code{protoize}. 11137 11138@item -g 11139Add explicit global declarations. This means inserting explicit 11140declarations at the beginning of each source file for each function 11141that is called in the file and was not declared. These declarations 11142precede the first function definition that contains a call to an 11143undeclared function. This option applies only to @code{protoize}. 11144 11145@item -i @var{string} 11146Indent old-style parameter declarations with the string @var{string}. 11147This option applies only to @code{protoize}. 11148 11149@code{unprotoize} converts prototyped function definitions to old-style 11150function definitions, where the arguments are declared between the 11151argument list and the initial @samp{@{}. By default, @code{unprotoize} 11152uses five spaces as the indentation. If you want to indent with just 11153one space instead, use @option{-i " "}. 11154 11155@item -k 11156Keep the @samp{.X} files. Normally, they are deleted after conversion 11157is finished. 11158 11159@item -l 11160Add explicit local declarations. @code{protoize} with @option{-l} inserts 11161a prototype declaration for each function in each block which calls the 11162function without any declaration. This option applies only to 11163@code{protoize}. 11164 11165@item -n 11166Make no real changes. This mode just prints information about the conversions 11167that would have been done without @option{-n}. 11168 11169@item -N 11170Make no @samp{.save} files. The original files are simply deleted. 11171Use this option with caution. 11172 11173@item -p @var{program} 11174Use the program @var{program} as the compiler. Normally, the name 11175@file{gcc} is used. 11176 11177@item -q 11178Work quietly. Most warnings are suppressed. 11179 11180@item -v 11181Print the version number, just like @option{-v} for @command{gcc}. 11182@end table 11183 11184If you need special compiler options to compile one of your program's 11185source files, then you should generate that file's @samp{.X} file 11186specially, by running @command{gcc} on that source file with the 11187appropriate options and the option @option{-aux-info}. Then run 11188@code{protoize} on the entire set of files. @code{protoize} will use 11189the existing @samp{.X} file because it is newer than the source file. 11190For example: 11191 11192@example 11193gcc -Dfoo=bar file1.c -aux-info file1.X 11194protoize *.c 11195@end example 11196 11197@noindent 11198You need to include the special files along with the rest in the 11199@code{protoize} command, even though their @samp{.X} files already 11200exist, because otherwise they won't get converted. 11201 11202@xref{Protoize Caveats}, for more information on how to use 11203@code{protoize} successfully. 11204