1@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2@c 2000, 2001, 2002, 2003, 2004, 2005, 2006 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 INCLUDE 8@include gcc-vers.texi 9@c man end 10 11@c man begin COPYRIGHT 12Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 131999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. 14 15Permission is granted to copy, distribute and/or modify this document 16under the terms of the GNU Free Documentation License, Version 1.2 or 17any later version published by the Free Software Foundation; with the 18Invariant Sections being ``GNU General Public License'' and ``Funding 19Free Software'', the Front-Cover texts being (a) (see below), and with 20the Back-Cover Texts being (b) (see below). A copy of the license is 21included in the gfdl(7) man page. 22 23(a) The FSF's Front-Cover Text is: 24 25 A GNU Manual 26 27(b) The FSF's Back-Cover Text is: 28 29 You have freedom to copy and modify this GNU Manual, like GNU 30 software. Copies published by the Free Software Foundation raise 31 funds for GNU development. 32@c man end 33@c Set file name and title for the man page. 34@setfilename gcc 35@settitle GNU project C and C++ compiler 36@c man begin SYNOPSIS 37gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}] 38 [@option{-g}] [@option{-pg}] [@option{-O}@var{level}] 39 [@option{-W}@var{warn}@dots{}] [@option{-pedantic}] 40 [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}] 41 [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}] 42 [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}] 43 [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{} 44 45Only the most useful options are listed here; see below for the 46remainder. @samp{g++} accepts mostly the same options as @samp{gcc}. 47@c man end 48@c man begin SEEALSO 49gpl(7), gfdl(7), fsf-funding(7), 50cpp(1), gcov(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1) 51and the Info entries for @file{gcc}, @file{cpp}, @file{as}, 52@file{ld}, @file{binutils} and @file{gdb}. 53@c man end 54@c man begin BUGS 55For instructions on reporting bugs, see 56@w{@uref{http://gcc.gnu.org/bugs.html}}. 57@c man end 58@c man begin AUTHOR 59See the Info entry for @command{gcc}, or 60@w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}}, 61for contributors to GCC@. 62@c man end 63@end ignore 64 65@node Invoking GCC 66@chapter GCC Command Options 67@cindex GCC command options 68@cindex command options 69@cindex options, GCC command 70 71@c man begin DESCRIPTION 72When you invoke GCC, it normally does preprocessing, compilation, 73assembly and linking. The ``overall options'' allow you to stop this 74process at an intermediate stage. For example, the @option{-c} option 75says not to run the linker. Then the output consists of object files 76output by the assembler. 77 78Other options are passed on to one stage of processing. Some options 79control the preprocessor and others the compiler itself. Yet other 80options control the assembler and linker; most of these are not 81documented here, since you rarely need to use any of them. 82 83@cindex C compilation options 84Most of the command line options that you can use with GCC are useful 85for C programs; when an option is only useful with another language 86(usually C++), the explanation says so explicitly. If the description 87for a particular option does not mention a source language, you can use 88that option with all supported languages. 89 90@cindex C++ compilation options 91@xref{Invoking G++,,Compiling C++ Programs}, for a summary of special 92options for compiling C++ programs. 93 94@cindex grouping options 95@cindex options, grouping 96The @command{gcc} program accepts options and file names as operands. Many 97options have multi-letter names; therefore multiple single-letter options 98may @emph{not} be grouped: @option{-dr} is very different from @w{@samp{-d 99-r}}. 100 101@cindex order of options 102@cindex options, order 103You can mix options and other arguments. For the most part, the order 104you use doesn't matter. Order does matter when you use several options 105of the same kind; for example, if you specify @option{-L} more than once, 106the directories are searched in the order specified. 107 108Many options have long names starting with @samp{-f} or with 109@samp{-W}---for example, 110@option{-fmove-loop-invariants}, @option{-Wformat} and so on. Most of 111these have both positive and negative forms; the negative form of 112@option{-ffoo} would be @option{-fno-foo}. This manual documents 113only one of these two forms, whichever one is not the default. 114 115@c man end 116 117@xref{Option Index}, for an index to GCC's options. 118 119@menu 120* Option Summary:: Brief list of all options, without explanations. 121* Overall Options:: Controlling the kind of output: 122 an executable, object files, assembler files, 123 or preprocessed source. 124* Invoking G++:: Compiling C++ programs. 125* C Dialect Options:: Controlling the variant of C language compiled. 126* C++ Dialect Options:: Variations on C++. 127* Language Independent Options:: Controlling how diagnostics should be 128 formatted. 129* Warning Options:: How picky should the compiler be? 130* Debugging Options:: Symbol tables, measurements, and debugging dumps. 131* Optimize Options:: How much optimization? 132* Preprocessor Options:: Controlling header files and macro definitions. 133 Also, getting dependency information for Make. 134* Assembler Options:: Passing options to the assembler. 135* Link Options:: Specifying libraries and so on. 136* Directory Options:: Where to find header files and libraries. 137 Where to find the compiler executable files. 138* Spec Files:: How to pass switches to sub-processes. 139* Target Options:: Running a cross-compiler, or an old version of GCC. 140* Submodel Options:: Specifying minor hardware or convention variations, 141 such as 68010 vs 68020. 142* Code Gen Options:: Specifying conventions for function calls, data layout 143 and register usage. 144* Environment Variables:: Env vars that affect GCC. 145* Precompiled Headers:: Compiling a header once, and using it many times. 146* Running Protoize:: Automatically adding or removing function prototypes. 147@end menu 148 149@c man begin OPTIONS 150 151@node Option Summary 152@section Option Summary 153 154Here is a summary of all the options, grouped by type. Explanations are 155in the following sections. 156 157@table @emph 158@item Overall Options 159@xref{Overall Options,,Options Controlling the Kind of Output}. 160@gccoptlist{-c -S -E -o @var{file} -combine -pipe -pass-exit-codes @gol 161-x @var{language} -v -### --help --target-help --version @@@var{file}} 162 163@item C Language Options 164@xref{C Dialect Options,,Options Controlling C Dialect}. 165@gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol 166-aux-info @var{filename} @gol 167@c APPLE LOCAL blocks 7205047 5811887 168-fno-asm -fno-blocks -fno-builtin -fno-builtin-@var{function} @gol 169-fhosted -ffreestanding -fopenmp -fms-extensions @gol 170-trigraphs -no-integrated-cpp -traditional -traditional-cpp @gol 171-fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol 172@c APPLE LOCAL nested functions 4357979 */ 173-fno-nested-functions @gol 174-fsigned-bitfields -fsigned-char @gol 175@c APPLE LOCAL -Wnewline-eof 2001-08-23 --sts ** 176-Wnewline-eof (Apple compatible) @gol 177-funsigned-bitfields -funsigned-char} 178 179@item C++ Language Options 180@xref{C++ Dialect Options,,Options Controlling C++ Dialect}. 181@gccoptlist{-fabi-version=@var{n} -fno-access-control -fcheck-new @gol 182-fconserve-space -ffriend-injection @gol 183-fno-elide-constructors @gol 184-fno-enforce-eh-specs @gol 185-ffor-scope -fno-for-scope -fno-gnu-keywords @gol 186-fno-implicit-templates @gol 187-fno-implicit-inline-templates @gol 188-fno-implement-inlines -fms-extensions @gol 189-fno-nonansi-builtins -fno-operator-names @gol 190-fno-optional-diags -fpermissive @gol 191-frepo -fno-rtti -fstats -ftemplate-depth-@var{n} @gol 192-fno-threadsafe-statics -fuse-cxa-atexit -fno-weak -nostdinc++ @gol 193-fno-default-inline -fvisibility-inlines-hidden @gol 194-fvisibility-ms-compat @gol 195-Wabi -Wctor-dtor-privacy @gol 196-Wnon-virtual-dtor -Wreorder @gol 197-Weffc++ -Wno-deprecated -Wstrict-null-sentinel @gol 198-Wno-non-template-friend -Wold-style-cast @gol 199-Woverloaded-virtual -Wno-pmf-conversions @gol 200-Wsign-promo} 201 202@item Language Independent Options 203@xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}. 204@gccoptlist{-fmessage-length=@var{n} @gol 205-fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol 206-fdiagnostics-show-option} 207 208@item Warning Options 209@xref{Warning Options,,Options to Request or Suppress Warnings}. 210@gccoptlist{-fsyntax-only -pedantic -pedantic-errors @gol 211-w -Wextra -Wall -Waddress -Waggregate-return -Wno-attributes @gol 212-Wc++-compat -Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment @gol 213-Wconversion -Wno-deprecated-declarations @gol 214-Wdisabled-optimization -Wno-div-by-zero -Wno-endif-labels @gol 215-Werror -Werror=* -Werror-implicit-function-declaration @gol 216-Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol 217-Wno-format-extra-args -Wformat-nonliteral @gol 218-Wformat-security -Wformat-y2k @gol 219-Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol 220-Wimport -Wno-import -Winit-self -Winline @gol 221-Wno-int-to-pointer-cast @gol 222-Wno-invalid-offsetof -Winvalid-pch @gol 223-Wlarger-than-@var{len} -Wframe-larger-than-@var{len} @gol 224-Wunsafe-loop-optimizations -Wlong-long @gol 225-Wmain -Wmissing-braces -Wmissing-field-initializers @gol 226-Wmissing-format-attribute -Wmissing-include-dirs @gol 227-Wmissing-noreturn @gol 228@c APPLE LOCAL warn missing prototype 6261539 229-Wmissing-prototypes @gol 230@c APPLE LOCAL -Wmost 231-Wmost (APPLE ONLY) @gol 232-Wno-multichar -Wnonnull -Wno-overflow @gol 233-Woverlength-strings -Wpacked -Wpadded @gol 234-Wparentheses -Wpointer-arith -Wno-pointer-to-int-cast @gol 235-Wredundant-decls @gol 236-Wreturn-type -Wsequence-point -Wshadow @gol 237-Wsign-compare -Wstack-protector @gol 238-Wstrict-aliasing -Wstrict-aliasing=2 @gol 239-Wstrict-overflow -Wstrict-overflow=@var{n} @gol 240-Wswitch -Wswitch-default -Wswitch-enum @gol 241-Wsystem-headers -Wtrigraphs -Wundef -Wuninitialized @gol 242-Wunknown-pragmas -Wno-pragmas -Wunreachable-code @gol 243-Wunused -Wunused-function -Wunused-label -Wunused-parameter @gol 244-Wunused-value -Wunused-variable @gol 245-Wvariadic-macros -Wvla @gol 246-Wvolatile-register-var -Wwrite-strings} 247 248@item C-only Warning Options 249@gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol 250@c APPLE LOCAL warn missing prototype 6261539 251-Wnested-externs -Wold-style-definition @gol 252-Wstrict-prototypes -Wtraditional @gol 253-Wdeclaration-after-statement -Wpointer-sign} 254 255@item Debugging Options 256@xref{Debugging Options,,Options for Debugging Your Program or GCC}. 257@gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol 258-fdump-noaddr -fdump-unnumbered -fdump-translation-unit@r{[}-@var{n}@r{]} @gol 259-fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol 260-fdump-ipa-all -fdump-ipa-cgraph @gol 261-fdump-tree-all @gol 262-fdump-tree-original@r{[}-@var{n}@r{]} @gol 263-fdump-tree-optimized@r{[}-@var{n}@r{]} @gol 264-fdump-tree-inlined@r{[}-@var{n}@r{]} @gol 265-fdump-tree-cfg -fdump-tree-vcg -fdump-tree-alias @gol 266-fdump-tree-ch @gol 267-fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol 268-fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol 269-fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol 270-fdump-tree-dom@r{[}-@var{n}@r{]} @gol 271-fdump-tree-dse@r{[}-@var{n}@r{]} @gol 272-fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol 273-fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol 274-fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol 275-fdump-tree-nrv -fdump-tree-vect @gol 276-fdump-tree-sink @gol 277-fdump-tree-sra@r{[}-@var{n}@r{]} @gol 278-fdump-tree-salias @gol 279-fdump-tree-fre@r{[}-@var{n}@r{]} @gol 280-fdump-tree-vrp@r{[}-@var{n}@r{]} @gol 281-ftree-vectorizer-verbose=@var{n} @gol 282-fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol 283-feliminate-dwarf2-dups -feliminate-unused-debug-types @gol 284-feliminate-unused-debug-symbols -femit-class-debug-always @gol 285-fmem-report -fprofile-arcs @gol 286-frandom-seed=@var{string} -fsched-verbose=@var{n} @gol 287-ftest-coverage -ftime-report -fvar-tracking @gol 288-g -g@var{level} -gcoff -gdwarf-2 @gol 289-ggdb -gstabs -gstabs+ -gvms -gxcoff -gxcoff+ @gol 290-femit-struct-debug-baseonly -femit-struct-debug-reduced @gol 291-femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol 292-p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol 293-print-multi-directory -print-multi-lib @gol 294-print-prog-name=@var{program} -print-search-dirs -Q @gol 295-save-temps -time} 296 297@item Optimization Options 298@xref{Optimize Options,,Options that Control Optimization}. 299@gccoptlist{-falign-functions=@var{n} -falign-jumps=@var{n} @gol 300-falign-labels=@var{n} -falign-loops=@var{n} @gol 301-fbounds-check -fmudflap -fmudflapth -fmudflapir @gol 302-fbranch-probabilities -fprofile-values -fvpt -fbranch-target-load-optimize @gol 303-fbranch-target-load-optimize2 -fbtr-bb-exclusive @gol 304-fcaller-saves -fcprop-registers -fcse-follow-jumps @gol 305-fcse-skip-blocks -fcx-limited-range -fdata-sections @gol 306-fdelayed-branch -fdelete-null-pointer-checks -fearly-inlining @gol 307-fexpensive-optimizations -ffast-math -ffloat-store @gol 308-fforce-addr -ffunction-sections @gol 309-fgcse -fgcse-lm -fgcse-sm -fgcse-las -fgcse-after-reload @gol 310-fcrossjumping -fif-conversion -fif-conversion2 @gol 311-finline-functions -finline-functions-called-once @gol 312-finline-limit=@var{n} -fkeep-inline-functions @gol 313-fkeep-static-consts -fmerge-constants -fmerge-all-constants @gol 314-fmodulo-sched -fno-branch-count-reg @gol 315-fno-default-inline -fno-defer-pop -fmove-loop-invariants @gol 316-fno-function-cse -fno-guess-branch-probability @gol 317-fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol 318-funsafe-math-optimizations -funsafe-loop-optimizations -ffinite-math-only @gol 319-fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol 320-fomit-frame-pointer -foptimize-register-move @gol 321-foptimize-sibling-calls -fprefetch-loop-arrays @gol 322-fprofile-generate -fprofile-use @gol 323-fregmove -frename-registers @gol 324-freorder-blocks -freorder-blocks-and-partition -freorder-functions @gol 325-frerun-cse-after-loop @gol 326-frounding-math -frtl-abstract-sequences @gol 327-fschedule-insns -fschedule-insns2 @gol 328-fno-sched-interblock -fno-sched-spec -fsched-spec-load @gol 329-fsched-spec-load-dangerous @gol 330-fsched-stalled-insns=@var{n} -fsched-stalled-insns-dep=@var{n} @gol 331-fsched2-use-superblocks @gol 332-fsched2-use-traces -fsee -freschedule-modulo-scheduled-loops @gol 333-fsection-anchors -fsignaling-nans -fsingle-precision-constant @gol 334-fstack-protector -fstack-protector-all -fstack-protector-strong @gol 335-fstrict-aliasing -fstrict-overflow -ftracer -fthread-jumps @gol 336-funroll-all-loops -funroll-loops -fpeel-loops @gol 337-fsplit-ivs-in-unroller -funswitch-loops @gol 338-fvariable-expansion-in-unroller @gol 339-ftree-pre -ftree-ccp -ftree-dce -ftree-loop-optimize @gol 340-ftree-loop-linear -ftree-loop-im -ftree-loop-ivcanon -fivopts @gol 341-ftree-dominator-opts -ftree-dse -ftree-copyrename -ftree-sink @gol 342-ftree-ch -ftree-sra -ftree-ter -ftree-lrs -ftree-fre -ftree-vectorize @gol 343-ftree-vect-loop-version -ftree-salias -fipa-pta -fweb @gol 344-ftree-copy-prop -ftree-store-ccp -ftree-store-copy-prop -fwhole-program @gol 345--param @var{name}=@var{value} 346-O -O0 -O1 -O2 -O3 -Os} 347 348@item Preprocessor Options 349@xref{Preprocessor Options,,Options Controlling the Preprocessor}. 350@gccoptlist{-A@var{question}=@var{answer} @gol 351-A-@var{question}@r{[}=@var{answer}@r{]} @gol 352-C -dD -dI -dM -dN @gol 353-D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol 354-idirafter @var{dir} @gol 355-include @var{file} -imacros @var{file} @gol 356-iprefix @var{file} -iwithprefix @var{dir} @gol 357-iwithprefixbefore @var{dir} -isystem @var{dir} @gol 358-imultilib @var{dir} -isysroot @var{dir} @gol 359-M -MM -MF -MG -MP -MQ -MT -nostdinc @gol 360-P -fworking-directory -remap @gol 361-trigraphs -undef -U@var{macro} -Wp,@var{option} @gol 362-Xpreprocessor @var{option}} 363 364@item Assembler Option 365@xref{Assembler Options,,Passing Options to the Assembler}. 366@gccoptlist{-Wa,@var{option} -Xassembler @var{option}} 367 368@item Linker Options 369@xref{Link Options,,Options for Linking}. 370@gccoptlist{@var{object-file-name} -l@var{library} @gol 371-nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol 372-s -static -static-libgcc -shared -shared-libgcc -symbolic @gol 373-Wl,@var{option} -Xlinker @var{option} @gol 374-u @var{symbol}} 375 376@item Directory Options 377@xref{Directory Options,,Options for Directory Search}. 378@gccoptlist{-B@var{prefix} -I@var{dir} -iquote@var{dir} -L@var{dir} 379-specs=@var{file} -I- --sysroot=@var{dir}} 380 381@item Target Options 382@c I wrote this xref this way to avoid overfull hbox. -- rms 383@xref{Target Options}. 384@gccoptlist{-V @var{version} -b @var{machine}} 385 386@item Machine Dependent Options 387@xref{Submodel Options,,Hardware Models and Configurations}. 388@c This list is ordered alphanumerically by subsection name. 389@c Try and put the significant identifier (CPU or system) first, 390@c so users have a clue at guessing where the ones they want will be. 391 392@emph{ARC Options} 393@gccoptlist{-EB -EL @gol 394-mmangle-cpu -mcpu=@var{cpu} -mtext=@var{text-section} @gol 395-mdata=@var{data-section} -mrodata=@var{readonly-data-section}} 396 397@emph{ARM Options} 398@gccoptlist{-mapcs-frame -mno-apcs-frame @gol 399-mabi=@var{name} @gol 400-mapcs-stack-check -mno-apcs-stack-check @gol 401-mapcs-float -mno-apcs-float @gol 402-mapcs-reentrant -mno-apcs-reentrant @gol 403-msched-prolog -mno-sched-prolog @gol 404-mlittle-endian -mbig-endian -mwords-little-endian @gol 405-mfloat-abi=@var{name} -msoft-float -mhard-float -mfpe @gol 406-mthumb-interwork -mno-thumb-interwork @gol 407-mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol 408-mstructure-size-boundary=@var{n} @gol 409-mabort-on-noreturn @gol 410-mlong-calls -mno-long-calls @gol 411-msingle-pic-base -mno-single-pic-base @gol 412-mpic-register=@var{reg} @gol 413-mnop-fun-dllimport @gol 414-mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol 415-mpoke-function-name @gol 416-mthumb -marm @gol 417-mtpcs-frame -mtpcs-leaf-frame @gol 418-mcaller-super-interworking -mcallee-super-interworking @gol 419-mtp=@var{name}} 420 421@emph{AVR Options} 422@gccoptlist{-mmcu=@var{mcu} -msize -minit-stack=@var{n} -mno-interrupts @gol 423-mcall-prologues -mno-tablejump -mtiny-stack -mint8} 424 425@emph{Blackfin Options} 426@gccoptlist{-momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol 427-mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol 428-mlow-64k -mno-low64k -mid-shared-library @gol 429-mno-id-shared-library -mshared-library-id=@var{n} @gol 430-mlong-calls -mno-long-calls} 431 432@emph{CRIS Options} 433@gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol 434-mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol 435-metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol 436-mstack-align -mdata-align -mconst-align @gol 437-m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol 438-melf -maout -melinux -mlinux -sim -sim2 @gol 439-mmul-bug-workaround -mno-mul-bug-workaround} 440 441@emph{CRX Options} 442@gccoptlist{-mmac -mpush-args} 443 444@emph{Darwin Options} 445@gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol 446-arch_only -bind_at_load -bundle -bundle_loader @gol 447-client_name -compatibility_version -current_version @gol 448-dead_strip @gol 449-dependency-file -dylib_file -dylinker_install_name @gol 450-dynamic -dynamiclib -exported_symbols_list @gol 451-filelist -flat_namespace -force_cpusubtype_ALL @gol 452-force_flat_namespace -headerpad_max_install_names @gol 453-image_base -init -install_name -keep_private_externs @gol 454-multi_module -multiply_defined -multiply_defined_unused @gol 455-noall_load -no_dead_strip_inits_and_terms @gol 456-nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol 457-pagezero_size -prebind -prebind_all_twolevel_modules @gol 458-private_bundle -read_only_relocs -sectalign @gol 459-sectobjectsymbols -whyload -seg1addr @gol 460-sectcreate -sectobjectsymbols -sectorder @gol 461-segaddr -segs_read_only_addr -segs_read_write_addr @gol 462-seg_addr_table -seg_addr_table_filename -seglinkedit @gol 463-segprot -segs_read_only_addr -segs_read_write_addr @gol 464-single_module -static -sub_library -sub_umbrella @gol 465-twolevel_namespace -umbrella -undefined @gol 466-unexported_symbols_list -weak_reference_mismatches @gol 467-whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol 468-mkernel -mone-byte-bool} 469 470@emph{DEC Alpha Options} 471@gccoptlist{-mno-fp-regs -msoft-float -malpha-as -mgas @gol 472-mieee -mieee-with-inexact -mieee-conformant @gol 473-mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol 474-mtrap-precision=@var{mode} -mbuild-constants @gol 475-mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol 476-mbwx -mmax -mfix -mcix @gol 477-mfloat-vax -mfloat-ieee @gol 478-mexplicit-relocs -msmall-data -mlarge-data @gol 479-msmall-text -mlarge-text @gol 480-mmemory-latency=@var{time}} 481 482@emph{DEC Alpha/VMS Options} 483@gccoptlist{-mvms-return-codes} 484 485@emph{FRV Options} 486@gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol 487-mhard-float -msoft-float @gol 488-malloc-cc -mfixed-cc -mdword -mno-dword @gol 489-mdouble -mno-double @gol 490-mmedia -mno-media -mmuladd -mno-muladd @gol 491-mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol 492-mlinked-fp -mlong-calls -malign-labels @gol 493-mlibrary-pic -macc-4 -macc-8 @gol 494-mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol 495-moptimize-membar -mno-optimize-membar @gol 496-mscc -mno-scc -mcond-exec -mno-cond-exec @gol 497-mvliw-branch -mno-vliw-branch @gol 498-mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol 499-mno-nested-cond-exec -mtomcat-stats @gol 500-mTLS -mtls @gol 501-mcpu=@var{cpu}} 502 503@emph{GNU/Linux Options} 504@gccoptlist{-muclibc} 505 506@emph{H8/300 Options} 507@gccoptlist{-mrelax -mh -ms -mn -mint32 -malign-300} 508 509@emph{HPPA Options} 510@gccoptlist{-march=@var{architecture-type} @gol 511-mbig-switch -mdisable-fpregs -mdisable-indexing @gol 512-mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol 513-mfixed-range=@var{register-range} @gol 514-mjump-in-delay -mlinker-opt -mlong-calls @gol 515-mlong-load-store -mno-big-switch -mno-disable-fpregs @gol 516-mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol 517-mno-jump-in-delay -mno-long-load-store @gol 518-mno-portable-runtime -mno-soft-float @gol 519-mno-space-regs -msoft-float -mpa-risc-1-0 @gol 520-mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol 521-mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol 522-munix=@var{unix-std} -nolibdld -static -threads} 523 524@emph{i386 and x86-64 Options} 525@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol 526-mfpmath=@var{unit} @gol 527-masm=@var{dialect} -mno-fancy-math-387 @gol 528-mno-fp-ret-in-387 -msoft-float -msvr3-shlib @gol 529-mno-wide-multiply -mrtd -malign-double @gol 530-mpreferred-stack-boundary=@var{num} @gol 531-mmmx -msse -msse2 -msse3 -mssse3 -msse4a -m3dnow -mpopcnt -mabm -maes @gol 532-mthreads -mno-align-stringops -minline-all-stringops @gol 533-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol 534-m96bit-long-double -mregparm=@var{num} -msseregparm @gol 535-mstackrealign @gol 536-momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol 537-mcmodel=@var{code-model} @gol 538-m32 -m64 -mlarge-data-threshold=@var{num}} 539 540@emph{IA-64 Options} 541@gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol 542-mvolatile-asm-stop -mregister-names -mno-sdata @gol 543-mconstant-gp -mauto-pic -minline-float-divide-min-latency @gol 544-minline-float-divide-max-throughput @gol 545-minline-int-divide-min-latency @gol 546-minline-int-divide-max-throughput @gol 547-minline-sqrt-min-latency -minline-sqrt-max-throughput @gol 548-mno-dwarf2-asm -mearly-stop-bits @gol 549-mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol 550-mtune=@var{cpu-type} -mt -pthread -milp32 -mlp64 @gol 551-mno-sched-br-data-spec -msched-ar-data-spec -mno-sched-control-spec @gol 552-msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol 553-msched-ldc -mno-sched-control-ldc -mno-sched-spec-verbose @gol 554-mno-sched-prefer-non-data-spec-insns @gol 555-mno-sched-prefer-non-control-spec-insns @gol 556-mno-sched-count-spec-in-critical-path} 557 558@emph{M32R/D Options} 559@gccoptlist{-m32r2 -m32rx -m32r @gol 560-mdebug @gol 561-malign-loops -mno-align-loops @gol 562-missue-rate=@var{number} @gol 563-mbranch-cost=@var{number} @gol 564-mmodel=@var{code-size-model-type} @gol 565-msdata=@var{sdata-type} @gol 566-mno-flush-func -mflush-func=@var{name} @gol 567-mno-flush-trap -mflush-trap=@var{number} @gol 568-G @var{num}} 569 570@emph{M32C Options} 571@gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}} 572 573@emph{M680x0 Options} 574@gccoptlist{-m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol 575-m68060 -mcpu32 -m5200 -mcfv4e -m68881 -mbitfield @gol 576-mc68000 -mc68020 @gol 577-mnobitfield -mrtd -mshort -msoft-float -mpcrel @gol 578-malign-int -mstrict-align -msep-data -mno-sep-data @gol 579-mshared-library-id=n -mid-shared-library -mno-id-shared-library} 580 581@emph{M68hc1x Options} 582@gccoptlist{-m6811 -m6812 -m68hc11 -m68hc12 -m68hcs12 @gol 583-mauto-incdec -minmax -mlong-calls -mshort @gol 584-msoft-reg-count=@var{count}} 585 586@emph{MCore Options} 587@gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol 588-mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol 589-m4byte-functions -mno-4byte-functions -mcallgraph-data @gol 590-mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol 591-mlittle-endian -mbig-endian -m210 -m340 -mstack-increment} 592 593@emph{MIPS Options} 594@gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol 595-mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips64 @gol 596-mips16 -mno-mips16 -mabi=@var{abi} -mabicalls -mno-abicalls @gol 597-mshared -mno-shared -mxgot -mno-xgot -mgp32 -mgp64 @gol 598-mfp32 -mfp64 -mhard-float -msoft-float @gol 599-msingle-float -mdouble-float -mdsp -mpaired-single -mips3d @gol 600-mlong64 -mlong32 -msym32 -mno-sym32 @gol 601-G@var{num} -membedded-data -mno-embedded-data @gol 602-muninit-const-in-rodata -mno-uninit-const-in-rodata @gol 603-msplit-addresses -mno-split-addresses @gol 604-mexplicit-relocs -mno-explicit-relocs @gol 605-mcheck-zero-division -mno-check-zero-division @gol 606-mdivide-traps -mdivide-breaks @gol 607-mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol 608-mmad -mno-mad -mfused-madd -mno-fused-madd -nocpp @gol 609-mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol 610-mfix-vr4120 -mno-fix-vr4120 -mfix-vr4130 @gol 611-mfix-sb1 -mno-fix-sb1 @gol 612-mflush-func=@var{func} -mno-flush-func @gol 613-mbranch-likely -mno-branch-likely @gol 614-mfp-exceptions -mno-fp-exceptions @gol 615-mvr4130-align -mno-vr4130-align} 616 617@emph{MMIX Options} 618@gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol 619-mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol 620-melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol 621-mno-base-addresses -msingle-exit -mno-single-exit} 622 623@emph{MN10300 Options} 624@gccoptlist{-mmult-bug -mno-mult-bug @gol 625-mam33 -mno-am33 @gol 626-mam33-2 -mno-am33-2 @gol 627-mreturn-pointer-on-d0 @gol 628-mno-crt0 -mrelax} 629 630@emph{MT Options} 631@gccoptlist{-mno-crt0 -mbacc -msim @gol 632-march=@var{cpu-type} } 633 634@emph{PDP-11 Options} 635@gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol 636-mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol 637-mint16 -mno-int32 -mfloat32 -mno-float64 @gol 638-mfloat64 -mno-float32 -mabshi -mno-abshi @gol 639-mbranch-expensive -mbranch-cheap @gol 640-msplit -mno-split -munix-asm -mdec-asm} 641 642@emph{PowerPC Options} 643See RS/6000 and PowerPC Options. 644 645@emph{RS/6000 and PowerPC Options} 646@gccoptlist{-mcpu=@var{cpu-type} @gol 647-mtune=@var{cpu-type} @gol 648-mpower -mno-power -mpower2 -mno-power2 @gol 649-mpowerpc -mpowerpc64 -mno-powerpc @gol 650-maltivec -mno-altivec @gol 651-mpowerpc-gpopt -mno-powerpc-gpopt @gol 652-mpowerpc-gfxopt -mno-powerpc-gfxopt @gol 653-mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mfprnd -mno-fprnd @gol 654-mnew-mnemonics -mold-mnemonics @gol 655-mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol 656-m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol 657-malign-power -malign-natural @gol 658-msoft-float -mhard-float -mmultiple -mno-multiple @gol 659-mstring -mno-string -mupdate -mno-update @gol 660-mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol 661-mstrict-align -mno-strict-align -mrelocatable @gol 662-mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol 663-mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol 664-mdynamic-no-pic -maltivec -mswdiv @gol 665-mprioritize-restricted-insns=@var{priority} @gol 666-msched-costly-dep=@var{dependence_type} @gol 667-minsert-sched-nops=@var{scheme} @gol 668-mcall-sysv -mcall-netbsd @gol 669-maix-struct-return -msvr4-struct-return @gol 670-mabi=@var{abi-type} -msecure-plt -mbss-plt @gol 671-misel -mno-isel @gol 672-misel=yes -misel=no @gol 673-mspe -mno-spe @gol 674-mspe=yes -mspe=no @gol 675-mvrsave -mno-vrsave @gol 676-mmulhw -mno-mulhw @gol 677-mdlmzb -mno-dlmzb @gol 678-mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol 679-mprototype -mno-prototype @gol 680-msim -mmvme -mads -myellowknife -memb -msdata @gol 681-msdata=@var{opt} -mvxworks -mwindiss -G @var{num} -pthread} 682 683@emph{S/390 and zSeries Options} 684@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol 685-mhard-float -msoft-float -mlong-double-64 -mlong-double-128 @gol 686-mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol 687-msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol 688-m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol 689-mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol 690-mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard} 691 692@emph{Score Options} 693@gccoptlist{-meb -mel @gol 694-mnhwloop @gol 695-muls @gol 696-mmac @gol 697-mscore5 -mscore5u -mscore7 -mscore7d} 698 699@emph{SH Options} 700@gccoptlist{-m1 -m2 -m2e -m3 -m3e @gol 701-m4-nofpu -m4-single-only -m4-single -m4 @gol 702-m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol 703-m5-64media -m5-64media-nofpu @gol 704-m5-32media -m5-32media-nofpu @gol 705-m5-compact -m5-compact-nofpu @gol 706-mb -ml -mdalign -mrelax @gol 707-mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol 708-mieee -misize -mpadstruct -mspace @gol 709-mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol 710-mdivsi3_libfunc=@var{name} @gol 711-madjust-unroll -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol 712 -minvalid-symbols} 713 714@emph{SPARC Options} 715@gccoptlist{-mcpu=@var{cpu-type} @gol 716-mtune=@var{cpu-type} @gol 717-mcmodel=@var{code-model} @gol 718-m32 -m64 -mapp-regs -mno-app-regs @gol 719-mfaster-structs -mno-faster-structs @gol 720-mfpu -mno-fpu -mhard-float -msoft-float @gol 721-mhard-quad-float -msoft-quad-float @gol 722-mimpure-text -mno-impure-text -mlittle-endian @gol 723-mstack-bias -mno-stack-bias @gol 724-munaligned-doubles -mno-unaligned-doubles @gol 725-mv8plus -mno-v8plus -mvis -mno-vis 726-threads -pthreads -pthread} 727 728@emph{System V Options} 729@gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}} 730 731@emph{TMS320C3x/C4x Options} 732@gccoptlist{-mcpu=@var{cpu} -mbig -msmall -mregparm -mmemparm @gol 733-mfast-fix -mmpyi -mbk -mti -mdp-isr-reload @gol 734-mrpts=@var{count} -mrptb -mdb -mloop-unsigned @gol 735-mparallel-insns -mparallel-mpy -mpreserve-float} 736 737@emph{V850 Options} 738@gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol 739-mprolog-function -mno-prolog-function -mspace @gol 740-mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol 741-mapp-regs -mno-app-regs @gol 742-mdisable-callt -mno-disable-callt @gol 743-mv850e1 @gol 744-mv850e @gol 745-mv850 -mbig-switch} 746 747@emph{VAX Options} 748@gccoptlist{-mg -mgnu -munix} 749 750@emph{x86-64 Options} 751See i386 and x86-64 Options. 752 753@emph{Xstormy16 Options} 754@gccoptlist{-msim} 755 756@emph{Xtensa Options} 757@gccoptlist{-mconst16 -mno-const16 @gol 758-mfused-madd -mno-fused-madd @gol 759-mtext-section-literals -mno-text-section-literals @gol 760-mtarget-align -mno-target-align @gol 761-mlongcalls -mno-longcalls} 762 763@emph{zSeries Options} 764See S/390 and zSeries Options. 765 766@item Code Generation Options 767@xref{Code Gen Options,,Options for Code Generation Conventions}. 768@gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol 769-ffixed-@var{reg} -fexceptions @gol 770-fnon-call-exceptions -funwind-tables @gol 771-fasynchronous-unwind-tables @gol 772-finhibit-size-directive -finstrument-functions @gol 773-finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol 774-finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @gol 775-fno-common -fno-ident @gol 776-fpcc-struct-return -fpic -fPIC -fpie -fPIE @gol 777-fno-jump-tables @gol 778-freg-struct-return -fshort-enums @gol 779-fshort-double -fshort-wchar @gol 780-fverbose-asm -fpack-struct[=@var{n}] -fstack-check @gol 781-fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol 782-fargument-alias -fargument-noalias @gol 783-fargument-noalias-global -fargument-noalias-anything 784-fleading-underscore -ftls-model=@var{model} @gol 785-ftrapv -fwrapv -fbounds-check @gol 786-fvisibility} 787@end table 788 789@menu 790* Overall Options:: Controlling the kind of output: 791 an executable, object files, assembler files, 792 or preprocessed source. 793* C Dialect Options:: Controlling the variant of C language compiled. 794* C++ Dialect Options:: Variations on C++. 795* Language Independent Options:: Controlling how diagnostics should be 796 formatted. 797* Warning Options:: How picky should the compiler be? 798* Debugging Options:: Symbol tables, measurements, and debugging dumps. 799* Optimize Options:: How much optimization? 800* Preprocessor Options:: Controlling header files and macro definitions. 801 Also, getting dependency information for Make. 802* Assembler Options:: Passing options to the assembler. 803* Link Options:: Specifying libraries and so on. 804* Directory Options:: Where to find header files and libraries. 805 Where to find the compiler executable files. 806* Spec Files:: How to pass switches to sub-processes. 807* Target Options:: Running a cross-compiler, or an old version of GCC. 808@end menu 809 810@node Overall Options 811@section Options Controlling the Kind of Output 812 813Compilation can involve up to four stages: preprocessing, compilation 814proper, assembly and linking, always in that order. GCC is capable of 815preprocessing and compiling several files either into several 816assembler input files, or into one assembler input file; then each 817assembler input file produces an object file, and linking combines all 818the object files (those newly compiled, and those specified as input) 819into an executable file. 820 821@cindex file name suffix 822For any given input file, the file name suffix determines what kind of 823compilation is done: 824 825@table @gcctabopt 826@item @var{file}.c 827C source code which must be preprocessed. 828 829@item @var{file}.i 830C source code which should not be preprocessed. 831 832@item @var{file}.ii 833C++ source code which should not be preprocessed. 834 835@item @var{file}.h 836C, or C++ header file to be turned into a precompiled header. 837 838@item @var{file}.cc 839@itemx @var{file}.cp 840@itemx @var{file}.cxx 841@itemx @var{file}.cpp 842@itemx @var{file}.CPP 843@itemx @var{file}.c++ 844@itemx @var{file}.C 845C++ source code which must be preprocessed. Note that in @samp{.cxx}, 846the last two letters must both be literally @samp{x}. Likewise, 847@samp{.C} refers to a literal capital C@. 848 849@item @var{file}.hh 850@itemx @var{file}.H 851C++ header file to be turned into a precompiled header. 852 853@item @var{file}.f 854@itemx @var{file}.for 855@itemx @var{file}.FOR 856Fixed form Fortran source code which should not be preprocessed. 857 858@item @var{file}.F 859@itemx @var{file}.fpp 860@itemx @var{file}.FPP 861Fixed form Fortran source code which must be preprocessed (with the traditional 862preprocessor). 863 864@item @var{file}.f90 865@itemx @var{file}.f95 866Free form Fortran source code which should not be preprocessed. 867 868@item @var{file}.F90 869@itemx @var{file}.F95 870Free form Fortran source code which must be preprocessed (with the 871traditional preprocessor). 872 873@c FIXME: Descriptions of Java file types. 874@c @var{file}.java 875@c @var{file}.class 876@c @var{file}.zip 877@c @var{file}.jar 878 879@item @var{file}.ads 880Ada source code file which contains a library unit declaration (a 881declaration of a package, subprogram, or generic, or a generic 882instantiation), or a library unit renaming declaration (a package, 883generic, or subprogram renaming declaration). Such files are also 884called @dfn{specs}. 885 886@itemx @var{file}.adb 887Ada source code file containing a library unit body (a subprogram or 888package body). Such files are also called @dfn{bodies}. 889 890@c GCC also knows about some suffixes for languages not yet included: 891@c Pascal: 892@c @var{file}.p 893@c @var{file}.pas 894@c Ratfor: 895@c @var{file}.r 896 897@item @var{file}.s 898Assembler code. 899 900@item @var{file}.S 901Assembler code which must be preprocessed. 902 903@item @var{other} 904An object file to be fed straight into linking. 905Any file name with no recognized suffix is treated this way. 906@end table 907 908@opindex x 909You can specify the input language explicitly with the @option{-x} option: 910 911@table @gcctabopt 912@item -x @var{language} 913Specify explicitly the @var{language} for the following input files 914(rather than letting the compiler choose a default based on the file 915name suffix). This option applies to all following input files until 916the next @option{-x} option. Possible values for @var{language} are: 917@smallexample 918c c-header c-cpp-output 919c++ c++-header c++-cpp-output 920assembler assembler-with-cpp 921ada 922f95 f95-cpp-input 923java 924treelang 925@end smallexample 926 927@item -x none 928Turn off any specification of a language, so that subsequent files are 929handled according to their file name suffixes (as they are if @option{-x} 930has not been used at all). 931 932@item -pass-exit-codes 933@opindex pass-exit-codes 934Normally the @command{gcc} program will exit with the code of 1 if any 935phase of the compiler returns a non-success return code. If you specify 936@option{-pass-exit-codes}, the @command{gcc} program will instead return with 937numerically highest error produced by any phase that returned an error 938indication. The C, C++, and Fortran frontends return 4, if an internal 939compiler error is encountered. 940@end table 941 942If you only want some of the stages of compilation, you can use 943@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and 944one of the options @option{-c}, @option{-S}, or @option{-E} to say where 945@command{gcc} is to stop. Note that some combinations (for example, 946@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all. 947 948@table @gcctabopt 949@item -c 950@opindex c 951Compile or assemble the source files, but do not link. The linking 952stage simply is not done. The ultimate output is in the form of an 953object file for each source file. 954 955By default, the object file name for a source file is made by replacing 956the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}. 957 958Unrecognized input files, not requiring compilation or assembly, are 959ignored. 960 961@item -S 962@opindex S 963Stop after the stage of compilation proper; do not assemble. The output 964is in the form of an assembler code file for each non-assembler input 965file specified. 966 967By default, the assembler file name for a source file is made by 968replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}. 969 970Input files that don't require compilation are ignored. 971 972@item -E 973@opindex E 974Stop after the preprocessing stage; do not run the compiler proper. The 975output is in the form of preprocessed source code, which is sent to the 976standard output. 977 978Input files which don't require preprocessing are ignored. 979 980@cindex output file option 981@item -o @var{file} 982@opindex o 983Place output in file @var{file}. This applies regardless to whatever 984sort of output is being produced, whether it be an executable file, 985an object file, an assembler file or preprocessed C code. 986 987If @option{-o} is not specified, the default is to put an executable 988file in @file{a.out}, the object file for 989@file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its 990assembler file in @file{@var{source}.s}, a precompiled header file in 991@file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on 992standard output. 993 994@item -v 995@opindex v 996Print (on standard error output) the commands executed to run the stages 997of compilation. Also print the version number of the compiler driver 998program and of the preprocessor and the compiler proper. 999 1000@item -### 1001@opindex ### 1002Like @option{-v} except the commands are not executed and all command 1003arguments are quoted. This is useful for shell scripts to capture the 1004driver-generated command lines. 1005 1006@item -pipe 1007@opindex pipe 1008Use pipes rather than temporary files for communication between the 1009various stages of compilation. This fails to work on some systems where 1010the assembler is unable to read from a pipe; but the GNU assembler has 1011no trouble. 1012 1013@item -combine 1014@opindex combine 1015If you are compiling multiple source files, this option tells the driver 1016to pass all the source files to the compiler at once (for those 1017languages for which the compiler can handle this). This will allow 1018intermodule analysis (IMA) to be performed by the compiler. Currently the only 1019language for which this is supported is C@. If you pass source files for 1020multiple languages to the driver, using this option, the driver will invoke 1021the compiler(s) that support IMA once each, passing each compiler all the 1022source files appropriate for it. For those languages that do not support 1023IMA this option will be ignored, and the compiler will be invoked once for 1024each source file in that language. If you use this option in conjunction 1025with @option{-save-temps}, the compiler will generate multiple 1026pre-processed files 1027(one for each source file), but only one (combined) @file{.o} or 1028@file{.s} file. 1029 1030@item --help 1031@opindex help 1032Print (on the standard output) a description of the command line options 1033understood by @command{gcc}. If the @option{-v} option is also specified 1034then @option{--help} will also be passed on to the various processes 1035invoked by @command{gcc}, so that they can display the command line options 1036they accept. If the @option{-Wextra} option is also specified then command 1037line options which have no documentation associated with them will also 1038be displayed. 1039 1040@item --target-help 1041@opindex target-help 1042Print (on the standard output) a description of target specific command 1043line options for each tool. 1044 1045@item --version 1046@opindex version 1047Display the version number and copyrights of the invoked GCC@. 1048 1049@include @value{srcdir}/../libiberty/at-file.texi 1050@end table 1051 1052@node Invoking G++ 1053@section Compiling C++ Programs 1054 1055@cindex suffixes for C++ source 1056@cindex C++ source file suffixes 1057C++ source files conventionally use one of the suffixes @samp{.C}, 1058@samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or 1059@samp{.cxx}; C++ header files often use @samp{.hh} or @samp{.H}; and 1060preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes 1061files with these names and compiles them as C++ programs even if you 1062call the compiler the same way as for compiling C programs (usually 1063with the name @command{gcc}). 1064 1065@findex g++ 1066@findex c++ 1067However, the use of @command{gcc} does not add the C++ library. 1068@command{g++} is a program that calls GCC and treats @samp{.c}, 1069@samp{.h} and @samp{.i} files as C++ source files instead of C source 1070files unless @option{-x} is used, and automatically specifies linking 1071against the C++ library. This program is also useful when 1072precompiling a C header file with a @samp{.h} extension for use in C++ 1073compilations. On many systems, @command{g++} is also installed with 1074the name @command{c++}. 1075 1076@cindex invoking @command{g++} 1077When you compile C++ programs, you may specify many of the same 1078command-line options that you use for compiling programs in any 1079language; or command-line options meaningful for C and related 1080languages; or options that are meaningful only for C++ programs. 1081@xref{C Dialect Options,,Options Controlling C Dialect}, for 1082explanations of options for languages related to C@. 1083@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for 1084explanations of options that are meaningful only for C++ programs. 1085 1086@node C Dialect Options 1087@section Options Controlling C Dialect 1088@cindex dialect options 1089@cindex language dialect options 1090@cindex options, dialect 1091 1092The following options control the dialect of C (or languages derived 1093from C, such as C++) that the compiler accepts: 1094 1095@table @gcctabopt 1096@cindex ANSI support 1097@cindex ISO support 1098@item -ansi 1099@opindex ansi 1100In C mode, support all ISO C90 programs. In C++ mode, 1101remove GNU extensions that conflict with ISO C++. 1102 1103This turns off certain features of GCC that are incompatible with ISO 1104C90 (when compiling C code), or of standard C++ (when compiling C++ code), 1105such as the @code{asm} and @code{typeof} keywords, and 1106predefined macros such as @code{unix} and @code{vax} that identify the 1107type of system you are using. It also enables the undesirable and 1108rarely used ISO trigraph feature. For the C compiler, 1109it disables recognition of C++ style @samp{//} comments as well as 1110the @code{inline} keyword. 1111 1112The alternate keywords @code{__asm__}, @code{__extension__}, 1113@code{__inline__} and @code{__typeof__} continue to work despite 1114@option{-ansi}. You would not want to use them in an ISO C program, of 1115course, but it is useful to put them in header files that might be included 1116in compilations done with @option{-ansi}. Alternate predefined macros 1117such as @code{__unix__} and @code{__vax__} are also available, with or 1118without @option{-ansi}. 1119 1120The @option{-ansi} option does not cause non-ISO programs to be 1121rejected gratuitously. For that, @option{-pedantic} is required in 1122addition to @option{-ansi}. @xref{Warning Options}. 1123 1124The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi} 1125option is used. Some header files may notice this macro and refrain 1126from declaring certain functions or defining certain macros that the 1127ISO standard doesn't call for; this is to avoid interfering with any 1128programs that might use these names for other things. 1129 1130Functions which would normally be built in but do not have semantics 1131defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in 1132functions with @option{-ansi} is used. @xref{Other Builtins,,Other 1133built-in functions provided by GCC}, for details of the functions 1134affected. 1135 1136@item -std= 1137@opindex std 1138Determine the language standard. This option is currently only 1139supported when compiling C or C++. A value for this option must be 1140provided; possible values are 1141 1142@table @samp 1143@item c89 1144@itemx iso9899:1990 1145ISO C90 (same as @option{-ansi}). 1146 1147@item iso9899:199409 1148ISO C90 as modified in amendment 1. 1149 1150@item c99 1151@itemx c9x 1152@itemx iso9899:1999 1153@itemx iso9899:199x 1154ISO C99. Note that this standard is not yet fully supported; see 1155@w{@uref{http://gcc.gnu.org/gcc-4.2/c99status.html}} for more information. The 1156names @samp{c9x} and @samp{iso9899:199x} are deprecated. 1157 1158@item gnu89 1159Default, ISO C90 plus GNU extensions (including some C99 features). 1160 1161@item gnu99 1162@itemx gnu9x 1163ISO C99 plus GNU extensions. When ISO C99 is fully implemented in GCC, 1164this will become the default. The name @samp{gnu9x} is deprecated. 1165 1166@item c++98 1167The 1998 ISO C++ standard plus amendments. 1168 1169@item gnu++98 1170The same as @option{-std=c++98} plus GNU extensions. This is the 1171default for C++ code. 1172@end table 1173 1174Even when this option is not specified, you can still use some of the 1175features of newer standards in so far as they do not conflict with 1176previous C standards. For example, you may use @code{__restrict__} even 1177when @option{-std=c99} is not specified. 1178 1179The @option{-std} options specifying some version of ISO C have the same 1180effects as @option{-ansi}, except that features that were not in ISO C90 1181but are in the specified version (for example, @samp{//} comments and 1182the @code{inline} keyword in ISO C99) are not disabled. 1183 1184@xref{Standards,,Language Standards Supported by GCC}, for details of 1185these standard versions. 1186 1187@item -fgnu89-inline 1188@opindex fgnu89-inline 1189The option @option{-fgnu89-inline} tells GCC to use the traditional 1190GNU semantics for @code{inline} functions when in C99 mode. 1191@xref{Inline,,An Inline Function is As Fast As a Macro}. Using this 1192option is roughly equivalent to adding the @code{gnu_inline} function 1193attribute to all inline functions (@pxref{Function Attributes}). 1194 1195This option is accepted by GCC versions 4.1.3 and up. In GCC versions 1196prior to 4.3, C99 inline semantics are not supported, and thus this 1197option is effectively assumed to be present regardless of whether or not 1198it is specified; the only effect of specifying it explicitly is to 1199disable warnings about using inline functions in C99 mode. Likewise, 1200the option @option{-fno-gnu89-inline} is not supported in versions of 1201GCC before 4.3. It will be supported only in C99 or gnu99 mode, not in 1202C89 or gnu89 mode. 1203 1204The preprocesor macros @code{__GNUC_GNU_INLINE__} and 1205@code{__GNUC_STDC_INLINE__} may be used to check which semantics are 1206in effect for @code{inline} functions. @xref{Common Predefined 1207Macros,,,cpp,The C Preprocessor}. 1208 1209@item -aux-info @var{filename} 1210@opindex aux-info 1211Output to the given filename prototyped declarations for all functions 1212declared and/or defined in a translation unit, including those in header 1213files. This option is silently ignored in any language other than C@. 1214 1215Besides declarations, the file indicates, in comments, the origin of 1216each declaration (source file and line), whether the declaration was 1217implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or 1218@samp{O} for old, respectively, in the first character after the line 1219number and the colon), and whether it came from a declaration or a 1220definition (@samp{C} or @samp{F}, respectively, in the following 1221character). In the case of function definitions, a K&R-style list of 1222arguments followed by their declarations is also provided, inside 1223comments, after the declaration. 1224 1225@item -fno-asm 1226@opindex fno-asm 1227Do not recognize @code{asm}, @code{inline} or @code{typeof} as a 1228keyword, so that code can use these words as identifiers. You can use 1229the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__} 1230instead. @option{-ansi} implies @option{-fno-asm}. 1231 1232In C++, this switch only affects the @code{typeof} keyword, since 1233@code{asm} and @code{inline} are standard keywords. You may want to 1234use the @option{-fno-gnu-keywords} flag instead, which has the same 1235effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this 1236switch only affects the @code{asm} and @code{typeof} keywords, since 1237@code{inline} is a standard keyword in ISO C99. 1238 1239@c APPLE LOCAL begin blocks 7205047 5811887 1240@item -fno-blocks 1241@opindex fno-blocks 1242Disable the use of blocks. In @option{-std=c99} mode, blocks are 1243turned off by default. @option{-fblocks} can be used to re-enable the 1244feature, if off. Runtime support for blocks first appeared in Mac OS 1245X 10.6. When targeting 10.6 (see @option{-mmacosx-version-min}) and 1246later, the extension is on by default. 1247@c APPLE LOCAL end blocks 7205047 5811887 1248 1249@item -fno-builtin 1250@itemx -fno-builtin-@var{function} 1251@opindex fno-builtin 1252@cindex built-in functions 1253Don't recognize built-in functions that do not begin with 1254@samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in 1255functions provided by GCC}, for details of the functions affected, 1256including those which are not built-in functions when @option{-ansi} or 1257@option{-std} options for strict ISO C conformance are used because they 1258do not have an ISO standard meaning. 1259 1260GCC normally generates special code to handle certain built-in functions 1261more efficiently; for instance, calls to @code{alloca} may become single 1262instructions that adjust the stack directly, and calls to @code{memcpy} 1263may become inline copy loops. The resulting code is often both smaller 1264and faster, but since the function calls no longer appear as such, you 1265cannot set a breakpoint on those calls, nor can you change the behavior 1266of the functions by linking with a different library. In addition, 1267when a function is recognized as a built-in function, GCC may use 1268information about that function to warn about problems with calls to 1269that function, or to generate more efficient code, even if the 1270resulting code still contains calls to that function. For example, 1271warnings are given with @option{-Wformat} for bad calls to 1272@code{printf}, when @code{printf} is built in, and @code{strlen} is 1273known not to modify global memory. 1274 1275With the @option{-fno-builtin-@var{function}} option 1276only the built-in function @var{function} is 1277disabled. @var{function} must not begin with @samp{__builtin_}. If a 1278function is named this is not built-in in this version of GCC, this 1279option is ignored. There is no corresponding 1280@option{-fbuiltin-@var{function}} option; if you wish to enable 1281built-in functions selectively when using @option{-fno-builtin} or 1282@option{-ffreestanding}, you may define macros such as: 1283 1284@smallexample 1285#define abs(n) __builtin_abs ((n)) 1286#define strcpy(d, s) __builtin_strcpy ((d), (s)) 1287@end smallexample 1288 1289@item -fhosted 1290@opindex fhosted 1291@cindex hosted environment 1292 1293Assert that compilation takes place in a hosted environment. This implies 1294@option{-fbuiltin}. A hosted environment is one in which the 1295entire standard library is available, and in which @code{main} has a return 1296type of @code{int}. Examples are nearly everything except a kernel. 1297This is equivalent to @option{-fno-freestanding}. 1298 1299@item -ffreestanding 1300@opindex ffreestanding 1301@cindex hosted environment 1302 1303Assert that compilation takes place in a freestanding environment. This 1304implies @option{-fno-builtin}. A freestanding environment 1305is one in which the standard library may not exist, and program startup may 1306not necessarily be at @code{main}. The most obvious example is an OS kernel. 1307This is equivalent to @option{-fno-hosted}. 1308 1309@xref{Standards,,Language Standards Supported by GCC}, for details of 1310freestanding and hosted environments. 1311 1312@item -fopenmp 1313@opindex fopenmp 1314@cindex openmp parallel 1315Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and 1316@code{!$omp} in Fortran. When @option{-fopenmp} is specified, the 1317compiler generates parallel code according to the OpenMP Application 1318Program Interface v2.5 @w{@uref{http://www.openmp.org/}}. 1319 1320@item -fms-extensions 1321@opindex fms-extensions 1322Accept some non-standard constructs used in Microsoft header files. 1323 1324Some cases of unnamed fields in structures and unions are only 1325accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union 1326fields within structs/unions}, for details. 1327 1328@item -trigraphs 1329@opindex trigraphs 1330Support ISO C trigraphs. The @option{-ansi} option (and @option{-std} 1331options for strict ISO C conformance) implies @option{-trigraphs}. 1332 1333@item -no-integrated-cpp 1334@opindex no-integrated-cpp 1335Performs a compilation in two passes: preprocessing and compiling. This 1336option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the 1337@option{-B} option. The user supplied compilation step can then add in 1338an additional preprocessing step after normal preprocessing but before 1339compiling. The default is to use the integrated cpp (internal cpp) 1340 1341The semantics of this option will change if "cc1", "cc1plus", and 1342"cc1obj" are merged. 1343 1344@cindex traditional C language 1345@cindex C language, traditional 1346@item -traditional 1347@itemx -traditional-cpp 1348@opindex traditional-cpp 1349@opindex traditional 1350Formerly, these options caused GCC to attempt to emulate a pre-standard 1351C compiler. They are now only supported with the @option{-E} switch. 1352The preprocessor continues to support a pre-standard mode. See the GNU 1353CPP manual for details. 1354 1355@c APPLE LOCAL begin nested functions 4357979 1356@item -fno-nested-functions 1357@opindex fno-nested-functions 1358Disable nested functions. This option is not supported for C++ or 1359Objective-C++. On FreeBSD, nested functions are disabled by default. 1360@c APPLE LOCAL end nested functions 4357979 1361 1362@item -fcond-mismatch 1363@opindex fcond-mismatch 1364Allow conditional expressions with mismatched types in the second and 1365third arguments. The value of such an expression is void. This option 1366is not supported for C++. 1367 1368@item -flax-vector-conversions 1369@opindex flax-vector-conversions 1370Allow implicit conversions between vectors with differing numbers of 1371elements and/or incompatible element types. This option should not be 1372used for new code. 1373 1374@item -funsigned-char 1375@opindex funsigned-char 1376Let the type @code{char} be unsigned, like @code{unsigned char}. 1377 1378Each kind of machine has a default for what @code{char} should 1379be. It is either like @code{unsigned char} by default or like 1380@code{signed char} by default. 1381 1382Ideally, a portable program should always use @code{signed char} or 1383@code{unsigned char} when it depends on the signedness of an object. 1384But many programs have been written to use plain @code{char} and 1385expect it to be signed, or expect it to be unsigned, depending on the 1386machines they were written for. This option, and its inverse, let you 1387make such a program work with the opposite default. 1388 1389The type @code{char} is always a distinct type from each of 1390@code{signed char} or @code{unsigned char}, even though its behavior 1391is always just like one of those two. 1392 1393@item -fsigned-char 1394@opindex fsigned-char 1395Let the type @code{char} be signed, like @code{signed char}. 1396 1397Note that this is equivalent to @option{-fno-unsigned-char}, which is 1398the negative form of @option{-funsigned-char}. Likewise, the option 1399@option{-fno-signed-char} is equivalent to @option{-funsigned-char}. 1400 1401@item -fsigned-bitfields 1402@itemx -funsigned-bitfields 1403@itemx -fno-signed-bitfields 1404@itemx -fno-unsigned-bitfields 1405@opindex fsigned-bitfields 1406@opindex funsigned-bitfields 1407@opindex fno-signed-bitfields 1408@opindex fno-unsigned-bitfields 1409These options control whether a bit-field is signed or unsigned, when the 1410declaration does not use either @code{signed} or @code{unsigned}. By 1411default, such a bit-field is signed, because this is consistent: the 1412basic integer types such as @code{int} are signed types. 1413@end table 1414 1415@node C++ Dialect Options 1416@section Options Controlling C++ Dialect 1417 1418@cindex compiler options, C++ 1419@cindex C++ options, command line 1420@cindex options, C++ 1421This section describes the command-line options that are only meaningful 1422for C++ programs; but you can also use most of the GNU compiler options 1423regardless of what language your program is in. For example, you 1424might compile a file @code{firstClass.C} like this: 1425 1426@smallexample 1427g++ -g -frepo -O -c firstClass.C 1428@end smallexample 1429 1430@noindent 1431In this example, only @option{-frepo} is an option meant 1432only for C++ programs; you can use the other options with any 1433language supported by GCC@. 1434 1435Here is a list of options that are @emph{only} for compiling C++ programs: 1436 1437@table @gcctabopt 1438 1439@item -fabi-version=@var{n} 1440@opindex fabi-version 1441Use version @var{n} of the C++ ABI@. Version 2 is the version of the 1442C++ ABI that first appeared in G++ 3.4. Version 1 is the version of 1443the C++ ABI that first appeared in G++ 3.2. Version 0 will always be 1444the version that conforms most closely to the C++ ABI specification. 1445Therefore, the ABI obtained using version 0 will change as ABI bugs 1446are fixed. 1447 1448The default is version 2. 1449 1450@item -fno-access-control 1451@opindex fno-access-control 1452Turn off all access checking. This switch is mainly useful for working 1453around bugs in the access control code. 1454 1455@item -fcheck-new 1456@opindex fcheck-new 1457Check that the pointer returned by @code{operator new} is non-null 1458before attempting to modify the storage allocated. This check is 1459normally unnecessary because the C++ standard specifies that 1460@code{operator new} will only return @code{0} if it is declared 1461@samp{throw()}, in which case the compiler will always check the 1462return value even without this option. In all other cases, when 1463@code{operator new} has a non-empty exception specification, memory 1464exhaustion is signalled by throwing @code{std::bad_alloc}. See also 1465@samp{new (nothrow)}. 1466 1467@item -fconserve-space 1468@opindex fconserve-space 1469Put uninitialized or runtime-initialized global variables into the 1470common segment, as C does. This saves space in the executable at the 1471cost of not diagnosing duplicate definitions. If you compile with this 1472flag and your program mysteriously crashes after @code{main()} has 1473completed, you may have an object that is being destroyed twice because 1474two definitions were merged. 1475 1476This option is no longer useful on most targets, now that support has 1477been added for putting variables into BSS without making them common. 1478 1479@item -ffriend-injection 1480@opindex ffriend-injection 1481Inject friend functions into the enclosing namespace, so that they are 1482visible outside the scope of the class in which they are declared. 1483Friend functions were documented to work this way in the old Annotated 1484C++ Reference Manual, and versions of G++ before 4.1 always worked 1485that way. However, in ISO C++ a friend function which is not declared 1486in an enclosing scope can only be found using argument dependent 1487lookup. This option causes friends to be injected as they were in 1488earlier releases. 1489 1490This option is for compatibility, and may be removed in a future 1491release of G++. 1492 1493@item -fno-elide-constructors 1494@opindex fno-elide-constructors 1495The C++ standard allows an implementation to omit creating a temporary 1496which is only used to initialize another object of the same type. 1497Specifying this option disables that optimization, and forces G++ to 1498call the copy constructor in all cases. 1499 1500@item -fno-enforce-eh-specs 1501@opindex fno-enforce-eh-specs 1502Don't generate code to check for violation of exception specifications 1503at runtime. This option violates the C++ standard, but may be useful 1504for reducing code size in production builds, much like defining 1505@samp{NDEBUG}. This does not give user code permission to throw 1506exceptions in violation of the exception specifications; the compiler 1507will still optimize based on the specifications, so throwing an 1508unexpected exception will result in undefined behavior. 1509 1510@item -ffor-scope 1511@itemx -fno-for-scope 1512@opindex ffor-scope 1513@opindex fno-for-scope 1514If @option{-ffor-scope} is specified, the scope of variables declared in 1515a @i{for-init-statement} is limited to the @samp{for} loop itself, 1516as specified by the C++ standard. 1517If @option{-fno-for-scope} is specified, the scope of variables declared in 1518a @i{for-init-statement} extends to the end of the enclosing scope, 1519as was the case in old versions of G++, and other (traditional) 1520implementations of C++. 1521 1522The default if neither flag is given to follow the standard, 1523but to allow and give a warning for old-style code that would 1524otherwise be invalid, or have different behavior. 1525 1526@item -fno-gnu-keywords 1527@opindex fno-gnu-keywords 1528Do not recognize @code{typeof} as a keyword, so that code can use this 1529word as an identifier. You can use the keyword @code{__typeof__} instead. 1530@option{-ansi} implies @option{-fno-gnu-keywords}. 1531 1532@item -fno-implicit-templates 1533@opindex fno-implicit-templates 1534Never emit code for non-inline templates which are instantiated 1535implicitly (i.e.@: by use); only emit code for explicit instantiations. 1536@xref{Template Instantiation}, for more information. 1537 1538@item -fno-implicit-inline-templates 1539@opindex fno-implicit-inline-templates 1540Don't emit code for implicit instantiations of inline templates, either. 1541The default is to handle inlines differently so that compiles with and 1542without optimization will need the same set of explicit instantiations. 1543 1544@item -fno-implement-inlines 1545@opindex fno-implement-inlines 1546To save space, do not emit out-of-line copies of inline functions 1547controlled by @samp{#pragma implementation}. This will cause linker 1548errors if these functions are not inlined everywhere they are called. 1549 1550@item -fms-extensions 1551@opindex fms-extensions 1552Disable pedantic warnings about constructs used in MFC, such as implicit 1553int and getting a pointer to member function via non-standard syntax. 1554 1555@item -fno-nonansi-builtins 1556@opindex fno-nonansi-builtins 1557Disable built-in declarations of functions that are not mandated by 1558ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit}, 1559@code{index}, @code{bzero}, @code{conjf}, and other related functions. 1560 1561@item -fno-operator-names 1562@opindex fno-operator-names 1563Do not treat the operator name keywords @code{and}, @code{bitand}, 1564@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as 1565synonyms as keywords. 1566 1567@item -fno-optional-diags 1568@opindex fno-optional-diags 1569Disable diagnostics that the standard says a compiler does not need to 1570issue. Currently, the only such diagnostic issued by G++ is the one for 1571a name having multiple meanings within a class. 1572 1573@item -fpermissive 1574@opindex fpermissive 1575Downgrade some diagnostics about nonconformant code from errors to 1576warnings. Thus, using @option{-fpermissive} will allow some 1577nonconforming code to compile. 1578 1579@item -frepo 1580@opindex frepo 1581Enable automatic template instantiation at link time. This option also 1582implies @option{-fno-implicit-templates}. @xref{Template 1583Instantiation}, for more information. 1584 1585@item -fno-rtti 1586@opindex fno-rtti 1587Disable generation of information about every class with virtual 1588functions for use by the C++ runtime type identification features 1589(@samp{dynamic_cast} and @samp{typeid}). If you don't use those parts 1590of the language, you can save some space by using this flag. Note that 1591exception handling uses the same information, but it will generate it as 1592needed. The @samp{dynamic_cast} operator can still be used for casts that 1593do not require runtime type information, i.e. casts to @code{void *} or to 1594unambiguous base classes. 1595 1596@item -fstats 1597@opindex fstats 1598Emit statistics about front-end processing at the end of the compilation. 1599This information is generally only useful to the G++ development team. 1600 1601@item -ftemplate-depth-@var{n} 1602@opindex ftemplate-depth 1603Set the maximum instantiation depth for template classes to @var{n}. 1604A limit on the template instantiation depth is needed to detect 1605endless recursions during template class instantiation. ANSI/ISO C++ 1606conforming programs must not rely on a maximum depth greater than 17. 1607 1608@item -fno-threadsafe-statics 1609@opindex fno-threadsafe-statics 1610Do not emit the extra code to use the routines specified in the C++ 1611ABI for thread-safe initialization of local statics. You can use this 1612option to reduce code size slightly in code that doesn't need to be 1613thread-safe. 1614 1615@item -fuse-cxa-atexit 1616@opindex fuse-cxa-atexit 1617Register destructors for objects with static storage duration with the 1618@code{__cxa_atexit} function rather than the @code{atexit} function. 1619This option is required for fully standards-compliant handling of static 1620destructors, but will only work if your C library supports 1621@code{__cxa_atexit}. 1622 1623@item -fno-use-cxa-get-exception-ptr 1624@opindex fno-use-cxa-get-exception-ptr 1625Don't use the @code{__cxa_get_exception_ptr} runtime routine. This 1626will cause @code{std::uncaught_exception} to be incorrect, but is necessary 1627if the runtime routine is not available. 1628 1629@item -fvisibility-inlines-hidden 1630@opindex fvisibility-inlines-hidden 1631This switch declares that the user does not attempt to compare 1632pointers to inline methods where the addresses of the two functions 1633were taken in different shared objects. 1634 1635The effect of this is that GCC may, effectively, mark inline methods with 1636@code{__attribute__ ((visibility ("hidden")))} so that they do not 1637appear in the export table of a DSO and do not require a PLT indirection 1638when used within the DSO@. Enabling this option can have a dramatic effect 1639on load and link times of a DSO as it massively reduces the size of the 1640dynamic export table when the library makes heavy use of templates. 1641 1642The behaviour of this switch is not quite the same as marking the 1643methods as hidden directly, because it does not affect static variables 1644local to the function or cause the compiler to deduce that 1645the function is defined in only one shared object. 1646 1647You may mark a method as having a visibility explicitly to negate the 1648effect of the switch for that method. For example, if you do want to 1649compare pointers to a particular inline method, you might mark it as 1650having default visibility. Marking the enclosing class with explicit 1651visibility will have no effect. 1652 1653Explicitly instantiated inline methods are unaffected by this option 1654as their linkage might otherwise cross a shared library boundary. 1655@xref{Template Instantiation}. 1656 1657@item -fvisibility-ms-compat 1658@opindex fvisibility-ms-compat 1659This flag attempts to use visibility settings to make GCC's C++ 1660linkage model compatible with that of Microsoft Visual Studio. 1661 1662The flag makes these changes to GCC's linkage model: 1663 1664@enumerate 1665@item 1666It sets the default visibility to @code{hidden}, like 1667@option{-fvisibility=hidden}. 1668 1669@item 1670Types, but not their members, are not hidden by default. 1671 1672@item 1673The One Definition Rule is relaxed for types without explicit 1674visibility specifications which are defined in more than one different 1675shared object: those declarations are permitted if they would have 1676been permitted when this option was not used. 1677@end enumerate 1678 1679In new code it is better to use @option{-fvisibility=hidden} and 1680export those classes which are intended to be externally visible. 1681Unfortunately it is possible for code to rely, perhaps accidentally, 1682on the Visual Studio behaviour. 1683 1684Among the consequences of these changes are that static data members 1685of the same type with the same name but defined in different shared 1686objects will be different, so changing one will not change the other; 1687and that pointers to function members defined in different shared 1688objects may not compare equal. When this flag is given, it is a 1689violation of the ODR to define types with the same name differently. 1690 1691@item -fno-weak 1692@opindex fno-weak 1693Do not use weak symbol support, even if it is provided by the linker. 1694By default, G++ will use weak symbols if they are available. This 1695option exists only for testing, and should not be used by end-users; 1696it will result in inferior code and has no benefits. This option may 1697be removed in a future release of G++. 1698 1699@item -nostdinc++ 1700@opindex nostdinc++ 1701Do not search for header files in the standard directories specific to 1702C++, but do still search the other standard directories. (This option 1703is used when building the C++ library.) 1704@end table 1705 1706In addition, these optimization, warning, and code generation options 1707have meanings only for C++ programs: 1708 1709@table @gcctabopt 1710@item -fno-default-inline 1711@opindex fno-default-inline 1712Do not assume @samp{inline} for functions defined inside a class scope. 1713@xref{Optimize Options,,Options That Control Optimization}. Note that these 1714functions will have linkage like inline functions; they just won't be 1715inlined by default. 1716 1717@item -Wabi @r{(C++ only)} 1718@opindex Wabi 1719Warn when G++ generates code that is probably not compatible with the 1720vendor-neutral C++ ABI@. Although an effort has been made to warn about 1721all such cases, there are probably some cases that are not warned about, 1722even though G++ is generating incompatible code. There may also be 1723cases where warnings are emitted even though the code that is generated 1724will be compatible. 1725 1726You should rewrite your code to avoid these warnings if you are 1727concerned about the fact that code generated by G++ may not be binary 1728compatible with code generated by other compilers. 1729 1730The known incompatibilities at this point include: 1731 1732@itemize @bullet 1733 1734@item 1735Incorrect handling of tail-padding for bit-fields. G++ may attempt to 1736pack data into the same byte as a base class. For example: 1737 1738@smallexample 1739struct A @{ virtual void f(); int f1 : 1; @}; 1740struct B : public A @{ int f2 : 1; @}; 1741@end smallexample 1742 1743@noindent 1744In this case, G++ will place @code{B::f2} into the same byte 1745as@code{A::f1}; other compilers will not. You can avoid this problem 1746by explicitly padding @code{A} so that its size is a multiple of the 1747byte size on your platform; that will cause G++ and other compilers to 1748layout @code{B} identically. 1749 1750@item 1751Incorrect handling of tail-padding for virtual bases. G++ does not use 1752tail padding when laying out virtual bases. For example: 1753 1754@smallexample 1755struct A @{ virtual void f(); char c1; @}; 1756struct B @{ B(); char c2; @}; 1757struct C : public A, public virtual B @{@}; 1758@end smallexample 1759 1760@noindent 1761In this case, G++ will not place @code{B} into the tail-padding for 1762@code{A}; other compilers will. You can avoid this problem by 1763explicitly padding @code{A} so that its size is a multiple of its 1764alignment (ignoring virtual base classes); that will cause G++ and other 1765compilers to layout @code{C} identically. 1766 1767@item 1768Incorrect handling of bit-fields with declared widths greater than that 1769of their underlying types, when the bit-fields appear in a union. For 1770example: 1771 1772@smallexample 1773union U @{ int i : 4096; @}; 1774@end smallexample 1775 1776@noindent 1777Assuming that an @code{int} does not have 4096 bits, G++ will make the 1778union too small by the number of bits in an @code{int}. 1779 1780@item 1781Empty classes can be placed at incorrect offsets. For example: 1782 1783@smallexample 1784struct A @{@}; 1785 1786struct B @{ 1787 A a; 1788 virtual void f (); 1789@}; 1790 1791struct C : public B, public A @{@}; 1792@end smallexample 1793 1794@noindent 1795G++ will place the @code{A} base class of @code{C} at a nonzero offset; 1796it should be placed at offset zero. G++ mistakenly believes that the 1797@code{A} data member of @code{B} is already at offset zero. 1798 1799@item 1800Names of template functions whose types involve @code{typename} or 1801template template parameters can be mangled incorrectly. 1802 1803@smallexample 1804template <typename Q> 1805void f(typename Q::X) @{@} 1806 1807template <template <typename> class Q> 1808void f(typename Q<int>::X) @{@} 1809@end smallexample 1810 1811@noindent 1812Instantiations of these templates may be mangled incorrectly. 1813 1814@end itemize 1815 1816@item -Wctor-dtor-privacy @r{(C++ only)} 1817@opindex Wctor-dtor-privacy 1818Warn when a class seems unusable because all the constructors or 1819destructors in that class are private, and it has neither friends nor 1820public static member functions. 1821 1822@item -Wnon-virtual-dtor @r{(C++ only)} 1823@opindex Wnon-virtual-dtor 1824Warn when a class appears to be polymorphic, thereby requiring a virtual 1825destructor, yet it declares a non-virtual one. This warning is also 1826enabled if -Weffc++ is specified. 1827 1828@item -Wreorder @r{(C++ only)} 1829@opindex Wreorder 1830@cindex reordering, warning 1831@cindex warning for reordering of member initializers 1832Warn when the order of member initializers given in the code does not 1833match the order in which they must be executed. For instance: 1834 1835@smallexample 1836struct A @{ 1837 int i; 1838 int j; 1839 A(): j (0), i (1) @{ @} 1840@}; 1841@end smallexample 1842 1843The compiler will rearrange the member initializers for @samp{i} 1844and @samp{j} to match the declaration order of the members, emitting 1845a warning to that effect. This warning is enabled by @option{-Wall}. 1846@end table 1847 1848The following @option{-W@dots{}} options are not affected by @option{-Wall}. 1849 1850@table @gcctabopt 1851@item -Weffc++ @r{(C++ only)} 1852@opindex Weffc++ 1853Warn about violations of the following style guidelines from Scott Meyers' 1854@cite{Effective C++} book: 1855 1856@itemize @bullet 1857@item 1858Item 11: Define a copy constructor and an assignment operator for classes 1859with dynamically allocated memory. 1860 1861@item 1862Item 12: Prefer initialization to assignment in constructors. 1863 1864@item 1865Item 14: Make destructors virtual in base classes. 1866 1867@item 1868Item 15: Have @code{operator=} return a reference to @code{*this}. 1869 1870@item 1871Item 23: Don't try to return a reference when you must return an object. 1872 1873@end itemize 1874 1875Also warn about violations of the following style guidelines from 1876Scott Meyers' @cite{More Effective C++} book: 1877 1878@itemize @bullet 1879@item 1880Item 6: Distinguish between prefix and postfix forms of increment and 1881decrement operators. 1882 1883@item 1884Item 7: Never overload @code{&&}, @code{||}, or @code{,}. 1885 1886@end itemize 1887 1888When selecting this option, be aware that the standard library 1889headers do not obey all of these guidelines; use @samp{grep -v} 1890to filter out those warnings. 1891 1892@item -Wno-deprecated @r{(C++ only)} 1893@opindex Wno-deprecated 1894Do not warn about usage of deprecated features. @xref{Deprecated Features}. 1895 1896@item -Wstrict-null-sentinel @r{(C++ only)} 1897@opindex Wstrict-null-sentinel 1898Warn also about the use of an uncasted @code{NULL} as sentinel. When 1899compiling only with GCC this is a valid sentinel, as @code{NULL} is defined 1900to @code{__null}. Although it is a null pointer constant not a null pointer, 1901it is guaranteed to of the same size as a pointer. But this use is 1902not portable across different compilers. 1903 1904@item -Wno-non-template-friend @r{(C++ only)} 1905@opindex Wno-non-template-friend 1906Disable warnings when non-templatized friend functions are declared 1907within a template. Since the advent of explicit template specification 1908support in G++, if the name of the friend is an unqualified-id (i.e., 1909@samp{friend foo(int)}), the C++ language specification demands that the 1910friend declare or define an ordinary, nontemplate function. (Section 191114.5.3). Before G++ implemented explicit specification, unqualified-ids 1912could be interpreted as a particular specialization of a templatized 1913function. Because this non-conforming behavior is no longer the default 1914behavior for G++, @option{-Wnon-template-friend} allows the compiler to 1915check existing code for potential trouble spots and is on by default. 1916This new compiler behavior can be turned off with 1917@option{-Wno-non-template-friend} which keeps the conformant compiler code 1918but disables the helpful warning. 1919 1920@item -Wold-style-cast @r{(C++ only)} 1921@opindex Wold-style-cast 1922Warn if an old-style (C-style) cast to a non-void type is used within 1923a C++ program. The new-style casts (@samp{dynamic_cast}, 1924@samp{static_cast}, @samp{reinterpret_cast}, and @samp{const_cast}) are 1925less vulnerable to unintended effects and much easier to search for. 1926 1927@item -Woverloaded-virtual @r{(C++ only)} 1928@opindex Woverloaded-virtual 1929@cindex overloaded virtual fn, warning 1930@cindex warning for overloaded virtual fn 1931Warn when a function declaration hides virtual functions from a 1932base class. For example, in: 1933 1934@smallexample 1935struct A @{ 1936 virtual void f(); 1937@}; 1938 1939struct B: public A @{ 1940 void f(int); 1941@}; 1942@end smallexample 1943 1944the @code{A} class version of @code{f} is hidden in @code{B}, and code 1945like: 1946 1947@smallexample 1948B* b; 1949b->f(); 1950@end smallexample 1951 1952will fail to compile. 1953 1954@item -Wno-pmf-conversions @r{(C++ only)} 1955@opindex Wno-pmf-conversions 1956Disable the diagnostic for converting a bound pointer to member function 1957to a plain pointer. 1958 1959@item -Wsign-promo @r{(C++ only)} 1960@opindex Wsign-promo 1961Warn when overload resolution chooses a promotion from unsigned or 1962enumerated type to a signed type, over a conversion to an unsigned type of 1963the same size. Previous versions of G++ would try to preserve 1964unsignedness, but the standard mandates the current behavior. 1965 1966@smallexample 1967struct A @{ 1968 operator int (); 1969 A& operator = (int); 1970@}; 1971 1972main () 1973@{ 1974 A a,b; 1975 a = b; 1976@} 1977@end smallexample 1978 1979In this example, G++ will synthesize a default @samp{A& operator = 1980(const A&);}, while cfront will use the user-defined @samp{operator =}. 1981@end table 1982 1983@node Language Independent Options 1984@section Options to Control Diagnostic Messages Formatting 1985@cindex options to control diagnostics formatting 1986@cindex diagnostic messages 1987@cindex message formatting 1988 1989Traditionally, diagnostic messages have been formatted irrespective of 1990the output device's aspect (e.g.@: its width, @dots{}). The options described 1991below can be used to control the diagnostic messages formatting 1992algorithm, e.g.@: how many characters per line, how often source location 1993information should be reported. Right now, only the C++ front end can 1994honor these options. However it is expected, in the near future, that 1995the remaining front ends would be able to digest them correctly. 1996 1997@table @gcctabopt 1998@item -fmessage-length=@var{n} 1999@opindex fmessage-length 2000Try to format error messages so that they fit on lines of about @var{n} 2001characters. The default is 72 characters for @command{g++} and 0 for the rest of 2002the front ends supported by GCC@. If @var{n} is zero, then no 2003line-wrapping will be done; each error message will appear on a single 2004line. 2005 2006@opindex fdiagnostics-show-location 2007@item -fdiagnostics-show-location=once 2008Only meaningful in line-wrapping mode. Instructs the diagnostic messages 2009reporter to emit @emph{once} source location information; that is, in 2010case the message is too long to fit on a single physical line and has to 2011be wrapped, the source location won't be emitted (as prefix) again, 2012over and over, in subsequent continuation lines. This is the default 2013behavior. 2014 2015@item -fdiagnostics-show-location=every-line 2016Only meaningful in line-wrapping mode. Instructs the diagnostic 2017messages reporter to emit the same source location information (as 2018prefix) for physical lines that result from the process of breaking 2019a message which is too long to fit on a single line. 2020 2021@item -fdiagnostics-show-option 2022@opindex fdiagnostics-show-option 2023This option instructs the diagnostic machinery to add text to each 2024diagnostic emitted, which indicates which command line option directly 2025controls that diagnostic, when such an option is known to the 2026diagnostic machinery. 2027 2028@end table 2029 2030@node Warning Options 2031@section Options to Request or Suppress Warnings 2032@cindex options to control warnings 2033@cindex warning messages 2034@cindex messages, warning 2035@cindex suppressing warnings 2036 2037Warnings are diagnostic messages that report constructions which 2038are not inherently erroneous but which are risky or suggest there 2039may have been an error. 2040 2041You can request many specific warnings with options beginning @samp{-W}, 2042for example @option{-Wimplicit} to request warnings on implicit 2043declarations. Each of these specific warning options also has a 2044negative form beginning @samp{-Wno-} to turn off warnings; 2045for example, @option{-Wno-implicit}. This manual lists only one of the 2046two forms, whichever is not the default. 2047 2048The following options control the amount and kinds of warnings produced 2049by GCC; for further, language-specific options also refer to 2050@ref{C++ Dialect Options}. 2051 2052@table @gcctabopt 2053@cindex syntax checking 2054@item -fsyntax-only 2055@opindex fsyntax-only 2056Check the code for syntax errors, but don't do anything beyond that. 2057 2058@item -pedantic 2059@opindex pedantic 2060Issue all the warnings demanded by strict ISO C and ISO C++; 2061reject all programs that use forbidden extensions, and some other 2062programs that do not follow ISO C and ISO C++. For ISO C, follows the 2063version of the ISO C standard specified by any @option{-std} option used. 2064 2065Valid ISO C and ISO C++ programs should compile properly with or without 2066this option (though a rare few will require @option{-ansi} or a 2067@option{-std} option specifying the required version of ISO C)@. However, 2068without this option, certain GNU extensions and traditional C and C++ 2069features are supported as well. With this option, they are rejected. 2070 2071@option{-pedantic} does not cause warning messages for use of the 2072alternate keywords whose names begin and end with @samp{__}. Pedantic 2073warnings are also disabled in the expression that follows 2074@code{__extension__}. However, only system header files should use 2075these escape routes; application programs should avoid them. 2076@xref{Alternate Keywords}. 2077 2078Some users try to use @option{-pedantic} to check programs for strict ISO 2079C conformance. They soon find that it does not do quite what they want: 2080it finds some non-ISO practices, but not all---only those for which 2081ISO C @emph{requires} a diagnostic, and some others for which 2082diagnostics have been added. 2083 2084A feature to report any failure to conform to ISO C might be useful in 2085some instances, but would require considerable additional work and would 2086be quite different from @option{-pedantic}. We don't have plans to 2087support such a feature in the near future. 2088 2089Where the standard specified with @option{-std} represents a GNU 2090extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a 2091corresponding @dfn{base standard}, the version of ISO C on which the GNU 2092extended dialect is based. Warnings from @option{-pedantic} are given 2093where they are required by the base standard. (It would not make sense 2094for such warnings to be given only for features not in the specified GNU 2095C dialect, since by definition the GNU dialects of C include all 2096features the compiler supports with the given option, and there would be 2097nothing to warn about.) 2098 2099@item -pedantic-errors 2100@opindex pedantic-errors 2101Like @option{-pedantic}, except that errors are produced rather than 2102warnings. 2103 2104@item -w 2105@opindex w 2106Inhibit all warning messages. 2107 2108@item -Wno-import 2109@opindex Wno-import 2110Inhibit warning messages about the use of @samp{#import}. 2111 2112@c APPLE LOCAL begin -Wnewline-eof 2001-08-23 --sts ** 2113@item -Wnewline-eof 2114@opindex Wnewline-eof 2115Warn about files missing a newline at the end of the file. (Apple compatible) 2116@c APPLE LOCAL end -Wnewline-eof 2001-08-23 --sts ** 2117 2118@item -Wchar-subscripts 2119@opindex Wchar-subscripts 2120Warn if an array subscript has type @code{char}. This is a common cause 2121of error, as programmers often forget that this type is signed on some 2122machines. 2123This warning is enabled by @option{-Wall}. 2124 2125@item -Wcomment 2126@opindex Wcomment 2127Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*} 2128comment, or whenever a Backslash-Newline appears in a @samp{//} comment. 2129This warning is enabled by @option{-Wall}. 2130 2131@item -Wfatal-errors 2132@opindex Wfatal-errors 2133This option causes the compiler to abort compilation on the first error 2134occurred rather than trying to keep going and printing further error 2135messages. 2136 2137@item -Wformat 2138@opindex Wformat 2139@opindex ffreestanding 2140@opindex fno-builtin 2141Check calls to @code{printf} and @code{scanf}, etc., to make sure that 2142the arguments supplied have types appropriate to the format string 2143specified, and that the conversions specified in the format string make 2144sense. This includes standard functions, and others specified by format 2145attributes (@pxref{Function Attributes}), in the @code{printf}, 2146@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension, 2147not in the C standard) families (or other target-specific families). 2148Which functions are checked without format attributes having been 2149specified depends on the standard version selected, and such checks of 2150functions without the attribute specified are disabled by 2151@option{-ffreestanding} or @option{-fno-builtin}. 2152 2153The formats are checked against the format features supported by GNU 2154libc version 2.2. These include all ISO C90 and C99 features, as well 2155as features from the Single Unix Specification and some BSD and GNU 2156extensions. Other library implementations may not support all these 2157features; GCC does not support warning about features that go beyond a 2158particular library's limitations. However, if @option{-pedantic} is used 2159with @option{-Wformat}, warnings will be given about format features not 2160in the selected standard version (but not for @code{strfmon} formats, 2161since those are not in any version of the C standard). @xref{C Dialect 2162Options,,Options Controlling C Dialect}. 2163 2164Since @option{-Wformat} also checks for null format arguments for 2165several functions, @option{-Wformat} also implies @option{-Wnonnull}. 2166 2167@option{-Wformat} is included in @option{-Wall}. For more control over some 2168aspects of format checking, the options @option{-Wformat-y2k}, 2169@option{-Wno-format-extra-args}, @option{-Wno-format-zero-length}, 2170@option{-Wformat-nonliteral}, @option{-Wformat-security}, and 2171@option{-Wformat=2} are available, but are not included in @option{-Wall}. 2172 2173@item -Wformat-y2k 2174@opindex Wformat-y2k 2175If @option{-Wformat} is specified, also warn about @code{strftime} 2176formats which may yield only a two-digit year. 2177 2178@item -Wno-format-extra-args 2179@opindex Wno-format-extra-args 2180If @option{-Wformat} is specified, do not warn about excess arguments to a 2181@code{printf} or @code{scanf} format function. The C standard specifies 2182that such arguments are ignored. 2183 2184Where the unused arguments lie between used arguments that are 2185specified with @samp{$} operand number specifications, normally 2186warnings are still given, since the implementation could not know what 2187type to pass to @code{va_arg} to skip the unused arguments. However, 2188in the case of @code{scanf} formats, this option will suppress the 2189warning if the unused arguments are all pointers, since the Single 2190Unix Specification says that such unused arguments are allowed. 2191 2192@item -Wno-format-zero-length 2193@opindex Wno-format-zero-length 2194If @option{-Wformat} is specified, do not warn about zero-length formats. 2195The C standard specifies that zero-length formats are allowed. 2196 2197@item -Wformat-nonliteral 2198@opindex Wformat-nonliteral 2199If @option{-Wformat} is specified, also warn if the format string is not a 2200string literal and so cannot be checked, unless the format function 2201takes its format arguments as a @code{va_list}. 2202 2203@item -Wformat-security 2204@opindex Wformat-security 2205If @option{-Wformat} is specified, also warn about uses of format 2206functions that represent possible security problems. At present, this 2207warns about calls to @code{printf} and @code{scanf} functions where the 2208format string is not a string literal and there are no format arguments, 2209as in @code{printf (foo);}. This may be a security hole if the format 2210string came from untrusted input and contains @samp{%n}. (This is 2211currently a subset of what @option{-Wformat-nonliteral} warns about, but 2212in future warnings may be added to @option{-Wformat-security} that are not 2213included in @option{-Wformat-nonliteral}.) 2214 2215@item -Wformat=2 2216@opindex Wformat=2 2217Enable @option{-Wformat} plus format checks not included in 2218@option{-Wformat}. Currently equivalent to @samp{-Wformat 2219-Wformat-nonliteral -Wformat-security -Wformat-y2k}. 2220 2221@item -Wnonnull 2222@opindex Wnonnull 2223Warn about passing a null pointer for arguments marked as 2224requiring a non-null value by the @code{nonnull} function attribute. 2225 2226@option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It 2227can be disabled with the @option{-Wno-nonnull} option. 2228 2229@item -Winit-self @r{(C and C++ only)} 2230@opindex Winit-self 2231Warn about uninitialized variables which are initialized with themselves. 2232Note this option can only be used with the @option{-Wuninitialized} option, 2233which in turn only works with @option{-O1} and above. 2234 2235For example, GCC will warn about @code{i} being uninitialized in the 2236following snippet only when @option{-Winit-self} has been specified: 2237@smallexample 2238@group 2239int f() 2240@{ 2241 int i = i; 2242 return i; 2243@} 2244@end group 2245@end smallexample 2246 2247@item -Wimplicit-int 2248@opindex Wimplicit-int 2249Warn when a declaration does not specify a type. 2250This warning is enabled by @option{-Wall}. 2251 2252@item -Wimplicit-function-declaration 2253@itemx -Werror-implicit-function-declaration 2254@opindex Wimplicit-function-declaration 2255@opindex Werror-implicit-function-declaration 2256Give a warning (or error) whenever a function is used before being 2257declared. The form @option{-Wno-error-implicit-function-declaration} 2258is not supported. 2259This warning is enabled by @option{-Wall} (as a warning, not an error). 2260 2261@item -Wimplicit 2262@opindex Wimplicit 2263Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}. 2264This warning is enabled by @option{-Wall}. 2265 2266@item -Wmain 2267@opindex Wmain 2268Warn if the type of @samp{main} is suspicious. @samp{main} should be a 2269function with external linkage, returning int, taking either zero 2270arguments, two, or three arguments of appropriate types. 2271This warning is enabled by @option{-Wall}. 2272 2273@item -Wmissing-braces 2274@opindex Wmissing-braces 2275Warn if an aggregate or union initializer is not fully bracketed. In 2276the following example, the initializer for @samp{a} is not fully 2277bracketed, but that for @samp{b} is fully bracketed. 2278 2279@smallexample 2280int a[2][2] = @{ 0, 1, 2, 3 @}; 2281int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @}; 2282@end smallexample 2283 2284This warning is enabled by @option{-Wall}. 2285 2286@item -Wmissing-include-dirs @r{(C and C++ only)} 2287@opindex Wmissing-include-dirs 2288Warn if a user-supplied include directory does not exist. 2289 2290@item -Wparentheses 2291@opindex Wparentheses 2292Warn if parentheses are omitted in certain contexts, such 2293as when there is an assignment in a context where a truth value 2294is expected, or when operators are nested whose precedence people 2295often get confused about. 2296 2297Also warn if a comparison like @samp{x<=y<=z} appears; this is 2298equivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different 2299interpretation from that of ordinary mathematical notation. 2300 2301Also warn about constructions where there may be confusion to which 2302@code{if} statement an @code{else} branch belongs. Here is an example of 2303such a case: 2304 2305@smallexample 2306@group 2307@{ 2308 if (a) 2309 if (b) 2310 foo (); 2311 else 2312 bar (); 2313@} 2314@end group 2315@end smallexample 2316 2317In C/C++, every @code{else} branch belongs to the innermost possible 2318@code{if} statement, which in this example is @code{if (b)}. This is 2319often not what the programmer expected, as illustrated in the above 2320example by indentation the programmer chose. When there is the 2321potential for this confusion, GCC will issue a warning when this flag 2322is specified. To eliminate the warning, add explicit braces around 2323the innermost @code{if} statement so there is no way the @code{else} 2324could belong to the enclosing @code{if}. The resulting code would 2325look like this: 2326 2327@smallexample 2328@group 2329@{ 2330 if (a) 2331 @{ 2332 if (b) 2333 foo (); 2334 else 2335 bar (); 2336 @} 2337@} 2338@end group 2339@end smallexample 2340 2341This warning is enabled by @option{-Wall}. 2342 2343@item -Wsequence-point 2344@opindex Wsequence-point 2345Warn about code that may have undefined semantics because of violations 2346of sequence point rules in the C and C++ standards. 2347 2348The C and C++ standards defines the order in which expressions in a C/C++ 2349program are evaluated in terms of @dfn{sequence points}, which represent 2350a partial ordering between the execution of parts of the program: those 2351executed before the sequence point, and those executed after it. These 2352occur after the evaluation of a full expression (one which is not part 2353of a larger expression), after the evaluation of the first operand of a 2354@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a 2355function is called (but after the evaluation of its arguments and the 2356expression denoting the called function), and in certain other places. 2357Other than as expressed by the sequence point rules, the order of 2358evaluation of subexpressions of an expression is not specified. All 2359these rules describe only a partial order rather than a total order, 2360since, for example, if two functions are called within one expression 2361with no sequence point between them, the order in which the functions 2362are called is not specified. However, the standards committee have 2363ruled that function calls do not overlap. 2364 2365It is not specified when between sequence points modifications to the 2366values of objects take effect. Programs whose behavior depends on this 2367have undefined behavior; the C and C++ standards specify that ``Between 2368the previous and next sequence point an object shall have its stored 2369value modified at most once by the evaluation of an expression. 2370Furthermore, the prior value shall be read only to determine the value 2371to be stored.''. If a program breaks these rules, the results on any 2372particular implementation are entirely unpredictable. 2373 2374Examples of code with undefined behavior are @code{a = a++;}, @code{a[n] 2375= b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not 2376diagnosed by this option, and it may give an occasional false positive 2377result, but in general it has been found fairly effective at detecting 2378this sort of problem in programs. 2379 2380The standard is worded confusingly, therefore there is some debate 2381over the precise meaning of the sequence point rules in subtle cases. 2382Links to discussions of the problem, including proposed formal 2383definitions, may be found on the GCC readings page, at 2384@w{@uref{http://gcc.gnu.org/readings.html}}. 2385 2386This warning is enabled by @option{-Wall} for C and C++. 2387 2388@item -Wreturn-type 2389@opindex Wreturn-type 2390Warn whenever a function is defined with a return-type that defaults to 2391@code{int}. Also warn about any @code{return} statement with no 2392return-value in a function whose return-type is not @code{void}. 2393 2394For C, also warn if the return type of a function has a type qualifier 2395such as @code{const}. Such a type qualifier has no effect, since the 2396value returned by a function is not an lvalue. ISO C prohibits 2397qualified @code{void} return types on function definitions, so such 2398return types always receive a warning even without this option. 2399 2400For C++, a function without return type always produces a diagnostic 2401message, even when @option{-Wno-return-type} is specified. The only 2402exceptions are @samp{main} and functions defined in system headers. 2403 2404This warning is enabled by @option{-Wall}. 2405 2406@item -Wswitch 2407@opindex Wswitch 2408Warn whenever a @code{switch} statement has an index of enumerated type 2409and lacks a @code{case} for one or more of the named codes of that 2410enumeration. (The presence of a @code{default} label prevents this 2411warning.) @code{case} labels outside the enumeration range also 2412provoke warnings when this option is used. 2413This warning is enabled by @option{-Wall}. 2414 2415@item -Wswitch-default 2416@opindex Wswitch-switch 2417Warn whenever a @code{switch} statement does not have a @code{default} 2418case. 2419 2420@item -Wswitch-enum 2421@opindex Wswitch-enum 2422Warn whenever a @code{switch} statement has an index of enumerated type 2423and lacks a @code{case} for one or more of the named codes of that 2424enumeration. @code{case} labels outside the enumeration range also 2425provoke warnings when this option is used. 2426 2427@item -Wtrigraphs 2428@opindex Wtrigraphs 2429Warn if any trigraphs are encountered that might change the meaning of 2430the program (trigraphs within comments are not warned about). 2431This warning is enabled by @option{-Wall}. 2432 2433@item -Wunused-function 2434@opindex Wunused-function 2435Warn whenever a static function is declared but not defined or a 2436non-inline static function is unused. 2437This warning is enabled by @option{-Wall}. 2438 2439@item -Wunused-label 2440@opindex Wunused-label 2441Warn whenever a label is declared but not used. 2442This warning is enabled by @option{-Wall}. 2443 2444To suppress this warning use the @samp{unused} attribute 2445(@pxref{Variable Attributes}). 2446 2447@item -Wunused-parameter 2448@opindex Wunused-parameter 2449Warn whenever a function parameter is unused aside from its declaration. 2450 2451To suppress this warning use the @samp{unused} attribute 2452(@pxref{Variable Attributes}). 2453 2454@item -Wunused-variable 2455@opindex Wunused-variable 2456Warn whenever a local variable or non-constant static variable is unused 2457aside from its declaration. 2458This warning is enabled by @option{-Wall}. 2459 2460To suppress this warning use the @samp{unused} attribute 2461(@pxref{Variable Attributes}). 2462 2463@item -Wunused-value 2464@opindex Wunused-value 2465Warn whenever a statement computes a result that is explicitly not used. 2466This warning is enabled by @option{-Wall}. 2467 2468To suppress this warning cast the expression to @samp{void}. 2469 2470@item -Wunused 2471@opindex Wunused 2472All the above @option{-Wunused} options combined. 2473 2474In order to get a warning about an unused function parameter, you must 2475either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies 2476@samp{-Wunused}), or separately specify @option{-Wunused-parameter}. 2477 2478@item -Wuninitialized 2479@opindex Wuninitialized 2480Warn if an automatic variable is used without first being initialized or 2481if a variable may be clobbered by a @code{setjmp} call. 2482 2483These warnings are possible only in optimizing compilation, 2484because they require data flow information that is computed only 2485when optimizing. If you do not specify @option{-O}, you will not get 2486these warnings. Instead, GCC will issue a warning about @option{-Wuninitialized} 2487requiring @option{-O}. 2488 2489If you want to warn about code which uses the uninitialized value of the 2490variable in its own initializer, use the @option{-Winit-self} option. 2491 2492These warnings occur for individual uninitialized or clobbered 2493elements of structure, union or array variables as well as for 2494variables which are uninitialized or clobbered as a whole. They do 2495not occur for variables or elements declared @code{volatile}. Because 2496these warnings depend on optimization, the exact variables or elements 2497for which there are warnings will depend on the precise optimization 2498options and version of GCC used. 2499 2500Note that there may be no warning about a variable that is used only 2501to compute a value that itself is never used, because such 2502computations may be deleted by data flow analysis before the warnings 2503are printed. 2504 2505These warnings are made optional because GCC is not smart 2506enough to see all the reasons why the code might be correct 2507despite appearing to have an error. Here is one example of how 2508this can happen: 2509 2510@smallexample 2511@group 2512@{ 2513 int x; 2514 switch (y) 2515 @{ 2516 case 1: x = 1; 2517 break; 2518 case 2: x = 4; 2519 break; 2520 case 3: x = 5; 2521 @} 2522 foo (x); 2523@} 2524@end group 2525@end smallexample 2526 2527@noindent 2528If the value of @code{y} is always 1, 2 or 3, then @code{x} is 2529always initialized, but GCC doesn't know this. Here is 2530another common case: 2531 2532@smallexample 2533@{ 2534 int save_y; 2535 if (change_y) save_y = y, y = new_y; 2536 @dots{} 2537 if (change_y) y = save_y; 2538@} 2539@end smallexample 2540 2541@noindent 2542This has no bug because @code{save_y} is used only if it is set. 2543 2544@cindex @code{longjmp} warnings 2545This option also warns when a non-volatile automatic variable might be 2546changed by a call to @code{longjmp}. These warnings as well are possible 2547only in optimizing compilation. 2548 2549The compiler sees only the calls to @code{setjmp}. It cannot know 2550where @code{longjmp} will be called; in fact, a signal handler could 2551call it at any point in the code. As a result, you may get a warning 2552even when there is in fact no problem because @code{longjmp} cannot 2553in fact be called at the place which would cause a problem. 2554 2555Some spurious warnings can be avoided if you declare all the functions 2556you use that never return as @code{noreturn}. @xref{Function 2557Attributes}. 2558 2559This warning is enabled by @option{-Wall}. 2560 2561@item -Wunknown-pragmas 2562@opindex Wunknown-pragmas 2563@cindex warning for unknown pragmas 2564@cindex unknown pragmas, warning 2565@cindex pragmas, warning of unknown 2566Warn when a #pragma directive is encountered which is not understood by 2567GCC@. If this command line option is used, warnings will even be issued 2568for unknown pragmas in system header files. This is not the case if 2569the warnings were only enabled by the @option{-Wall} command line option. 2570 2571@item -Wno-pragmas 2572@opindex Wno-pragmas 2573@opindex Wpragmas 2574Do not warn about misuses of pragmas, such as incorrect parameters, 2575invalid syntax, or conflicts between pragmas. See also 2576@samp{-Wunknown-pragmas}. 2577 2578@item -Wstrict-aliasing 2579@opindex Wstrict-aliasing 2580This option is only active when @option{-fstrict-aliasing} is active. 2581It warns about code which might break the strict aliasing rules that the 2582compiler is using for optimization. The warning does not catch all 2583cases, but does attempt to catch the more common pitfalls. It is 2584included in @option{-Wall}. 2585It is equivalent to -Wstrict-aliasing=3 2586 2587@item -Wstrict-aliasing=n 2588@opindex Wstrict-aliasing=n 2589This option is only active when @option{-fstrict-aliasing} is active. 2590It warns about code which might break the strict aliasing rules that the 2591compiler is using for optimization. 2592Higher levels correspond to higher accuracy (fewer false positives). 2593Higher levels also correspond to more effort, similar to the way -O works. 2594@option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=n}, 2595with n=3. 2596 2597Level 1: Most aggressive, quick, least accurate. 2598Possibly useful when higher levels 2599do not warn but -fstrict-aliasing still breaks the code, as it has very few 2600false negatives. However, it has many false positives. 2601Warns for all pointer conversions between possibly incompatible types, 2602even if never dereferenced. Runs in the frontend only. 2603 2604Level 2: Aggressive, quick, not too precise. 2605May still have many false positives (not as many as level 1 though), 2606and few false negatives (but possibly more than level 1). 2607Unlike level 1, it only warns when an address is taken. Warns about 2608incomplete types. Runs in the frontend only. 2609 2610Level 3 (default for @option{-Wstrict-aliasing}): 2611Should have very few false positives and few false 2612negatives. Slightly slower than levels 1 or 2 when optimization is enabled. 2613Takes care of the common punn+dereference pattern in the frontend: 2614@code{*(int*)&some_float}. 2615If optimization is enabled, it also runs in the backend, where it deals 2616with multiple statement cases using flow-sensitive points-to information. 2617Only warns when the converted pointer is dereferenced. 2618Does not warn about incomplete types. 2619 2620@item -Wstrict-overflow 2621@item -Wstrict-overflow=@var{n} 2622@opindex Wstrict-overflow 2623This option is only active when @option{-fstrict-overflow} is active. 2624It warns about cases where the compiler optimizes based on the 2625assumption that signed overflow does not occur. Note that it does not 2626warn about all cases where the code might overflow: it only warns 2627about cases where the compiler implements some optimization. Thus 2628this warning depends on the optimization level. 2629 2630An optimization which assumes that signed overflow does not occur is 2631perfectly safe if the values of the variables involved are such that 2632overflow never does, in fact, occur. Therefore this warning can 2633easily give a false positive: a warning about code which is not 2634actually a problem. To help focus on important issues, several 2635warning levels are defined. No warnings are issued for the use of 2636undefined signed overflow when estimating how many iterations a loop 2637will require, in particular when determining whether a loop will be 2638executed at all. 2639 2640@table @option 2641@item -Wstrict-overflow=1 2642Warn about cases which are both questionable and easy to avoid. For 2643example: @code{x + 1 > x}; with @option{-fstrict-overflow}, the 2644compiler will simplify this to @code{1}. This level of 2645@option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels 2646are not, and must be explicitly requested. 2647 2648@item -Wstrict-overflow=2 2649Also warn about other cases where a comparison is simplified to a 2650constant. For example: @code{abs (x) >= 0}. This can only be 2651simplified when @option{-fstrict-overflow} is in effect, because 2652@code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than 2653zero. @option{-Wstrict-overflow} (with no level) is the same as 2654@option{-Wstrict-overflow=2}. 2655 2656@item -Wstrict-overflow=3 2657Also warn about other cases where a comparison is simplified. For 2658example: @code{x + 1 > 1} will be simplified to @code{x > 0}. 2659 2660@item -Wstrict-overflow=4 2661Also warn about other simplifications not covered by the above cases. 2662For example: @code{(x * 10) / 5} will be simplified to @code{x * 2}. 2663 2664@item -Wstrict-overflow=5 2665Also warn about cases where the compiler reduces the magnitude of a 2666constant involved in a comparison. For example: @code{x + 2 > y} will 2667be simplified to @code{x + 1 >= y}. This is reported only at the 2668highest warning level because this simplification applies to many 2669comparisons, so this warning level will give a very large number of 2670false positives. 2671@end table 2672 2673@item -Wall 2674@opindex Wall 2675All of the above @samp{-W} options combined. This enables all the 2676warnings about constructions that some users consider questionable, and 2677that are easy to avoid (or modify to prevent the warning), even in 2678conjunction with macros. This also enables some language-specific 2679warnings described in @ref{C++ Dialect Options}. 2680@c APPLE LOCAL begin -Wmost 2681@item -Wmost 2682@opindex Wmost 2683This is equivalent to -Wall -Wno-parentheses. (Apple compatible) 2684@end table 2685@c APPLE LOCAL end -Wmost 2686 2687The following @option{-W@dots{}} options are not implied by @option{-Wall}. 2688Some of them warn about constructions that users generally do not 2689consider questionable, but which occasionally you might wish to check 2690for; others warn about constructions that are necessary or hard to avoid 2691in some cases, and there is no simple way to modify the code to suppress 2692the warning. 2693 2694@table @gcctabopt 2695@item -Wextra 2696@opindex W 2697@opindex Wextra 2698(This option used to be called @option{-W}. The older name is still 2699supported, but the newer name is more descriptive.) Print extra warning 2700messages for these events: 2701 2702@itemize @bullet 2703@item 2704A function can return either with or without a value. (Falling 2705off the end of the function body is considered returning without 2706a value.) For example, this function would evoke such a 2707warning: 2708 2709@smallexample 2710@group 2711foo (a) 2712@{ 2713 if (a > 0) 2714 return a; 2715@} 2716@end group 2717@end smallexample 2718 2719@item 2720An expression-statement or the left-hand side of a comma expression 2721contains no side effects. 2722To suppress the warning, cast the unused expression to void. 2723For example, an expression such as @samp{x[i,j]} will cause a warning, 2724but @samp{x[(void)i,j]} will not. 2725 2726@item 2727An unsigned value is compared against zero with @samp{<} or @samp{>=}. 2728 2729@item 2730Storage-class specifiers like @code{static} are not the first things in 2731a declaration. According to the C Standard, this usage is obsolescent. 2732 2733@item 2734If @option{-Wall} or @option{-Wunused} is also specified, warn about unused 2735arguments. 2736 2737@item 2738A comparison between signed and unsigned values could produce an 2739incorrect result when the signed value is converted to unsigned. 2740(But don't warn if @option{-Wno-sign-compare} is also specified.) 2741 2742@item 2743An aggregate has an initializer which does not initialize all members. 2744This warning can be independently controlled by 2745@option{-Wmissing-field-initializers}. 2746 2747@item 2748An initialized field without side effects is overridden when using 2749designated initializers (@pxref{Designated Inits, , Designated 2750Initializers}). This warning can be independently controlled by 2751@option{-Woverride-init}. 2752 2753@item 2754A function parameter is declared without a type specifier in K&R-style 2755functions: 2756 2757@smallexample 2758void foo(bar) @{ @} 2759@end smallexample 2760 2761@item 2762An empty body occurs in an @samp{if} or @samp{else} statement. 2763 2764@item 2765A pointer is compared against integer zero with @samp{<}, @samp{<=}, 2766@samp{>}, or @samp{>=}. 2767 2768@item 2769A variable might be changed by @samp{longjmp} or @samp{vfork}. 2770 2771@item @r{(C++ only)} 2772An enumerator and a non-enumerator both appear in a conditional expression. 2773 2774@item @r{(C++ only)} 2775A non-static reference or non-static @samp{const} member appears in a 2776class without constructors. 2777 2778@item @r{(C++ only)} 2779Ambiguous virtual bases. 2780 2781@item @r{(C++ only)} 2782Subscripting an array which has been declared @samp{register}. 2783 2784@item @r{(C++ only)} 2785Taking the address of a variable which has been declared @samp{register}. 2786 2787@item @r{(C++ only)} 2788A base class is not initialized in a derived class' copy constructor. 2789@end itemize 2790 2791@item -Wno-div-by-zero 2792@opindex Wno-div-by-zero 2793@opindex Wdiv-by-zero 2794Do not warn about compile-time integer division by zero. Floating point 2795division by zero is not warned about, as it can be a legitimate way of 2796obtaining infinities and NaNs. 2797 2798@item -Wsystem-headers 2799@opindex Wsystem-headers 2800@cindex warnings from system headers 2801@cindex system headers, warnings from 2802Print warning messages for constructs found in system header files. 2803Warnings from system headers are normally suppressed, on the assumption 2804that they usually do not indicate real problems and would only make the 2805compiler output harder to read. Using this command line option tells 2806GCC to emit warnings from system headers as if they occurred in user 2807code. However, note that using @option{-Wall} in conjunction with this 2808option will @emph{not} warn about unknown pragmas in system 2809headers---for that, @option{-Wunknown-pragmas} must also be used. 2810 2811@item -Wfloat-equal 2812@opindex Wfloat-equal 2813Warn if floating point values are used in equality comparisons. 2814 2815The idea behind this is that sometimes it is convenient (for the 2816programmer) to consider floating-point values as approximations to 2817infinitely precise real numbers. If you are doing this, then you need 2818to compute (by analyzing the code, or in some other way) the maximum or 2819likely maximum error that the computation introduces, and allow for it 2820when performing comparisons (and when producing output, but that's a 2821different problem). In particular, instead of testing for equality, you 2822would check to see whether the two values have ranges that overlap; and 2823this is done with the relational operators, so equality comparisons are 2824probably mistaken. 2825 2826@item -Wtraditional @r{(C only)} 2827@opindex Wtraditional 2828Warn about certain constructs that behave differently in traditional and 2829ISO C@. Also warn about ISO C constructs that have no traditional C 2830equivalent, and/or problematic constructs which should be avoided. 2831 2832@itemize @bullet 2833@item 2834Macro parameters that appear within string literals in the macro body. 2835In traditional C macro replacement takes place within string literals, 2836but does not in ISO C@. 2837 2838@item 2839In traditional C, some preprocessor directives did not exist. 2840Traditional preprocessors would only consider a line to be a directive 2841if the @samp{#} appeared in column 1 on the line. Therefore 2842@option{-Wtraditional} warns about directives that traditional C 2843understands but would ignore because the @samp{#} does not appear as the 2844first character on the line. It also suggests you hide directives like 2845@samp{#pragma} not understood by traditional C by indenting them. Some 2846traditional implementations would not recognize @samp{#elif}, so it 2847suggests avoiding it altogether. 2848 2849@item 2850A function-like macro that appears without arguments. 2851 2852@item 2853The unary plus operator. 2854 2855@item 2856The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point 2857constant suffixes. (Traditional C does support the @samp{L} suffix on integer 2858constants.) Note, these suffixes appear in macros defined in the system 2859headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}. 2860Use of these macros in user code might normally lead to spurious 2861warnings, however GCC's integrated preprocessor has enough context to 2862avoid warning in these cases. 2863 2864@item 2865A function declared external in one block and then used after the end of 2866the block. 2867 2868@item 2869A @code{switch} statement has an operand of type @code{long}. 2870 2871@item 2872A non-@code{static} function declaration follows a @code{static} one. 2873This construct is not accepted by some traditional C compilers. 2874 2875@item 2876The ISO type of an integer constant has a different width or 2877signedness from its traditional type. This warning is only issued if 2878the base of the constant is ten. I.e.@: hexadecimal or octal values, which 2879typically represent bit patterns, are not warned about. 2880 2881@item 2882Usage of ISO string concatenation is detected. 2883 2884@item 2885Initialization of automatic aggregates. 2886 2887@item 2888Identifier conflicts with labels. Traditional C lacks a separate 2889namespace for labels. 2890 2891@item 2892Initialization of unions. If the initializer is zero, the warning is 2893omitted. This is done under the assumption that the zero initializer in 2894user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing 2895initializer warnings and relies on default initialization to zero in the 2896traditional C case. 2897 2898@item 2899Conversions by prototypes between fixed/floating point values and vice 2900versa. The absence of these prototypes when compiling with traditional 2901C would cause serious problems. This is a subset of the possible 2902conversion warnings, for the full set use @option{-Wconversion}. 2903 2904@item 2905Use of ISO C style function definitions. This warning intentionally is 2906@emph{not} issued for prototype declarations or variadic functions 2907because these ISO C features will appear in your code when using 2908libiberty's traditional C compatibility macros, @code{PARAMS} and 2909@code{VPARAMS}. This warning is also bypassed for nested functions 2910because that feature is already a GCC extension and thus not relevant to 2911traditional C compatibility. 2912@end itemize 2913 2914@item -Wdeclaration-after-statement @r{(C only)} 2915@opindex Wdeclaration-after-statement 2916Warn when a declaration is found after a statement in a block. This 2917construct, known from C++, was introduced with ISO C99 and is by default 2918allowed in GCC@. It is not supported by ISO C90 and was not supported by 2919GCC versions before GCC 3.0. @xref{Mixed Declarations}. 2920 2921@item -Wundef 2922@opindex Wundef 2923Warn if an undefined identifier is evaluated in an @samp{#if} directive. 2924 2925@item -Wno-endif-labels 2926@opindex Wno-endif-labels 2927@opindex Wendif-labels 2928Do not warn whenever an @samp{#else} or an @samp{#endif} are followed by text. 2929 2930@item -Wshadow 2931@opindex Wshadow 2932Warn whenever a local variable shadows another local variable, parameter or 2933global variable or whenever a built-in function is shadowed. 2934 2935@item -Wlarger-than-@var{len} 2936@opindex Wlarger-than 2937Warn whenever an object of larger than @var{len} bytes is defined. 2938 2939@item -Wframe-larger-than-@var{len} 2940@opindex Wframe-larger-than 2941Warn whenever the frame size of a function is larger than @var{len} bytes. 2942 2943@item -Wunsafe-loop-optimizations 2944@opindex Wunsafe-loop-optimizations 2945Warn if the loop cannot be optimized because the compiler could not 2946assume anything on the bounds of the loop indices. With 2947@option{-funsafe-loop-optimizations} warn if the compiler made 2948such assumptions. 2949 2950@item -Wpointer-arith 2951@opindex Wpointer-arith 2952Warn about anything that depends on the ``size of'' a function type or 2953of @code{void}. GNU C assigns these types a size of 1, for 2954convenience in calculations with @code{void *} pointers and pointers 2955to functions. 2956 2957@item -Wbad-function-cast @r{(C only)} 2958@opindex Wbad-function-cast 2959Warn whenever a function call is cast to a non-matching type. 2960For example, warn if @code{int malloc()} is cast to @code{anything *}. 2961 2962@item -Wc++-compat 2963Warn about ISO C constructs that are outside of the common subset of 2964ISO C and ISO C++, e.g.@: request for implicit conversion from 2965@code{void *} to a pointer to non-@code{void} type. 2966 2967@item -Wcast-qual 2968@opindex Wcast-qual 2969Warn whenever a pointer is cast so as to remove a type qualifier from 2970the target type. For example, warn if a @code{const char *} is cast 2971to an ordinary @code{char *}. 2972 2973@item -Wcast-align 2974@opindex Wcast-align 2975Warn whenever a pointer is cast such that the required alignment of the 2976target is increased. For example, warn if a @code{char *} is cast to 2977an @code{int *} on machines where integers can only be accessed at 2978two- or four-byte boundaries. 2979 2980@item -Wwrite-strings 2981@opindex Wwrite-strings 2982When compiling C, give string constants the type @code{const 2983char[@var{length}]} so that 2984copying the address of one into a non-@code{const} @code{char *} 2985pointer will get a warning; when compiling C++, warn about the 2986deprecated conversion from string literals to @code{char *}. This 2987warning, by default, is enabled for C++ programs. 2988These warnings will help you find at 2989compile time code that can try to write into a string constant, but 2990only if you have been very careful about using @code{const} in 2991declarations and prototypes. Otherwise, it will just be a nuisance; 2992this is why we did not make @option{-Wall} request these warnings. 2993 2994@item -Wconversion 2995@opindex Wconversion 2996Warn if a prototype causes a type conversion that is different from what 2997would happen to the same argument in the absence of a prototype. This 2998includes conversions of fixed point to floating and vice versa, and 2999conversions changing the width or signedness of a fixed point argument 3000except when the same as the default promotion. 3001 3002Also, warn if a negative integer constant expression is implicitly 3003converted to an unsigned type. For example, warn about the assignment 3004@code{x = -1} if @code{x} is unsigned. But do not warn about explicit 3005casts like @code{(unsigned) -1}. 3006 3007@item -Wsign-compare 3008@opindex Wsign-compare 3009@cindex warning for comparison of signed and unsigned values 3010@cindex comparison of signed and unsigned values, warning 3011@cindex signed and unsigned values, comparison warning 3012Warn when a comparison between signed and unsigned values could produce 3013an incorrect result when the signed value is converted to unsigned. 3014This warning is also enabled by @option{-Wextra}; to get the other warnings 3015of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}. 3016 3017@item -Waddress 3018@opindex Waddress 3019@opindex Wno-address 3020Warn about suspicious uses of memory addresses. These include using 3021the address of a function in a conditional expression, such as 3022@code{void func(void); if (func)}, and comparisons against the memory 3023address of a string literal, such as @code{if (x == "abc")}. Such 3024uses typically indicate a programmer error: the address of a function 3025always evaluates to true, so their use in a conditional usually 3026indicate that the programmer forgot the parentheses in a function 3027call; and comparisons against string literals result in unspecified 3028behavior and are not portable in C, so they usually indicate that the 3029programmer intended to use @code{strcmp}. This warning is enabled by 3030@option{-Wall}. 3031 3032@item -Waggregate-return 3033@opindex Waggregate-return 3034Warn if any functions that return structures or unions are defined or 3035called. (In languages where you can return an array, this also elicits 3036a warning.) 3037 3038@item -Wno-attributes 3039@opindex Wno-attributes 3040@opindex Wattributes 3041Do not warn if an unexpected @code{__attribute__} is used, such as 3042unrecognized attributes, function attributes applied to variables, 3043etc. This will not stop errors for incorrect use of supported 3044attributes. 3045 3046@item -Wstrict-prototypes @r{(C only)} 3047@opindex Wstrict-prototypes 3048Warn if a function is declared or defined without specifying the 3049argument types. (An old-style function definition is permitted without 3050a warning if preceded by a declaration which specifies the argument 3051types.) 3052 3053@item -Wold-style-definition @r{(C only)} 3054@opindex Wold-style-definition 3055Warn if an old-style function definition is used. A warning is given 3056even if there is a previous prototype. 3057 3058@c APPLE LOCAL warn missing prototype 6261539 3059@item -Wmissing-prototypes 3060@opindex Wmissing-prototypes 3061Warn if a global function is defined without a previous prototype 3062declaration. This warning is issued even if the definition itself 3063provides a prototype. The aim is to detect global functions that fail 3064to be declared in header files. 3065 3066@item -Wmissing-declarations @r{(C only)} 3067@opindex Wmissing-declarations 3068Warn if a global function is defined without a previous declaration. 3069Do so even if the definition itself provides a prototype. 3070Use this option to detect global functions that are not declared in 3071header files. 3072 3073@item -Wmissing-field-initializers 3074@opindex Wmissing-field-initializers 3075@opindex W 3076@opindex Wextra 3077Warn if a structure's initializer has some fields missing. For 3078example, the following code would cause such a warning, because 3079@code{x.h} is implicitly zero: 3080 3081@smallexample 3082struct s @{ int f, g, h; @}; 3083struct s x = @{ 3, 4 @}; 3084@end smallexample 3085 3086This option does not warn about designated initializers, so the following 3087modification would not trigger a warning: 3088 3089@smallexample 3090struct s @{ int f, g, h; @}; 3091struct s x = @{ .f = 3, .g = 4 @}; 3092@end smallexample 3093 3094This warning is included in @option{-Wextra}. To get other @option{-Wextra} 3095warnings without this one, use @samp{-Wextra -Wno-missing-field-initializers}. 3096 3097@item -Wmissing-noreturn 3098@opindex Wmissing-noreturn 3099Warn about functions which might be candidates for attribute @code{noreturn}. 3100Note these are only possible candidates, not absolute ones. Care should 3101be taken to manually verify functions actually do not ever return before 3102adding the @code{noreturn} attribute, otherwise subtle code generation 3103bugs could be introduced. You will not get a warning for @code{main} in 3104hosted C environments. 3105 3106@item -Wmissing-format-attribute 3107@opindex Wmissing-format-attribute 3108@opindex Wformat 3109Warn about function pointers which might be candidates for @code{format} 3110attributes. Note these are only possible candidates, not absolute ones. 3111GCC will guess that function pointers with @code{format} attributes that 3112are used in assignment, initialization, parameter passing or return 3113statements should have a corresponding @code{format} attribute in the 3114resulting type. I.e.@: the left-hand side of the assignment or 3115initialization, the type of the parameter variable, or the return type 3116of the containing function respectively should also have a @code{format} 3117attribute to avoid the warning. 3118 3119GCC will also warn about function definitions which might be 3120candidates for @code{format} attributes. Again, these are only 3121possible candidates. GCC will guess that @code{format} attributes 3122might be appropriate for any function that calls a function like 3123@code{vprintf} or @code{vscanf}, but this might not always be the 3124case, and some functions for which @code{format} attributes are 3125appropriate may not be detected. 3126 3127@item -Wno-multichar 3128@opindex Wno-multichar 3129@opindex Wmultichar 3130Do not warn if a multicharacter constant (@samp{'FOOF'}) is used. 3131Usually they indicate a typo in the user's code, as they have 3132implementation-defined values, and should not be used in portable code. 3133 3134@item -Wnormalized=<none|id|nfc|nfkc> 3135@opindex Wnormalized 3136@cindex NFC 3137@cindex NFKC 3138@cindex character set, input normalization 3139In ISO C and ISO C++, two identifiers are different if they are 3140different sequences of characters. However, sometimes when characters 3141outside the basic ASCII character set are used, you can have two 3142different character sequences that look the same. To avoid confusion, 3143the ISO 10646 standard sets out some @dfn{normalization rules} which 3144when applied ensure that two sequences that look the same are turned into 3145the same sequence. GCC can warn you if you are using identifiers which 3146have not been normalized; this option controls that warning. 3147 3148There are four levels of warning that GCC supports. The default is 3149@option{-Wnormalized=nfc}, which warns about any identifier which is 3150not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the 3151recommended form for most uses. 3152 3153Unfortunately, there are some characters which ISO C and ISO C++ allow 3154in identifiers that when turned into NFC aren't allowable as 3155identifiers. That is, there's no way to use these symbols in portable 3156ISO C or C++ and have all your identifiers in NFC. 3157@option{-Wnormalized=id} suppresses the warning for these characters. 3158It is hoped that future versions of the standards involved will correct 3159this, which is why this option is not the default. 3160 3161You can switch the warning off for all characters by writing 3162@option{-Wnormalized=none}. You would only want to do this if you 3163were using some other normalization scheme (like ``D''), because 3164otherwise you can easily create bugs that are literally impossible to see. 3165 3166Some characters in ISO 10646 have distinct meanings but look identical 3167in some fonts or display methodologies, especially once formatting has 3168been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL 3169LETTER N'', will display just like a regular @code{n} which has been 3170placed in a superscript. ISO 10646 defines the @dfn{NFKC} 3171normalization scheme to convert all these into a standard form as 3172well, and GCC will warn if your code is not in NFKC if you use 3173@option{-Wnormalized=nfkc}. This warning is comparable to warning 3174about every identifier that contains the letter O because it might be 3175confused with the digit 0, and so is not the default, but may be 3176useful as a local coding convention if the programming environment is 3177unable to be fixed to display these characters distinctly. 3178 3179@item -Wno-deprecated-declarations 3180@opindex Wno-deprecated-declarations 3181Do not warn about uses of functions (@pxref{Function Attributes}), 3182variables (@pxref{Variable Attributes}), and types (@pxref{Type 3183Attributes}) marked as deprecated by using the @code{deprecated} 3184attribute. 3185 3186@item -Wno-overflow 3187@opindex Wno-overflow 3188Do not warn about compile-time overflow in constant expressions. 3189 3190@item -Woverride-init 3191@opindex Woverride-init 3192@opindex W 3193@opindex Wextra 3194Warn if an initialized field without side effects is overridden when 3195using designated initializers (@pxref{Designated Inits, , Designated 3196Initializers}). 3197 3198This warning is included in @option{-Wextra}. To get other 3199@option{-Wextra} warnings without this one, use @samp{-Wextra 3200-Wno-override-init}. 3201 3202@item -Wpacked 3203@opindex Wpacked 3204Warn if a structure is given the packed attribute, but the packed 3205attribute has no effect on the layout or size of the structure. 3206Such structures may be mis-aligned for little benefit. For 3207instance, in this code, the variable @code{f.x} in @code{struct bar} 3208will be misaligned even though @code{struct bar} does not itself 3209have the packed attribute: 3210 3211@smallexample 3212@group 3213struct foo @{ 3214 int x; 3215 char a, b, c, d; 3216@} __attribute__((packed)); 3217struct bar @{ 3218 char z; 3219 struct foo f; 3220@}; 3221@end group 3222@end smallexample 3223 3224@item -Wpadded 3225@opindex Wpadded 3226Warn if padding is included in a structure, either to align an element 3227of the structure or to align the whole structure. Sometimes when this 3228happens it is possible to rearrange the fields of the structure to 3229reduce the padding and so make the structure smaller. 3230 3231@item -Wredundant-decls 3232@opindex Wredundant-decls 3233Warn if anything is declared more than once in the same scope, even in 3234cases where multiple declaration is valid and changes nothing. 3235 3236@item -Wnested-externs @r{(C only)} 3237@opindex Wnested-externs 3238Warn if an @code{extern} declaration is encountered within a function. 3239 3240@item -Wunreachable-code 3241@opindex Wunreachable-code 3242Warn if the compiler detects that code will never be executed. 3243 3244This option is intended to warn when the compiler detects that at 3245least a whole line of source code will never be executed, because 3246some condition is never satisfied or because it is after a 3247procedure that never returns. 3248 3249It is possible for this option to produce a warning even though there 3250are circumstances under which part of the affected line can be executed, 3251so care should be taken when removing apparently-unreachable code. 3252 3253For instance, when a function is inlined, a warning may mean that the 3254line is unreachable in only one inlined copy of the function. 3255 3256This option is not made part of @option{-Wall} because in a debugging 3257version of a program there is often substantial code which checks 3258correct functioning of the program and is, hopefully, unreachable 3259because the program does work. Another common use of unreachable 3260code is to provide behavior which is selectable at compile-time. 3261 3262@item -Winline 3263@opindex Winline 3264Warn if a function can not be inlined and it was declared as inline. 3265Even with this option, the compiler will not warn about failures to 3266inline functions declared in system headers. 3267 3268The compiler uses a variety of heuristics to determine whether or not 3269to inline a function. For example, the compiler takes into account 3270the size of the function being inlined and the amount of inlining 3271that has already been done in the current function. Therefore, 3272seemingly insignificant changes in the source program can cause the 3273warnings produced by @option{-Winline} to appear or disappear. 3274 3275@item -Wno-invalid-offsetof @r{(C++ only)} 3276@opindex Wno-invalid-offsetof 3277Suppress warnings from applying the @samp{offsetof} macro to a non-POD 3278type. According to the 1998 ISO C++ standard, applying @samp{offsetof} 3279to a non-POD type is undefined. In existing C++ implementations, 3280however, @samp{offsetof} typically gives meaningful results even when 3281applied to certain kinds of non-POD types. (Such as a simple 3282@samp{struct} that fails to be a POD type only by virtue of having a 3283constructor.) This flag is for users who are aware that they are 3284writing nonportable code and who have deliberately chosen to ignore the 3285warning about it. 3286 3287The restrictions on @samp{offsetof} may be relaxed in a future version 3288of the C++ standard. 3289 3290@item -Wno-int-to-pointer-cast @r{(C only)} 3291@opindex Wno-int-to-pointer-cast 3292Suppress warnings from casts to pointer type of an integer of a 3293different size. 3294 3295@item -Wno-pointer-to-int-cast @r{(C only)} 3296@opindex Wno-pointer-to-int-cast 3297Suppress warnings from casts from a pointer to an integer type of a 3298different size. 3299 3300@item -Winvalid-pch 3301@opindex Winvalid-pch 3302Warn if a precompiled header (@pxref{Precompiled Headers}) is found in 3303the search path but can't be used. 3304 3305@item -Wlong-long 3306@opindex Wlong-long 3307@opindex Wno-long-long 3308Warn if @samp{long long} type is used. This is default. To inhibit 3309the warning messages, use @option{-Wno-long-long}. Flags 3310@option{-Wlong-long} and @option{-Wno-long-long} are taken into account 3311only when @option{-pedantic} flag is used. 3312 3313@item -Wvariadic-macros 3314@opindex Wvariadic-macros 3315@opindex Wno-variadic-macros 3316Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU 3317alternate syntax when in pedantic ISO C99 mode. This is default. 3318To inhibit the warning messages, use @option{-Wno-variadic-macros}. 3319 3320@item -Wvla 3321@opindex Wvla 3322@opindex Wno-vla 3323Warn if variable length array is used in the code. 3324@option{-Wno-vla} will prevent the @option{-pedantic} warning of 3325the variable length array. 3326 3327@item -Wvolatile-register-var 3328@opindex Wvolatile-register-var 3329@opindex Wno-volatile-register-var 3330Warn if a register variable is declared volatile. The volatile 3331modifier does not inhibit all optimizations that may eliminate reads 3332and/or writes to register variables. 3333 3334@item -Wdisabled-optimization 3335@opindex Wdisabled-optimization 3336Warn if a requested optimization pass is disabled. This warning does 3337not generally indicate that there is anything wrong with your code; it 3338merely indicates that GCC's optimizers were unable to handle the code 3339effectively. Often, the problem is that your code is too big or too 3340complex; GCC will refuse to optimize programs when the optimization 3341itself is likely to take inordinate amounts of time. 3342 3343@item -Wpointer-sign 3344@opindex Wpointer-sign 3345@opindex Wno-pointer-sign 3346Warn for pointer argument passing or assignment with different signedness. 3347This option is only supported for C. It is implied by @option{-Wall} 3348and by @option{-pedantic}, which can be disabled with 3349@option{-Wno-pointer-sign}. 3350 3351@item -Werror 3352@opindex Werror 3353Make all warnings into errors. 3354 3355@item -Werror= 3356@opindex Werror= 3357Make the specified warning into an errors. The specifier for a 3358warning is appended, for example @option{-Werror=switch} turns the 3359warnings controlled by @option{-Wswitch} into errors. This switch 3360takes a negative form, to be used to negate @option{-Werror} for 3361specific warnings, for example @option{-Wno-error=switch} makes 3362@option{-Wswitch} warnings not be errors, even when @option{-Werror} 3363is in effect. You can use the @option{-fdiagnostics-show-option} 3364option to have each controllable warning amended with the option which 3365controls it, to determine what to use with this option. 3366 3367Note that specifying @option{-Werror=}@var{foo} automatically implies 3368@option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not 3369imply anything. 3370 3371@item -Wstack-protector 3372@opindex Wstack-protector 3373This option is only active when @option{-fstack-protector} is active. It 3374warns about functions that will not be protected against stack smashing. 3375 3376@item -Woverlength-strings 3377@opindex Woverlength-strings 3378Warn about string constants which are longer than the ``minimum 3379maximum'' length specified in the C standard. Modern compilers 3380generally allow string constants which are much longer than the 3381standard's minimum limit, but very portable programs should avoid 3382using longer strings. 3383 3384The limit applies @emph{after} string constant concatenation, and does 3385not count the trailing NUL@. In C89, the limit was 509 characters; in 3386C99, it was raised to 4095. C++98 does not specify a normative 3387minimum maximum, so we do not diagnose overlength strings in C++@. 3388 3389This option is implied by @option{-pedantic}, and can be disabled with 3390@option{-Wno-overlength-strings}. 3391@end table 3392 3393@node Debugging Options 3394@section Options for Debugging Your Program or GCC 3395@cindex options, debugging 3396@cindex debugging information options 3397 3398GCC has various special options that are used for debugging 3399either your program or GCC: 3400 3401@table @gcctabopt 3402@item -g 3403@opindex g 3404Produce debugging information in the operating system's native format 3405(stabs, COFF, XCOFF, or DWARF 2)@. GDB can work with this debugging 3406information. 3407 3408On most systems that use stabs format, @option{-g} enables use of extra 3409debugging information that only GDB can use; this extra information 3410makes debugging work better in GDB but will probably make other debuggers 3411crash or 3412refuse to read the program. If you want to control for certain whether 3413to generate the extra information, use @option{-gstabs+}, @option{-gstabs}, 3414@option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below). 3415 3416GCC allows you to use @option{-g} with 3417@option{-O}. The shortcuts taken by optimized code may occasionally 3418produce surprising results: some variables you declared may not exist 3419at all; flow of control may briefly move where you did not expect it; 3420some statements may not be executed because they compute constant 3421results or their values were already at hand; some statements may 3422execute in different places because they were moved out of loops. 3423 3424Nevertheless it proves possible to debug optimized output. This makes 3425it reasonable to use the optimizer for programs that might have bugs. 3426 3427The following options are useful when GCC is generated with the 3428capability for more than one debugging format. 3429 3430@item -ggdb 3431@opindex ggdb 3432Produce debugging information for use by GDB@. This means to use the 3433most expressive format available (DWARF 2, stabs, or the native format 3434if neither of those are supported), including GDB extensions if at all 3435possible. 3436 3437@item -gstabs 3438@opindex gstabs 3439Produce debugging information in stabs format (if that is supported), 3440without GDB extensions. This is the format used by DBX on most BSD 3441systems. On MIPS, Alpha and System V Release 4 systems this option 3442produces stabs debugging output which is not understood by DBX or SDB@. 3443On System V Release 4 systems this option requires the GNU assembler. 3444 3445@item -feliminate-unused-debug-symbols 3446@opindex feliminate-unused-debug-symbols 3447Produce debugging information in stabs format (if that is supported), 3448for only symbols that are actually used. 3449 3450@item -femit-class-debug-always 3451Instead of emitting debugging information for a C++ class in only one 3452object file, emit it in all object files using the class. This option 3453should be used only with debuggers that are unable to handle the way GCC 3454normally emits debugging information for classes because using this 3455option will increase the size of debugging information by as much as a 3456factor of two. 3457 3458@item -gstabs+ 3459@opindex gstabs+ 3460Produce debugging information in stabs format (if that is supported), 3461using GNU extensions understood only by the GNU debugger (GDB)@. The 3462use of these extensions is likely to make other debuggers crash or 3463refuse to read the program. 3464 3465@item -gcoff 3466@opindex gcoff 3467Produce debugging information in COFF format (if that is supported). 3468This is the format used by SDB on most System V systems prior to 3469System V Release 4. 3470 3471@item -gxcoff 3472@opindex gxcoff 3473Produce debugging information in XCOFF format (if that is supported). 3474This is the format used by the DBX debugger on IBM RS/6000 systems. 3475 3476@item -gxcoff+ 3477@opindex gxcoff+ 3478Produce debugging information in XCOFF format (if that is supported), 3479using GNU extensions understood only by the GNU debugger (GDB)@. The 3480use of these extensions is likely to make other debuggers crash or 3481refuse to read the program, and may cause assemblers other than the GNU 3482assembler (GAS) to fail with an error. 3483 3484@item -gdwarf-2 3485@opindex gdwarf-2 3486Produce debugging information in DWARF version 2 format (if that is 3487supported). This is the format used by DBX on IRIX 6. With this 3488option, GCC uses features of DWARF version 3 when they are useful; 3489version 3 is upward compatible with version 2, but may still cause 3490problems for older debuggers. 3491 3492@item -gvms 3493@opindex gvms 3494Produce debugging information in VMS debug format (if that is 3495supported). This is the format used by DEBUG on VMS systems. 3496 3497@item -g@var{level} 3498@itemx -ggdb@var{level} 3499@itemx -gstabs@var{level} 3500@itemx -gcoff@var{level} 3501@itemx -gxcoff@var{level} 3502@itemx -gvms@var{level} 3503Request debugging information and also use @var{level} to specify how 3504much information. The default level is 2. 3505 3506Level 1 produces minimal information, enough for making backtraces in 3507parts of the program that you don't plan to debug. This includes 3508descriptions of functions and external variables, but no information 3509about local variables and no line numbers. 3510 3511Level 3 includes extra information, such as all the macro definitions 3512present in the program. Some debuggers support macro expansion when 3513you use @option{-g3}. 3514 3515@option{-gdwarf-2} does not accept a concatenated debug level, because 3516GCC used to support an option @option{-gdwarf} that meant to generate 3517debug information in version 1 of the DWARF format (which is very 3518different from version 2), and it would have been too confusing. That 3519debug format is long obsolete, but the option cannot be changed now. 3520Instead use an additional @option{-g@var{level}} option to change the 3521debug level for DWARF2. 3522 3523@item -feliminate-dwarf2-dups 3524@opindex feliminate-dwarf2-dups 3525Compress DWARF2 debugging information by eliminating duplicated 3526information about each symbol. This option only makes sense when 3527generating DWARF2 debugging information with @option{-gdwarf-2}. 3528 3529@item -femit-struct-debug-baseonly 3530Emit debug information for struct-like types 3531only when the base name of the compilation source file 3532matches the base name of file in which the struct was defined. 3533 3534This option substantially reduces the size of debugging information, 3535but at significant potential loss in type information to the debugger. 3536See @option{-femit-struct-debug-reduced} for a less aggressive option. 3537See @option{-femit-struct-debug-detailed} for more detailed control. 3538 3539This option works only with DWARF 2. 3540 3541@item -femit-struct-debug-reduced 3542Emit debug information for struct-like types 3543only when the base name of the compilation source file 3544matches the base name of file in which the type was defined, 3545unless the struct is a template or defined in a system header. 3546 3547This option significantly reduces the size of debugging information, 3548with some potential loss in type information to the debugger. 3549See @option{-femit-struct-debug-baseonly} for a more aggressive option. 3550See @option{-femit-struct-debug-detailed} for more detailed control. 3551 3552This option works only with DWARF 2. 3553 3554@item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} 3555Specify the struct-like types 3556for which the compiler will generate debug information. 3557The intent is to reduce duplicate struct debug information 3558between different object files within the same program. 3559 3560This option is a detailed version of 3561@option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly}, 3562which will serve for most needs. 3563 3564A specification has the syntax 3565[@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none}) 3566 3567The optional first word limits the specification to 3568structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}). 3569A struct type is used directly when it is the type of a variable, member. 3570Indirect uses arise through pointers to structs. 3571That is, when use of an incomplete struct would be legal, the use is indirect. 3572An example is 3573@samp{struct one direct; struct two * indirect;}. 3574 3575The optional second word limits the specification to 3576ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}). 3577Generic structs are a bit complicated to explain. 3578For C++, these are non-explicit specializations of template classes, 3579or non-template classes within the above. 3580Other programming languages have generics, 3581but @samp{-femit-struct-debug-detailed} does not yet implement them. 3582 3583The third word specifies the source files for those 3584structs for which the compiler will emit debug information. 3585The values @samp{none} and @samp{any} have the normal meaning. 3586The value @samp{base} means that 3587the base of name of the file in which the type declaration appears 3588must match the base of the name of the main compilation file. 3589In practice, this means that 3590types declared in @file{foo.c} and @file{foo.h} will have debug information, 3591but types declared in other header will not. 3592The value @samp{sys} means those types satisfying @samp{base} 3593or declared in system or compiler headers. 3594 3595You may need to experiment to determine the best settings for your application. 3596 3597The default is @samp{-femit-struct-debug-detailed=all}. 3598 3599This option works only with DWARF 2. 3600 3601@cindex @command{prof} 3602@item -p 3603@opindex p 3604Generate extra code to write profile information suitable for the 3605analysis program @command{prof}. You must use this option when compiling 3606the source files you want data about, and you must also use it when 3607linking. 3608 3609@cindex @command{gprof} 3610@item -pg 3611@opindex pg 3612Generate extra code to write profile information suitable for the 3613analysis program @command{gprof}. You must use this option when compiling 3614the source files you want data about, and you must also use it when 3615linking. 3616 3617@item -Q 3618@opindex Q 3619Makes the compiler print out each function name as it is compiled, and 3620print some statistics about each pass when it finishes. 3621 3622@item -ftime-report 3623@opindex ftime-report 3624Makes the compiler print some statistics about the time consumed by each 3625pass when it finishes. 3626 3627@item -fmem-report 3628@opindex fmem-report 3629Makes the compiler print some statistics about permanent memory 3630allocation when it finishes. 3631 3632@item -fprofile-arcs 3633@opindex fprofile-arcs 3634Add code so that program flow @dfn{arcs} are instrumented. During 3635execution the program records how many times each branch and call is 3636executed and how many times it is taken or returns. When the compiled 3637program exits it saves this data to a file called 3638@file{@var{auxname}.gcda} for each source file. The data may be used for 3639profile-directed optimizations (@option{-fbranch-probabilities}), or for 3640test coverage analysis (@option{-ftest-coverage}). Each object file's 3641@var{auxname} is generated from the name of the output file, if 3642explicitly specified and it is not the final executable, otherwise it is 3643the basename of the source file. In both cases any suffix is removed 3644(e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or 3645@file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}). 3646@xref{Cross-profiling}. 3647 3648@cindex @command{gcov} 3649@item --coverage 3650@opindex coverage 3651 3652This option is used to compile and link code instrumented for coverage 3653analysis. The option is a synonym for @option{-fprofile-arcs} 3654@option{-ftest-coverage} (when compiling) and @option{-lgcov} (when 3655linking). See the documentation for those options for more details. 3656 3657@itemize 3658 3659@item 3660Compile the source files with @option{-fprofile-arcs} plus optimization 3661and code generation options. For test coverage analysis, use the 3662additional @option{-ftest-coverage} option. You do not need to profile 3663every source file in a program. 3664 3665@item 3666Link your object files with @option{-lgcov} or @option{-fprofile-arcs} 3667(the latter implies the former). 3668 3669@item 3670Run the program on a representative workload to generate the arc profile 3671information. This may be repeated any number of times. You can run 3672concurrent instances of your program, and provided that the file system 3673supports locking, the data files will be correctly updated. Also 3674@code{fork} calls are detected and correctly handled (double counting 3675will not happen). 3676 3677@item 3678For profile-directed optimizations, compile the source files again with 3679the same optimization and code generation options plus 3680@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that 3681Control Optimization}). 3682 3683@item 3684For test coverage analysis, use @command{gcov} to produce human readable 3685information from the @file{.gcno} and @file{.gcda} files. Refer to the 3686@command{gcov} documentation for further information. 3687 3688@end itemize 3689 3690With @option{-fprofile-arcs}, for each function of your program GCC 3691creates a program flow graph, then finds a spanning tree for the graph. 3692Only arcs that are not on the spanning tree have to be instrumented: the 3693compiler adds code to count the number of times that these arcs are 3694executed. When an arc is the only exit or only entrance to a block, the 3695instrumentation code can be added to the block; otherwise, a new basic 3696block must be created to hold the instrumentation code. 3697 3698@need 2000 3699@item -ftest-coverage 3700@opindex ftest-coverage 3701Produce a notes file that the @command{gcov} code-coverage utility 3702(@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to 3703show program coverage. Each source file's note file is called 3704@file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option 3705above for a description of @var{auxname} and instructions on how to 3706generate test coverage data. Coverage data will match the source files 3707more closely, if you do not optimize. 3708 3709@item -d@var{letters} 3710@item -fdump-rtl-@var{pass} 3711@opindex d 3712Says to make debugging dumps during compilation at times specified by 3713@var{letters}. This is used for debugging the RTL-based passes of the 3714compiler. The file names for most of the dumps are made by appending a 3715pass number and a word to the @var{dumpname}. @var{dumpname} is generated 3716from the name of the output file, if explicitly specified and it is not 3717an executable, otherwise it is the basename of the source file. These 3718switches may have different effects when @option{-E} is used for 3719preprocessing. 3720 3721Most debug dumps can be enabled either passing a letter to the @option{-d} 3722option, or with a long @option{-fdump-rtl} switch; here are the possible 3723letters for use in @var{letters} and @var{pass}, and their meanings: 3724 3725@table @gcctabopt 3726@item -dA 3727@opindex dA 3728Annotate the assembler output with miscellaneous debugging information. 3729 3730@item -dB 3731@itemx -fdump-rtl-bbro 3732@opindex dB 3733@opindex fdump-rtl-bbro 3734Dump after block reordering, to @file{@var{file}.148r.bbro}. 3735 3736@item -dc 3737@itemx -fdump-rtl-combine 3738@opindex dc 3739@opindex fdump-rtl-combine 3740Dump after instruction combination, to the file @file{@var{file}.129r.combine}. 3741 3742@item -dC 3743@itemx -fdump-rtl-ce1 3744@itemx -fdump-rtl-ce2 3745@opindex dC 3746@opindex fdump-rtl-ce1 3747@opindex fdump-rtl-ce2 3748@option{-dC} and @option{-fdump-rtl-ce1} enable dumping after the 3749first if conversion, to the file @file{@var{file}.117r.ce1}. @option{-dC} 3750and @option{-fdump-rtl-ce2} enable dumping after the second if 3751conversion, to the file @file{@var{file}.130r.ce2}. 3752 3753@item -dd 3754@itemx -fdump-rtl-btl 3755@itemx -fdump-rtl-dbr 3756@opindex dd 3757@opindex fdump-rtl-btl 3758@opindex fdump-rtl-dbr 3759@option{-dd} and @option{-fdump-rtl-btl} enable dumping after branch 3760target load optimization, to @file{@var{file}.31.btl}. @option{-dd} 3761and @option{-fdump-rtl-dbr} enable dumping after delayed branch 3762scheduling, to @file{@var{file}.36.dbr}. 3763 3764@item -dD 3765@opindex dD 3766Dump all macro definitions, at the end of preprocessing, in addition to 3767normal output. 3768 3769@item -dE 3770@itemx -fdump-rtl-ce3 3771@opindex dE 3772@opindex fdump-rtl-ce3 3773Dump after the third if conversion, to @file{@var{file}.146r.ce3}. 3774 3775@item -df 3776@itemx -fdump-rtl-cfg 3777@itemx -fdump-rtl-life 3778@opindex df 3779@opindex fdump-rtl-cfg 3780@opindex fdump-rtl-life 3781@option{-df} and @option{-fdump-rtl-cfg} enable dumping after control 3782and data flow analysis, to @file{@var{file}.116r.cfg}. @option{-df} 3783and @option{-fdump-rtl-cfg} enable dumping dump after life analysis, 3784to @file{@var{file}.128r.life1} and @file{@var{file}.135r.life2}. 3785 3786@item -dg 3787@itemx -fdump-rtl-greg 3788@opindex dg 3789@opindex fdump-rtl-greg 3790Dump after global register allocation, to @file{@var{file}.139r.greg}. 3791 3792@item -dG 3793@itemx -fdump-rtl-gcse 3794@itemx -fdump-rtl-bypass 3795@opindex dG 3796@opindex fdump-rtl-gcse 3797@opindex fdump-rtl-bypass 3798@option{-dG} and @option{-fdump-rtl-gcse} enable dumping after GCSE, to 3799@file{@var{file}.114r.gcse}. @option{-dG} and @option{-fdump-rtl-bypass} 3800enable dumping after jump bypassing and control flow optimizations, to 3801@file{@var{file}.115r.bypass}. 3802 3803@item -dh 3804@itemx -fdump-rtl-eh 3805@opindex dh 3806@opindex fdump-rtl-eh 3807Dump after finalization of EH handling code, to @file{@var{file}.02.eh}. 3808 3809@item -di 3810@itemx -fdump-rtl-sibling 3811@opindex di 3812@opindex fdump-rtl-sibling 3813Dump after sibling call optimizations, to @file{@var{file}.106r.sibling}. 3814 3815@item -dj 3816@itemx -fdump-rtl-jump 3817@opindex dj 3818@opindex fdump-rtl-jump 3819Dump after the first jump optimization, to @file{@var{file}.112r.jump}. 3820 3821@item -dk 3822@itemx -fdump-rtl-stack 3823@opindex dk 3824@opindex fdump-rtl-stack 3825Dump after conversion from registers to stack, to @file{@var{file}.152r.stack}. 3826 3827@item -dl 3828@itemx -fdump-rtl-lreg 3829@opindex dl 3830@opindex fdump-rtl-lreg 3831Dump after local register allocation, to @file{@var{file}.138r.lreg}. 3832 3833@item -dL 3834@itemx -fdump-rtl-loop2 3835@opindex dL 3836@opindex fdump-rtl-loop2 3837@option{-dL} and @option{-fdump-rtl-loop2} enable dumping after the 3838loop optimization pass, to @file{@var{file}.119r.loop2}, 3839@file{@var{file}.120r.loop2_init}, 3840@file{@var{file}.121r.loop2_invariant}, and 3841@file{@var{file}.125r.loop2_done}. 3842 3843@item -dm 3844@itemx -fdump-rtl-sms 3845@opindex dm 3846@opindex fdump-rtl-sms 3847Dump after modulo scheduling, to @file{@var{file}.136r.sms}. 3848 3849@item -dM 3850@itemx -fdump-rtl-mach 3851@opindex dM 3852@opindex fdump-rtl-mach 3853Dump after performing the machine dependent reorganization pass, to 3854@file{@var{file}.155r.mach} if that pass exists. 3855 3856@item -dn 3857@itemx -fdump-rtl-rnreg 3858@opindex dn 3859@opindex fdump-rtl-rnreg 3860Dump after register renumbering, to @file{@var{file}.147r.rnreg}. 3861 3862@item -dN 3863@itemx -fdump-rtl-regmove 3864@opindex dN 3865@opindex fdump-rtl-regmove 3866Dump after the register move pass, to @file{@var{file}.132r.regmove}. 3867 3868@item -do 3869@itemx -fdump-rtl-postreload 3870@opindex do 3871@opindex fdump-rtl-postreload 3872Dump after post-reload optimizations, to @file{@var{file}.24.postreload}. 3873 3874@item -dr 3875@itemx -fdump-rtl-expand 3876@opindex dr 3877@opindex fdump-rtl-expand 3878Dump after RTL generation, to @file{@var{file}.104r.expand}. 3879 3880@item -dR 3881@itemx -fdump-rtl-sched2 3882@opindex dR 3883@opindex fdump-rtl-sched2 3884Dump after the second scheduling pass, to @file{@var{file}.150r.sched2}. 3885 3886@item -ds 3887@itemx -fdump-rtl-cse 3888@opindex ds 3889@opindex fdump-rtl-cse 3890Dump after CSE (including the jump optimization that sometimes follows 3891CSE), to @file{@var{file}.113r.cse}. 3892 3893@item -dS 3894@itemx -fdump-rtl-sched 3895@opindex dS 3896@opindex fdump-rtl-sched 3897Dump after the first scheduling pass, to @file{@var{file}.21.sched}. 3898 3899@item -dt 3900@itemx -fdump-rtl-cse2 3901@opindex dt 3902@opindex fdump-rtl-cse2 3903Dump after the second CSE pass (including the jump optimization that 3904sometimes follows CSE), to @file{@var{file}.127r.cse2}. 3905 3906@item -dT 3907@itemx -fdump-rtl-tracer 3908@opindex dT 3909@opindex fdump-rtl-tracer 3910Dump after running tracer, to @file{@var{file}.118r.tracer}. 3911 3912@item -dV 3913@itemx -fdump-rtl-vpt 3914@itemx -fdump-rtl-vartrack 3915@opindex dV 3916@opindex fdump-rtl-vpt 3917@opindex fdump-rtl-vartrack 3918@option{-dV} and @option{-fdump-rtl-vpt} enable dumping after the value 3919profile transformations, to @file{@var{file}.10.vpt}. @option{-dV} 3920and @option{-fdump-rtl-vartrack} enable dumping after variable tracking, 3921to @file{@var{file}.154r.vartrack}. 3922 3923@item -dw 3924@itemx -fdump-rtl-flow2 3925@opindex dw 3926@opindex fdump-rtl-flow2 3927Dump after the second flow pass, to @file{@var{file}.142r.flow2}. 3928 3929@item -dz 3930@itemx -fdump-rtl-peephole2 3931@opindex dz 3932@opindex fdump-rtl-peephole2 3933Dump after the peephole pass, to @file{@var{file}.145r.peephole2}. 3934 3935@item -dZ 3936@itemx -fdump-rtl-web 3937@opindex dZ 3938@opindex fdump-rtl-web 3939Dump after live range splitting, to @file{@var{file}.126r.web}. 3940 3941@item -da 3942@itemx -fdump-rtl-all 3943@opindex da 3944@opindex fdump-rtl-all 3945Produce all the dumps listed above. 3946 3947@item -dH 3948@opindex dH 3949Produce a core dump whenever an error occurs. 3950 3951@item -dm 3952@opindex dm 3953Print statistics on memory usage, at the end of the run, to 3954standard error. 3955 3956@item -dp 3957@opindex dp 3958Annotate the assembler output with a comment indicating which 3959pattern and alternative was used. The length of each instruction is 3960also printed. 3961 3962@item -dP 3963@opindex dP 3964Dump the RTL in the assembler output as a comment before each instruction. 3965Also turns on @option{-dp} annotation. 3966 3967@item -dv 3968@opindex dv 3969For each of the other indicated dump files (either with @option{-d} or 3970@option{-fdump-rtl-@var{pass}}), dump a representation of the control flow 3971graph suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}. 3972 3973@item -dx 3974@opindex dx 3975Just generate RTL for a function instead of compiling it. Usually used 3976with @samp{r} (@option{-fdump-rtl-expand}). 3977 3978@item -dy 3979@opindex dy 3980Dump debugging information during parsing, to standard error. 3981@end table 3982 3983@item -fdump-noaddr 3984@opindex fdump-noaddr 3985When doing debugging dumps (see @option{-d} option above), suppress 3986address output. This makes it more feasible to use diff on debugging 3987dumps for compiler invocations with different compiler binaries and/or 3988different text / bss / data / heap / stack / dso start locations. 3989 3990@item -fdump-unnumbered 3991@opindex fdump-unnumbered 3992When doing debugging dumps (see @option{-d} option above), suppress instruction 3993numbers, line number note and address output. This makes it more feasible to 3994use diff on debugging dumps for compiler invocations with different 3995options, in particular with and without @option{-g}. 3996 3997@item -fdump-translation-unit @r{(C++ only)} 3998@itemx -fdump-translation-unit-@var{options} @r{(C++ only)} 3999@opindex fdump-translation-unit 4000Dump a representation of the tree structure for the entire translation 4001unit to a file. The file name is made by appending @file{.tu} to the 4002source file name. If the @samp{-@var{options}} form is used, @var{options} 4003controls the details of the dump as described for the 4004@option{-fdump-tree} options. 4005 4006@item -fdump-class-hierarchy @r{(C++ only)} 4007@itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)} 4008@opindex fdump-class-hierarchy 4009Dump a representation of each class's hierarchy and virtual function 4010table layout to a file. The file name is made by appending @file{.class} 4011to the source file name. If the @samp{-@var{options}} form is used, 4012@var{options} controls the details of the dump as described for the 4013@option{-fdump-tree} options. 4014 4015@item -fdump-ipa-@var{switch} 4016@opindex fdump-ipa 4017Control the dumping at various stages of inter-procedural analysis 4018language tree to a file. The file name is generated by appending a switch 4019specific suffix to the source file name. The following dumps are possible: 4020 4021@table @samp 4022@item all 4023Enables all inter-procedural analysis dumps; currently the only produced 4024dump is the @samp{cgraph} dump. 4025 4026@item cgraph 4027Dumps information about call-graph optimization, unused function removal, 4028and inlining decisions. 4029@end table 4030 4031@item -fdump-tree-@var{switch} 4032@itemx -fdump-tree-@var{switch}-@var{options} 4033@opindex fdump-tree 4034Control the dumping at various stages of processing the intermediate 4035language tree to a file. The file name is generated by appending a switch 4036specific suffix to the source file name. If the @samp{-@var{options}} 4037form is used, @var{options} is a list of @samp{-} separated options that 4038control the details of the dump. Not all options are applicable to all 4039dumps, those which are not meaningful will be ignored. The following 4040options are available 4041 4042@table @samp 4043@item address 4044Print the address of each node. Usually this is not meaningful as it 4045changes according to the environment and source file. Its primary use 4046is for tying up a dump file with a debug environment. 4047@item slim 4048Inhibit dumping of members of a scope or body of a function merely 4049because that scope has been reached. Only dump such items when they 4050are directly reachable by some other path. When dumping pretty-printed 4051trees, this option inhibits dumping the bodies of control structures. 4052@item raw 4053Print a raw representation of the tree. By default, trees are 4054pretty-printed into a C-like representation. 4055@item details 4056Enable more detailed dumps (not honored by every dump option). 4057@item stats 4058Enable dumping various statistics about the pass (not honored by every dump 4059option). 4060@item blocks 4061Enable showing basic block boundaries (disabled in raw dumps). 4062@item vops 4063Enable showing virtual operands for every statement. 4064@item lineno 4065Enable showing line numbers for statements. 4066@item uid 4067Enable showing the unique ID (@code{DECL_UID}) for each variable. 4068@item all 4069Turn on all options, except @option{raw}, @option{slim} and @option{lineno}. 4070@end table 4071 4072The following tree dumps are possible: 4073@table @samp 4074 4075@item original 4076Dump before any tree based optimization, to @file{@var{file}.original}. 4077 4078@item optimized 4079Dump after all tree based optimization, to @file{@var{file}.optimized}. 4080 4081@item inlined 4082Dump after function inlining, to @file{@var{file}.inlined}. 4083 4084@item gimple 4085@opindex fdump-tree-gimple 4086Dump each function before and after the gimplification pass to a file. The 4087file name is made by appending @file{.gimple} to the source file name. 4088 4089@item cfg 4090@opindex fdump-tree-cfg 4091Dump the control flow graph of each function to a file. The file name is 4092made by appending @file{.cfg} to the source file name. 4093 4094@item vcg 4095@opindex fdump-tree-vcg 4096Dump the control flow graph of each function to a file in VCG format. The 4097file name is made by appending @file{.vcg} to the source file name. Note 4098that if the file contains more than one function, the generated file cannot 4099be used directly by VCG@. You will need to cut and paste each function's 4100graph into its own separate file first. 4101 4102@item ch 4103@opindex fdump-tree-ch 4104Dump each function after copying loop headers. The file name is made by 4105appending @file{.ch} to the source file name. 4106 4107@item ssa 4108@opindex fdump-tree-ssa 4109Dump SSA related information to a file. The file name is made by appending 4110@file{.ssa} to the source file name. 4111 4112@item salias 4113@opindex fdump-tree-salias 4114Dump structure aliasing variable information to a file. This file name 4115is made by appending @file{.salias} to the source file name. 4116 4117@item alias 4118@opindex fdump-tree-alias 4119Dump aliasing information for each function. The file name is made by 4120appending @file{.alias} to the source file name. 4121 4122@item ccp 4123@opindex fdump-tree-ccp 4124Dump each function after CCP@. The file name is made by appending 4125@file{.ccp} to the source file name. 4126 4127@item storeccp 4128@opindex fdump-tree-storeccp 4129Dump each function after STORE-CCP. The file name is made by appending 4130@file{.storeccp} to the source file name. 4131 4132@item pre 4133@opindex fdump-tree-pre 4134Dump trees after partial redundancy elimination. The file name is made 4135by appending @file{.pre} to the source file name. 4136 4137@item fre 4138@opindex fdump-tree-fre 4139Dump trees after full redundancy elimination. The file name is made 4140by appending @file{.fre} to the source file name. 4141 4142@item copyprop 4143@opindex fdump-tree-copyprop 4144Dump trees after copy propagation. The file name is made 4145by appending @file{.copyprop} to the source file name. 4146 4147@item store_copyprop 4148@opindex fdump-tree-store_copyprop 4149Dump trees after store copy-propagation. The file name is made 4150by appending @file{.store_copyprop} to the source file name. 4151 4152@item dce 4153@opindex fdump-tree-dce 4154Dump each function after dead code elimination. The file name is made by 4155appending @file{.dce} to the source file name. 4156 4157@item mudflap 4158@opindex fdump-tree-mudflap 4159Dump each function after adding mudflap instrumentation. The file name is 4160made by appending @file{.mudflap} to the source file name. 4161 4162@item sra 4163@opindex fdump-tree-sra 4164Dump each function after performing scalar replacement of aggregates. The 4165file name is made by appending @file{.sra} to the source file name. 4166 4167@item sink 4168@opindex fdump-tree-sink 4169Dump each function after performing code sinking. The file name is made 4170by appending @file{.sink} to the source file name. 4171 4172@item dom 4173@opindex fdump-tree-dom 4174Dump each function after applying dominator tree optimizations. The file 4175name is made by appending @file{.dom} to the source file name. 4176 4177@item dse 4178@opindex fdump-tree-dse 4179Dump each function after applying dead store elimination. The file 4180name is made by appending @file{.dse} to the source file name. 4181 4182@item phiopt 4183@opindex fdump-tree-phiopt 4184Dump each function after optimizing PHI nodes into straightline code. The file 4185name is made by appending @file{.phiopt} to the source file name. 4186 4187@item forwprop 4188@opindex fdump-tree-forwprop 4189Dump each function after forward propagating single use variables. The file 4190name is made by appending @file{.forwprop} to the source file name. 4191 4192@item copyrename 4193@opindex fdump-tree-copyrename 4194Dump each function after applying the copy rename optimization. The file 4195name is made by appending @file{.copyrename} to the source file name. 4196 4197@item nrv 4198@opindex fdump-tree-nrv 4199Dump each function after applying the named return value optimization on 4200generic trees. The file name is made by appending @file{.nrv} to the source 4201file name. 4202 4203@item vect 4204@opindex fdump-tree-vect 4205Dump each function after applying vectorization of loops. The file name is 4206made by appending @file{.vect} to the source file name. 4207 4208@item vrp 4209@opindex fdump-tree-vrp 4210Dump each function after Value Range Propagation (VRP). The file name 4211is made by appending @file{.vrp} to the source file name. 4212 4213@item all 4214@opindex fdump-tree-all 4215Enable all the available tree dumps with the flags provided in this option. 4216@end table 4217 4218@item -ftree-vectorizer-verbose=@var{n} 4219@opindex ftree-vectorizer-verbose 4220This option controls the amount of debugging output the vectorizer prints. 4221This information is written to standard error, unless 4222@option{-fdump-tree-all} or @option{-fdump-tree-vect} is specified, 4223in which case it is output to the usual dump listing file, @file{.vect}. 4224For @var{n}=0 no diagnostic information is reported. 4225If @var{n}=1 the vectorizer reports each loop that got vectorized, 4226and the total number of loops that got vectorized. 4227If @var{n}=2 the vectorizer also reports non-vectorized loops that passed 4228the first analysis phase (vect_analyze_loop_form) - i.e. countable, 4229inner-most, single-bb, single-entry/exit loops. This is the same verbosity 4230level that @option{-fdump-tree-vect-stats} uses. 4231Higher verbosity levels mean either more information dumped for each 4232reported loop, or same amount of information reported for more loops: 4233If @var{n}=3, alignment related information is added to the reports. 4234If @var{n}=4, data-references related information (e.g. memory dependences, 4235memory access-patterns) is added to the reports. 4236If @var{n}=5, the vectorizer reports also non-vectorized inner-most loops 4237that did not pass the first analysis phase (i.e. may not be countable, or 4238may have complicated control-flow). 4239If @var{n}=6, the vectorizer reports also non-vectorized nested loops. 4240For @var{n}=7, all the information the vectorizer generates during its 4241analysis and transformation is reported. This is the same verbosity level 4242that @option{-fdump-tree-vect-details} uses. 4243 4244@item -frandom-seed=@var{string} 4245@opindex frandom-string 4246This option provides a seed that GCC uses when it would otherwise use 4247random numbers. It is used to generate certain symbol names 4248that have to be different in every compiled file. It is also used to 4249place unique stamps in coverage data files and the object files that 4250produce them. You can use the @option{-frandom-seed} option to produce 4251reproducibly identical object files. 4252 4253The @var{string} should be different for every file you compile. 4254 4255@item -fsched-verbose=@var{n} 4256@opindex fsched-verbose 4257On targets that use instruction scheduling, this option controls the 4258amount of debugging output the scheduler prints. This information is 4259written to standard error, unless @option{-dS} or @option{-dR} is 4260specified, in which case it is output to the usual dump 4261listing file, @file{.sched} or @file{.sched2} respectively. However 4262for @var{n} greater than nine, the output is always printed to standard 4263error. 4264 4265For @var{n} greater than zero, @option{-fsched-verbose} outputs the 4266same information as @option{-dRS}. For @var{n} greater than one, it 4267also output basic block probabilities, detailed ready list information 4268and unit/insn info. For @var{n} greater than two, it includes RTL 4269at abort point, control-flow and regions info. And for @var{n} over 4270four, @option{-fsched-verbose} also includes dependence info. 4271 4272@item -save-temps 4273@opindex save-temps 4274Store the usual ``temporary'' intermediate files permanently; place them 4275in the current directory and name them based on the source file. Thus, 4276compiling @file{foo.c} with @samp{-c -save-temps} would produce files 4277@file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a 4278preprocessed @file{foo.i} output file even though the compiler now 4279normally uses an integrated preprocessor. 4280 4281When used in combination with the @option{-x} command line option, 4282@option{-save-temps} is sensible enough to avoid over writing an 4283input source file with the same extension as an intermediate file. 4284The corresponding intermediate file may be obtained by renaming the 4285source file before using @option{-save-temps}. 4286 4287@item -time 4288@opindex time 4289Report the CPU time taken by each subprocess in the compilation 4290sequence. For C source files, this is the compiler proper and assembler 4291(plus the linker if linking is done). The output looks like this: 4292 4293@smallexample 4294# cc1 0.12 0.01 4295# as 0.00 0.01 4296@end smallexample 4297 4298The first number on each line is the ``user time'', that is time spent 4299executing the program itself. The second number is ``system time'', 4300time spent executing operating system routines on behalf of the program. 4301Both numbers are in seconds. 4302 4303@item -fvar-tracking 4304@opindex fvar-tracking 4305Run variable tracking pass. It computes where variables are stored at each 4306position in code. Better debugging information is then generated 4307(if the debugging information format supports this information). 4308 4309It is enabled by default when compiling with optimization (@option{-Os}, 4310@option{-O}, @option{-O2}, ...), debugging information (@option{-g}) and 4311the debug info format supports it. 4312 4313@item -print-file-name=@var{library} 4314@opindex print-file-name 4315Print the full absolute name of the library file @var{library} that 4316would be used when linking---and don't do anything else. With this 4317option, GCC does not compile or link anything; it just prints the 4318file name. 4319 4320@item -print-multi-directory 4321@opindex print-multi-directory 4322Print the directory name corresponding to the multilib selected by any 4323other switches present in the command line. This directory is supposed 4324to exist in @env{GCC_EXEC_PREFIX}. 4325 4326@item -print-multi-lib 4327@opindex print-multi-lib 4328Print the mapping from multilib directory names to compiler switches 4329that enable them. The directory name is separated from the switches by 4330@samp{;}, and each switch starts with an @samp{@@} instead of the 4331@samp{-}, without spaces between multiple switches. This is supposed to 4332ease shell-processing. 4333 4334@item -print-prog-name=@var{program} 4335@opindex print-prog-name 4336Like @option{-print-file-name}, but searches for a program such as @samp{cpp}. 4337 4338@item -print-libgcc-file-name 4339@opindex print-libgcc-file-name 4340Same as @option{-print-file-name=libgcc.a}. 4341 4342This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs} 4343but you do want to link with @file{libgcc.a}. You can do 4344 4345@smallexample 4346gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name` 4347@end smallexample 4348 4349@item -print-search-dirs 4350@opindex print-search-dirs 4351Print the name of the configured installation directory and a list of 4352program and library directories @command{gcc} will search---and don't do anything else. 4353 4354This is useful when @command{gcc} prints the error message 4355@samp{installation problem, cannot exec cpp0: No such file or directory}. 4356To resolve this you either need to put @file{cpp0} and the other compiler 4357components where @command{gcc} expects to find them, or you can set the environment 4358variable @env{GCC_EXEC_PREFIX} to the directory where you installed them. 4359Don't forget the trailing @samp{/}. 4360@xref{Environment Variables}. 4361 4362@item -dumpmachine 4363@opindex dumpmachine 4364Print the compiler's target machine (for example, 4365@samp{i686-pc-linux-gnu})---and don't do anything else. 4366 4367@item -dumpversion 4368@opindex dumpversion 4369Print the compiler version (for example, @samp{3.0})---and don't do 4370anything else. 4371 4372@item -dumpspecs 4373@opindex dumpspecs 4374Print the compiler's built-in specs---and don't do anything else. (This 4375is used when GCC itself is being built.) @xref{Spec Files}. 4376 4377@item -feliminate-unused-debug-types 4378@opindex feliminate-unused-debug-types 4379Normally, when producing DWARF2 output, GCC will emit debugging 4380information for all types declared in a compilation 4381unit, regardless of whether or not they are actually used 4382in that compilation unit. Sometimes this is useful, such as 4383if, in the debugger, you want to cast a value to a type that is 4384not actually used in your program (but is declared). More often, 4385however, this results in a significant amount of wasted space. 4386With this option, GCC will avoid producing debug symbol output 4387for types that are nowhere used in the source file being compiled. 4388@end table 4389 4390@node Optimize Options 4391@section Options That Control Optimization 4392@cindex optimize options 4393@cindex options, optimization 4394 4395These options control various sorts of optimizations. 4396 4397Without any optimization option, the compiler's goal is to reduce the 4398cost of compilation and to make debugging produce the expected 4399results. Statements are independent: if you stop the program with a 4400breakpoint between statements, you can then assign a new value to any 4401variable or change the program counter to any other statement in the 4402function and get exactly the results you would expect from the source 4403code. 4404 4405Turning on optimization flags makes the compiler attempt to improve 4406the performance and/or code size at the expense of compilation time 4407and possibly the ability to debug the program. 4408 4409The compiler performs optimization based on the knowledge it has of 4410the program. Optimization levels @option{-O} and above, in 4411particular, enable @emph{unit-at-a-time} mode, which allows the 4412compiler to consider information gained from later functions in 4413the file when compiling a function. Compiling multiple files at 4414once to a single output file in @emph{unit-at-a-time} mode allows 4415the compiler to use information gained from all of the files when 4416compiling each of them. 4417 4418Not all optimizations are controlled directly by a flag. Only 4419optimizations that have a flag are listed. 4420 4421@table @gcctabopt 4422@item -O 4423@itemx -O1 4424@opindex O 4425@opindex O1 4426Optimize. Optimizing compilation takes somewhat more time, and a lot 4427more memory for a large function. 4428 4429With @option{-O}, the compiler tries to reduce code size and execution 4430time, without performing any optimizations that take a great deal of 4431compilation time. 4432 4433@option{-O} turns on the following optimization flags: 4434@gccoptlist{-fdefer-pop @gol 4435-fdelayed-branch @gol 4436-fguess-branch-probability @gol 4437-fcprop-registers @gol 4438-fif-conversion @gol 4439-fif-conversion2 @gol 4440-ftree-ccp @gol 4441-ftree-dce @gol 4442-ftree-dominator-opts @gol 4443-ftree-dse @gol 4444-ftree-ter @gol 4445-ftree-lrs @gol 4446-ftree-sra @gol 4447-ftree-copyrename @gol 4448-ftree-fre @gol 4449-ftree-ch @gol 4450-funit-at-a-time @gol 4451-fmerge-constants} 4452 4453@option{-O} also turns on @option{-fomit-frame-pointer} on machines 4454where doing so does not interfere with debugging. 4455 4456@item -O2 4457@opindex O2 4458Optimize even more. GCC performs nearly all supported optimizations 4459that do not involve a space-speed tradeoff. The compiler does not 4460perform loop unrolling or function inlining when you specify @option{-O2}. 4461As compared to @option{-O}, this option increases both compilation time 4462and the performance of the generated code. 4463 4464@option{-O2} turns on all optimization flags specified by @option{-O}. It 4465also turns on the following optimization flags: 4466@gccoptlist{-fthread-jumps @gol 4467-fcrossjumping @gol 4468-foptimize-sibling-calls @gol 4469-fcse-follow-jumps -fcse-skip-blocks @gol 4470-fgcse -fgcse-lm @gol 4471-fexpensive-optimizations @gol 4472-frerun-cse-after-loop @gol 4473-fcaller-saves @gol 4474-fpeephole2 @gol 4475-fschedule-insns -fschedule-insns2 @gol 4476-fsched-interblock -fsched-spec @gol 4477-fregmove @gol 4478-fstrict-aliasing -fstrict-overflow @gol 4479-fdelete-null-pointer-checks @gol 4480-freorder-blocks -freorder-functions @gol 4481-falign-functions -falign-jumps @gol 4482-falign-loops -falign-labels @gol 4483-ftree-vrp @gol 4484-ftree-pre} 4485 4486Please note the warning under @option{-fgcse} about 4487invoking @option{-O2} on programs that use computed gotos. 4488 4489@option{-O2} doesn't turn on @option{-ftree-vrp} for the Ada compiler. 4490This option must be explicitly specified on the command line to be 4491enabled for the Ada compiler. 4492 4493@item -O3 4494@opindex O3 4495Optimize yet more. @option{-O3} turns on all optimizations specified by 4496@option{-O2} and also turns on the @option{-finline-functions}, 4497@option{-funswitch-loops} and @option{-fgcse-after-reload} options. 4498 4499@item -O0 4500@opindex O0 4501Do not optimize. This is the default. 4502 4503@item -Os 4504@opindex Os 4505Optimize for size. @option{-Os} enables all @option{-O2} optimizations that 4506do not typically increase code size. It also performs further 4507optimizations designed to reduce code size. 4508 4509@option{-Os} disables the following optimization flags: 4510@gccoptlist{-falign-functions -falign-jumps -falign-loops @gol 4511-falign-labels -freorder-blocks -freorder-blocks-and-partition @gol 4512-fprefetch-loop-arrays -ftree-vect-loop-version} 4513 4514If you use multiple @option{-O} options, with or without level numbers, 4515the last such option is the one that is effective. 4516@end table 4517 4518Options of the form @option{-f@var{flag}} specify machine-independent 4519flags. Most flags have both positive and negative forms; the negative 4520form of @option{-ffoo} would be @option{-fno-foo}. In the table 4521below, only one of the forms is listed---the one you typically will 4522use. You can figure out the other form by either removing @samp{no-} 4523or adding it. 4524 4525The following options control specific optimizations. They are either 4526activated by @option{-O} options or are related to ones that are. You 4527can use the following flags in the rare cases when ``fine-tuning'' of 4528optimizations to be performed is desired. 4529 4530@table @gcctabopt 4531@item -fno-default-inline 4532@opindex fno-default-inline 4533Do not make member functions inline by default merely because they are 4534defined inside the class scope (C++ only). Otherwise, when you specify 4535@w{@option{-O}}, member functions defined inside class scope are compiled 4536inline by default; i.e., you don't need to add @samp{inline} in front of 4537the member function name. 4538 4539@item -fno-defer-pop 4540@opindex fno-defer-pop 4541Always pop the arguments to each function call as soon as that function 4542returns. For machines which must pop arguments after a function call, 4543the compiler normally lets arguments accumulate on the stack for several 4544function calls and pops them all at once. 4545 4546Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4547 4548@item -fforce-mem 4549@opindex fforce-mem 4550Force memory operands to be copied into registers before doing 4551arithmetic on them. This produces better code by making all memory 4552references potential common subexpressions. When they are not common 4553subexpressions, instruction combination should eliminate the separate 4554register-load. This option is now a nop and will be removed in 4.3. 4555 4556@item -fforce-addr 4557@opindex fforce-addr 4558Force memory address constants to be copied into registers before 4559doing arithmetic on them. 4560 4561@item -fomit-frame-pointer 4562@opindex fomit-frame-pointer 4563Don't keep the frame pointer in a register for functions that 4564don't need one. This avoids the instructions to save, set up and 4565restore frame pointers; it also makes an extra register available 4566in many functions. @strong{It also makes debugging impossible on 4567some machines.} 4568 4569On some machines, such as the VAX, this flag has no effect, because 4570the standard calling sequence automatically handles the frame pointer 4571and nothing is saved by pretending it doesn't exist. The 4572machine-description macro @code{FRAME_POINTER_REQUIRED} controls 4573whether a target machine supports this flag. @xref{Registers,,Register 4574Usage, gccint, GNU Compiler Collection (GCC) Internals}. 4575 4576Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4577 4578@item -foptimize-sibling-calls 4579@opindex foptimize-sibling-calls 4580Optimize sibling and tail recursive calls. 4581 4582Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4583 4584@item -fno-inline 4585@opindex fno-inline 4586Don't pay attention to the @code{inline} keyword. Normally this option 4587is used to keep the compiler from expanding any functions inline. 4588Note that if you are not optimizing, no functions can be expanded inline. 4589 4590@item -finline-functions 4591@opindex finline-functions 4592Integrate all simple functions into their callers. The compiler 4593heuristically decides which functions are simple enough to be worth 4594integrating in this way. 4595 4596If all calls to a given function are integrated, and the function is 4597declared @code{static}, then the function is normally not output as 4598assembler code in its own right. 4599 4600Enabled at level @option{-O3}. 4601 4602@item -finline-functions-called-once 4603@opindex finline-functions-called-once 4604Consider all @code{static} functions called once for inlining into their 4605caller even if they are not marked @code{inline}. If a call to a given 4606function is integrated, then the function is not output as assembler code 4607in its own right. 4608 4609Enabled if @option{-funit-at-a-time} is enabled. 4610 4611@item -fearly-inlining 4612@opindex fearly-inlining 4613Inline functions marked by @code{always_inline} and functions whose body seems 4614smaller than the function call overhead early before doing 4615@option{-fprofile-generate} instrumentation and real inlining pass. Doing so 4616makes profiling significantly cheaper and usually inlining faster on programs 4617having large chains of nested wrapper functions. 4618 4619Enabled by default. 4620 4621@item -finline-limit=@var{n} 4622@opindex finline-limit 4623By default, GCC limits the size of functions that can be inlined. This flag 4624allows the control of this limit for functions that are explicitly marked as 4625inline (i.e., marked with the inline keyword or defined within the class 4626definition in c++). @var{n} is the size of functions that can be inlined in 4627number of pseudo instructions (not counting parameter handling). The default 4628value of @var{n} is 600. 4629Increasing this value can result in more inlined code at 4630the cost of compilation time and memory consumption. Decreasing usually makes 4631the compilation faster and less code will be inlined (which presumably 4632means slower programs). This option is particularly useful for programs that 4633use inlining heavily such as those based on recursive templates with C++. 4634 4635Inlining is actually controlled by a number of parameters, which may be 4636specified individually by using @option{--param @var{name}=@var{value}}. 4637The @option{-finline-limit=@var{n}} option sets some of these parameters 4638as follows: 4639 4640@table @gcctabopt 4641@item max-inline-insns-single 4642 is set to @var{n}/2. 4643@item max-inline-insns-auto 4644 is set to @var{n}/2. 4645@item min-inline-insns 4646 is set to 130 or @var{n}/4, whichever is smaller. 4647@item max-inline-insns-rtl 4648 is set to @var{n}. 4649@end table 4650 4651See below for a documentation of the individual 4652parameters controlling inlining. 4653 4654@emph{Note:} pseudo instruction represents, in this particular context, an 4655abstract measurement of function's size. In no way does it represent a count 4656of assembly instructions and as such its exact meaning might change from one 4657release to an another. 4658 4659@item -fkeep-inline-functions 4660@opindex fkeep-inline-functions 4661In C, emit @code{static} functions that are declared @code{inline} 4662into the object file, even if the function has been inlined into all 4663of its callers. This switch does not affect functions using the 4664@code{extern inline} extension in GNU C@. In C++, emit any and all 4665inline functions into the object file. 4666 4667@item -fkeep-static-consts 4668@opindex fkeep-static-consts 4669Emit variables declared @code{static const} when optimization isn't turned 4670on, even if the variables aren't referenced. 4671 4672GCC enables this option by default. If you want to force the compiler to 4673check if the variable was referenced, regardless of whether or not 4674optimization is turned on, use the @option{-fno-keep-static-consts} option. 4675 4676@item -fmerge-constants 4677Attempt to merge identical constants (string constants and floating point 4678constants) across compilation units. 4679 4680This option is the default for optimized compilation if the assembler and 4681linker support it. Use @option{-fno-merge-constants} to inhibit this 4682behavior. 4683 4684Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4685 4686@item -fmerge-all-constants 4687Attempt to merge identical constants and identical variables. 4688 4689This option implies @option{-fmerge-constants}. In addition to 4690@option{-fmerge-constants} this considers e.g.@: even constant initialized 4691arrays or initialized constant variables with integral or floating point 4692types. Languages like C or C++ require each non-automatic variable to 4693have distinct location, so using this option will result in non-conforming 4694behavior. 4695 4696@item -fmodulo-sched 4697@opindex fmodulo-sched 4698Perform swing modulo scheduling immediately before the first scheduling 4699pass. This pass looks at innermost loops and reorders their 4700instructions by overlapping different iterations. 4701 4702@item -fno-branch-count-reg 4703@opindex fno-branch-count-reg 4704Do not use ``decrement and branch'' instructions on a count register, 4705but instead generate a sequence of instructions that decrement a 4706register, compare it against zero, then branch based upon the result. 4707This option is only meaningful on architectures that support such 4708instructions, which include x86, PowerPC, IA-64 and S/390. 4709 4710The default is @option{-fbranch-count-reg}. 4711 4712@item -fno-function-cse 4713@opindex fno-function-cse 4714Do not put function addresses in registers; make each instruction that 4715calls a constant function contain the function's address explicitly. 4716 4717This option results in less efficient code, but some strange hacks 4718that alter the assembler output may be confused by the optimizations 4719performed when this option is not used. 4720 4721The default is @option{-ffunction-cse} 4722 4723@item -fno-zero-initialized-in-bss 4724@opindex fno-zero-initialized-in-bss 4725If the target supports a BSS section, GCC by default puts variables that 4726are initialized to zero into BSS@. This can save space in the resulting 4727code. 4728 4729This option turns off this behavior because some programs explicitly 4730rely on variables going to the data section. E.g., so that the 4731resulting executable can find the beginning of that section and/or make 4732assumptions based on that. 4733 4734The default is @option{-fzero-initialized-in-bss}. 4735 4736@item -fbounds-check 4737@opindex fbounds-check 4738For front-ends that support it, generate additional code to check that 4739indices used to access arrays are within the declared range. This is 4740currently only supported by the Java and Fortran front-ends, where 4741this option defaults to true and false respectively. 4742 4743@item -fmudflap -fmudflapth -fmudflapir 4744@opindex fmudflap 4745@opindex fmudflapth 4746@opindex fmudflapir 4747@cindex bounds checking 4748@cindex mudflap 4749For front-ends that support it (C and C++), instrument all risky 4750pointer/array dereferencing operations, some standard library 4751string/heap functions, and some other associated constructs with 4752range/validity tests. Modules so instrumented should be immune to 4753buffer overflows, invalid heap use, and some other classes of C/C++ 4754programming errors. The instrumentation relies on a separate runtime 4755library (@file{libmudflap}), which will be linked into a program if 4756@option{-fmudflap} is given at link time. Run-time behavior of the 4757instrumented program is controlled by the @env{MUDFLAP_OPTIONS} 4758environment variable. See @code{env MUDFLAP_OPTIONS=-help a.out} 4759for its options. 4760 4761Use @option{-fmudflapth} instead of @option{-fmudflap} to compile and to 4762link if your program is multi-threaded. Use @option{-fmudflapir}, in 4763addition to @option{-fmudflap} or @option{-fmudflapth}, if 4764instrumentation should ignore pointer reads. This produces less 4765instrumentation (and therefore faster execution) and still provides 4766some protection against outright memory corrupting writes, but allows 4767erroneously read data to propagate within a program. 4768 4769@item -fthread-jumps 4770@opindex fthread-jumps 4771Perform optimizations where we check to see if a jump branches to a 4772location where another comparison subsumed by the first is found. If 4773so, the first branch is redirected to either the destination of the 4774second branch or a point immediately following it, depending on whether 4775the condition is known to be true or false. 4776 4777Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4778 4779@item -fcse-follow-jumps 4780@opindex fcse-follow-jumps 4781In common subexpression elimination, scan through jump instructions 4782when the target of the jump is not reached by any other path. For 4783example, when CSE encounters an @code{if} statement with an 4784@code{else} clause, CSE will follow the jump when the condition 4785tested is false. 4786 4787Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4788 4789@item -fcse-skip-blocks 4790@opindex fcse-skip-blocks 4791This is similar to @option{-fcse-follow-jumps}, but causes CSE to 4792follow jumps which conditionally skip over blocks. When CSE 4793encounters a simple @code{if} statement with no else clause, 4794@option{-fcse-skip-blocks} causes CSE to follow the jump around the 4795body of the @code{if}. 4796 4797Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4798 4799@item -frerun-cse-after-loop 4800@opindex frerun-cse-after-loop 4801Re-run common subexpression elimination after loop optimizations has been 4802performed. 4803 4804Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4805 4806@item -fgcse 4807@opindex fgcse 4808Perform a global common subexpression elimination pass. 4809This pass also performs global constant and copy propagation. 4810 4811@emph{Note:} When compiling a program using computed gotos, a GCC 4812extension, you may get better runtime performance if you disable 4813the global common subexpression elimination pass by adding 4814@option{-fno-gcse} to the command line. 4815 4816Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4817 4818@item -fgcse-lm 4819@opindex fgcse-lm 4820When @option{-fgcse-lm} is enabled, global common subexpression elimination will 4821attempt to move loads which are only killed by stores into themselves. This 4822allows a loop containing a load/store sequence to be changed to a load outside 4823the loop, and a copy/store within the loop. 4824 4825Enabled by default when gcse is enabled. 4826 4827@item -fgcse-sm 4828@opindex fgcse-sm 4829When @option{-fgcse-sm} is enabled, a store motion pass is run after 4830global common subexpression elimination. This pass will attempt to move 4831stores out of loops. When used in conjunction with @option{-fgcse-lm}, 4832loops containing a load/store sequence can be changed to a load before 4833the loop and a store after the loop. 4834 4835Not enabled at any optimization level. 4836 4837@item -fgcse-las 4838@opindex fgcse-las 4839When @option{-fgcse-las} is enabled, the global common subexpression 4840elimination pass eliminates redundant loads that come after stores to the 4841same memory location (both partial and full redundancies). 4842 4843Not enabled at any optimization level. 4844 4845@item -fgcse-after-reload 4846@opindex fgcse-after-reload 4847When @option{-fgcse-after-reload} is enabled, a redundant load elimination 4848pass is performed after reload. The purpose of this pass is to cleanup 4849redundant spilling. 4850 4851@item -funsafe-loop-optimizations 4852@opindex funsafe-loop-optimizations 4853If given, the loop optimizer will assume that loop indices do not 4854overflow, and that the loops with nontrivial exit condition are not 4855infinite. This enables a wider range of loop optimizations even if 4856the loop optimizer itself cannot prove that these assumptions are valid. 4857Using @option{-Wunsafe-loop-optimizations}, the compiler will warn you 4858if it finds this kind of loop. 4859 4860@item -fcrossjumping 4861@opindex crossjumping 4862Perform cross-jumping transformation. This transformation unifies equivalent code and save code size. The 4863resulting code may or may not perform better than without cross-jumping. 4864 4865Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4866 4867@item -fif-conversion 4868@opindex if-conversion 4869Attempt to transform conditional jumps into branch-less equivalents. This 4870include use of conditional moves, min, max, set flags and abs instructions, and 4871some tricks doable by standard arithmetics. The use of conditional execution 4872on chips where it is available is controlled by @code{if-conversion2}. 4873 4874Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4875 4876@item -fif-conversion2 4877@opindex if-conversion2 4878Use conditional execution (where available) to transform conditional jumps into 4879branch-less equivalents. 4880 4881Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4882 4883@item -fdelete-null-pointer-checks 4884@opindex fdelete-null-pointer-checks 4885Use global dataflow analysis to identify and eliminate useless checks 4886for null pointers. The compiler assumes that dereferencing a null 4887pointer would have halted the program. If a pointer is checked after 4888it has already been dereferenced, it cannot be null. 4889 4890In some environments, this assumption is not true, and programs can 4891safely dereference null pointers. Use 4892@option{-fno-delete-null-pointer-checks} to disable this optimization 4893for programs which depend on that behavior. 4894 4895Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4896 4897@item -fexpensive-optimizations 4898@opindex fexpensive-optimizations 4899Perform a number of minor optimizations that are relatively expensive. 4900 4901Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4902 4903@item -foptimize-register-move 4904@itemx -fregmove 4905@opindex foptimize-register-move 4906@opindex fregmove 4907Attempt to reassign register numbers in move instructions and as 4908operands of other simple instructions in order to maximize the amount of 4909register tying. This is especially helpful on machines with two-operand 4910instructions. 4911 4912Note @option{-fregmove} and @option{-foptimize-register-move} are the same 4913optimization. 4914 4915Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4916 4917@item -fdelayed-branch 4918@opindex fdelayed-branch 4919If supported for the target machine, attempt to reorder instructions 4920to exploit instruction slots available after delayed branch 4921instructions. 4922 4923Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4924 4925@item -fschedule-insns 4926@opindex fschedule-insns 4927If supported for the target machine, attempt to reorder instructions to 4928eliminate execution stalls due to required data being unavailable. This 4929helps machines that have slow floating point or memory load instructions 4930by allowing other instructions to be issued until the result of the load 4931or floating point instruction is required. 4932 4933Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4934 4935@item -fschedule-insns2 4936@opindex fschedule-insns2 4937Similar to @option{-fschedule-insns}, but requests an additional pass of 4938instruction scheduling after register allocation has been done. This is 4939especially useful on machines with a relatively small number of 4940registers and where memory load instructions take more than one cycle. 4941 4942Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4943 4944@item -fno-sched-interblock 4945@opindex fno-sched-interblock 4946Don't schedule instructions across basic blocks. This is normally 4947enabled by default when scheduling before register allocation, i.e.@: 4948with @option{-fschedule-insns} or at @option{-O2} or higher. 4949 4950@item -fno-sched-spec 4951@opindex fno-sched-spec 4952Don't allow speculative motion of non-load instructions. This is normally 4953enabled by default when scheduling before register allocation, i.e.@: 4954with @option{-fschedule-insns} or at @option{-O2} or higher. 4955 4956@item -fsched-spec-load 4957@opindex fsched-spec-load 4958Allow speculative motion of some load instructions. This only makes 4959sense when scheduling before register allocation, i.e.@: with 4960@option{-fschedule-insns} or at @option{-O2} or higher. 4961 4962@item -fsched-spec-load-dangerous 4963@opindex fsched-spec-load-dangerous 4964Allow speculative motion of more load instructions. This only makes 4965sense when scheduling before register allocation, i.e.@: with 4966@option{-fschedule-insns} or at @option{-O2} or higher. 4967 4968@item -fsched-stalled-insns=@var{n} 4969@opindex fsched-stalled-insns 4970Define how many insns (if any) can be moved prematurely from the queue 4971of stalled insns into the ready list, during the second scheduling pass. 4972 4973@item -fsched-stalled-insns-dep=@var{n} 4974@opindex fsched-stalled-insns-dep 4975Define how many insn groups (cycles) will be examined for a dependency 4976on a stalled insn that is candidate for premature removal from the queue 4977of stalled insns. Has an effect only during the second scheduling pass, 4978and only if @option{-fsched-stalled-insns} is used and its value is not zero. 4979 4980@item -fsched2-use-superblocks 4981@opindex fsched2-use-superblocks 4982When scheduling after register allocation, do use superblock scheduling 4983algorithm. Superblock scheduling allows motion across basic block boundaries 4984resulting on faster schedules. This option is experimental, as not all machine 4985descriptions used by GCC model the CPU closely enough to avoid unreliable 4986results from the algorithm. 4987 4988This only makes sense when scheduling after register allocation, i.e.@: with 4989@option{-fschedule-insns2} or at @option{-O2} or higher. 4990 4991@item -fsched2-use-traces 4992@opindex fsched2-use-traces 4993Use @option{-fsched2-use-superblocks} algorithm when scheduling after register 4994allocation and additionally perform code duplication in order to increase the 4995size of superblocks using tracer pass. See @option{-ftracer} for details on 4996trace formation. 4997 4998This mode should produce faster but significantly longer programs. Also 4999without @option{-fbranch-probabilities} the traces constructed may not 5000match the reality and hurt the performance. This only makes 5001sense when scheduling after register allocation, i.e.@: with 5002@option{-fschedule-insns2} or at @option{-O2} or higher. 5003 5004@item -fsee 5005@opindex fsee 5006Eliminates redundant extension instructions and move the non redundant 5007ones to optimal placement using LCM. 5008 5009@item -freschedule-modulo-scheduled-loops 5010@opindex fscheduling-in-modulo-scheduled-loops 5011The modulo scheduling comes before the traditional scheduling, if a loop was modulo scheduled 5012we may want to prevent the later scheduling passes from changing its schedule, we use this 5013option to control that. 5014 5015@item -fcaller-saves 5016@opindex fcaller-saves 5017Enable values to be allocated in registers that will be clobbered by 5018function calls, by emitting extra instructions to save and restore the 5019registers around such calls. Such allocation is done only when it 5020seems to result in better code than would otherwise be produced. 5021 5022This option is always enabled by default on certain machines, usually 5023those which have no call-preserved registers to use instead. 5024 5025Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 5026 5027@item -ftree-pre 5028Perform Partial Redundancy Elimination (PRE) on trees. This flag is 5029enabled by default at @option{-O2} and @option{-O3}. 5030 5031@item -ftree-fre 5032Perform Full Redundancy Elimination (FRE) on trees. The difference 5033between FRE and PRE is that FRE only considers expressions 5034that are computed on all paths leading to the redundant computation. 5035This analysis faster than PRE, though it exposes fewer redundancies. 5036This flag is enabled by default at @option{-O} and higher. 5037 5038@item -ftree-copy-prop 5039Perform copy propagation on trees. This pass eliminates unnecessary 5040copy operations. This flag is enabled by default at @option{-O} and 5041higher. 5042 5043@item -ftree-store-copy-prop 5044Perform copy propagation of memory loads and stores. This pass 5045eliminates unnecessary copy operations in memory references 5046(structures, global variables, arrays, etc). This flag is enabled by 5047default at @option{-O2} and higher. 5048 5049@item -ftree-salias 5050Perform structural alias analysis on trees. This flag 5051is enabled by default at @option{-O} and higher. 5052 5053@item -fipa-pta 5054Perform interprocedural pointer analysis. 5055 5056@item -ftree-sink 5057Perform forward store motion on trees. This flag is 5058enabled by default at @option{-O} and higher. 5059 5060@item -ftree-ccp 5061Perform sparse conditional constant propagation (CCP) on trees. This 5062pass only operates on local scalar variables and is enabled by default 5063at @option{-O} and higher. 5064 5065@item -ftree-store-ccp 5066Perform sparse conditional constant propagation (CCP) on trees. This 5067pass operates on both local scalar variables and memory stores and 5068loads (global variables, structures, arrays, etc). This flag is 5069enabled by default at @option{-O2} and higher. 5070 5071@item -ftree-dce 5072Perform dead code elimination (DCE) on trees. This flag is enabled by 5073default at @option{-O} and higher. 5074 5075@item -ftree-dominator-opts 5076Perform a variety of simple scalar cleanups (constant/copy 5077propagation, redundancy elimination, range propagation and expression 5078simplification) based on a dominator tree traversal. This also 5079performs jump threading (to reduce jumps to jumps). This flag is 5080enabled by default at @option{-O} and higher. 5081 5082@item -ftree-ch 5083Perform loop header copying on trees. This is beneficial since it increases 5084effectiveness of code motion optimizations. It also saves one jump. This flag 5085is enabled by default at @option{-O} and higher. It is not enabled 5086for @option{-Os}, since it usually increases code size. 5087 5088@item -ftree-loop-optimize 5089Perform loop optimizations on trees. This flag is enabled by default 5090at @option{-O} and higher. 5091 5092@item -ftree-loop-linear 5093Perform linear loop transformations on tree. This flag can improve cache 5094performance and allow further loop optimizations to take place. 5095 5096@item -ftree-loop-im 5097Perform loop invariant motion on trees. This pass moves only invariants that 5098would be hard to handle at RTL level (function calls, operations that expand to 5099nontrivial sequences of insns). With @option{-funswitch-loops} it also moves 5100operands of conditions that are invariant out of the loop, so that we can use 5101just trivial invariantness analysis in loop unswitching. The pass also includes 5102store motion. 5103 5104@item -ftree-loop-ivcanon 5105Create a canonical counter for number of iterations in the loop for that 5106determining number of iterations requires complicated analysis. Later 5107optimizations then may determine the number easily. Useful especially 5108in connection with unrolling. 5109 5110@item -fivopts 5111Perform induction variable optimizations (strength reduction, induction 5112variable merging and induction variable elimination) on trees. 5113 5114@item -ftree-sra 5115Perform scalar replacement of aggregates. This pass replaces structure 5116references with scalars to prevent committing structures to memory too 5117early. This flag is enabled by default at @option{-O} and higher. 5118 5119@item -ftree-copyrename 5120Perform copy renaming on trees. This pass attempts to rename compiler 5121temporaries to other variables at copy locations, usually resulting in 5122variable names which more closely resemble the original variables. This flag 5123is enabled by default at @option{-O} and higher. 5124 5125@item -ftree-ter 5126Perform temporary expression replacement during the SSA->normal phase. Single 5127use/single def temporaries are replaced at their use location with their 5128defining expression. This results in non-GIMPLE code, but gives the expanders 5129much more complex trees to work on resulting in better RTL generation. This is 5130enabled by default at @option{-O} and higher. 5131 5132@item -ftree-lrs 5133Perform live range splitting during the SSA->normal phase. Distinct live 5134ranges of a variable are split into unique variables, allowing for better 5135optimization later. This is enabled by default at @option{-O} and higher. 5136 5137@item -ftree-vectorize 5138Perform loop vectorization on trees. 5139 5140@item -ftree-vect-loop-version 5141@opindex ftree-vect-loop-version 5142Perform loop versioning when doing loop vectorization on trees. When a loop 5143appears to be vectorizable except that data alignment or data dependence cannot 5144be determined at compile time then vectorized and non-vectorized versions of 5145the loop are generated along with runtime checks for alignment or dependence 5146to control which version is executed. This option is enabled by default 5147except at level @option{-Os} where it is disabled. 5148 5149@item -ftree-vrp 5150Perform Value Range Propagation on trees. This is similar to the 5151constant propagation pass, but instead of values, ranges of values are 5152propagated. This allows the optimizers to remove unnecessary range 5153checks like array bound checks and null pointer checks. This is 5154enabled by default at @option{-O2} and higher. Null pointer check 5155elimination is only done if @option{-fdelete-null-pointer-checks} is 5156enabled. 5157 5158@item -ftracer 5159@opindex ftracer 5160Perform tail duplication to enlarge superblock size. This transformation 5161simplifies the control flow of the function allowing other optimizations to do 5162better job. 5163 5164@item -funroll-loops 5165@opindex funroll-loops 5166Unroll loops whose number of iterations can be determined at compile 5167time or upon entry to the loop. @option{-funroll-loops} implies 5168@option{-frerun-cse-after-loop}. This option makes code larger, 5169and may or may not make it run faster. 5170 5171@item -funroll-all-loops 5172@opindex funroll-all-loops 5173Unroll all loops, even if their number of iterations is uncertain when 5174the loop is entered. This usually makes programs run more slowly. 5175@option{-funroll-all-loops} implies the same options as 5176@option{-funroll-loops}, 5177 5178@item -fsplit-ivs-in-unroller 5179@opindex fsplit-ivs-in-unroller 5180Enables expressing of values of induction variables in later iterations 5181of the unrolled loop using the value in the first iteration. This breaks 5182long dependency chains, thus improving efficiency of the scheduling passes. 5183 5184Combination of @option{-fweb} and CSE is often sufficient to obtain the 5185same effect. However in cases the loop body is more complicated than 5186a single basic block, this is not reliable. It also does not work at all 5187on some of the architectures due to restrictions in the CSE pass. 5188 5189This optimization is enabled by default. 5190 5191@item -fvariable-expansion-in-unroller 5192@opindex fvariable-expansion-in-unroller 5193With this option, the compiler will create multiple copies of some 5194local variables when unrolling a loop which can result in superior code. 5195 5196@item -fprefetch-loop-arrays 5197@opindex fprefetch-loop-arrays 5198If supported by the target machine, generate instructions to prefetch 5199memory to improve the performance of loops that access large arrays. 5200 5201This option may generate better or worse code; results are highly 5202dependent on the structure of loops within the source code. 5203 5204Disabled at level @option{-Os}. 5205 5206@item -fno-peephole 5207@itemx -fno-peephole2 5208@opindex fno-peephole 5209@opindex fno-peephole2 5210Disable any machine-specific peephole optimizations. The difference 5211between @option{-fno-peephole} and @option{-fno-peephole2} is in how they 5212are implemented in the compiler; some targets use one, some use the 5213other, a few use both. 5214 5215@option{-fpeephole} is enabled by default. 5216@option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 5217 5218@item -fno-guess-branch-probability 5219@opindex fno-guess-branch-probability 5220Do not guess branch probabilities using heuristics. 5221 5222GCC will use heuristics to guess branch probabilities if they are 5223not provided by profiling feedback (@option{-fprofile-arcs}). These 5224heuristics are based on the control flow graph. If some branch probabilities 5225are specified by @samp{__builtin_expect}, then the heuristics will be 5226used to guess branch probabilities for the rest of the control flow graph, 5227taking the @samp{__builtin_expect} info into account. The interactions 5228between the heuristics and @samp{__builtin_expect} can be complex, and in 5229some cases, it may be useful to disable the heuristics so that the effects 5230of @samp{__builtin_expect} are easier to understand. 5231 5232The default is @option{-fguess-branch-probability} at levels 5233@option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 5234 5235@item -freorder-blocks 5236@opindex freorder-blocks 5237Reorder basic blocks in the compiled function in order to reduce number of 5238taken branches and improve code locality. 5239 5240Enabled at levels @option{-O2}, @option{-O3}. 5241 5242@item -freorder-blocks-and-partition 5243@opindex freorder-blocks-and-partition 5244In addition to reordering basic blocks in the compiled function, in order 5245to reduce number of taken branches, partitions hot and cold basic blocks 5246into separate sections of the assembly and .o files, to improve 5247paging and cache locality performance. 5248 5249This optimization is automatically turned off in the presence of 5250exception handling, for linkonce sections, for functions with a user-defined 5251section attribute and on any architecture that does not support named 5252sections. 5253 5254@item -freorder-functions 5255@opindex freorder-functions 5256Reorder functions in the object file in order to 5257improve code locality. This is implemented by using special 5258subsections @code{.text.hot} for most frequently executed functions and 5259@code{.text.unlikely} for unlikely executed functions. Reordering is done by 5260the linker so object file format must support named sections and linker must 5261place them in a reasonable way. 5262 5263Also profile feedback must be available in to make this option effective. See 5264@option{-fprofile-arcs} for details. 5265 5266Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 5267 5268@item -fstrict-aliasing 5269@opindex fstrict-aliasing 5270Allows the compiler to assume the strictest aliasing rules applicable to 5271the language being compiled. For C (and C++), this activates 5272optimizations based on the type of expressions. In particular, an 5273object of one type is assumed never to reside at the same address as an 5274object of a different type, unless the types are almost the same. For 5275example, an @code{unsigned int} can alias an @code{int}, but not a 5276@code{void*} or a @code{double}. A character type may alias any other 5277type. 5278 5279Pay special attention to code like this: 5280@smallexample 5281union a_union @{ 5282 int i; 5283 double d; 5284@}; 5285 5286int f() @{ 5287 a_union t; 5288 t.d = 3.0; 5289 return t.i; 5290@} 5291@end smallexample 5292The practice of reading from a different union member than the one most 5293recently written to (called ``type-punning'') is common. Even with 5294@option{-fstrict-aliasing}, type-punning is allowed, provided the memory 5295is accessed through the union type. So, the code above will work as 5296expected. However, this code might not: 5297@smallexample 5298int f() @{ 5299 a_union t; 5300 int* ip; 5301 t.d = 3.0; 5302 ip = &t.i; 5303 return *ip; 5304@} 5305@end smallexample 5306 5307Every language that wishes to perform language-specific alias analysis 5308should define a function that computes, given an @code{tree} 5309node, an alias set for the node. Nodes in different alias sets are not 5310allowed to alias. For an example, see the C front-end function 5311@code{c_get_alias_set}. 5312 5313Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 5314 5315@item -fstrict-overflow 5316@opindex fstrict-overflow 5317Allow the compiler to assume strict signed overflow rules, depending 5318on the language being compiled. For C (and C++) this means that 5319overflow when doing arithmetic with signed numbers is undefined, which 5320means that the compiler may assume that it will not happen. This 5321permits various optimizations. For example, the compiler will assume 5322that an expression like @code{i + 10 > i} will always be true for 5323signed @code{i}. This assumption is only valid if signed overflow is 5324undefined, as the expression is false if @code{i + 10} overflows when 5325using twos complement arithmetic. When this option is in effect any 5326attempt to determine whether an operation on signed numbers will 5327overflow must be written carefully to not actually involve overflow. 5328 5329See also the @option{-fwrapv} option. Using @option{-fwrapv} means 5330that signed overflow is fully defined: it wraps. When 5331@option{-fwrapv} is used, there is no difference between 5332@option{-fstrict-overflow} and @option{-fno-strict-overflow}. With 5333@option{-fwrapv} certain types of overflow are permitted. For 5334example, if the compiler gets an overflow when doing arithmetic on 5335constants, the overflowed value can still be used with 5336@option{-fwrapv}, but not otherwise. 5337 5338The @option{-fstrict-overflow} option is enabled at levels 5339@option{-O2}, @option{-O3}, @option{-Os}. 5340 5341@item -falign-functions 5342@itemx -falign-functions=@var{n} 5343@opindex falign-functions 5344Align the start of functions to the next power-of-two greater than 5345@var{n}, skipping up to @var{n} bytes. For instance, 5346@option{-falign-functions=32} aligns functions to the next 32-byte 5347boundary, but @option{-falign-functions=24} would align to the next 534832-byte boundary only if this can be done by skipping 23 bytes or less. 5349 5350@option{-fno-align-functions} and @option{-falign-functions=1} are 5351equivalent and mean that functions will not be aligned. 5352 5353Some assemblers only support this flag when @var{n} is a power of two; 5354in that case, it is rounded up. 5355 5356If @var{n} is not specified or is zero, use a machine-dependent default. 5357 5358Enabled at levels @option{-O2}, @option{-O3}. 5359 5360@item -falign-labels 5361@itemx -falign-labels=@var{n} 5362@opindex falign-labels 5363Align all branch targets to a power-of-two boundary, skipping up to 5364@var{n} bytes like @option{-falign-functions}. This option can easily 5365make code slower, because it must insert dummy operations for when the 5366branch target is reached in the usual flow of the code. 5367 5368@option{-fno-align-labels} and @option{-falign-labels=1} are 5369equivalent and mean that labels will not be aligned. 5370 5371If @option{-falign-loops} or @option{-falign-jumps} are applicable and 5372are greater than this value, then their values are used instead. 5373 5374If @var{n} is not specified or is zero, use a machine-dependent default 5375which is very likely to be @samp{1}, meaning no alignment. 5376 5377Enabled at levels @option{-O2}, @option{-O3}. 5378 5379@item -falign-loops 5380@itemx -falign-loops=@var{n} 5381@opindex falign-loops 5382Align loops to a power-of-two boundary, skipping up to @var{n} bytes 5383like @option{-falign-functions}. The hope is that the loop will be 5384executed many times, which will make up for any execution of the dummy 5385operations. 5386 5387@option{-fno-align-loops} and @option{-falign-loops=1} are 5388equivalent and mean that loops will not be aligned. 5389 5390If @var{n} is not specified or is zero, use a machine-dependent default. 5391 5392Enabled at levels @option{-O2}, @option{-O3}. 5393 5394@item -falign-jumps 5395@itemx -falign-jumps=@var{n} 5396@opindex falign-jumps 5397Align branch targets to a power-of-two boundary, for branch targets 5398where the targets can only be reached by jumping, skipping up to @var{n} 5399bytes like @option{-falign-functions}. In this case, no dummy operations 5400need be executed. 5401 5402@option{-fno-align-jumps} and @option{-falign-jumps=1} are 5403equivalent and mean that loops will not be aligned. 5404 5405If @var{n} is not specified or is zero, use a machine-dependent default. 5406 5407Enabled at levels @option{-O2}, @option{-O3}. 5408 5409@item -funit-at-a-time 5410@opindex funit-at-a-time 5411Parse the whole compilation unit before starting to produce code. 5412This allows some extra optimizations to take place but consumes 5413more memory (in general). There are some compatibility issues 5414with @emph{unit-at-a-time} mode: 5415@itemize @bullet 5416@item 5417enabling @emph{unit-at-a-time} mode may change the order 5418in which functions, variables, and top-level @code{asm} statements 5419are emitted, and will likely break code relying on some particular 5420ordering. The majority of such top-level @code{asm} statements, 5421though, can be replaced by @code{section} attributes. The 5422@option{fno-toplevel-reorder} option may be used to keep the ordering 5423used in the input file, at the cost of some optimizations. 5424 5425@item 5426@emph{unit-at-a-time} mode removes unreferenced static variables 5427and functions. This may result in undefined references 5428when an @code{asm} statement refers directly to variables or functions 5429that are otherwise unused. In that case either the variable/function 5430shall be listed as an operand of the @code{asm} statement operand or, 5431in the case of top-level @code{asm} statements the attribute @code{used} 5432shall be used on the declaration. 5433 5434@item 5435Static functions now can use non-standard passing conventions that 5436may break @code{asm} statements calling functions directly. Again, 5437attribute @code{used} will prevent this behavior. 5438@end itemize 5439 5440As a temporary workaround, @option{-fno-unit-at-a-time} can be used, 5441but this scheme may not be supported by future releases of GCC@. 5442 5443Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 5444 5445@item -fno-toplevel-reorder 5446Do not reorder top-level functions, variables, and @code{asm} 5447statements. Output them in the same order that they appear in the 5448input file. When this option is used, unreferenced static variables 5449will not be removed. This option is intended to support existing code 5450which relies on a particular ordering. For new code, it is better to 5451use attributes. 5452 5453@item -fweb 5454@opindex fweb 5455Constructs webs as commonly used for register allocation purposes and assign 5456each web individual pseudo register. This allows the register allocation pass 5457to operate on pseudos directly, but also strengthens several other optimization 5458passes, such as CSE, loop optimizer and trivial dead code remover. It can, 5459however, make debugging impossible, since variables will no longer stay in a 5460``home register''. 5461 5462Enabled by default with @option{-funroll-loops}. 5463 5464@item -fwhole-program 5465@opindex fwhole-program 5466Assume that the current compilation unit represents whole program being 5467compiled. All public functions and variables with the exception of @code{main} 5468and those merged by attribute @code{externally_visible} become static functions 5469and in a affect gets more aggressively optimized by interprocedural optimizers. 5470While this option is equivalent to proper use of @code{static} keyword for 5471programs consisting of single file, in combination with option 5472@option{--combine} this flag can be used to compile most of smaller scale C 5473programs since the functions and variables become local for the whole combined 5474compilation unit, not for the single source file itself. 5475 5476 5477@item -fno-cprop-registers 5478@opindex fno-cprop-registers 5479After register allocation and post-register allocation instruction splitting, 5480we perform a copy-propagation pass to try to reduce scheduling dependencies 5481and occasionally eliminate the copy. 5482 5483Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 5484 5485@item -fprofile-generate 5486@opindex fprofile-generate 5487 5488Enable options usually used for instrumenting application to produce 5489profile useful for later recompilation with profile feedback based 5490optimization. You must use @option{-fprofile-generate} both when 5491compiling and when linking your program. 5492 5493The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}. 5494 5495@item -fprofile-use 5496@opindex fprofile-use 5497Enable profile feedback directed optimizations, and optimizations 5498generally profitable only with profile feedback available. 5499 5500The following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt}, 5501@code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer} 5502 5503@end table 5504 5505The following options control compiler behavior regarding floating 5506point arithmetic. These options trade off between speed and 5507correctness. All must be specifically enabled. 5508 5509@table @gcctabopt 5510@item -ffloat-store 5511@opindex ffloat-store 5512Do not store floating point variables in registers, and inhibit other 5513options that might change whether a floating point value is taken from a 5514register or memory. 5515 5516@cindex floating point precision 5517This option prevents undesirable excess precision on machines such as 5518the 68000 where the floating registers (of the 68881) keep more 5519precision than a @code{double} is supposed to have. Similarly for the 5520x86 architecture. For most programs, the excess precision does only 5521good, but a few programs rely on the precise definition of IEEE floating 5522point. Use @option{-ffloat-store} for such programs, after modifying 5523them to store all pertinent intermediate computations into variables. 5524 5525@item -ffast-math 5526@opindex ffast-math 5527Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, @* 5528@option{-fno-trapping-math}, @option{-ffinite-math-only}, 5529@option{-fno-rounding-math}, @option{-fno-signaling-nans} 5530and @option{fcx-limited-range}. 5531 5532This option causes the preprocessor macro @code{__FAST_MATH__} to be defined. 5533 5534This option should never be turned on by any @option{-O} option since 5535it can result in incorrect output for programs which depend on 5536an exact implementation of IEEE or ISO rules/specifications for 5537math functions. 5538 5539@item -fno-math-errno 5540@opindex fno-math-errno 5541Do not set ERRNO after calling math functions that are executed 5542with a single instruction, e.g., sqrt. A program that relies on 5543IEEE exceptions for math error handling may want to use this flag 5544for speed while maintaining IEEE arithmetic compatibility. 5545 5546This option should never be turned on by any @option{-O} option since 5547it can result in incorrect output for programs which depend on 5548an exact implementation of IEEE or ISO rules/specifications for 5549math functions. 5550 5551The default is @option{-fmath-errno}. 5552 5553On Darwin and FreeBSD systems, the math library never sets @code{errno}. 5554There is therefore 5555no reason for the compiler to consider the possibility that it might, 5556and @option{-fno-math-errno} is the default. 5557 5558@item -funsafe-math-optimizations 5559@opindex funsafe-math-optimizations 5560Allow optimizations for floating-point arithmetic that (a) assume 5561that arguments and results are valid and (b) may violate IEEE or 5562ANSI standards. When used at link-time, it may include libraries 5563or startup files that change the default FPU control word or other 5564similar optimizations. 5565 5566This option should never be turned on by any @option{-O} option since 5567it can result in incorrect output for programs which depend on 5568an exact implementation of IEEE or ISO rules/specifications for 5569math functions. 5570 5571The default is @option{-fno-unsafe-math-optimizations}. 5572 5573@item -ffinite-math-only 5574@opindex ffinite-math-only 5575Allow optimizations for floating-point arithmetic that assume 5576that arguments and results are not NaNs or +-Infs. 5577 5578This option should never be turned on by any @option{-O} option since 5579it can result in incorrect output for programs which depend on 5580an exact implementation of IEEE or ISO rules/specifications. 5581 5582The default is @option{-fno-finite-math-only}. 5583 5584@item -fno-trapping-math 5585@opindex fno-trapping-math 5586Compile code assuming that floating-point operations cannot generate 5587user-visible traps. These traps include division by zero, overflow, 5588underflow, inexact result and invalid operation. This option implies 5589@option{-fno-signaling-nans}. Setting this option may allow faster 5590code if one relies on ``non-stop'' IEEE arithmetic, for example. 5591 5592This option should never be turned on by any @option{-O} option since 5593it can result in incorrect output for programs which depend on 5594an exact implementation of IEEE or ISO rules/specifications for 5595math functions. 5596 5597The default is @option{-ftrapping-math}. 5598 5599@item -frounding-math 5600@opindex frounding-math 5601Disable transformations and optimizations that assume default floating 5602point rounding behavior. This is round-to-zero for all floating point 5603to integer conversions, and round-to-nearest for all other arithmetic 5604truncations. This option should be specified for programs that change 5605the FP rounding mode dynamically, or that may be executed with a 5606non-default rounding mode. This option disables constant folding of 5607floating point expressions at compile-time (which may be affected by 5608rounding mode) and arithmetic transformations that are unsafe in the 5609presence of sign-dependent rounding modes. 5610 5611The default is @option{-fno-rounding-math}. 5612 5613This option is experimental and does not currently guarantee to 5614disable all GCC optimizations that are affected by rounding mode. 5615Future versions of GCC may provide finer control of this setting 5616using C99's @code{FENV_ACCESS} pragma. This command line option 5617will be used to specify the default state for @code{FENV_ACCESS}. 5618 5619@item -frtl-abstract-sequences 5620@opindex frtl-abstract-sequences 5621It is a size optimization method. This option is to find identical 5622sequences of code, which can be turned into pseudo-procedures and 5623then replace all occurrences with calls to the newly created 5624subroutine. It is kind of an opposite of @option{-finline-functions}. 5625This optimization runs at RTL level. 5626 5627@item -fsignaling-nans 5628@opindex fsignaling-nans 5629Compile code assuming that IEEE signaling NaNs may generate user-visible 5630traps during floating-point operations. Setting this option disables 5631optimizations that may change the number of exceptions visible with 5632signaling NaNs. This option implies @option{-ftrapping-math}. 5633 5634This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to 5635be defined. 5636 5637The default is @option{-fno-signaling-nans}. 5638 5639This option is experimental and does not currently guarantee to 5640disable all GCC optimizations that affect signaling NaN behavior. 5641 5642@item -fsingle-precision-constant 5643@opindex fsingle-precision-constant 5644Treat floating point constant as single precision constant instead of 5645implicitly converting it to double precision constant. 5646 5647@item -fcx-limited-range 5648@itemx -fno-cx-limited-range 5649@opindex fcx-limited-range 5650@opindex fno-cx-limited-range 5651When enabled, this option states that a range reduction step is not 5652needed when performing complex division. The default is 5653@option{-fno-cx-limited-range}, but is enabled by @option{-ffast-math}. 5654 5655This option controls the default setting of the ISO C99 5656@code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to 5657all languages. 5658 5659@end table 5660 5661The following options control optimizations that may improve 5662performance, but are not enabled by any @option{-O} options. This 5663section includes experimental options that may produce broken code. 5664 5665@table @gcctabopt 5666@item -fbranch-probabilities 5667@opindex fbranch-probabilities 5668After running a program compiled with @option{-fprofile-arcs} 5669(@pxref{Debugging Options,, Options for Debugging Your Program or 5670@command{gcc}}), you can compile it a second time using 5671@option{-fbranch-probabilities}, to improve optimizations based on 5672the number of times each branch was taken. When the program 5673compiled with @option{-fprofile-arcs} exits it saves arc execution 5674counts to a file called @file{@var{sourcename}.gcda} for each source 5675file The information in this data file is very dependent on the 5676structure of the generated code, so you must use the same source code 5677and the same optimization options for both compilations. 5678 5679With @option{-fbranch-probabilities}, GCC puts a 5680@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}. 5681These can be used to improve optimization. Currently, they are only 5682used in one place: in @file{reorg.c}, instead of guessing which path a 5683branch is mostly to take, the @samp{REG_BR_PROB} values are used to 5684exactly determine which path is taken more often. 5685 5686@item -fprofile-values 5687@opindex fprofile-values 5688If combined with @option{-fprofile-arcs}, it adds code so that some 5689data about values of expressions in the program is gathered. 5690 5691With @option{-fbranch-probabilities}, it reads back the data gathered 5692from profiling values of expressions and adds @samp{REG_VALUE_PROFILE} 5693notes to instructions for their later usage in optimizations. 5694 5695Enabled with @option{-fprofile-generate} and @option{-fprofile-use}. 5696 5697@item -fvpt 5698@opindex fvpt 5699If combined with @option{-fprofile-arcs}, it instructs the compiler to add 5700a code to gather information about values of expressions. 5701 5702With @option{-fbranch-probabilities}, it reads back the data gathered 5703and actually performs the optimizations based on them. 5704Currently the optimizations include specialization of division operation 5705using the knowledge about the value of the denominator. 5706 5707@item -frename-registers 5708@opindex frename-registers 5709Attempt to avoid false dependencies in scheduled code by making use 5710of registers left over after register allocation. This optimization 5711will most benefit processors with lots of registers. Depending on the 5712debug information format adopted by the target, however, it can 5713make debugging impossible, since variables will no longer stay in 5714a ``home register''. 5715 5716Enabled by default with @option{-funroll-loops}. 5717 5718@item -ftracer 5719@opindex ftracer 5720Perform tail duplication to enlarge superblock size. This transformation 5721simplifies the control flow of the function allowing other optimizations to do 5722better job. 5723 5724Enabled with @option{-fprofile-use}. 5725 5726@item -funroll-loops 5727@opindex funroll-loops 5728Unroll loops whose number of iterations can be determined at compile time or 5729upon entry to the loop. @option{-funroll-loops} implies 5730@option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}. 5731It also turns on complete loop peeling (i.e.@: complete removal of loops with 5732small constant number of iterations). This option makes code larger, and may 5733or may not make it run faster. 5734 5735Enabled with @option{-fprofile-use}. 5736 5737@item -funroll-all-loops 5738@opindex funroll-all-loops 5739Unroll all loops, even if their number of iterations is uncertain when 5740the loop is entered. This usually makes programs run more slowly. 5741@option{-funroll-all-loops} implies the same options as 5742@option{-funroll-loops}. 5743 5744@item -fpeel-loops 5745@opindex fpeel-loops 5746Peels the loops for that there is enough information that they do not 5747roll much (from profile feedback). It also turns on complete loop peeling 5748(i.e.@: complete removal of loops with small constant number of iterations). 5749 5750Enabled with @option{-fprofile-use}. 5751 5752@item -fmove-loop-invariants 5753@opindex fmove-loop-invariants 5754Enables the loop invariant motion pass in the RTL loop optimizer. Enabled 5755at level @option{-O1} 5756 5757@item -funswitch-loops 5758@opindex funswitch-loops 5759Move branches with loop invariant conditions out of the loop, with duplicates 5760of the loop on both branches (modified according to result of the condition). 5761 5762@item -ffunction-sections 5763@itemx -fdata-sections 5764@opindex ffunction-sections 5765@opindex fdata-sections 5766Place each function or data item into its own section in the output 5767file if the target supports arbitrary sections. The name of the 5768function or the name of the data item determines the section's name 5769in the output file. 5770 5771Use these options on systems where the linker can perform optimizations 5772to improve locality of reference in the instruction space. Most systems 5773using the ELF object format and SPARC processors running Solaris 2 have 5774linkers with such optimizations. AIX may have these optimizations in 5775the future. 5776 5777Only use these options when there are significant benefits from doing 5778so. When you specify these options, the assembler and linker will 5779create larger object and executable files and will also be slower. 5780You will not be able to use @code{gprof} on all systems if you 5781specify this option and you may have problems with debugging if 5782you specify both this option and @option{-g}. 5783 5784@item -fbranch-target-load-optimize 5785@opindex fbranch-target-load-optimize 5786Perform branch target register load optimization before prologue / epilogue 5787threading. 5788The use of target registers can typically be exposed only during reload, 5789thus hoisting loads out of loops and doing inter-block scheduling needs 5790a separate optimization pass. 5791 5792@item -fbranch-target-load-optimize2 5793@opindex fbranch-target-load-optimize2 5794Perform branch target register load optimization after prologue / epilogue 5795threading. 5796 5797@item -fbtr-bb-exclusive 5798@opindex fbtr-bb-exclusive 5799When performing branch target register load optimization, don't reuse 5800branch target registers in within any basic block. 5801 5802@item -fstack-protector 5803Emit extra code to check for buffer overflows, such as stack smashing 5804attacks. This is done by adding a guard variable to functions with 5805vulnerable objects. This includes functions that call alloca, and 5806functions with buffers larger than 8 bytes. The guards are initialized 5807when a function is entered and then checked when the function exits. 5808If a guard check fails, an error message is printed and the program exits. 5809 5810@item -fstack-protector-all 5811Like @option{-fstack-protector} except that all functions are protected. 5812 5813@item -fstack-protector-strong 5814Like @option{-fstack-protector} but includes additional functions to 5815be protected --- those that have local array definitions, or have 5816references to local frame addresses. 5817 5818@item -fsection-anchors 5819@opindex fsection-anchors 5820Try to reduce the number of symbolic address calculations by using 5821shared ``anchor'' symbols to address nearby objects. This transformation 5822can help to reduce the number of GOT entries and GOT accesses on some 5823targets. 5824 5825For example, the implementation of the following function @code{foo}: 5826 5827@smallexample 5828static int a, b, c; 5829int foo (void) @{ return a + b + c; @} 5830@end smallexample 5831 5832would usually calculate the addresses of all three variables, but if you 5833compile it with @option{-fsection-anchors}, it will access the variables 5834from a common anchor point instead. The effect is similar to the 5835following pseudocode (which isn't valid C): 5836 5837@smallexample 5838int foo (void) 5839@{ 5840 register int *xr = &x; 5841 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x]; 5842@} 5843@end smallexample 5844 5845Not all targets support this option. 5846 5847@item --param @var{name}=@var{value} 5848@opindex param 5849In some places, GCC uses various constants to control the amount of 5850optimization that is done. For example, GCC will not inline functions 5851that contain more that a certain number of instructions. You can 5852control some of these constants on the command-line using the 5853@option{--param} option. 5854 5855The names of specific parameters, and the meaning of the values, are 5856tied to the internals of the compiler, and are subject to change 5857without notice in future releases. 5858 5859In each case, the @var{value} is an integer. The allowable choices for 5860@var{name} are given in the following table: 5861 5862@table @gcctabopt 5863@item salias-max-implicit-fields 5864The maximum number of fields in a variable without direct 5865structure accesses for which structure aliasing will consider trying 5866to track each field. The default is 5 5867 5868@item salias-max-array-elements 5869The maximum number of elements an array can have and its elements 5870still be tracked individually by structure aliasing. The default is 4 5871 5872@item sra-max-structure-size 5873The maximum structure size, in bytes, at which the scalar replacement 5874of aggregates (SRA) optimization will perform block copies. The 5875default value, 0, implies that GCC will select the most appropriate 5876size itself. 5877 5878@item sra-field-structure-ratio 5879The threshold ratio (as a percentage) between instantiated fields and 5880the complete structure size. We say that if the ratio of the number 5881of bytes in instantiated fields to the number of bytes in the complete 5882structure exceeds this parameter, then block copies are not used. The 5883default is 75. 5884 5885@item max-crossjump-edges 5886The maximum number of incoming edges to consider for crossjumping. 5887The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in 5888the number of edges incoming to each block. Increasing values mean 5889more aggressive optimization, making the compile time increase with 5890probably small improvement in executable size. 5891 5892@item min-crossjump-insns 5893The minimum number of instructions which must be matched at the end 5894of two blocks before crossjumping will be performed on them. This 5895value is ignored in the case where all instructions in the block being 5896crossjumped from are matched. The default value is 5. 5897 5898@item max-grow-copy-bb-insns 5899The maximum code size expansion factor when copying basic blocks 5900instead of jumping. The expansion is relative to a jump instruction. 5901The default value is 8. 5902 5903@item max-goto-duplication-insns 5904The maximum number of instructions to duplicate to a block that jumps 5905to a computed goto. To avoid @math{O(N^2)} behavior in a number of 5906passes, GCC factors computed gotos early in the compilation process, 5907and unfactors them as late as possible. Only computed jumps at the 5908end of a basic blocks with no more than max-goto-duplication-insns are 5909unfactored. The default value is 8. 5910 5911@item max-delay-slot-insn-search 5912The maximum number of instructions to consider when looking for an 5913instruction to fill a delay slot. If more than this arbitrary number of 5914instructions is searched, the time savings from filling the delay slot 5915will be minimal so stop searching. Increasing values mean more 5916aggressive optimization, making the compile time increase with probably 5917small improvement in executable run time. 5918 5919@item max-delay-slot-live-search 5920When trying to fill delay slots, the maximum number of instructions to 5921consider when searching for a block with valid live register 5922information. Increasing this arbitrarily chosen value means more 5923aggressive optimization, increasing the compile time. This parameter 5924should be removed when the delay slot code is rewritten to maintain the 5925control-flow graph. 5926 5927@item max-gcse-memory 5928The approximate maximum amount of memory that will be allocated in 5929order to perform the global common subexpression elimination 5930optimization. If more memory than specified is required, the 5931optimization will not be done. 5932 5933@item max-gcse-passes 5934The maximum number of passes of GCSE to run. The default is 1. 5935 5936@item max-pending-list-length 5937The maximum number of pending dependencies scheduling will allow 5938before flushing the current state and starting over. Large functions 5939with few branches or calls can create excessively large lists which 5940needlessly consume memory and resources. 5941 5942@item max-inline-insns-single 5943Several parameters control the tree inliner used in gcc. 5944This number sets the maximum number of instructions (counted in GCC's 5945internal representation) in a single function that the tree inliner 5946will consider for inlining. This only affects functions declared 5947inline and methods implemented in a class declaration (C++). 5948The default value is 450. 5949 5950@item max-inline-insns-auto 5951When you use @option{-finline-functions} (included in @option{-O3}), 5952a lot of functions that would otherwise not be considered for inlining 5953by the compiler will be investigated. To those functions, a different 5954(more restrictive) limit compared to functions declared inline can 5955be applied. 5956The default value is 90. 5957 5958@item large-function-insns 5959The limit specifying really large functions. For functions larger than this 5960limit after inlining inlining is constrained by 5961@option{--param large-function-growth}. This parameter is useful primarily 5962to avoid extreme compilation time caused by non-linear algorithms used by the 5963backend. 5964This parameter is ignored when @option{-funit-at-a-time} is not used. 5965The default value is 2700. 5966 5967@item large-function-growth 5968Specifies maximal growth of large function caused by inlining in percents. 5969This parameter is ignored when @option{-funit-at-a-time} is not used. 5970The default value is 100 which limits large function growth to 2.0 times 5971the original size. 5972 5973@item large-unit-insns 5974The limit specifying large translation unit. Growth caused by inlining of 5975units larger than this limit is limited by @option{--param inline-unit-growth}. 5976For small units this might be too tight (consider unit consisting of function A 5977that is inline and B that just calls A three time. If B is small relative to 5978A, the growth of unit is 300\% and yet such inlining is very sane. For very 5979large units consisting of small inlininable functions however the overall unit 5980growth limit is needed to avoid exponential explosion of code size. Thus for 5981smaller units, the size is increased to @option{--param large-unit-insns} 5982before applying @option{--param inline-unit-growth}. The default is 10000 5983 5984@item inline-unit-growth 5985Specifies maximal overall growth of the compilation unit caused by inlining. 5986This parameter is ignored when @option{-funit-at-a-time} is not used. 5987The default value is 50 which limits unit growth to 1.5 times the original 5988size. 5989 5990@item max-inline-insns-recursive 5991@itemx max-inline-insns-recursive-auto 5992Specifies maximum number of instructions out-of-line copy of self recursive inline 5993function can grow into by performing recursive inlining. 5994 5995For functions declared inline @option{--param max-inline-insns-recursive} is 5996taken into account. For function not declared inline, recursive inlining 5997happens only when @option{-finline-functions} (included in @option{-O3}) is 5998enabled and @option{--param max-inline-insns-recursive-auto} is used. The 5999default value is 450. 6000 6001@item max-inline-recursive-depth 6002@itemx max-inline-recursive-depth-auto 6003Specifies maximum recursion depth used by the recursive inlining. 6004 6005For functions declared inline @option{--param max-inline-recursive-depth} is 6006taken into account. For function not declared inline, recursive inlining 6007happens only when @option{-finline-functions} (included in @option{-O3}) is 6008enabled and @option{--param max-inline-recursive-depth-auto} is used. The 6009default value is 450. 6010 6011@item min-inline-recursive-probability 6012Recursive inlining is profitable only for function having deep recursion 6013in average and can hurt for function having little recursion depth by 6014increasing the prologue size or complexity of function body to other 6015optimizers. 6016 6017When profile feedback is available (see @option{-fprofile-generate}) the actual 6018recursion depth can be guessed from probability that function will recurse via 6019given call expression. This parameter limits inlining only to call expression 6020whose probability exceeds given threshold (in percents). The default value is 602110. 6022 6023@item inline-call-cost 6024Specify cost of call instruction relative to simple arithmetics operations 6025(having cost of 1). Increasing this cost disqualifies inlining of non-leaf 6026functions and at the same time increases size of leaf function that is believed to 6027reduce function size by being inlined. In effect it increases amount of 6028inlining for code having large abstraction penalty (many functions that just 6029pass the arguments to other functions) and decrease inlining for code with low 6030abstraction penalty. The default value is 16. 6031 6032@item max-unrolled-insns 6033The maximum number of instructions that a loop should have if that loop 6034is unrolled, and if the loop is unrolled, it determines how many times 6035the loop code is unrolled. 6036 6037@item max-average-unrolled-insns 6038The maximum number of instructions biased by probabilities of their execution 6039that a loop should have if that loop is unrolled, and if the loop is unrolled, 6040it determines how many times the loop code is unrolled. 6041 6042@item max-unroll-times 6043The maximum number of unrollings of a single loop. 6044 6045@item max-peeled-insns 6046The maximum number of instructions that a loop should have if that loop 6047is peeled, and if the loop is peeled, it determines how many times 6048the loop code is peeled. 6049 6050@item max-peel-times 6051The maximum number of peelings of a single loop. 6052 6053@item max-completely-peeled-insns 6054The maximum number of insns of a completely peeled loop. 6055 6056@item max-completely-peel-times 6057The maximum number of iterations of a loop to be suitable for complete peeling. 6058 6059@item max-unswitch-insns 6060The maximum number of insns of an unswitched loop. 6061 6062@item max-unswitch-level 6063The maximum number of branches unswitched in a single loop. 6064 6065@item lim-expensive 6066The minimum cost of an expensive expression in the loop invariant motion. 6067 6068@item iv-consider-all-candidates-bound 6069Bound on number of candidates for induction variables below that 6070all candidates are considered for each use in induction variable 6071optimizations. Only the most relevant candidates are considered 6072if there are more candidates, to avoid quadratic time complexity. 6073 6074@item iv-max-considered-uses 6075The induction variable optimizations give up on loops that contain more 6076induction variable uses. 6077 6078@item iv-always-prune-cand-set-bound 6079If number of candidates in the set is smaller than this value, 6080we always try to remove unnecessary ivs from the set during its 6081optimization when a new iv is added to the set. 6082 6083@item scev-max-expr-size 6084Bound on size of expressions used in the scalar evolutions analyzer. 6085Large expressions slow the analyzer. 6086 6087@item vect-max-version-checks 6088The maximum number of runtime checks that can be performed when doing 6089loop versioning in the vectorizer. See option ftree-vect-loop-version 6090for more information. 6091 6092@item max-iterations-to-track 6093 6094The maximum number of iterations of a loop the brute force algorithm 6095for analysis of # of iterations of the loop tries to evaluate. 6096 6097@item hot-bb-count-fraction 6098Select fraction of the maximal count of repetitions of basic block in program 6099given basic block needs to have to be considered hot. 6100 6101@item hot-bb-frequency-fraction 6102Select fraction of the maximal frequency of executions of basic block in 6103function given basic block needs to have to be considered hot 6104 6105@item max-predicted-iterations 6106The maximum number of loop iterations we predict statically. This is useful 6107in cases where function contain single loop with known bound and other loop 6108with unknown. We predict the known number of iterations correctly, while 6109the unknown number of iterations average to roughly 10. This means that the 6110loop without bounds would appear artificially cold relative to the other one. 6111 6112@item tracer-dynamic-coverage 6113@itemx tracer-dynamic-coverage-feedback 6114 6115This value is used to limit superblock formation once the given percentage of 6116executed instructions is covered. This limits unnecessary code size 6117expansion. 6118 6119The @option{tracer-dynamic-coverage-feedback} is used only when profile 6120feedback is available. The real profiles (as opposed to statically estimated 6121ones) are much less balanced allowing the threshold to be larger value. 6122 6123@item tracer-max-code-growth 6124Stop tail duplication once code growth has reached given percentage. This is 6125rather hokey argument, as most of the duplicates will be eliminated later in 6126cross jumping, so it may be set to much higher values than is the desired code 6127growth. 6128 6129@item tracer-min-branch-ratio 6130 6131Stop reverse growth when the reverse probability of best edge is less than this 6132threshold (in percent). 6133 6134@item tracer-min-branch-ratio 6135@itemx tracer-min-branch-ratio-feedback 6136 6137Stop forward growth if the best edge do have probability lower than this 6138threshold. 6139 6140Similarly to @option{tracer-dynamic-coverage} two values are present, one for 6141compilation for profile feedback and one for compilation without. The value 6142for compilation with profile feedback needs to be more conservative (higher) in 6143order to make tracer effective. 6144 6145@item max-cse-path-length 6146 6147Maximum number of basic blocks on path that cse considers. The default is 10. 6148 6149@item max-cse-insns 6150The maximum instructions CSE process before flushing. The default is 1000. 6151 6152@item global-var-threshold 6153 6154Counts the number of function calls (@var{n}) and the number of 6155call-clobbered variables (@var{v}). If @var{n}x@var{v} is larger than this limit, a 6156single artificial variable will be created to represent all the 6157call-clobbered variables at function call sites. This artificial 6158variable will then be made to alias every call-clobbered variable. 6159(done as @code{int * size_t} on the host machine; beware overflow). 6160 6161@item max-aliased-vops 6162 6163Maximum number of virtual operands allowed to represent aliases 6164before triggering the alias grouping heuristic. Alias grouping 6165reduces compile times and memory consumption needed for aliasing at 6166the expense of precision loss in alias information. 6167 6168@item ggc-min-expand 6169 6170GCC uses a garbage collector to manage its own memory allocation. This 6171parameter specifies the minimum percentage by which the garbage 6172collector's heap should be allowed to expand between collections. 6173Tuning this may improve compilation speed; it has no effect on code 6174generation. 6175 6176The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when 6177RAM >= 1GB@. If @code{getrlimit} is available, the notion of "RAM" is 6178the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If 6179GCC is not able to calculate RAM on a particular platform, the lower 6180bound of 30% is used. Setting this parameter and 6181@option{ggc-min-heapsize} to zero causes a full collection to occur at 6182every opportunity. This is extremely slow, but can be useful for 6183debugging. 6184 6185@item ggc-min-heapsize 6186 6187Minimum size of the garbage collector's heap before it begins bothering 6188to collect garbage. The first collection occurs after the heap expands 6189by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again, 6190tuning this may improve compilation speed, and has no effect on code 6191generation. 6192 6193The default is the smaller of RAM/8, RLIMIT_RSS, or a limit which 6194tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but 6195with a lower bound of 4096 (four megabytes) and an upper bound of 6196131072 (128 megabytes). If GCC is not able to calculate RAM on a 6197particular platform, the lower bound is used. Setting this parameter 6198very large effectively disables garbage collection. Setting this 6199parameter and @option{ggc-min-expand} to zero causes a full collection 6200to occur at every opportunity. 6201 6202@item max-reload-search-insns 6203The maximum number of instruction reload should look backward for equivalent 6204register. Increasing values mean more aggressive optimization, making the 6205compile time increase with probably slightly better performance. The default 6206value is 100. 6207 6208@item max-cselib-memory-locations 6209The maximum number of memory locations cselib should take into account. 6210Increasing values mean more aggressive optimization, making the compile time 6211increase with probably slightly better performance. The default value is 500. 6212 6213@item max-flow-memory-locations 6214Similar as @option{max-cselib-memory-locations} but for dataflow liveness. 6215The default value is 100. 6216 6217@item reorder-blocks-duplicate 6218@itemx reorder-blocks-duplicate-feedback 6219 6220Used by basic block reordering pass to decide whether to use unconditional 6221branch or duplicate the code on its destination. Code is duplicated when its 6222estimated size is smaller than this value multiplied by the estimated size of 6223unconditional jump in the hot spots of the program. 6224 6225The @option{reorder-block-duplicate-feedback} is used only when profile 6226feedback is available and may be set to higher values than 6227@option{reorder-block-duplicate} since information about the hot spots is more 6228accurate. 6229 6230@item max-sched-ready-insns 6231The maximum number of instructions ready to be issued the scheduler should 6232consider at any given time during the first scheduling pass. Increasing 6233values mean more thorough searches, making the compilation time increase 6234with probably little benefit. The default value is 100. 6235 6236@item max-sched-region-blocks 6237The maximum number of blocks in a region to be considered for 6238interblock scheduling. The default value is 10. 6239 6240@item max-sched-region-insns 6241The maximum number of insns in a region to be considered for 6242interblock scheduling. The default value is 100. 6243 6244@item min-spec-prob 6245The minimum probability (in percents) of reaching a source block 6246for interblock speculative scheduling. The default value is 40. 6247 6248@item max-sched-extend-regions-iters 6249The maximum number of iterations through CFG to extend regions. 62500 - disable region extension, 6251N - do at most N iterations. 6252The default value is 0. 6253 6254@item max-sched-insn-conflict-delay 6255The maximum conflict delay for an insn to be considered for speculative motion. 6256The default value is 3. 6257 6258@item sched-spec-prob-cutoff 6259The minimal probability of speculation success (in percents), so that 6260speculative insn will be scheduled. 6261The default value is 40. 6262 6263@item max-last-value-rtl 6264 6265The maximum size measured as number of RTLs that can be recorded in an expression 6266in combiner for a pseudo register as last known value of that register. The default 6267is 10000. 6268 6269@item integer-share-limit 6270Small integer constants can use a shared data structure, reducing the 6271compiler's memory usage and increasing its speed. This sets the maximum 6272value of a shared integer constant's. The default value is 256. 6273 6274@item min-virtual-mappings 6275Specifies the minimum number of virtual mappings in the incremental 6276SSA updater that should be registered to trigger the virtual mappings 6277heuristic defined by virtual-mappings-ratio. The default value is 6278100. 6279 6280@item virtual-mappings-ratio 6281If the number of virtual mappings is virtual-mappings-ratio bigger 6282than the number of virtual symbols to be updated, then the incremental 6283SSA updater switches to a full update for those symbols. The default 6284ratio is 3. 6285 6286@item ssp-buffer-size 6287The minimum size of buffers (i.e. arrays) that will receive stack smashing 6288protection when @option{-fstack-protection} is used. 6289 6290@item max-jump-thread-duplication-stmts 6291Maximum number of statements allowed in a block that needs to be 6292duplicated when threading jumps. 6293 6294@item max-fields-for-field-sensitive 6295Maximum number of fields in a structure we will treat in 6296a field sensitive manner during pointer analysis. 6297 6298@end table 6299@end table 6300 6301@node Preprocessor Options 6302@section Options Controlling the Preprocessor 6303@cindex preprocessor options 6304@cindex options, preprocessor 6305 6306These options control the C preprocessor, which is run on each C source 6307file before actual compilation. 6308 6309If you use the @option{-E} option, nothing is done except preprocessing. 6310Some of these options make sense only together with @option{-E} because 6311they cause the preprocessor output to be unsuitable for actual 6312compilation. 6313 6314@table @gcctabopt 6315@opindex Wp 6316You can use @option{-Wp,@var{option}} to bypass the compiler driver 6317and pass @var{option} directly through to the preprocessor. If 6318@var{option} contains commas, it is split into multiple options at the 6319commas. However, many options are modified, translated or interpreted 6320by the compiler driver before being passed to the preprocessor, and 6321@option{-Wp} forcibly bypasses this phase. The preprocessor's direct 6322interface is undocumented and subject to change, so whenever possible 6323you should avoid using @option{-Wp} and let the driver handle the 6324options instead. 6325 6326@item -Xpreprocessor @var{option} 6327@opindex preprocessor 6328Pass @var{option} as an option to the preprocessor. You can use this to 6329supply system-specific preprocessor options which GCC does not know how to 6330recognize. 6331 6332If you want to pass an option that takes an argument, you must use 6333@option{-Xpreprocessor} twice, once for the option and once for the argument. 6334@end table 6335 6336@include cppopts.texi 6337 6338@node Assembler Options 6339@section Passing Options to the Assembler 6340 6341@c prevent bad page break with this line 6342You can pass options to the assembler. 6343 6344@table @gcctabopt 6345@item -Wa,@var{option} 6346@opindex Wa 6347Pass @var{option} as an option to the assembler. If @var{option} 6348contains commas, it is split into multiple options at the commas. 6349 6350@item -Xassembler @var{option} 6351@opindex Xassembler 6352Pass @var{option} as an option to the assembler. You can use this to 6353supply system-specific assembler options which GCC does not know how to 6354recognize. 6355 6356If you want to pass an option that takes an argument, you must use 6357@option{-Xassembler} twice, once for the option and once for the argument. 6358 6359@end table 6360 6361@node Link Options 6362@section Options for Linking 6363@cindex link options 6364@cindex options, linking 6365 6366These options come into play when the compiler links object files into 6367an executable output file. They are meaningless if the compiler is 6368not doing a link step. 6369 6370@table @gcctabopt 6371@cindex file names 6372@item @var{object-file-name} 6373A file name that does not end in a special recognized suffix is 6374considered to name an object file or library. (Object files are 6375distinguished from libraries by the linker according to the file 6376contents.) If linking is done, these object files are used as input 6377to the linker. 6378 6379@item -c 6380@itemx -S 6381@itemx -E 6382@opindex c 6383@opindex S 6384@opindex E 6385If any of these options is used, then the linker is not run, and 6386object file names should not be used as arguments. @xref{Overall 6387Options}. 6388 6389@cindex Libraries 6390@item -l@var{library} 6391@itemx -l @var{library} 6392@opindex l 6393Search the library named @var{library} when linking. (The second 6394alternative with the library as a separate argument is only for 6395POSIX compliance and is not recommended.) 6396 6397It makes a difference where in the command you write this option; the 6398linker searches and processes libraries and object files in the order they 6399are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z} 6400after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers 6401to functions in @samp{z}, those functions may not be loaded. 6402 6403The linker searches a standard list of directories for the library, 6404which is actually a file named @file{lib@var{library}.a}. The linker 6405then uses this file as if it had been specified precisely by name. 6406 6407The directories searched include several standard system directories 6408plus any that you specify with @option{-L}. 6409 6410Normally the files found this way are library files---archive files 6411whose members are object files. The linker handles an archive file by 6412scanning through it for members which define symbols that have so far 6413been referenced but not defined. But if the file that is found is an 6414ordinary object file, it is linked in the usual fashion. The only 6415difference between using an @option{-l} option and specifying a file name 6416is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a} 6417and searches several directories. 6418 6419@item -nostartfiles 6420@opindex nostartfiles 6421Do not use the standard system startup files when linking. 6422The standard system libraries are used normally, unless @option{-nostdlib} 6423or @option{-nodefaultlibs} is used. 6424 6425@item -nodefaultlibs 6426@opindex nodefaultlibs 6427Do not use the standard system libraries when linking. 6428Only the libraries you specify will be passed to the linker. 6429The standard startup files are used normally, unless @option{-nostartfiles} 6430is used. The compiler may generate calls to @code{memcmp}, 6431@code{memset}, @code{memcpy} and @code{memmove}. 6432These entries are usually resolved by entries in 6433libc. These entry points should be supplied through some other 6434mechanism when this option is specified. 6435 6436@item -nostdlib 6437@opindex nostdlib 6438Do not use the standard system startup files or libraries when linking. 6439No startup files and only the libraries you specify will be passed to 6440the linker. The compiler may generate calls to @code{memcmp}, @code{memset}, 6441@code{memcpy} and @code{memmove}. 6442These entries are usually resolved by entries in 6443libc. These entry points should be supplied through some other 6444mechanism when this option is specified. 6445 6446@cindex @option{-lgcc}, use with @option{-nostdlib} 6447@cindex @option{-nostdlib} and unresolved references 6448@cindex unresolved references and @option{-nostdlib} 6449@cindex @option{-lgcc}, use with @option{-nodefaultlibs} 6450@cindex @option{-nodefaultlibs} and unresolved references 6451@cindex unresolved references and @option{-nodefaultlibs} 6452One of the standard libraries bypassed by @option{-nostdlib} and 6453@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines 6454that GCC uses to overcome shortcomings of particular machines, or special 6455needs for some languages. 6456(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler 6457Collection (GCC) Internals}, 6458for more discussion of @file{libgcc.a}.) 6459In most cases, you need @file{libgcc.a} even when you want to avoid 6460other standard libraries. In other words, when you specify @option{-nostdlib} 6461or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well. 6462This ensures that you have no unresolved references to internal GCC 6463library subroutines. (For example, @samp{__main}, used to ensure C++ 6464constructors will be called; @pxref{Collect2,,@code{collect2}, gccint, 6465GNU Compiler Collection (GCC) Internals}.) 6466 6467@item -pie 6468@opindex pie 6469Produce a position independent executable on targets which support it. 6470For predictable results, you must also specify the same set of options 6471that were used to generate code (@option{-fpie}, @option{-fPIE}, 6472or model suboptions) when you specify this option. 6473 6474@item -rdynamic 6475@opindex rdynamic 6476Pass the flag @option{-export-dynamic} to the ELF linker, on targets 6477that support it. This instructs the linker to add all symbols, not 6478only used ones, to the dynamic symbol table. This option is needed 6479for some uses of @code{dlopen} or to allow obtaining backtraces 6480from within a program. 6481 6482@item -s 6483@opindex s 6484Remove all symbol table and relocation information from the executable. 6485 6486@item -static 6487@opindex static 6488On systems that support dynamic linking, this prevents linking with the shared 6489libraries. On other systems, this option has no effect. 6490 6491@item -shared 6492@opindex shared 6493Produce a shared object which can then be linked with other objects to 6494form an executable. Not all systems support this option. For predictable 6495results, you must also specify the same set of options that were used to 6496generate code (@option{-fpic}, @option{-fPIC}, or model suboptions) 6497when you specify this option.@footnote{On some systems, @samp{gcc -shared} 6498needs to build supplementary stub code for constructors to work. On 6499multi-libbed systems, @samp{gcc -shared} must select the correct support 6500libraries to link against. Failing to supply the correct flags may lead 6501to subtle defects. Supplying them in cases where they are not necessary 6502is innocuous.} 6503 6504@item -shared-libgcc 6505@itemx -static-libgcc 6506@opindex shared-libgcc 6507@opindex static-libgcc 6508On systems that provide @file{libgcc} as a shared library, these options 6509force the use of either the shared or static version respectively. 6510If no shared version of @file{libgcc} was built when the compiler was 6511configured, these options have no effect. 6512 6513There are several situations in which an application should use the 6514shared @file{libgcc} instead of the static version. The most common 6515of these is when the application wishes to throw and catch exceptions 6516across different shared libraries. In that case, each of the libraries 6517as well as the application itself should use the shared @file{libgcc}. 6518 6519Therefore, the G++ and GCJ drivers automatically add 6520@option{-shared-libgcc} whenever you build a shared library or a main 6521executable, because C++ and Java programs typically use exceptions, so 6522this is the right thing to do. 6523 6524If, instead, you use the GCC driver to create shared libraries, you may 6525find that they will not always be linked with the shared @file{libgcc}. 6526If GCC finds, at its configuration time, that you have a non-GNU linker 6527or a GNU linker that does not support option @option{--eh-frame-hdr}, 6528it will link the shared version of @file{libgcc} into shared libraries 6529by default. Otherwise, it will take advantage of the linker and optimize 6530away the linking with the shared version of @file{libgcc}, linking with 6531the static version of libgcc by default. This allows exceptions to 6532propagate through such shared libraries, without incurring relocation 6533costs at library load time. 6534 6535However, if a library or main executable is supposed to throw or catch 6536exceptions, you must link it using the G++ or GCJ driver, as appropriate 6537for the languages used in the program, or using the option 6538@option{-shared-libgcc}, such that it is linked with the shared 6539@file{libgcc}. 6540 6541@item -symbolic 6542@opindex symbolic 6543Bind references to global symbols when building a shared object. Warn 6544about any unresolved references (unless overridden by the link editor 6545option @samp{-Xlinker -z -Xlinker defs}). Only a few systems support 6546this option. 6547 6548@item -Xlinker @var{option} 6549@opindex Xlinker 6550Pass @var{option} as an option to the linker. You can use this to 6551supply system-specific linker options which GCC does not know how to 6552recognize. 6553 6554If you want to pass an option that takes an argument, you must use 6555@option{-Xlinker} twice, once for the option and once for the argument. 6556For example, to pass @option{-assert definitions}, you must write 6557@samp{-Xlinker -assert -Xlinker definitions}. It does not work to write 6558@option{-Xlinker "-assert definitions"}, because this passes the entire 6559string as a single argument, which is not what the linker expects. 6560 6561@item -Wl,@var{option} 6562@opindex Wl 6563Pass @var{option} as an option to the linker. If @var{option} contains 6564commas, it is split into multiple options at the commas. 6565 6566@item -u @var{symbol} 6567@opindex u 6568Pretend the symbol @var{symbol} is undefined, to force linking of 6569library modules to define it. You can use @option{-u} multiple times with 6570different symbols to force loading of additional library modules. 6571@end table 6572 6573@node Directory Options 6574@section Options for Directory Search 6575@cindex directory options 6576@cindex options, directory search 6577@cindex search path 6578 6579These options specify directories to search for header files, for 6580libraries and for parts of the compiler: 6581 6582@table @gcctabopt 6583@item -I@var{dir} 6584@opindex I 6585Add the directory @var{dir} to the head of the list of directories to be 6586searched for header files. This can be used to override a system header 6587file, substituting your own version, since these directories are 6588searched before the system header file directories. However, you should 6589not use this option to add directories that contain vendor-supplied 6590system header files (use @option{-isystem} for that). If you use more than 6591one @option{-I} option, the directories are scanned in left-to-right 6592order; the standard system directories come after. 6593 6594If a standard system include directory, or a directory specified with 6595@option{-isystem}, is also specified with @option{-I}, the @option{-I} 6596option will be ignored. The directory will still be searched but as a 6597system directory at its normal position in the system include chain. 6598This is to ensure that GCC's procedure to fix buggy system headers and 6599the ordering for the include_next directive are not inadvertently changed. 6600If you really need to change the search order for system directories, 6601use the @option{-nostdinc} and/or @option{-isystem} options. 6602 6603@item -iquote@var{dir} 6604@opindex iquote 6605Add the directory @var{dir} to the head of the list of directories to 6606be searched for header files only for the case of @samp{#include 6607"@var{file}"}; they are not searched for @samp{#include <@var{file}>}, 6608otherwise just like @option{-I}. 6609 6610@item -L@var{dir} 6611@opindex L 6612Add directory @var{dir} to the list of directories to be searched 6613for @option{-l}. 6614 6615@item -B@var{prefix} 6616@opindex B 6617This option specifies where to find the executables, libraries, 6618include files, and data files of the compiler itself. 6619 6620The compiler driver program runs one or more of the subprograms 6621@file{cpp}, @file{cc1}, @file{as} and @file{ld}. It tries 6622@var{prefix} as a prefix for each program it tries to run, both with and 6623without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}). 6624 6625For each subprogram to be run, the compiler driver first tries the 6626@option{-B} prefix, if any. If that name is not found, or if @option{-B} 6627was not specified, the driver tries two standard prefixes, which are 6628@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of 6629those results in a file name that is found, the unmodified program 6630name is searched for using the directories specified in your 6631@env{PATH} environment variable. 6632 6633The compiler will check to see if the path provided by the @option{-B} 6634refers to a directory, and if necessary it will add a directory 6635separator character at the end of the path. 6636 6637@option{-B} prefixes that effectively specify directory names also apply 6638to libraries in the linker, because the compiler translates these 6639options into @option{-L} options for the linker. They also apply to 6640includes files in the preprocessor, because the compiler translates these 6641options into @option{-isystem} options for the preprocessor. In this case, 6642the compiler appends @samp{include} to the prefix. 6643 6644The run-time support file @file{libgcc.a} can also be searched for using 6645the @option{-B} prefix, if needed. If it is not found there, the two 6646standard prefixes above are tried, and that is all. The file is left 6647out of the link if it is not found by those means. 6648 6649Another way to specify a prefix much like the @option{-B} prefix is to use 6650the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment 6651Variables}. 6652 6653As a special kludge, if the path provided by @option{-B} is 6654@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to 66559, then it will be replaced by @file{[dir/]include}. This is to help 6656with boot-strapping the compiler. 6657 6658@item -specs=@var{file} 6659@opindex specs 6660Process @var{file} after the compiler reads in the standard @file{specs} 6661file, in order to override the defaults that the @file{gcc} driver 6662program uses when determining what switches to pass to @file{cc1}, 6663@file{cc1plus}, @file{as}, @file{ld}, etc. More than one 6664@option{-specs=@var{file}} can be specified on the command line, and they 6665are processed in order, from left to right. 6666 6667@item --sysroot=@var{dir} 6668@opindex sysroot 6669Use @var{dir} as the logical root directory for headers and libraries. 6670For example, if the compiler would normally search for headers in 6671@file{/usr/include} and libraries in @file{/usr/lib}, it will instead 6672search @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}. 6673 6674If you use both this option and the @option{-isysroot} option, then 6675the @option{--sysroot} option will apply to libraries, but the 6676@option{-isysroot} option will apply to header files. 6677 6678The GNU linker (beginning with version 2.16) has the necessary support 6679for this option. If your linker does not support this option, the 6680header file aspect of @option{--sysroot} will still work, but the 6681library aspect will not. 6682 6683@item -I- 6684@opindex I- 6685This option has been deprecated. Please use @option{-iquote} instead for 6686@option{-I} directories before the @option{-I-} and remove the @option{-I-}. 6687Any directories you specify with @option{-I} options before the @option{-I-} 6688option are searched only for the case of @samp{#include "@var{file}"}; 6689they are not searched for @samp{#include <@var{file}>}. 6690 6691If additional directories are specified with @option{-I} options after 6692the @option{-I-}, these directories are searched for all @samp{#include} 6693directives. (Ordinarily @emph{all} @option{-I} directories are used 6694this way.) 6695 6696In addition, the @option{-I-} option inhibits the use of the current 6697directory (where the current input file came from) as the first search 6698directory for @samp{#include "@var{file}"}. There is no way to 6699override this effect of @option{-I-}. With @option{-I.} you can specify 6700searching the directory which was current when the compiler was 6701invoked. That is not exactly the same as what the preprocessor does 6702by default, but it is often satisfactory. 6703 6704@option{-I-} does not inhibit the use of the standard system directories 6705for header files. Thus, @option{-I-} and @option{-nostdinc} are 6706independent. 6707@end table 6708 6709@c man end 6710 6711@node Spec Files 6712@section Specifying subprocesses and the switches to pass to them 6713@cindex Spec Files 6714 6715@command{gcc} is a driver program. It performs its job by invoking a 6716sequence of other programs to do the work of compiling, assembling and 6717linking. GCC interprets its command-line parameters and uses these to 6718deduce which programs it should invoke, and which command-line options 6719it ought to place on their command lines. This behavior is controlled 6720by @dfn{spec strings}. In most cases there is one spec string for each 6721program that GCC can invoke, but a few programs have multiple spec 6722strings to control their behavior. The spec strings built into GCC can 6723be overridden by using the @option{-specs=} command-line switch to specify 6724a spec file. 6725 6726@dfn{Spec files} are plaintext files that are used to construct spec 6727strings. They consist of a sequence of directives separated by blank 6728lines. The type of directive is determined by the first non-whitespace 6729character on the line and it can be one of the following: 6730 6731@table @code 6732@item %@var{command} 6733Issues a @var{command} to the spec file processor. The commands that can 6734appear here are: 6735 6736@table @code 6737@item %include <@var{file}> 6738@cindex %include 6739Search for @var{file} and insert its text at the current point in the 6740specs file. 6741 6742@item %include_noerr <@var{file}> 6743@cindex %include_noerr 6744Just like @samp{%include}, but do not generate an error message if the include 6745file cannot be found. 6746 6747@item %rename @var{old_name} @var{new_name} 6748@cindex %rename 6749Rename the spec string @var{old_name} to @var{new_name}. 6750 6751@end table 6752 6753@item *[@var{spec_name}]: 6754This tells the compiler to create, override or delete the named spec 6755string. All lines after this directive up to the next directive or 6756blank line are considered to be the text for the spec string. If this 6757results in an empty string then the spec will be deleted. (Or, if the 6758spec did not exist, then nothing will happened.) Otherwise, if the spec 6759does not currently exist a new spec will be created. If the spec does 6760exist then its contents will be overridden by the text of this 6761directive, unless the first character of that text is the @samp{+} 6762character, in which case the text will be appended to the spec. 6763 6764@item [@var{suffix}]: 6765Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive 6766and up to the next directive or blank line are considered to make up the 6767spec string for the indicated suffix. When the compiler encounters an 6768input file with the named suffix, it will processes the spec string in 6769order to work out how to compile that file. For example: 6770 6771@smallexample 6772.ZZ: 6773z-compile -input %i 6774@end smallexample 6775 6776This says that any input file whose name ends in @samp{.ZZ} should be 6777passed to the program @samp{z-compile}, which should be invoked with the 6778command-line switch @option{-input} and with the result of performing the 6779@samp{%i} substitution. (See below.) 6780 6781As an alternative to providing a spec string, the text that follows a 6782suffix directive can be one of the following: 6783 6784@table @code 6785@item @@@var{language} 6786This says that the suffix is an alias for a known @var{language}. This is 6787similar to using the @option{-x} command-line switch to GCC to specify a 6788language explicitly. For example: 6789 6790@smallexample 6791.ZZ: 6792@@c++ 6793@end smallexample 6794 6795Says that .ZZ files are, in fact, C++ source files. 6796 6797@item #@var{name} 6798This causes an error messages saying: 6799 6800@smallexample 6801@var{name} compiler not installed on this system. 6802@end smallexample 6803@end table 6804 6805GCC already has an extensive list of suffixes built into it. 6806This directive will add an entry to the end of the list of suffixes, but 6807since the list is searched from the end backwards, it is effectively 6808possible to override earlier entries using this technique. 6809 6810@end table 6811 6812GCC has the following spec strings built into it. Spec files can 6813override these strings or create their own. Note that individual 6814targets can also add their own spec strings to this list. 6815 6816@smallexample 6817asm Options to pass to the assembler 6818asm_final Options to pass to the assembler post-processor 6819cpp Options to pass to the C preprocessor 6820cc1 Options to pass to the C compiler 6821cc1plus Options to pass to the C++ compiler 6822endfile Object files to include at the end of the link 6823link Options to pass to the linker 6824lib Libraries to include on the command line to the linker 6825libgcc Decides which GCC support library to pass to the linker 6826linker Sets the name of the linker 6827predefines Defines to be passed to the C preprocessor 6828signed_char Defines to pass to CPP to say whether @code{char} is signed 6829 by default 6830startfile Object files to include at the start of the link 6831@end smallexample 6832 6833Here is a small example of a spec file: 6834 6835@smallexample 6836%rename lib old_lib 6837 6838*lib: 6839--start-group -lgcc -lc -leval1 --end-group %(old_lib) 6840@end smallexample 6841 6842This example renames the spec called @samp{lib} to @samp{old_lib} and 6843then overrides the previous definition of @samp{lib} with a new one. 6844The new definition adds in some extra command-line options before 6845including the text of the old definition. 6846 6847@dfn{Spec strings} are a list of command-line options to be passed to their 6848corresponding program. In addition, the spec strings can contain 6849@samp{%}-prefixed sequences to substitute variable text or to 6850conditionally insert text into the command line. Using these constructs 6851it is possible to generate quite complex command lines. 6852 6853Here is a table of all defined @samp{%}-sequences for spec 6854strings. Note that spaces are not generated automatically around the 6855results of expanding these sequences. Therefore you can concatenate them 6856together or combine them with constant text in a single argument. 6857 6858@table @code 6859@item %% 6860Substitute one @samp{%} into the program name or argument. 6861 6862@item %i 6863Substitute the name of the input file being processed. 6864 6865@item %b 6866Substitute the basename of the input file being processed. 6867This is the substring up to (and not including) the last period 6868and not including the directory. 6869 6870@item %B 6871This is the same as @samp{%b}, but include the file suffix (text after 6872the last period). 6873 6874@item %d 6875Marks the argument containing or following the @samp{%d} as a 6876temporary file name, so that that file will be deleted if GCC exits 6877successfully. Unlike @samp{%g}, this contributes no text to the 6878argument. 6879 6880@item %g@var{suffix} 6881Substitute a file name that has suffix @var{suffix} and is chosen 6882once per compilation, and mark the argument in the same way as 6883@samp{%d}. To reduce exposure to denial-of-service attacks, the file 6884name is now chosen in a way that is hard to predict even when previously 6885chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s} 6886might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches 6887the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is 6888treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g} 6889was simply substituted with a file name chosen once per compilation, 6890without regard to any appended suffix (which was therefore treated 6891just like ordinary text), making such attacks more likely to succeed. 6892 6893@item %u@var{suffix} 6894Like @samp{%g}, but generates a new temporary file name even if 6895@samp{%u@var{suffix}} was already seen. 6896 6897@item %U@var{suffix} 6898Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a 6899new one if there is no such last file name. In the absence of any 6900@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share 6901the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s} 6902would involve the generation of two distinct file names, one 6903for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was 6904simply substituted with a file name chosen for the previous @samp{%u}, 6905without regard to any appended suffix. 6906 6907@item %j@var{suffix} 6908Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is 6909writable, and if save-temps is off; otherwise, substitute the name 6910of a temporary file, just like @samp{%u}. This temporary file is not 6911meant for communication between processes, but rather as a junk 6912disposal mechanism. 6913 6914@item %|@var{suffix} 6915@itemx %m@var{suffix} 6916Like @samp{%g}, except if @option{-pipe} is in effect. In that case 6917@samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at 6918all. These are the two most common ways to instruct a program that it 6919should read from standard input or write to standard output. If you 6920need something more elaborate you can use an @samp{%@{pipe:@code{X}@}} 6921construct: see for example @file{f/lang-specs.h}. 6922 6923@item %.@var{SUFFIX} 6924Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args 6925when it is subsequently output with @samp{%*}. @var{SUFFIX} is 6926terminated by the next space or %. 6927 6928@item %w 6929Marks the argument containing or following the @samp{%w} as the 6930designated output file of this compilation. This puts the argument 6931into the sequence of arguments that @samp{%o} will substitute later. 6932 6933@item %o 6934Substitutes the names of all the output files, with spaces 6935automatically placed around them. You should write spaces 6936around the @samp{%o} as well or the results are undefined. 6937@samp{%o} is for use in the specs for running the linker. 6938Input files whose names have no recognized suffix are not compiled 6939at all, but they are included among the output files, so they will 6940be linked. 6941 6942@item %O 6943Substitutes the suffix for object files. Note that this is 6944handled specially when it immediately follows @samp{%g, %u, or %U}, 6945because of the need for those to form complete file names. The 6946handling is such that @samp{%O} is treated exactly as if it had already 6947been substituted, except that @samp{%g, %u, and %U} do not currently 6948support additional @var{suffix} characters following @samp{%O} as they would 6949following, for example, @samp{.o}. 6950 6951@item %p 6952Substitutes the standard macro predefinitions for the 6953current target machine. Use this when running @code{cpp}. 6954 6955@item %P 6956Like @samp{%p}, but puts @samp{__} before and after the name of each 6957predefined macro, except for macros that start with @samp{__} or with 6958@samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO 6959C@. 6960 6961@item %I 6962Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}), 6963@option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}), 6964@option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options) 6965and @option{-imultilib} as necessary. 6966 6967@item %s 6968Current argument is the name of a library or startup file of some sort. 6969Search for that file in a standard list of directories and substitute 6970the full name found. 6971 6972@item %e@var{str} 6973Print @var{str} as an error message. @var{str} is terminated by a newline. 6974Use this when inconsistent options are detected. 6975 6976@item %(@var{name}) 6977Substitute the contents of spec string @var{name} at this point. 6978 6979@item %[@var{name}] 6980Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments. 6981 6982@item %x@{@var{option}@} 6983Accumulate an option for @samp{%X}. 6984 6985@item %X 6986Output the accumulated linker options specified by @option{-Wl} or a @samp{%x} 6987spec string. 6988 6989@item %Y 6990Output the accumulated assembler options specified by @option{-Wa}. 6991 6992@item %Z 6993Output the accumulated preprocessor options specified by @option{-Wp}. 6994 6995@item %a 6996Process the @code{asm} spec. This is used to compute the 6997switches to be passed to the assembler. 6998 6999@item %A 7000Process the @code{asm_final} spec. This is a spec string for 7001passing switches to an assembler post-processor, if such a program is 7002needed. 7003 7004@item %l 7005Process the @code{link} spec. This is the spec for computing the 7006command line passed to the linker. Typically it will make use of the 7007@samp{%L %G %S %D and %E} sequences. 7008 7009@item %D 7010Dump out a @option{-L} option for each directory that GCC believes might 7011contain startup files. If the target supports multilibs then the 7012current multilib directory will be prepended to each of these paths. 7013 7014@item %L 7015Process the @code{lib} spec. This is a spec string for deciding which 7016libraries should be included on the command line to the linker. 7017 7018@item %G 7019Process the @code{libgcc} spec. This is a spec string for deciding 7020which GCC support library should be included on the command line to the linker. 7021 7022@item %S 7023Process the @code{startfile} spec. This is a spec for deciding which 7024object files should be the first ones passed to the linker. Typically 7025this might be a file named @file{crt0.o}. 7026 7027@item %E 7028Process the @code{endfile} spec. This is a spec string that specifies 7029the last object files that will be passed to the linker. 7030 7031@item %C 7032Process the @code{cpp} spec. This is used to construct the arguments 7033to be passed to the C preprocessor. 7034 7035@item %1 7036Process the @code{cc1} spec. This is used to construct the options to be 7037passed to the actual C compiler (@samp{cc1}). 7038 7039@item %2 7040Process the @code{cc1plus} spec. This is used to construct the options to be 7041passed to the actual C++ compiler (@samp{cc1plus}). 7042 7043@item %* 7044Substitute the variable part of a matched option. See below. 7045Note that each comma in the substituted string is replaced by 7046a single space. 7047 7048@item %<@code{S} 7049Remove all occurrences of @code{-S} from the command line. Note---this 7050command is position dependent. @samp{%} commands in the spec string 7051before this one will see @code{-S}, @samp{%} commands in the spec string 7052after this one will not. 7053 7054@item %:@var{function}(@var{args}) 7055Call the named function @var{function}, passing it @var{args}. 7056@var{args} is first processed as a nested spec string, then split 7057into an argument vector in the usual fashion. The function returns 7058a string which is processed as if it had appeared literally as part 7059of the current spec. 7060 7061The following built-in spec functions are provided: 7062 7063@table @code 7064@item @code{if-exists} 7065The @code{if-exists} spec function takes one argument, an absolute 7066pathname to a file. If the file exists, @code{if-exists} returns the 7067pathname. Here is a small example of its usage: 7068 7069@smallexample 7070*startfile: 7071crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s 7072@end smallexample 7073 7074@item @code{if-exists-else} 7075The @code{if-exists-else} spec function is similar to the @code{if-exists} 7076spec function, except that it takes two arguments. The first argument is 7077an absolute pathname to a file. If the file exists, @code{if-exists-else} 7078returns the pathname. If it does not exist, it returns the second argument. 7079This way, @code{if-exists-else} can be used to select one file or another, 7080based on the existence of the first. Here is a small example of its usage: 7081 7082@smallexample 7083*startfile: 7084crt0%O%s %:if-exists(crti%O%s) \ 7085%:if-exists-else(crtbeginT%O%s crtbegin%O%s) 7086@end smallexample 7087 7088@item @code{replace-outfile} 7089The @code{replace-outfile} spec function takes two arguments. It looks for the 7090first argument in the outfiles array and replaces it with the second argument. Here 7091is a small example of its usage: 7092 7093@smallexample 7094%@{static|static-libgcc|static-libstdc++:%:replace-outfile(-lstdc++ \ 7095libstdc++.a%s)@} 7096 7097@end smallexample 7098 7099@end table 7100 7101@item %@{@code{S}@} 7102Substitutes the @code{-S} switch, if that switch was given to GCC@. 7103If that switch was not specified, this substitutes nothing. Note that 7104the leading dash is omitted when specifying this option, and it is 7105automatically inserted if the substitution is performed. Thus the spec 7106string @samp{%@{foo@}} would match the command-line option @option{-foo} 7107and would output the command line option @option{-foo}. 7108 7109@item %W@{@code{S}@} 7110Like %@{@code{S}@} but mark last argument supplied within as a file to be 7111deleted on failure. 7112 7113@item %@{@code{S}*@} 7114Substitutes all the switches specified to GCC whose names start 7115with @code{-S}, but which also take an argument. This is used for 7116switches like @option{-o}, @option{-D}, @option{-I}, etc. 7117GCC considers @option{-o foo} as being 7118one switch whose names starts with @samp{o}. %@{o*@} would substitute this 7119text, including the space. Thus two arguments would be generated. 7120 7121@item %@{@code{S}*&@code{T}*@} 7122Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options 7123(the order of @code{S} and @code{T} in the spec is not significant). 7124There can be any number of ampersand-separated variables; for each the 7125wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}. 7126 7127@item %@{@code{S}:@code{X}@} 7128Substitutes @code{X}, if the @samp{-S} switch was given to GCC@. 7129 7130@item %@{!@code{S}:@code{X}@} 7131Substitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@. 7132 7133@item %@{@code{S}*:@code{X}@} 7134Substitutes @code{X} if one or more switches whose names start with 7135@code{-S} are specified to GCC@. Normally @code{X} is substituted only 7136once, no matter how many such switches appeared. However, if @code{%*} 7137appears somewhere in @code{X}, then @code{X} will be substituted once 7138for each matching switch, with the @code{%*} replaced by the part of 7139that switch that matched the @code{*}. 7140 7141@item %@{.@code{S}:@code{X}@} 7142Substitutes @code{X}, if processing a file with suffix @code{S}. 7143 7144@item %@{!.@code{S}:@code{X}@} 7145Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}. 7146 7147@item %@{@code{S}|@code{P}:@code{X}@} 7148Substitutes @code{X} if either @code{-S} or @code{-P} was given to GCC@. 7149This may be combined with @samp{!}, @samp{.}, and @code{*} sequences as well, 7150although they have a stronger binding than the @samp{|}. If @code{%*} 7151appears in @code{X}, all of the alternatives must be starred, and only 7152the first matching alternative is substituted. 7153 7154For example, a spec string like this: 7155 7156@smallexample 7157%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@} 7158@end smallexample 7159 7160will output the following command-line options from the following input 7161command-line options: 7162 7163@smallexample 7164fred.c -foo -baz 7165jim.d -bar -boggle 7166-d fred.c -foo -baz -boggle 7167-d jim.d -bar -baz -boggle 7168@end smallexample 7169 7170@item %@{S:X; T:Y; :D@} 7171 7172If @code{S} was given to GCC, substitutes @code{X}; else if @code{T} was 7173given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can 7174be as many clauses as you need. This may be combined with @code{.}, 7175@code{!}, @code{|}, and @code{*} as needed. 7176 7177 7178@end table 7179 7180The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar 7181construct may contain other nested @samp{%} constructs or spaces, or 7182even newlines. They are processed as usual, as described above. 7183Trailing white space in @code{X} is ignored. White space may also 7184appear anywhere on the left side of the colon in these constructs, 7185except between @code{.} or @code{*} and the corresponding word. 7186 7187The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are 7188handled specifically in these constructs. If another value of 7189@option{-O} or the negated form of a @option{-f}, @option{-m}, or 7190@option{-W} switch is found later in the command line, the earlier 7191switch value is ignored, except with @{@code{S}*@} where @code{S} is 7192just one letter, which passes all matching options. 7193 7194The character @samp{|} at the beginning of the predicate text is used to 7195indicate that a command should be piped to the following command, but 7196only if @option{-pipe} is specified. 7197 7198It is built into GCC which switches take arguments and which do not. 7199(You might think it would be useful to generalize this to allow each 7200compiler's spec to say which switches take arguments. But this cannot 7201be done in a consistent fashion. GCC cannot even decide which input 7202files have been specified without knowing which switches take arguments, 7203and it must know which input files to compile in order to tell which 7204compilers to run). 7205 7206GCC also knows implicitly that arguments starting in @option{-l} are to be 7207treated as compiler output files, and passed to the linker in their 7208proper position among the other output files. 7209 7210@c man begin OPTIONS 7211 7212@node Target Options 7213@section Specifying Target Machine and Compiler Version 7214@cindex target options 7215@cindex cross compiling 7216@cindex specifying machine version 7217@cindex specifying compiler version and target machine 7218@cindex compiler version, specifying 7219@cindex target machine, specifying 7220 7221The usual way to run GCC is to run the executable called @file{gcc}, or 7222@file{<machine>-gcc} when cross-compiling, or 7223@file{<machine>-gcc-<version>} to run a version other than the one that 7224was installed last. Sometimes this is inconvenient, so GCC provides 7225options that will switch to another cross-compiler or version. 7226 7227@table @gcctabopt 7228@item -b @var{machine} 7229@opindex b 7230The argument @var{machine} specifies the target machine for compilation. 7231 7232The value to use for @var{machine} is the same as was specified as the 7233machine type when configuring GCC as a cross-compiler. For 7234example, if a cross-compiler was configured with @samp{configure 7235arm-elf}, meaning to compile for an arm processor with elf binaries, 7236then you would specify @option{-b arm-elf} to run that cross compiler. 7237Because there are other options beginning with @option{-b}, the 7238configuration must contain a hyphen. 7239 7240@item -V @var{version} 7241@opindex V 7242The argument @var{version} specifies which version of GCC to run. 7243This is useful when multiple versions are installed. For example, 7244@var{version} might be @samp{4.0}, meaning to run GCC version 4.0. 7245@end table 7246 7247The @option{-V} and @option{-b} options work by running the 7248@file{<machine>-gcc-<version>} executable, so there's no real reason to 7249use them if you can just run that directly. 7250 7251@node Submodel Options 7252@section Hardware Models and Configurations 7253@cindex submodel options 7254@cindex specifying hardware config 7255@cindex hardware models and configurations, specifying 7256@cindex machine dependent options 7257 7258Earlier we discussed the standard option @option{-b} which chooses among 7259different installed compilers for completely different target 7260machines, such as VAX vs.@: 68000 vs.@: 80386. 7261 7262In addition, each of these target machine types can have its own 7263special options, starting with @samp{-m}, to choose among various 7264hardware models or configurations---for example, 68010 vs 68020, 7265floating coprocessor or none. A single installed version of the 7266compiler can compile for any model or configuration, according to the 7267options specified. 7268 7269Some configurations of the compiler also support additional special 7270options, usually for compatibility with other compilers on the same 7271platform. 7272 7273@c This list is ordered alphanumerically by subsection name. 7274@c It should be the same order and spelling as these options are listed 7275@c in Machine Dependent Options 7276 7277@menu 7278* ARC Options:: 7279* ARM Options:: 7280* AVR Options:: 7281* Blackfin Options:: 7282* CRIS Options:: 7283* CRX Options:: 7284* Darwin Options:: 7285* DEC Alpha Options:: 7286* DEC Alpha/VMS Options:: 7287* FRV Options:: 7288* GNU/Linux Options:: 7289* H8/300 Options:: 7290* HPPA Options:: 7291* i386 and x86-64 Options:: 7292* IA-64 Options:: 7293* M32C Options:: 7294* M32R/D Options:: 7295* M680x0 Options:: 7296* M68hc1x Options:: 7297* MCore Options:: 7298* MIPS Options:: 7299* MMIX Options:: 7300* MN10300 Options:: 7301* MT Options:: 7302* PDP-11 Options:: 7303* PowerPC Options:: 7304* RS/6000 and PowerPC Options:: 7305* S/390 and zSeries Options:: 7306* Score Options:: 7307* SH Options:: 7308* SPARC Options:: 7309* System V Options:: 7310* TMS320C3x/C4x Options:: 7311* V850 Options:: 7312* VAX Options:: 7313* x86-64 Options:: 7314* Xstormy16 Options:: 7315* Xtensa Options:: 7316* zSeries Options:: 7317@end menu 7318 7319@node ARC Options 7320@subsection ARC Options 7321@cindex ARC Options 7322 7323These options are defined for ARC implementations: 7324 7325@table @gcctabopt 7326@item -EL 7327@opindex EL 7328Compile code for little endian mode. This is the default. 7329 7330@item -EB 7331@opindex EB 7332Compile code for big endian mode. 7333 7334@item -mmangle-cpu 7335@opindex mmangle-cpu 7336Prepend the name of the cpu to all public symbol names. 7337In multiple-processor systems, there are many ARC variants with different 7338instruction and register set characteristics. This flag prevents code 7339compiled for one cpu to be linked with code compiled for another. 7340No facility exists for handling variants that are ``almost identical''. 7341This is an all or nothing option. 7342 7343@item -mcpu=@var{cpu} 7344@opindex mcpu 7345Compile code for ARC variant @var{cpu}. 7346Which variants are supported depend on the configuration. 7347All variants support @option{-mcpu=base}, this is the default. 7348 7349@item -mtext=@var{text-section} 7350@itemx -mdata=@var{data-section} 7351@itemx -mrodata=@var{readonly-data-section} 7352@opindex mtext 7353@opindex mdata 7354@opindex mrodata 7355Put functions, data, and readonly data in @var{text-section}, 7356@var{data-section}, and @var{readonly-data-section} respectively 7357by default. This can be overridden with the @code{section} attribute. 7358@xref{Variable Attributes}. 7359 7360@end table 7361 7362@node ARM Options 7363@subsection ARM Options 7364@cindex ARM options 7365 7366These @samp{-m} options are defined for Advanced RISC Machines (ARM) 7367architectures: 7368 7369@table @gcctabopt 7370@item -mabi=@var{name} 7371@opindex mabi 7372Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu}, 7373@samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}. 7374 7375@item -mapcs-frame 7376@opindex mapcs-frame 7377Generate a stack frame that is compliant with the ARM Procedure Call 7378Standard for all functions, even if this is not strictly necessary for 7379correct execution of the code. Specifying @option{-fomit-frame-pointer} 7380with this option will cause the stack frames not to be generated for 7381leaf functions. The default is @option{-mno-apcs-frame}. 7382 7383@item -mapcs 7384@opindex mapcs 7385This is a synonym for @option{-mapcs-frame}. 7386 7387@ignore 7388@c not currently implemented 7389@item -mapcs-stack-check 7390@opindex mapcs-stack-check 7391Generate code to check the amount of stack space available upon entry to 7392every function (that actually uses some stack space). If there is 7393insufficient space available then either the function 7394@samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be 7395called, depending upon the amount of stack space required. The run time 7396system is required to provide these functions. The default is 7397@option{-mno-apcs-stack-check}, since this produces smaller code. 7398 7399@c not currently implemented 7400@item -mapcs-float 7401@opindex mapcs-float 7402Pass floating point arguments using the float point registers. This is 7403one of the variants of the APCS@. This option is recommended if the 7404target hardware has a floating point unit or if a lot of floating point 7405arithmetic is going to be performed by the code. The default is 7406@option{-mno-apcs-float}, since integer only code is slightly increased in 7407size if @option{-mapcs-float} is used. 7408 7409@c not currently implemented 7410@item -mapcs-reentrant 7411@opindex mapcs-reentrant 7412Generate reentrant, position independent code. The default is 7413@option{-mno-apcs-reentrant}. 7414@end ignore 7415 7416@item -mthumb-interwork 7417@opindex mthumb-interwork 7418Generate code which supports calling between the ARM and Thumb 7419instruction sets. Without this option the two instruction sets cannot 7420be reliably used inside one program. The default is 7421@option{-mno-thumb-interwork}, since slightly larger code is generated 7422when @option{-mthumb-interwork} is specified. 7423 7424@item -mno-sched-prolog 7425@opindex mno-sched-prolog 7426Prevent the reordering of instructions in the function prolog, or the 7427merging of those instruction with the instructions in the function's 7428body. This means that all functions will start with a recognizable set 7429of instructions (or in fact one of a choice from a small set of 7430different function prologues), and this information can be used to 7431locate the start if functions inside an executable piece of code. The 7432default is @option{-msched-prolog}. 7433 7434@item -mhard-float 7435@opindex mhard-float 7436Generate output containing floating point instructions. This is the 7437default. 7438 7439@item -msoft-float 7440@opindex msoft-float 7441Generate output containing library calls for floating point. 7442@strong{Warning:} the requisite libraries are not available for all ARM 7443targets. Normally the facilities of the machine's usual C compiler are 7444used, but this cannot be done directly in cross-compilation. You must make 7445your own arrangements to provide suitable library functions for 7446cross-compilation. 7447 7448@option{-msoft-float} changes the calling convention in the output file; 7449therefore, it is only useful if you compile @emph{all} of a program with 7450this option. In particular, you need to compile @file{libgcc.a}, the 7451library that comes with GCC, with @option{-msoft-float} in order for 7452this to work. 7453 7454@item -mfloat-abi=@var{name} 7455@opindex mfloat-abi 7456Specifies which ABI to use for floating point values. Permissible values 7457are: @samp{soft}, @samp{softfp} and @samp{hard}. 7458 7459@samp{soft} and @samp{hard} are equivalent to @option{-msoft-float} 7460and @option{-mhard-float} respectively. @samp{softfp} allows the generation 7461of floating point instructions, but still uses the soft-float calling 7462conventions. 7463 7464@item -mlittle-endian 7465@opindex mlittle-endian 7466Generate code for a processor running in little-endian mode. This is 7467the default for all standard configurations. 7468 7469@item -mbig-endian 7470@opindex mbig-endian 7471Generate code for a processor running in big-endian mode; the default is 7472to compile code for a little-endian processor. 7473 7474@item -mwords-little-endian 7475@opindex mwords-little-endian 7476This option only applies when generating code for big-endian processors. 7477Generate code for a little-endian word order but a big-endian byte 7478order. That is, a byte order of the form @samp{32107654}. Note: this 7479option should only be used if you require compatibility with code for 7480big-endian ARM processors generated by versions of the compiler prior to 74812.8. 7482 7483@item -mcpu=@var{name} 7484@opindex mcpu 7485This specifies the name of the target ARM processor. GCC uses this name 7486to determine what kind of instructions it can emit when generating 7487assembly code. Permissible names are: @samp{arm2}, @samp{arm250}, 7488@samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610}, 7489@samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm}, 7490@samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700}, 7491@samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100}, 7492@samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s}, 7493@samp{arm8}, @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100}, 7494@samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920}, 7495@samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s}, 7496@samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi}, 7497@samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s}, 7498@samp{arm10e}, @samp{arm1020e}, @samp{arm1022e}, 7499@samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp}, 7500@samp{arm1176jz-s}, @samp{arm1176jzf-s}, @samp{xscale}, @samp{iwmmxt}, 7501@samp{ep9312}. 7502 7503@itemx -mtune=@var{name} 7504@opindex mtune 7505This option is very similar to the @option{-mcpu=} option, except that 7506instead of specifying the actual target processor type, and hence 7507restricting which instructions can be used, it specifies that GCC should 7508tune the performance of the code as if the target were of the type 7509specified in this option, but still choosing the instructions that it 7510will generate based on the cpu specified by a @option{-mcpu=} option. 7511For some ARM implementations better performance can be obtained by using 7512this option. 7513 7514@item -march=@var{name} 7515@opindex march 7516This specifies the name of the target ARM architecture. GCC uses this 7517name to determine what kind of instructions it can emit when generating 7518assembly code. This option can be used in conjunction with or instead 7519of the @option{-mcpu=} option. Permissible names are: @samp{armv2}, 7520@samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t}, 7521@samp{armv5}, @samp{armv5t}, @samp{armv5te}, @samp{armv6}, @samp{armv6j}, 7522@samp{iwmmxt}, @samp{ep9312}. 7523 7524@item -mfpu=@var{name} 7525@itemx -mfpe=@var{number} 7526@itemx -mfp=@var{number} 7527@opindex mfpu 7528@opindex mfpe 7529@opindex mfp 7530This specifies what floating point hardware (or hardware emulation) is 7531available on the target. Permissible names are: @samp{fpa}, @samp{fpe2}, 7532@samp{fpe3}, @samp{maverick}, @samp{vfp}. @option{-mfp} and @option{-mfpe} 7533are synonyms for @option{-mfpu}=@samp{fpe}@var{number}, for compatibility 7534with older versions of GCC@. 7535 7536If @option{-msoft-float} is specified this specifies the format of 7537floating point values. 7538 7539@item -mstructure-size-boundary=@var{n} 7540@opindex mstructure-size-boundary 7541The size of all structures and unions will be rounded up to a multiple 7542of the number of bits set by this option. Permissible values are 8, 32 7543and 64. The default value varies for different toolchains. For the COFF 7544targeted toolchain the default value is 8. A value of 64 is only allowed 7545if the underlying ABI supports it. 7546 7547Specifying the larger number can produce faster, more efficient code, but 7548can also increase the size of the program. Different values are potentially 7549incompatible. Code compiled with one value cannot necessarily expect to 7550work with code or libraries compiled with another value, if they exchange 7551information using structures or unions. 7552 7553@item -mabort-on-noreturn 7554@opindex mabort-on-noreturn 7555Generate a call to the function @code{abort} at the end of a 7556@code{noreturn} function. It will be executed if the function tries to 7557return. 7558 7559@item -mlong-calls 7560@itemx -mno-long-calls 7561@opindex mlong-calls 7562@opindex mno-long-calls 7563Tells the compiler to perform function calls by first loading the 7564address of the function into a register and then performing a subroutine 7565call on this register. This switch is needed if the target function 7566will lie outside of the 64 megabyte addressing range of the offset based 7567version of subroutine call instruction. 7568 7569Even if this switch is enabled, not all function calls will be turned 7570into long calls. The heuristic is that static functions, functions 7571which have the @samp{short-call} attribute, functions that are inside 7572the scope of a @samp{#pragma no_long_calls} directive and functions whose 7573definitions have already been compiled within the current compilation 7574unit, will not be turned into long calls. The exception to this rule is 7575that weak function definitions, functions with the @samp{long-call} 7576attribute or the @samp{section} attribute, and functions that are within 7577the scope of a @samp{#pragma long_calls} directive, will always be 7578turned into long calls. 7579 7580This feature is not enabled by default. Specifying 7581@option{-mno-long-calls} will restore the default behavior, as will 7582placing the function calls within the scope of a @samp{#pragma 7583long_calls_off} directive. Note these switches have no effect on how 7584the compiler generates code to handle function calls via function 7585pointers. 7586 7587@item -mnop-fun-dllimport 7588@opindex mnop-fun-dllimport 7589Disable support for the @code{dllimport} attribute. 7590 7591@item -msingle-pic-base 7592@opindex msingle-pic-base 7593Treat the register used for PIC addressing as read-only, rather than 7594loading it in the prologue for each function. The run-time system is 7595responsible for initializing this register with an appropriate value 7596before execution begins. 7597 7598@item -mpic-register=@var{reg} 7599@opindex mpic-register 7600Specify the register to be used for PIC addressing. The default is R10 7601unless stack-checking is enabled, when R9 is used. 7602 7603@item -mcirrus-fix-invalid-insns 7604@opindex mcirrus-fix-invalid-insns 7605@opindex mno-cirrus-fix-invalid-insns 7606Insert NOPs into the instruction stream to in order to work around 7607problems with invalid Maverick instruction combinations. This option 7608is only valid if the @option{-mcpu=ep9312} option has been used to 7609enable generation of instructions for the Cirrus Maverick floating 7610point co-processor. This option is not enabled by default, since the 7611problem is only present in older Maverick implementations. The default 7612can be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns} 7613switch. 7614 7615@item -mpoke-function-name 7616@opindex mpoke-function-name 7617Write the name of each function into the text section, directly 7618preceding the function prologue. The generated code is similar to this: 7619 7620@smallexample 7621 t0 7622 .ascii "arm_poke_function_name", 0 7623 .align 7624 t1 7625 .word 0xff000000 + (t1 - t0) 7626 arm_poke_function_name 7627 mov ip, sp 7628 stmfd sp!, @{fp, ip, lr, pc@} 7629 sub fp, ip, #4 7630@end smallexample 7631 7632When performing a stack backtrace, code can inspect the value of 7633@code{pc} stored at @code{fp + 0}. If the trace function then looks at 7634location @code{pc - 12} and the top 8 bits are set, then we know that 7635there is a function name embedded immediately preceding this location 7636and has length @code{((pc[-3]) & 0xff000000)}. 7637 7638@item -mthumb 7639@opindex mthumb 7640Generate code for the 16-bit Thumb instruction set. The default is to 7641use the 32-bit ARM instruction set. 7642 7643@item -mtpcs-frame 7644@opindex mtpcs-frame 7645Generate a stack frame that is compliant with the Thumb Procedure Call 7646Standard for all non-leaf functions. (A leaf function is one that does 7647not call any other functions.) The default is @option{-mno-tpcs-frame}. 7648 7649@item -mtpcs-leaf-frame 7650@opindex mtpcs-leaf-frame 7651Generate a stack frame that is compliant with the Thumb Procedure Call 7652Standard for all leaf functions. (A leaf function is one that does 7653not call any other functions.) The default is @option{-mno-apcs-leaf-frame}. 7654 7655@item -mcallee-super-interworking 7656@opindex mcallee-super-interworking 7657Gives all externally visible functions in the file being compiled an ARM 7658instruction set header which switches to Thumb mode before executing the 7659rest of the function. This allows these functions to be called from 7660non-interworking code. 7661 7662@item -mcaller-super-interworking 7663@opindex mcaller-super-interworking 7664Allows calls via function pointers (including virtual functions) to 7665execute correctly regardless of whether the target code has been 7666compiled for interworking or not. There is a small overhead in the cost 7667of executing a function pointer if this option is enabled. 7668 7669@item -mtp=@var{name} 7670@opindex mtp 7671Specify the access model for the thread local storage pointer. The valid 7672models are @option{soft}, which generates calls to @code{__aeabi_read_tp}, 7673@option{cp15}, which fetches the thread pointer from @code{cp15} directly 7674(supported in the arm6k architecture), and @option{auto}, which uses the 7675best available method for the selected processor. The default setting is 7676@option{auto}. 7677 7678@end table 7679 7680@node AVR Options 7681@subsection AVR Options 7682@cindex AVR Options 7683 7684These options are defined for AVR implementations: 7685 7686@table @gcctabopt 7687@item -mmcu=@var{mcu} 7688@opindex mmcu 7689Specify ATMEL AVR instruction set or MCU type. 7690 7691Instruction set avr1 is for the minimal AVR core, not supported by the C 7692compiler, only for assembler programs (MCU types: at90s1200, attiny10, 7693attiny11, attiny12, attiny15, attiny28). 7694 7695Instruction set avr2 (default) is for the classic AVR core with up to 76968K program memory space (MCU types: at90s2313, at90s2323, attiny22, 7697at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515, 7698at90c8534, at90s8535). 7699 7700Instruction set avr3 is for the classic AVR core with up to 128K program 7701memory space (MCU types: atmega103, atmega603, at43usb320, at76c711). 7702 7703Instruction set avr4 is for the enhanced AVR core with up to 8K program 7704memory space (MCU types: atmega8, atmega83, atmega85). 7705 7706Instruction set avr5 is for the enhanced AVR core with up to 128K program 7707memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323, 7708atmega64, atmega128, at43usb355, at94k). 7709 7710@item -msize 7711@opindex msize 7712Output instruction sizes to the asm file. 7713 7714@item -minit-stack=@var{N} 7715@opindex minit-stack 7716Specify the initial stack address, which may be a symbol or numeric value, 7717@samp{__stack} is the default. 7718 7719@item -mno-interrupts 7720@opindex mno-interrupts 7721Generated code is not compatible with hardware interrupts. 7722Code size will be smaller. 7723 7724@item -mcall-prologues 7725@opindex mcall-prologues 7726Functions prologues/epilogues expanded as call to appropriate 7727subroutines. Code size will be smaller. 7728 7729@item -mno-tablejump 7730@opindex mno-tablejump 7731Do not generate tablejump insns which sometimes increase code size. 7732 7733@item -mtiny-stack 7734@opindex mtiny-stack 7735Change only the low 8 bits of the stack pointer. 7736 7737@item -mint8 7738@opindex mint8 7739Assume int to be 8 bit integer. This affects the sizes of all types: A 7740char will be 1 byte, an int will be 1 byte, an long will be 2 bytes 7741and long long will be 4 bytes. Please note that this option does not 7742comply to the C standards, but it will provide you with smaller code 7743size. 7744@end table 7745 7746@node Blackfin Options 7747@subsection Blackfin Options 7748@cindex Blackfin Options 7749 7750@table @gcctabopt 7751@item -momit-leaf-frame-pointer 7752@opindex momit-leaf-frame-pointer 7753Don't keep the frame pointer in a register for leaf functions. This 7754avoids the instructions to save, set up and restore frame pointers and 7755makes an extra register available in leaf functions. The option 7756@option{-fomit-frame-pointer} removes the frame pointer for all functions 7757which might make debugging harder. 7758 7759@item -mspecld-anomaly 7760@opindex mspecld-anomaly 7761When enabled, the compiler will ensure that the generated code does not 7762contain speculative loads after jump instructions. This option is enabled 7763by default. 7764 7765@item -mno-specld-anomaly 7766@opindex mno-specld-anomaly 7767Don't generate extra code to prevent speculative loads from occurring. 7768 7769@item -mcsync-anomaly 7770@opindex mcsync-anomaly 7771When enabled, the compiler will ensure that the generated code does not 7772contain CSYNC or SSYNC instructions too soon after conditional branches. 7773This option is enabled by default. 7774 7775@item -mno-csync-anomaly 7776@opindex mno-csync-anomaly 7777Don't generate extra code to prevent CSYNC or SSYNC instructions from 7778occurring too soon after a conditional branch. 7779 7780@item -mlow-64k 7781@opindex mlow-64k 7782When enabled, the compiler is free to take advantage of the knowledge that 7783the entire program fits into the low 64k of memory. 7784 7785@item -mno-low-64k 7786@opindex mno-low-64k 7787Assume that the program is arbitrarily large. This is the default. 7788 7789@item -mid-shared-library 7790@opindex mid-shared-library 7791Generate code that supports shared libraries via the library ID method. 7792This allows for execute in place and shared libraries in an environment 7793without virtual memory management. This option implies @option{-fPIC}. 7794 7795@item -mno-id-shared-library 7796@opindex mno-id-shared-library 7797Generate code that doesn't assume ID based shared libraries are being used. 7798This is the default. 7799 7800@item -mshared-library-id=n 7801@opindex mshared-library-id 7802Specified the identification number of the ID based shared library being 7803compiled. Specifying a value of 0 will generate more compact code, specifying 7804other values will force the allocation of that number to the current 7805library but is no more space or time efficient than omitting this option. 7806 7807@item -mlong-calls 7808@itemx -mno-long-calls 7809@opindex mlong-calls 7810@opindex mno-long-calls 7811Tells the compiler to perform function calls by first loading the 7812address of the function into a register and then performing a subroutine 7813call on this register. This switch is needed if the target function 7814will lie outside of the 24 bit addressing range of the offset based 7815version of subroutine call instruction. 7816 7817This feature is not enabled by default. Specifying 7818@option{-mno-long-calls} will restore the default behavior. Note these 7819switches have no effect on how the compiler generates code to handle 7820function calls via function pointers. 7821@end table 7822 7823@node CRIS Options 7824@subsection CRIS Options 7825@cindex CRIS Options 7826 7827These options are defined specifically for the CRIS ports. 7828 7829@table @gcctabopt 7830@item -march=@var{architecture-type} 7831@itemx -mcpu=@var{architecture-type} 7832@opindex march 7833@opindex mcpu 7834Generate code for the specified architecture. The choices for 7835@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for 7836respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@. 7837Default is @samp{v0} except for cris-axis-linux-gnu, where the default is 7838@samp{v10}. 7839 7840@item -mtune=@var{architecture-type} 7841@opindex mtune 7842Tune to @var{architecture-type} everything applicable about the generated 7843code, except for the ABI and the set of available instructions. The 7844choices for @var{architecture-type} are the same as for 7845@option{-march=@var{architecture-type}}. 7846 7847@item -mmax-stack-frame=@var{n} 7848@opindex mmax-stack-frame 7849Warn when the stack frame of a function exceeds @var{n} bytes. 7850 7851@item -melinux-stacksize=@var{n} 7852@opindex melinux-stacksize 7853Only available with the @samp{cris-axis-aout} target. Arranges for 7854indications in the program to the kernel loader that the stack of the 7855program should be set to @var{n} bytes. 7856 7857@item -metrax4 7858@itemx -metrax100 7859@opindex metrax4 7860@opindex metrax100 7861The options @option{-metrax4} and @option{-metrax100} are synonyms for 7862@option{-march=v3} and @option{-march=v8} respectively. 7863 7864@item -mmul-bug-workaround 7865@itemx -mno-mul-bug-workaround 7866@opindex mmul-bug-workaround 7867@opindex mno-mul-bug-workaround 7868Work around a bug in the @code{muls} and @code{mulu} instructions for CPU 7869models where it applies. This option is active by default. 7870 7871@item -mpdebug 7872@opindex mpdebug 7873Enable CRIS-specific verbose debug-related information in the assembly 7874code. This option also has the effect to turn off the @samp{#NO_APP} 7875formatted-code indicator to the assembler at the beginning of the 7876assembly file. 7877 7878@item -mcc-init 7879@opindex mcc-init 7880Do not use condition-code results from previous instruction; always emit 7881compare and test instructions before use of condition codes. 7882 7883@item -mno-side-effects 7884@opindex mno-side-effects 7885Do not emit instructions with side-effects in addressing modes other than 7886post-increment. 7887 7888@item -mstack-align 7889@itemx -mno-stack-align 7890@itemx -mdata-align 7891@itemx -mno-data-align 7892@itemx -mconst-align 7893@itemx -mno-const-align 7894@opindex mstack-align 7895@opindex mno-stack-align 7896@opindex mdata-align 7897@opindex mno-data-align 7898@opindex mconst-align 7899@opindex mno-const-align 7900These options (no-options) arranges (eliminate arrangements) for the 7901stack-frame, individual data and constants to be aligned for the maximum 7902single data access size for the chosen CPU model. The default is to 7903arrange for 32-bit alignment. ABI details such as structure layout are 7904not affected by these options. 7905 7906@item -m32-bit 7907@itemx -m16-bit 7908@itemx -m8-bit 7909@opindex m32-bit 7910@opindex m16-bit 7911@opindex m8-bit 7912Similar to the stack- data- and const-align options above, these options 7913arrange for stack-frame, writable data and constants to all be 32-bit, 791416-bit or 8-bit aligned. The default is 32-bit alignment. 7915 7916@item -mno-prologue-epilogue 7917@itemx -mprologue-epilogue 7918@opindex mno-prologue-epilogue 7919@opindex mprologue-epilogue 7920With @option{-mno-prologue-epilogue}, the normal function prologue and 7921epilogue that sets up the stack-frame are omitted and no return 7922instructions or return sequences are generated in the code. Use this 7923option only together with visual inspection of the compiled code: no 7924warnings or errors are generated when call-saved registers must be saved, 7925or storage for local variable needs to be allocated. 7926 7927@item -mno-gotplt 7928@itemx -mgotplt 7929@opindex mno-gotplt 7930@opindex mgotplt 7931With @option{-fpic} and @option{-fPIC}, don't generate (do generate) 7932instruction sequences that load addresses for functions from the PLT part 7933of the GOT rather than (traditional on other architectures) calls to the 7934PLT@. The default is @option{-mgotplt}. 7935 7936@item -maout 7937@opindex maout 7938Legacy no-op option only recognized with the cris-axis-aout target. 7939 7940@item -melf 7941@opindex melf 7942Legacy no-op option only recognized with the cris-axis-elf and 7943cris-axis-linux-gnu targets. 7944 7945@item -melinux 7946@opindex melinux 7947Only recognized with the cris-axis-aout target, where it selects a 7948GNU/linux-like multilib, include files and instruction set for 7949@option{-march=v8}. 7950 7951@item -mlinux 7952@opindex mlinux 7953Legacy no-op option only recognized with the cris-axis-linux-gnu target. 7954 7955@item -sim 7956@opindex sim 7957This option, recognized for the cris-axis-aout and cris-axis-elf arranges 7958to link with input-output functions from a simulator library. Code, 7959initialized data and zero-initialized data are allocated consecutively. 7960 7961@item -sim2 7962@opindex sim2 7963Like @option{-sim}, but pass linker options to locate initialized data at 79640x40000000 and zero-initialized data at 0x80000000. 7965@end table 7966 7967@node CRX Options 7968@subsection CRX Options 7969@cindex CRX Options 7970 7971These options are defined specifically for the CRX ports. 7972 7973@table @gcctabopt 7974 7975@item -mmac 7976@opindex mmac 7977Enable the use of multiply-accumulate instructions. Disabled by default. 7978 7979@item -mpush-args 7980@opindex mpush-args 7981Push instructions will be used to pass outgoing arguments when functions 7982are called. Enabled by default. 7983@end table 7984 7985@node Darwin Options 7986@subsection Darwin Options 7987@cindex Darwin options 7988 7989These options are defined for all architectures running the Darwin operating 7990system. 7991 7992FSF GCC on Darwin does not create ``fat'' object files; it will create 7993an object file for the single architecture that it was built to 7994target. Apple's GCC on Darwin does create ``fat'' files if multiple 7995@option{-arch} options are used; it does so by running the compiler or 7996linker multiple times and joining the results together with 7997@file{lipo}. 7998 7999The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or 8000@samp{i686}) is determined by the flags that specify the ISA 8001that GCC is targetting, like @option{-mcpu} or @option{-march}. The 8002@option{-force_cpusubtype_ALL} option can be used to override this. 8003 8004The Darwin tools vary in their behavior when presented with an ISA 8005mismatch. The assembler, @file{as}, will only permit instructions to 8006be used that are valid for the subtype of the file it is generating, 8007so you cannot put 64-bit instructions in an @samp{ppc750} object file. 8008The linker for shared libraries, @file{/usr/bin/libtool}, will fail 8009and print an error if asked to create a shared library with a less 8010restrictive subtype than its input files (for instance, trying to put 8011a @samp{ppc970} object file in a @samp{ppc7400} library). The linker 8012for executables, @file{ld}, will quietly give the executable the most 8013restrictive subtype of any of its input files. 8014 8015@table @gcctabopt 8016@item -F@var{dir} 8017@opindex F 8018Add the framework directory @var{dir} to the head of the list of 8019directories to be searched for header files. These directories are 8020interleaved with those specified by @option{-I} options and are 8021scanned in a left-to-right order. 8022 8023A framework directory is a directory with frameworks in it. A 8024framework is a directory with a @samp{"Headers"} and/or 8025@samp{"PrivateHeaders"} directory contained directly in it that ends 8026in @samp{".framework"}. The name of a framework is the name of this 8027directory excluding the @samp{".framework"}. Headers associated with 8028the framework are found in one of those two directories, with 8029@samp{"Headers"} being searched first. A subframework is a framework 8030directory that is in a framework's @samp{"Frameworks"} directory. 8031Includes of subframework headers can only appear in a header of a 8032framework that contains the subframework, or in a sibling subframework 8033header. Two subframeworks are siblings if they occur in the same 8034framework. A subframework should not have the same name as a 8035framework, a warning will be issued if this is violated. Currently a 8036subframework cannot have subframeworks, in the future, the mechanism 8037may be extended to support this. The standard frameworks can be found 8038in @samp{"/System/Library/Frameworks"} and 8039@samp{"/Library/Frameworks"}. An example include looks like 8040@code{#include <Framework/header.h>}, where @samp{Framework} denotes 8041the name of the framework and header.h is found in the 8042@samp{"PrivateHeaders"} or @samp{"Headers"} directory. 8043 8044@item -gused 8045@opindex gused 8046Emit debugging information for symbols that are used. For STABS 8047debugging format, this enables @option{-feliminate-unused-debug-symbols}. 8048This is by default ON@. 8049 8050@item -gfull 8051@opindex gfull 8052Emit debugging information for all symbols and types. 8053 8054@item -mmacosx-version-min=@var{version} 8055The earliest version of MacOS X that this executable will run on 8056is @var{version}. Typical values of @var{version} include @code{10.1}, 8057@code{10.2}, and @code{10.3.9}. 8058 8059The default for this option is to make choices that seem to be most 8060useful. 8061 8062@item -mkernel 8063@opindex mkernel 8064Enable kernel development mode. The @option{-mkernel} option sets 8065@option{-static}, @option{-fno-common}, @option{-fno-cxa-atexit}, 8066@option{-fno-exceptions}, @option{-fno-non-call-exceptions}, 8067@option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where 8068applicable. This mode also sets @option{-mno-altivec}, 8069@option{-msoft-float}, @option{-fno-builtin} and 8070@option{-mlong-branch} for PowerPC targets. 8071 8072@item -mone-byte-bool 8073@opindex mone-byte-bool 8074Override the defaults for @samp{bool} so that @samp{sizeof(bool)==1}. 8075By default @samp{sizeof(bool)} is @samp{4} when compiling for 8076Darwin/PowerPC and @samp{1} when compiling for Darwin/x86, so this 8077option has no effect on x86. 8078 8079@strong{Warning:} The @option{-mone-byte-bool} switch causes GCC 8080to generate code that is not binary compatible with code generated 8081without that switch. Using this switch may require recompiling all 8082other modules in a program, including system libraries. Use this 8083switch to conform to a non-default data model. 8084 8085@item -mfix-and-continue 8086@itemx -ffix-and-continue 8087@itemx -findirect-data 8088@opindex mfix-and-continue 8089@opindex ffix-and-continue 8090@opindex findirect-data 8091Generate code suitable for fast turn around development. Needed to 8092enable gdb to dynamically load @code{.o} files into already running 8093programs. @option{-findirect-data} and @option{-ffix-and-continue} 8094are provided for backwards compatibility. 8095 8096@item -all_load 8097@opindex all_load 8098Loads all members of static archive libraries. 8099See man ld(1) for more information. 8100 8101@item -arch_errors_fatal 8102@opindex arch_errors_fatal 8103Cause the errors having to do with files that have the wrong architecture 8104to be fatal. 8105 8106@item -bind_at_load 8107@opindex bind_at_load 8108Causes the output file to be marked such that the dynamic linker will 8109bind all undefined references when the file is loaded or launched. 8110 8111@item -bundle 8112@opindex bundle 8113Produce a Mach-o bundle format file. 8114See man ld(1) for more information. 8115 8116@item -bundle_loader @var{executable} 8117@opindex bundle_loader 8118This option specifies the @var{executable} that will be loading the build 8119output file being linked. See man ld(1) for more information. 8120 8121@item -dynamiclib 8122@opindex dynamiclib 8123When passed this option, GCC will produce a dynamic library instead of 8124an executable when linking, using the Darwin @file{libtool} command. 8125 8126@item -force_cpusubtype_ALL 8127@opindex force_cpusubtype_ALL 8128This causes GCC's output file to have the @var{ALL} subtype, instead of 8129one controlled by the @option{-mcpu} or @option{-march} option. 8130 8131@item -allowable_client @var{client_name} 8132@itemx -client_name 8133@itemx -compatibility_version 8134@itemx -current_version 8135@itemx -dead_strip 8136@itemx -dependency-file 8137@itemx -dylib_file 8138@itemx -dylinker_install_name 8139@itemx -dynamic 8140@itemx -exported_symbols_list 8141@itemx -filelist 8142@itemx -flat_namespace 8143@itemx -force_flat_namespace 8144@itemx -headerpad_max_install_names 8145@itemx -image_base 8146@itemx -init 8147@itemx -install_name 8148@itemx -keep_private_externs 8149@itemx -multi_module 8150@itemx -multiply_defined 8151@itemx -multiply_defined_unused 8152@itemx -noall_load 8153@itemx -no_dead_strip_inits_and_terms 8154@itemx -nofixprebinding 8155@itemx -nomultidefs 8156@itemx -noprebind 8157@itemx -noseglinkedit 8158@itemx -pagezero_size 8159@itemx -prebind 8160@itemx -prebind_all_twolevel_modules 8161@itemx -private_bundle 8162@itemx -read_only_relocs 8163@itemx -sectalign 8164@itemx -sectobjectsymbols 8165@itemx -whyload 8166@itemx -seg1addr 8167@itemx -sectcreate 8168@itemx -sectobjectsymbols 8169@itemx -sectorder 8170@itemx -segaddr 8171@itemx -segs_read_only_addr 8172@itemx -segs_read_write_addr 8173@itemx -seg_addr_table 8174@itemx -seg_addr_table_filename 8175@itemx -seglinkedit 8176@itemx -segprot 8177@itemx -segs_read_only_addr 8178@itemx -segs_read_write_addr 8179@itemx -single_module 8180@itemx -static 8181@itemx -sub_library 8182@itemx -sub_umbrella 8183@itemx -twolevel_namespace 8184@itemx -umbrella 8185@itemx -undefined 8186@itemx -unexported_symbols_list 8187@itemx -weak_reference_mismatches 8188@itemx -whatsloaded 8189 8190@opindex allowable_client 8191@opindex client_name 8192@opindex compatibility_version 8193@opindex current_version 8194@opindex dead_strip 8195@opindex dependency-file 8196@opindex dylib_file 8197@opindex dylinker_install_name 8198@opindex dynamic 8199@opindex exported_symbols_list 8200@opindex filelist 8201@opindex flat_namespace 8202@opindex force_flat_namespace 8203@opindex headerpad_max_install_names 8204@opindex image_base 8205@opindex init 8206@opindex install_name 8207@opindex keep_private_externs 8208@opindex multi_module 8209@opindex multiply_defined 8210@opindex multiply_defined_unused 8211@opindex noall_load 8212@opindex no_dead_strip_inits_and_terms 8213@opindex nofixprebinding 8214@opindex nomultidefs 8215@opindex noprebind 8216@opindex noseglinkedit 8217@opindex pagezero_size 8218@opindex prebind 8219@opindex prebind_all_twolevel_modules 8220@opindex private_bundle 8221@opindex read_only_relocs 8222@opindex sectalign 8223@opindex sectobjectsymbols 8224@opindex whyload 8225@opindex seg1addr 8226@opindex sectcreate 8227@opindex sectobjectsymbols 8228@opindex sectorder 8229@opindex segaddr 8230@opindex segs_read_only_addr 8231@opindex segs_read_write_addr 8232@opindex seg_addr_table 8233@opindex seg_addr_table_filename 8234@opindex seglinkedit 8235@opindex segprot 8236@opindex segs_read_only_addr 8237@opindex segs_read_write_addr 8238@opindex single_module 8239@opindex static 8240@opindex sub_library 8241@opindex sub_umbrella 8242@opindex twolevel_namespace 8243@opindex umbrella 8244@opindex undefined 8245@opindex unexported_symbols_list 8246@opindex weak_reference_mismatches 8247@opindex whatsloaded 8248 8249These options are passed to the Darwin linker. The Darwin linker man page 8250describes them in detail. 8251@end table 8252 8253@node DEC Alpha Options 8254@subsection DEC Alpha Options 8255 8256These @samp{-m} options are defined for the DEC Alpha implementations: 8257 8258@table @gcctabopt 8259@item -mno-soft-float 8260@itemx -msoft-float 8261@opindex mno-soft-float 8262@opindex msoft-float 8263Use (do not use) the hardware floating-point instructions for 8264floating-point operations. When @option{-msoft-float} is specified, 8265functions in @file{libgcc.a} will be used to perform floating-point 8266operations. Unless they are replaced by routines that emulate the 8267floating-point operations, or compiled in such a way as to call such 8268emulations routines, these routines will issue floating-point 8269operations. If you are compiling for an Alpha without floating-point 8270operations, you must ensure that the library is built so as not to call 8271them. 8272 8273Note that Alpha implementations without floating-point operations are 8274required to have floating-point registers. 8275 8276@item -mfp-reg 8277@itemx -mno-fp-regs 8278@opindex mfp-reg 8279@opindex mno-fp-regs 8280Generate code that uses (does not use) the floating-point register set. 8281@option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point 8282register set is not used, floating point operands are passed in integer 8283registers as if they were integers and floating-point results are passed 8284in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence, 8285so any function with a floating-point argument or return value called by code 8286compiled with @option{-mno-fp-regs} must also be compiled with that 8287option. 8288 8289A typical use of this option is building a kernel that does not use, 8290and hence need not save and restore, any floating-point registers. 8291 8292@item -mieee 8293@opindex mieee 8294The Alpha architecture implements floating-point hardware optimized for 8295maximum performance. It is mostly compliant with the IEEE floating 8296point standard. However, for full compliance, software assistance is 8297required. This option generates code fully IEEE compliant code 8298@emph{except} that the @var{inexact-flag} is not maintained (see below). 8299If this option is turned on, the preprocessor macro @code{_IEEE_FP} is 8300defined during compilation. The resulting code is less efficient but is 8301able to correctly support denormalized numbers and exceptional IEEE 8302values such as not-a-number and plus/minus infinity. Other Alpha 8303compilers call this option @option{-ieee_with_no_inexact}. 8304 8305@item -mieee-with-inexact 8306@opindex mieee-with-inexact 8307This is like @option{-mieee} except the generated code also maintains 8308the IEEE @var{inexact-flag}. Turning on this option causes the 8309generated code to implement fully-compliant IEEE math. In addition to 8310@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor 8311macro. On some Alpha implementations the resulting code may execute 8312significantly slower than the code generated by default. Since there is 8313very little code that depends on the @var{inexact-flag}, you should 8314normally not specify this option. Other Alpha compilers call this 8315option @option{-ieee_with_inexact}. 8316 8317@item -mfp-trap-mode=@var{trap-mode} 8318@opindex mfp-trap-mode 8319This option controls what floating-point related traps are enabled. 8320Other Alpha compilers call this option @option{-fptm @var{trap-mode}}. 8321The trap mode can be set to one of four values: 8322 8323@table @samp 8324@item n 8325This is the default (normal) setting. The only traps that are enabled 8326are the ones that cannot be disabled in software (e.g., division by zero 8327trap). 8328 8329@item u 8330In addition to the traps enabled by @samp{n}, underflow traps are enabled 8331as well. 8332 8333@item su 8334Like @samp{u}, but the instructions are marked to be safe for software 8335completion (see Alpha architecture manual for details). 8336 8337@item sui 8338Like @samp{su}, but inexact traps are enabled as well. 8339@end table 8340 8341@item -mfp-rounding-mode=@var{rounding-mode} 8342@opindex mfp-rounding-mode 8343Selects the IEEE rounding mode. Other Alpha compilers call this option 8344@option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one 8345of: 8346 8347@table @samp 8348@item n 8349Normal IEEE rounding mode. Floating point numbers are rounded towards 8350the nearest machine number or towards the even machine number in case 8351of a tie. 8352 8353@item m 8354Round towards minus infinity. 8355 8356@item c 8357Chopped rounding mode. Floating point numbers are rounded towards zero. 8358 8359@item d 8360Dynamic rounding mode. A field in the floating point control register 8361(@var{fpcr}, see Alpha architecture reference manual) controls the 8362rounding mode in effect. The C library initializes this register for 8363rounding towards plus infinity. Thus, unless your program modifies the 8364@var{fpcr}, @samp{d} corresponds to round towards plus infinity. 8365@end table 8366 8367@item -mtrap-precision=@var{trap-precision} 8368@opindex mtrap-precision 8369In the Alpha architecture, floating point traps are imprecise. This 8370means without software assistance it is impossible to recover from a 8371floating trap and program execution normally needs to be terminated. 8372GCC can generate code that can assist operating system trap handlers 8373in determining the exact location that caused a floating point trap. 8374Depending on the requirements of an application, different levels of 8375precisions can be selected: 8376 8377@table @samp 8378@item p 8379Program precision. This option is the default and means a trap handler 8380can only identify which program caused a floating point exception. 8381 8382@item f 8383Function precision. The trap handler can determine the function that 8384caused a floating point exception. 8385 8386@item i 8387Instruction precision. The trap handler can determine the exact 8388instruction that caused a floating point exception. 8389@end table 8390 8391Other Alpha compilers provide the equivalent options called 8392@option{-scope_safe} and @option{-resumption_safe}. 8393 8394@item -mieee-conformant 8395@opindex mieee-conformant 8396This option marks the generated code as IEEE conformant. You must not 8397use this option unless you also specify @option{-mtrap-precision=i} and either 8398@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect 8399is to emit the line @samp{.eflag 48} in the function prologue of the 8400generated assembly file. Under DEC Unix, this has the effect that 8401IEEE-conformant math library routines will be linked in. 8402 8403@item -mbuild-constants 8404@opindex mbuild-constants 8405Normally GCC examines a 32- or 64-bit integer constant to 8406see if it can construct it from smaller constants in two or three 8407instructions. If it cannot, it will output the constant as a literal and 8408generate code to load it from the data segment at runtime. 8409 8410Use this option to require GCC to construct @emph{all} integer constants 8411using code, even if it takes more instructions (the maximum is six). 8412 8413You would typically use this option to build a shared library dynamic 8414loader. Itself a shared library, it must relocate itself in memory 8415before it can find the variables and constants in its own data segment. 8416 8417@item -malpha-as 8418@itemx -mgas 8419@opindex malpha-as 8420@opindex mgas 8421Select whether to generate code to be assembled by the vendor-supplied 8422assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}. 8423 8424@item -mbwx 8425@itemx -mno-bwx 8426@itemx -mcix 8427@itemx -mno-cix 8428@itemx -mfix 8429@itemx -mno-fix 8430@itemx -mmax 8431@itemx -mno-max 8432@opindex mbwx 8433@opindex mno-bwx 8434@opindex mcix 8435@opindex mno-cix 8436@opindex mfix 8437@opindex mno-fix 8438@opindex mmax 8439@opindex mno-max 8440Indicate whether GCC should generate code to use the optional BWX, 8441CIX, FIX and MAX instruction sets. The default is to use the instruction 8442sets supported by the CPU type specified via @option{-mcpu=} option or that 8443of the CPU on which GCC was built if none was specified. 8444 8445@item -mfloat-vax 8446@itemx -mfloat-ieee 8447@opindex mfloat-vax 8448@opindex mfloat-ieee 8449Generate code that uses (does not use) VAX F and G floating point 8450arithmetic instead of IEEE single and double precision. 8451 8452@item -mexplicit-relocs 8453@itemx -mno-explicit-relocs 8454@opindex mexplicit-relocs 8455@opindex mno-explicit-relocs 8456Older Alpha assemblers provided no way to generate symbol relocations 8457except via assembler macros. Use of these macros does not allow 8458optimal instruction scheduling. GNU binutils as of version 2.12 8459supports a new syntax that allows the compiler to explicitly mark 8460which relocations should apply to which instructions. This option 8461is mostly useful for debugging, as GCC detects the capabilities of 8462the assembler when it is built and sets the default accordingly. 8463 8464@item -msmall-data 8465@itemx -mlarge-data 8466@opindex msmall-data 8467@opindex mlarge-data 8468When @option{-mexplicit-relocs} is in effect, static data is 8469accessed via @dfn{gp-relative} relocations. When @option{-msmall-data} 8470is used, objects 8 bytes long or smaller are placed in a @dfn{small data area} 8471(the @code{.sdata} and @code{.sbss} sections) and are accessed via 847216-bit relocations off of the @code{$gp} register. This limits the 8473size of the small data area to 64KB, but allows the variables to be 8474directly accessed via a single instruction. 8475 8476The default is @option{-mlarge-data}. With this option the data area 8477is limited to just below 2GB@. Programs that require more than 2GB of 8478data must use @code{malloc} or @code{mmap} to allocate the data in the 8479heap instead of in the program's data segment. 8480 8481When generating code for shared libraries, @option{-fpic} implies 8482@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}. 8483 8484@item -msmall-text 8485@itemx -mlarge-text 8486@opindex msmall-text 8487@opindex mlarge-text 8488When @option{-msmall-text} is used, the compiler assumes that the 8489code of the entire program (or shared library) fits in 4MB, and is 8490thus reachable with a branch instruction. When @option{-msmall-data} 8491is used, the compiler can assume that all local symbols share the 8492same @code{$gp} value, and thus reduce the number of instructions 8493required for a function call from 4 to 1. 8494 8495The default is @option{-mlarge-text}. 8496 8497@item -mcpu=@var{cpu_type} 8498@opindex mcpu 8499Set the instruction set and instruction scheduling parameters for 8500machine type @var{cpu_type}. You can specify either the @samp{EV} 8501style name or the corresponding chip number. GCC supports scheduling 8502parameters for the EV4, EV5 and EV6 family of processors and will 8503choose the default values for the instruction set from the processor 8504you specify. If you do not specify a processor type, GCC will default 8505to the processor on which the compiler was built. 8506 8507Supported values for @var{cpu_type} are 8508 8509@table @samp 8510@item ev4 8511@itemx ev45 8512@itemx 21064 8513Schedules as an EV4 and has no instruction set extensions. 8514 8515@item ev5 8516@itemx 21164 8517Schedules as an EV5 and has no instruction set extensions. 8518 8519@item ev56 8520@itemx 21164a 8521Schedules as an EV5 and supports the BWX extension. 8522 8523@item pca56 8524@itemx 21164pc 8525@itemx 21164PC 8526Schedules as an EV5 and supports the BWX and MAX extensions. 8527 8528@item ev6 8529@itemx 21264 8530Schedules as an EV6 and supports the BWX, FIX, and MAX extensions. 8531 8532@item ev67 8533@itemx 21264a 8534Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions. 8535@end table 8536 8537@item -mtune=@var{cpu_type} 8538@opindex mtune 8539Set only the instruction scheduling parameters for machine type 8540@var{cpu_type}. The instruction set is not changed. 8541 8542@item -mmemory-latency=@var{time} 8543@opindex mmemory-latency 8544Sets the latency the scheduler should assume for typical memory 8545references as seen by the application. This number is highly 8546dependent on the memory access patterns used by the application 8547and the size of the external cache on the machine. 8548 8549Valid options for @var{time} are 8550 8551@table @samp 8552@item @var{number} 8553A decimal number representing clock cycles. 8554 8555@item L1 8556@itemx L2 8557@itemx L3 8558@itemx main 8559The compiler contains estimates of the number of clock cycles for 8560``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches 8561(also called Dcache, Scache, and Bcache), as well as to main memory. 8562Note that L3 is only valid for EV5. 8563 8564@end table 8565@end table 8566 8567@node DEC Alpha/VMS Options 8568@subsection DEC Alpha/VMS Options 8569 8570These @samp{-m} options are defined for the DEC Alpha/VMS implementations: 8571 8572@table @gcctabopt 8573@item -mvms-return-codes 8574@opindex mvms-return-codes 8575Return VMS condition codes from main. The default is to return POSIX 8576style condition (e.g.@ error) codes. 8577@end table 8578 8579@node FRV Options 8580@subsection FRV Options 8581@cindex FRV Options 8582 8583@table @gcctabopt 8584@item -mgpr-32 8585@opindex mgpr-32 8586 8587Only use the first 32 general purpose registers. 8588 8589@item -mgpr-64 8590@opindex mgpr-64 8591 8592Use all 64 general purpose registers. 8593 8594@item -mfpr-32 8595@opindex mfpr-32 8596 8597Use only the first 32 floating point registers. 8598 8599@item -mfpr-64 8600@opindex mfpr-64 8601 8602Use all 64 floating point registers 8603 8604@item -mhard-float 8605@opindex mhard-float 8606 8607Use hardware instructions for floating point operations. 8608 8609@item -msoft-float 8610@opindex msoft-float 8611 8612Use library routines for floating point operations. 8613 8614@item -malloc-cc 8615@opindex malloc-cc 8616 8617Dynamically allocate condition code registers. 8618 8619@item -mfixed-cc 8620@opindex mfixed-cc 8621 8622Do not try to dynamically allocate condition code registers, only 8623use @code{icc0} and @code{fcc0}. 8624 8625@item -mdword 8626@opindex mdword 8627 8628Change ABI to use double word insns. 8629 8630@item -mno-dword 8631@opindex mno-dword 8632 8633Do not use double word instructions. 8634 8635@item -mdouble 8636@opindex mdouble 8637 8638Use floating point double instructions. 8639 8640@item -mno-double 8641@opindex mno-double 8642 8643Do not use floating point double instructions. 8644 8645@item -mmedia 8646@opindex mmedia 8647 8648Use media instructions. 8649 8650@item -mno-media 8651@opindex mno-media 8652 8653Do not use media instructions. 8654 8655@item -mmuladd 8656@opindex mmuladd 8657 8658Use multiply and add/subtract instructions. 8659 8660@item -mno-muladd 8661@opindex mno-muladd 8662 8663Do not use multiply and add/subtract instructions. 8664 8665@item -mfdpic 8666@opindex mfdpic 8667 8668Select the FDPIC ABI, that uses function descriptors to represent 8669pointers to functions. Without any PIC/PIE-related options, it 8670implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it 8671assumes GOT entries and small data are within a 12-bit range from the 8672GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets 8673are computed with 32 bits. 8674 8675@item -minline-plt 8676@opindex minline-plt 8677 8678Enable inlining of PLT entries in function calls to functions that are 8679not known to bind locally. It has no effect without @option{-mfdpic}. 8680It's enabled by default if optimizing for speed and compiling for 8681shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an 8682optimization option such as @option{-O3} or above is present in the 8683command line. 8684 8685@item -mTLS 8686@opindex TLS 8687 8688Assume a large TLS segment when generating thread-local code. 8689 8690@item -mtls 8691@opindex tls 8692 8693Do not assume a large TLS segment when generating thread-local code. 8694 8695@item -mgprel-ro 8696@opindex mgprel-ro 8697 8698Enable the use of @code{GPREL} relocations in the FDPIC ABI for data 8699that is known to be in read-only sections. It's enabled by default, 8700except for @option{-fpic} or @option{-fpie}: even though it may help 8701make the global offset table smaller, it trades 1 instruction for 4. 8702With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4, 8703one of which may be shared by multiple symbols, and it avoids the need 8704for a GOT entry for the referenced symbol, so it's more likely to be a 8705win. If it is not, @option{-mno-gprel-ro} can be used to disable it. 8706 8707@item -multilib-library-pic 8708@opindex multilib-library-pic 8709 8710Link with the (library, not FD) pic libraries. It's implied by 8711@option{-mlibrary-pic}, as well as by @option{-fPIC} and 8712@option{-fpic} without @option{-mfdpic}. You should never have to use 8713it explicitly. 8714 8715@item -mlinked-fp 8716@opindex mlinked-fp 8717 8718Follow the EABI requirement of always creating a frame pointer whenever 8719a stack frame is allocated. This option is enabled by default and can 8720be disabled with @option{-mno-linked-fp}. 8721 8722@item -mlong-calls 8723@opindex mlong-calls 8724 8725Use indirect addressing to call functions outside the current 8726compilation unit. This allows the functions to be placed anywhere 8727within the 32-bit address space. 8728 8729@item -malign-labels 8730@opindex malign-labels 8731 8732Try to align labels to an 8-byte boundary by inserting nops into the 8733previous packet. This option only has an effect when VLIW packing 8734is enabled. It doesn't create new packets; it merely adds nops to 8735existing ones. 8736 8737@item -mlibrary-pic 8738@opindex mlibrary-pic 8739 8740Generate position-independent EABI code. 8741 8742@item -macc-4 8743@opindex macc-4 8744 8745Use only the first four media accumulator registers. 8746 8747@item -macc-8 8748@opindex macc-8 8749 8750Use all eight media accumulator registers. 8751 8752@item -mpack 8753@opindex mpack 8754 8755Pack VLIW instructions. 8756 8757@item -mno-pack 8758@opindex mno-pack 8759 8760Do not pack VLIW instructions. 8761 8762@item -mno-eflags 8763@opindex mno-eflags 8764 8765Do not mark ABI switches in e_flags. 8766 8767@item -mcond-move 8768@opindex mcond-move 8769 8770Enable the use of conditional-move instructions (default). 8771 8772This switch is mainly for debugging the compiler and will likely be removed 8773in a future version. 8774 8775@item -mno-cond-move 8776@opindex mno-cond-move 8777 8778Disable the use of conditional-move instructions. 8779 8780This switch is mainly for debugging the compiler and will likely be removed 8781in a future version. 8782 8783@item -mscc 8784@opindex mscc 8785 8786Enable the use of conditional set instructions (default). 8787 8788This switch is mainly for debugging the compiler and will likely be removed 8789in a future version. 8790 8791@item -mno-scc 8792@opindex mno-scc 8793 8794Disable the use of conditional set instructions. 8795 8796This switch is mainly for debugging the compiler and will likely be removed 8797in a future version. 8798 8799@item -mcond-exec 8800@opindex mcond-exec 8801 8802Enable the use of conditional execution (default). 8803 8804This switch is mainly for debugging the compiler and will likely be removed 8805in a future version. 8806 8807@item -mno-cond-exec 8808@opindex mno-cond-exec 8809 8810Disable the use of conditional execution. 8811 8812This switch is mainly for debugging the compiler and will likely be removed 8813in a future version. 8814 8815@item -mvliw-branch 8816@opindex mvliw-branch 8817 8818Run a pass to pack branches into VLIW instructions (default). 8819 8820This switch is mainly for debugging the compiler and will likely be removed 8821in a future version. 8822 8823@item -mno-vliw-branch 8824@opindex mno-vliw-branch 8825 8826Do not run a pass to pack branches into VLIW instructions. 8827 8828This switch is mainly for debugging the compiler and will likely be removed 8829in a future version. 8830 8831@item -mmulti-cond-exec 8832@opindex mmulti-cond-exec 8833 8834Enable optimization of @code{&&} and @code{||} in conditional execution 8835(default). 8836 8837This switch is mainly for debugging the compiler and will likely be removed 8838in a future version. 8839 8840@item -mno-multi-cond-exec 8841@opindex mno-multi-cond-exec 8842 8843Disable optimization of @code{&&} and @code{||} in conditional execution. 8844 8845This switch is mainly for debugging the compiler and will likely be removed 8846in a future version. 8847 8848@item -mnested-cond-exec 8849@opindex mnested-cond-exec 8850 8851Enable nested conditional execution optimizations (default). 8852 8853This switch is mainly for debugging the compiler and will likely be removed 8854in a future version. 8855 8856@item -mno-nested-cond-exec 8857@opindex mno-nested-cond-exec 8858 8859Disable nested conditional execution optimizations. 8860 8861This switch is mainly for debugging the compiler and will likely be removed 8862in a future version. 8863 8864@item -moptimize-membar 8865@opindex moptimize-membar 8866 8867This switch removes redundant @code{membar} instructions from the 8868compiler generated code. It is enabled by default. 8869 8870@item -mno-optimize-membar 8871@opindex mno-optimize-membar 8872 8873This switch disables the automatic removal of redundant @code{membar} 8874instructions from the generated code. 8875 8876@item -mtomcat-stats 8877@opindex mtomcat-stats 8878 8879Cause gas to print out tomcat statistics. 8880 8881@item -mcpu=@var{cpu} 8882@opindex mcpu 8883 8884Select the processor type for which to generate code. Possible values are 8885@samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450}, 8886@samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}. 8887 8888@end table 8889 8890@node GNU/Linux Options 8891@subsection GNU/Linux Options 8892 8893These @samp{-m} options are defined for GNU/Linux targets: 8894 8895@table @gcctabopt 8896@item -mglibc 8897@opindex mglibc 8898Use the GNU C library instead of uClibc. This is the default except 8899on @samp{*-*-linux-*uclibc*} targets. 8900 8901@item -muclibc 8902@opindex muclibc 8903Use uClibc instead of the GNU C library. This is the default on 8904@samp{*-*-linux-*uclibc*} targets. 8905@end table 8906 8907@node H8/300 Options 8908@subsection H8/300 Options 8909 8910These @samp{-m} options are defined for the H8/300 implementations: 8911 8912@table @gcctabopt 8913@item -mrelax 8914@opindex mrelax 8915Shorten some address references at link time, when possible; uses the 8916linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300, 8917ld, Using ld}, for a fuller description. 8918 8919@item -mh 8920@opindex mh 8921Generate code for the H8/300H@. 8922 8923@item -ms 8924@opindex ms 8925Generate code for the H8S@. 8926 8927@item -mn 8928@opindex mn 8929Generate code for the H8S and H8/300H in the normal mode. This switch 8930must be used either with @option{-mh} or @option{-ms}. 8931 8932@item -ms2600 8933@opindex ms2600 8934Generate code for the H8S/2600. This switch must be used with @option{-ms}. 8935 8936@item -mint32 8937@opindex mint32 8938Make @code{int} data 32 bits by default. 8939 8940@item -malign-300 8941@opindex malign-300 8942On the H8/300H and H8S, use the same alignment rules as for the H8/300. 8943The default for the H8/300H and H8S is to align longs and floats on 4 8944byte boundaries. 8945@option{-malign-300} causes them to be aligned on 2 byte boundaries. 8946This option has no effect on the H8/300. 8947@end table 8948 8949@node HPPA Options 8950@subsection HPPA Options 8951@cindex HPPA Options 8952 8953These @samp{-m} options are defined for the HPPA family of computers: 8954 8955@table @gcctabopt 8956@item -march=@var{architecture-type} 8957@opindex march 8958Generate code for the specified architecture. The choices for 8959@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA 89601.1, and @samp{2.0} for PA 2.0 processors. Refer to 8961@file{/usr/lib/sched.models} on an HP-UX system to determine the proper 8962architecture option for your machine. Code compiled for lower numbered 8963architectures will run on higher numbered architectures, but not the 8964other way around. 8965 8966@item -mpa-risc-1-0 8967@itemx -mpa-risc-1-1 8968@itemx -mpa-risc-2-0 8969@opindex mpa-risc-1-0 8970@opindex mpa-risc-1-1 8971@opindex mpa-risc-2-0 8972Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively. 8973 8974@item -mbig-switch 8975@opindex mbig-switch 8976Generate code suitable for big switch tables. Use this option only if 8977the assembler/linker complain about out of range branches within a switch 8978table. 8979 8980@item -mjump-in-delay 8981@opindex mjump-in-delay 8982Fill delay slots of function calls with unconditional jump instructions 8983by modifying the return pointer for the function call to be the target 8984of the conditional jump. 8985 8986@item -mdisable-fpregs 8987@opindex mdisable-fpregs 8988Prevent floating point registers from being used in any manner. This is 8989necessary for compiling kernels which perform lazy context switching of 8990floating point registers. If you use this option and attempt to perform 8991floating point operations, the compiler will abort. 8992 8993@item -mdisable-indexing 8994@opindex mdisable-indexing 8995Prevent the compiler from using indexing address modes. This avoids some 8996rather obscure problems when compiling MIG generated code under MACH@. 8997 8998@item -mno-space-regs 8999@opindex mno-space-regs 9000Generate code that assumes the target has no space registers. This allows 9001GCC to generate faster indirect calls and use unscaled index address modes. 9002 9003Such code is suitable for level 0 PA systems and kernels. 9004 9005@item -mfast-indirect-calls 9006@opindex mfast-indirect-calls 9007Generate code that assumes calls never cross space boundaries. This 9008allows GCC to emit code which performs faster indirect calls. 9009 9010This option will not work in the presence of shared libraries or nested 9011functions. 9012 9013@item -mfixed-range=@var{register-range} 9014@opindex mfixed-range 9015Generate code treating the given register range as fixed registers. 9016A fixed register is one that the register allocator can not use. This is 9017useful when compiling kernel code. A register range is specified as 9018two registers separated by a dash. Multiple register ranges can be 9019specified separated by a comma. 9020 9021@item -mlong-load-store 9022@opindex mlong-load-store 9023Generate 3-instruction load and store sequences as sometimes required by 9024the HP-UX 10 linker. This is equivalent to the @samp{+k} option to 9025the HP compilers. 9026 9027@item -mportable-runtime 9028@opindex mportable-runtime 9029Use the portable calling conventions proposed by HP for ELF systems. 9030 9031@item -mgas 9032@opindex mgas 9033Enable the use of assembler directives only GAS understands. 9034 9035@item -mschedule=@var{cpu-type} 9036@opindex mschedule 9037Schedule code according to the constraints for the machine type 9038@var{cpu-type}. The choices for @var{cpu-type} are @samp{700} 9039@samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer 9040to @file{/usr/lib/sched.models} on an HP-UX system to determine the 9041proper scheduling option for your machine. The default scheduling is 9042@samp{8000}. 9043 9044@item -mlinker-opt 9045@opindex mlinker-opt 9046Enable the optimization pass in the HP-UX linker. Note this makes symbolic 9047debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9 9048linkers in which they give bogus error messages when linking some programs. 9049 9050@item -msoft-float 9051@opindex msoft-float 9052Generate output containing library calls for floating point. 9053@strong{Warning:} the requisite libraries are not available for all HPPA 9054targets. Normally the facilities of the machine's usual C compiler are 9055used, but this cannot be done directly in cross-compilation. You must make 9056your own arrangements to provide suitable library functions for 9057cross-compilation. The embedded target @samp{hppa1.1-*-pro} 9058does provide software floating point support. 9059 9060@option{-msoft-float} changes the calling convention in the output file; 9061therefore, it is only useful if you compile @emph{all} of a program with 9062this option. In particular, you need to compile @file{libgcc.a}, the 9063library that comes with GCC, with @option{-msoft-float} in order for 9064this to work. 9065 9066@item -msio 9067@opindex msio 9068Generate the predefine, @code{_SIO}, for server IO@. The default is 9069@option{-mwsio}. This generates the predefines, @code{__hp9000s700}, 9070@code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These 9071options are available under HP-UX and HI-UX@. 9072 9073@item -mgnu-ld 9074@opindex gnu-ld 9075Use GNU ld specific options. This passes @option{-shared} to ld when 9076building a shared library. It is the default when GCC is configured, 9077explicitly or implicitly, with the GNU linker. This option does not 9078have any affect on which ld is called, it only changes what parameters 9079are passed to that ld. The ld that is called is determined by the 9080@option{--with-ld} configure option, GCC's program search path, and 9081finally by the user's @env{PATH}. The linker used by GCC can be printed 9082using @samp{which `gcc -print-prog-name=ld`}. This option is only available 9083on the 64 bit HP-UX GCC, i.e. configured with @samp{hppa*64*-*-hpux*}. 9084 9085@item -mhp-ld 9086@opindex hp-ld 9087Use HP ld specific options. This passes @option{-b} to ld when building 9088a shared library and passes @option{+Accept TypeMismatch} to ld on all 9089links. It is the default when GCC is configured, explicitly or 9090implicitly, with the HP linker. This option does not have any affect on 9091which ld is called, it only changes what parameters are passed to that 9092ld. The ld that is called is determined by the @option{--with-ld} 9093configure option, GCC's program search path, and finally by the user's 9094@env{PATH}. The linker used by GCC can be printed using @samp{which 9095`gcc -print-prog-name=ld`}. This option is only available on the 64 bit 9096HP-UX GCC, i.e. configured with @samp{hppa*64*-*-hpux*}. 9097 9098@item -mlong-calls 9099@opindex mno-long-calls 9100Generate code that uses long call sequences. This ensures that a call 9101is always able to reach linker generated stubs. The default is to generate 9102long calls only when the distance from the call site to the beginning 9103of the function or translation unit, as the case may be, exceeds a 9104predefined limit set by the branch type being used. The limits for 9105normal calls are 7,600,000 and 240,000 bytes, respectively for the 9106PA 2.0 and PA 1.X architectures. Sibcalls are always limited at 9107240,000 bytes. 9108 9109Distances are measured from the beginning of functions when using the 9110@option{-ffunction-sections} option, or when using the @option{-mgas} 9111and @option{-mno-portable-runtime} options together under HP-UX with 9112the SOM linker. 9113 9114It is normally not desirable to use this option as it will degrade 9115performance. However, it may be useful in large applications, 9116particularly when partial linking is used to build the application. 9117 9118The types of long calls used depends on the capabilities of the 9119assembler and linker, and the type of code being generated. The 9120impact on systems that support long absolute calls, and long pic 9121symbol-difference or pc-relative calls should be relatively small. 9122However, an indirect call is used on 32-bit ELF systems in pic code 9123and it is quite long. 9124 9125@item -munix=@var{unix-std} 9126@opindex march 9127Generate compiler predefines and select a startfile for the specified 9128UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95} 9129and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95} 9130is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX 913111.11 and later. The default values are @samp{93} for HP-UX 10.00, 9132@samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11 9133and later. 9134 9135@option{-munix=93} provides the same predefines as GCC 3.3 and 3.4. 9136@option{-munix=95} provides additional predefines for @code{XOPEN_UNIX} 9137and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}. 9138@option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX}, 9139@code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and 9140@code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}. 9141 9142It is @emph{important} to note that this option changes the interfaces 9143for various library routines. It also affects the operational behavior 9144of the C library. Thus, @emph{extreme} care is needed in using this 9145option. 9146 9147Library code that is intended to operate with more than one UNIX 9148standard must test, set and restore the variable @var{__xpg4_extended_mask} 9149as appropriate. Most GNU software doesn't provide this capability. 9150 9151@item -nolibdld 9152@opindex nolibdld 9153Suppress the generation of link options to search libdld.sl when the 9154@option{-static} option is specified on HP-UX 10 and later. 9155 9156@item -static 9157@opindex static 9158The HP-UX implementation of setlocale in libc has a dependency on 9159libdld.sl. There isn't an archive version of libdld.sl. Thus, 9160when the @option{-static} option is specified, special link options 9161are needed to resolve this dependency. 9162 9163On HP-UX 10 and later, the GCC driver adds the necessary options to 9164link with libdld.sl when the @option{-static} option is specified. 9165This causes the resulting binary to be dynamic. On the 64-bit port, 9166the linkers generate dynamic binaries by default in any case. The 9167@option{-nolibdld} option can be used to prevent the GCC driver from 9168adding these link options. 9169 9170@item -threads 9171@opindex threads 9172Add support for multithreading with the @dfn{dce thread} library 9173under HP-UX@. This option sets flags for both the preprocessor and 9174linker. 9175@end table 9176 9177@node i386 and x86-64 Options 9178@subsection Intel 386 and AMD x86-64 Options 9179@cindex i386 Options 9180@cindex x86-64 Options 9181@cindex Intel 386 Options 9182@cindex AMD x86-64 Options 9183 9184These @samp{-m} options are defined for the i386 and x86-64 family of 9185computers: 9186 9187@table @gcctabopt 9188@item -mtune=@var{cpu-type} 9189@opindex mtune 9190Tune to @var{cpu-type} everything applicable about the generated code, except 9191for the ABI and the set of available instructions. The choices for 9192@var{cpu-type} are: 9193@table @emph 9194@item generic 9195Produce code optimized for the most common IA32/AMD64/EM64T processors. 9196If you know the CPU on which your code will run, then you should use 9197the corresponding @option{-mtune} option instead of 9198@option{-mtune=generic}. But, if you do not know exactly what CPU users 9199of your application will have, then you should use this option. 9200 9201As new processors are deployed in the marketplace, the behavior of this 9202option will change. Therefore, if you upgrade to a newer version of 9203GCC, the code generated option will change to reflect the processors 9204that were most common when that version of GCC was released. 9205 9206There is no @option{-march=generic} option because @option{-march} 9207indicates the instruction set the compiler can use, and there is no 9208generic instruction set applicable to all processors. In contrast, 9209@option{-mtune} indicates the processor (or, in this case, collection of 9210processors) for which the code is optimized. 9211@item native 9212This selects the CPU to tune for at compilation time by determining 9213the processor type of the compiling machine. Using @option{-mtune=native} 9214will produce code optimized for the local machine under the constraints 9215of the selected instruction set. Using @option{-march=native} will 9216enable all instruction subsets supported by the local machine (hence 9217the result might not run on different machines). 9218@item i386 9219Original Intel's i386 CPU@. 9220@item i486 9221Intel's i486 CPU@. (No scheduling is implemented for this chip.) 9222@item i586, pentium 9223Intel Pentium CPU with no MMX support. 9224@item pentium-mmx 9225Intel PentiumMMX CPU based on Pentium core with MMX instruction set support. 9226@item pentiumpro 9227Intel PentiumPro CPU@. 9228@item i686 9229Same as @code{generic}, but when used as @code{march} option, PentiumPro 9230instruction set will be used, so the code will run on all i686 family chips. 9231@item pentium2 9232Intel Pentium2 CPU based on PentiumPro core with MMX instruction set support. 9233@item pentium3, pentium3m 9234Intel Pentium3 CPU based on PentiumPro core with MMX and SSE instruction set 9235support. 9236@item pentium-m 9237Low power version of Intel Pentium3 CPU with MMX, SSE and SSE2 instruction set 9238support. Used by Centrino notebooks. 9239@item pentium4, pentium4m 9240Intel Pentium4 CPU with MMX, SSE and SSE2 instruction set support. 9241@item prescott 9242Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction 9243set support. 9244@item nocona 9245Improved version of Intel Pentium4 CPU with 64-bit extensions, MMX, SSE, 9246SSE2 and SSE3 instruction set support. 9247@item core2 9248Intel Core2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3 9249instruction set support. 9250@item k6 9251AMD K6 CPU with MMX instruction set support. 9252@item k6-2, k6-3 9253Improved versions of AMD K6 CPU with MMX and 3dNOW! instruction set support. 9254@item athlon, athlon-tbird 9255AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and SSE prefetch instructions 9256support. 9257@item athlon-4, athlon-xp, athlon-mp 9258Improved AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and full SSE 9259instruction set support. 9260@item k8, opteron, athlon64, athlon-fx 9261AMD K8 core based CPUs with x86-64 instruction set support. (This supersets 9262MMX, SSE, SSE2, 3dNOW!, enhanced 3dNOW! and 64-bit instruction set extensions.) 9263@item k8-sse3, opteron-sse3, athlon64-sse3 9264Improved versions of k8, opteron and athlon64 with SSE3 instruction set support. 9265@item amdfam10, barcelona 9266AMD Family 10h core based CPUs with x86-64 instruction set support. (This 9267supersets MMX, SSE, SSE2, SSE3, SSE4A, 3dNOW!, enhanced 3dNOW!, ABM and 64-bit 9268instruction set extensions.) 9269@item winchip-c6 9270IDT Winchip C6 CPU, dealt in same way as i486 with additional MMX instruction 9271set support. 9272@item winchip2 9273IDT Winchip2 CPU, dealt in same way as i486 with additional MMX and 3dNOW! 9274instruction set support. 9275@item c3 9276Via C3 CPU with MMX and 3dNOW! instruction set support. (No scheduling is 9277implemented for this chip.) 9278@item c3-2 9279Via C3-2 CPU with MMX and SSE instruction set support. (No scheduling is 9280implemented for this chip.) 9281@item geode 9282Embedded AMD CPU with MMX and 3dNOW! instruction set support. 9283@end table 9284 9285While picking a specific @var{cpu-type} will schedule things appropriately 9286for that particular chip, the compiler will not generate any code that 9287does not run on the i386 without the @option{-march=@var{cpu-type}} option 9288being used. 9289 9290@item -march=@var{cpu-type} 9291@opindex march 9292Generate instructions for the machine type @var{cpu-type}. The choices 9293for @var{cpu-type} are the same as for @option{-mtune}. Moreover, 9294specifying @option{-march=@var{cpu-type}} implies @option{-mtune=@var{cpu-type}}. 9295 9296@item -mcpu=@var{cpu-type} 9297@opindex mcpu 9298A deprecated synonym for @option{-mtune}. 9299 9300@item -m386 9301@itemx -m486 9302@itemx -mpentium 9303@itemx -mpentiumpro 9304@opindex m386 9305@opindex m486 9306@opindex mpentium 9307@opindex mpentiumpro 9308These options are synonyms for @option{-mtune=i386}, @option{-mtune=i486}, 9309@option{-mtune=pentium}, and @option{-mtune=pentiumpro} respectively. 9310These synonyms are deprecated. 9311 9312@item -mfpmath=@var{unit} 9313@opindex march 9314Generate floating point arithmetics for selected unit @var{unit}. The choices 9315for @var{unit} are: 9316 9317@table @samp 9318@item 387 9319Use the standard 387 floating point coprocessor present majority of chips and 9320emulated otherwise. Code compiled with this option will run almost everywhere. 9321The temporary results are computed in 80bit precision instead of precision 9322specified by the type resulting in slightly different results compared to most 9323of other chips. See @option{-ffloat-store} for more detailed description. 9324 9325This is the default choice for i386 compiler. 9326 9327@item sse 9328Use scalar floating point instructions present in the SSE instruction set. 9329This instruction set is supported by Pentium3 and newer chips, in the AMD line 9330by Athlon-4, Athlon-xp and Athlon-mp chips. The earlier version of SSE 9331instruction set supports only single precision arithmetics, thus the double and 9332extended precision arithmetics is still done using 387. Later version, present 9333only in Pentium4 and the future AMD x86-64 chips supports double precision 9334arithmetics too. 9335 9336For the i386 compiler, you need to use @option{-march=@var{cpu-type}}, @option{-msse} 9337or @option{-msse2} switches to enable SSE extensions and make this option 9338effective. For the x86-64 compiler, these extensions are enabled by default. 9339 9340The resulting code should be considerably faster in the majority of cases and avoid 9341the numerical instability problems of 387 code, but may break some existing 9342code that expects temporaries to be 80bit. 9343 9344This is the default choice for the x86-64 compiler. 9345 9346@item sse,387 9347Attempt to utilize both instruction sets at once. This effectively double the 9348amount of available registers and on chips with separate execution units for 9349387 and SSE the execution resources too. Use this option with care, as it is 9350still experimental, because the GCC register allocator does not model separate 9351functional units well resulting in instable performance. 9352@end table 9353 9354@item -masm=@var{dialect} 9355@opindex masm=@var{dialect} 9356Output asm instructions using selected @var{dialect}. Supported 9357choices are @samp{intel} or @samp{att} (the default one). Darwin does 9358not support @samp{intel}. 9359 9360@item -mieee-fp 9361@itemx -mno-ieee-fp 9362@opindex mieee-fp 9363@opindex mno-ieee-fp 9364Control whether or not the compiler uses IEEE floating point 9365comparisons. These handle correctly the case where the result of a 9366comparison is unordered. 9367 9368@item -msoft-float 9369@opindex msoft-float 9370Generate output containing library calls for floating point. 9371@strong{Warning:} the requisite libraries are not part of GCC@. 9372Normally the facilities of the machine's usual C compiler are used, but 9373this can't be done directly in cross-compilation. You must make your 9374own arrangements to provide suitable library functions for 9375cross-compilation. 9376 9377On machines where a function returns floating point results in the 80387 9378register stack, some floating point opcodes may be emitted even if 9379@option{-msoft-float} is used. 9380 9381@item -mno-fp-ret-in-387 9382@opindex mno-fp-ret-in-387 9383Do not use the FPU registers for return values of functions. 9384 9385The usual calling convention has functions return values of types 9386@code{float} and @code{double} in an FPU register, even if there 9387is no FPU@. The idea is that the operating system should emulate 9388an FPU@. 9389 9390The option @option{-mno-fp-ret-in-387} causes such values to be returned 9391in ordinary CPU registers instead. 9392 9393@item -mno-fancy-math-387 9394@opindex mno-fancy-math-387 9395Some 387 emulators do not support the @code{sin}, @code{cos} and 9396@code{sqrt} instructions for the 387. Specify this option to avoid 9397generating those instructions. This option is the default on 9398OpenBSD and NetBSD@. This option is overridden when @option{-march} 9399indicates that the target cpu will always have an FPU and so the 9400instruction will not need emulation. As of revision 2.6.1, these 9401instructions are not generated unless you also use the 9402@option{-funsafe-math-optimizations} switch. 9403 9404@item -malign-double 9405@itemx -mno-align-double 9406@opindex malign-double 9407@opindex mno-align-double 9408Control whether GCC aligns @code{double}, @code{long double}, and 9409@code{long long} variables on a two word boundary or a one word 9410boundary. Aligning @code{double} variables on a two word boundary will 9411produce code that runs somewhat faster on a @samp{Pentium} at the 9412expense of more memory. 9413 9414On x86-64, @option{-malign-double} is enabled by default. 9415 9416@strong{Warning:} if you use the @option{-malign-double} switch, 9417structures containing the above types will be aligned differently than 9418the published application binary interface specifications for the 386 9419and will not be binary compatible with structures in code compiled 9420without that switch. 9421 9422@item -m96bit-long-double 9423@itemx -m128bit-long-double 9424@opindex m96bit-long-double 9425@opindex m128bit-long-double 9426These switches control the size of @code{long double} type. The i386 9427application binary interface specifies the size to be 96 bits, 9428so @option{-m96bit-long-double} is the default in 32 bit mode. 9429 9430Modern architectures (Pentium and newer) would prefer @code{long double} 9431to be aligned to an 8 or 16 byte boundary. In arrays or structures 9432conforming to the ABI, this would not be possible. So specifying a 9433@option{-m128bit-long-double} will align @code{long double} 9434to a 16 byte boundary by padding the @code{long double} with an additional 943532 bit zero. 9436 9437In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as 9438its ABI specifies that @code{long double} is to be aligned on 16 byte boundary. 9439 9440Notice that neither of these options enable any extra precision over the x87 9441standard of 80 bits for a @code{long double}. 9442 9443@strong{Warning:} if you override the default value for your target ABI, the 9444structures and arrays containing @code{long double} variables will change 9445their size as well as function calling convention for function taking 9446@code{long double} will be modified. Hence they will not be binary 9447compatible with arrays or structures in code compiled without that switch. 9448 9449@item -mmlarge-data-threshold=@var{number} 9450@opindex mlarge-data-threshold=@var{number} 9451When @option{-mcmodel=medium} is specified, the data greater than 9452@var{threshold} are placed in large data section. This value must be the 9453same across all object linked into the binary and defaults to 65535. 9454 9455@item -msvr3-shlib 9456@itemx -mno-svr3-shlib 9457@opindex msvr3-shlib 9458@opindex mno-svr3-shlib 9459Control whether GCC places uninitialized local variables into the 9460@code{bss} or @code{data} segments. @option{-msvr3-shlib} places them 9461into @code{bss}. These options are meaningful only on System V Release 3. 9462 9463@item -mrtd 9464@opindex mrtd 9465Use a different function-calling convention, in which functions that 9466take a fixed number of arguments return with the @code{ret} @var{num} 9467instruction, which pops their arguments while returning. This saves one 9468instruction in the caller since there is no need to pop the arguments 9469there. 9470 9471You can specify that an individual function is called with this calling 9472sequence with the function attribute @samp{stdcall}. You can also 9473override the @option{-mrtd} option by using the function attribute 9474@samp{cdecl}. @xref{Function Attributes}. 9475 9476@strong{Warning:} this calling convention is incompatible with the one 9477normally used on Unix, so you cannot use it if you need to call 9478libraries compiled with the Unix compiler. 9479 9480Also, you must provide function prototypes for all functions that 9481take variable numbers of arguments (including @code{printf}); 9482otherwise incorrect code will be generated for calls to those 9483functions. 9484 9485In addition, seriously incorrect code will result if you call a 9486function with too many arguments. (Normally, extra arguments are 9487harmlessly ignored.) 9488 9489@item -mregparm=@var{num} 9490@opindex mregparm 9491Control how many registers are used to pass integer arguments. By 9492default, no registers are used to pass arguments, and at most 3 9493registers can be used. You can control this behavior for a specific 9494function by using the function attribute @samp{regparm}. 9495@xref{Function Attributes}. 9496 9497@strong{Warning:} if you use this switch, and 9498@var{num} is nonzero, then you must build all modules with the same 9499value, including any libraries. This includes the system libraries and 9500startup modules. 9501 9502@item -msseregparm 9503@opindex msseregparm 9504Use SSE register passing conventions for float and double arguments 9505and return values. You can control this behavior for a specific 9506function by using the function attribute @samp{sseregparm}. 9507@xref{Function Attributes}. 9508 9509@strong{Warning:} if you use this switch then you must build all 9510modules with the same value, including any libraries. This includes 9511the system libraries and startup modules. 9512 9513@item -mstackrealign 9514@opindex mstackrealign 9515Realign the stack at entry. On the Intel x86, the 9516@option{-mstackrealign} option will generate an alternate prologue and 9517epilogue that realigns the runtime stack. This supports mixing legacy 9518codes that keep a 4-byte aligned stack with modern codes that keep a 951916-byte stack for SSE compatibility. The alternate prologue and 9520epilogue are slower and bigger than the regular ones, and the 9521alternate prologue requires an extra scratch register; this lowers the 9522number of registers available if used in conjunction with the 9523@code{regparm} attribute. The @option{-mstackrealign} option is 9524incompatible with the nested function prologue; this is considered a 9525hard error. See also the attribute @code{force_align_arg_pointer}, 9526applicable to individual functions. 9527 9528@item -mpreferred-stack-boundary=@var{num} 9529@opindex mpreferred-stack-boundary 9530Attempt to keep the stack boundary aligned to a 2 raised to @var{num} 9531byte boundary. If @option{-mpreferred-stack-boundary} is not specified, 9532the default is 4 (16 bytes or 128 bits). 9533 9534On Pentium and PentiumPro, @code{double} and @code{long double} values 9535should be aligned to an 8 byte boundary (see @option{-malign-double}) or 9536suffer significant run time performance penalties. On Pentium III, the 9537Streaming SIMD Extension (SSE) data type @code{__m128} may not work 9538properly if it is not 16 byte aligned. 9539 9540To ensure proper alignment of this values on the stack, the stack boundary 9541must be as aligned as that required by any value stored on the stack. 9542Further, every function must be generated such that it keeps the stack 9543aligned. Thus calling a function compiled with a higher preferred 9544stack boundary from a function compiled with a lower preferred stack 9545boundary will most likely misalign the stack. It is recommended that 9546libraries that use callbacks always use the default setting. 9547 9548This extra alignment does consume extra stack space, and generally 9549increases code size. Code that is sensitive to stack space usage, such 9550as embedded systems and operating system kernels, may want to reduce the 9551preferred alignment to @option{-mpreferred-stack-boundary=2}. 9552 9553@item -mmmx 9554@itemx -mno-mmx 9555@item -msse 9556@itemx -mno-sse 9557@item -msse2 9558@itemx -mno-sse2 9559@item -msse3 9560@itemx -mno-sse3 9561@item -mssse3 9562@itemx -mno-ssse3 9563@item -msse4a 9564@item -mno-sse4a 9565@item -m3dnow 9566@itemx -mno-3dnow 9567@item -mpopcnt 9568@itemx -mno-popcnt 9569@item -mabm 9570@itemx -mno-abm 9571@item -maes 9572@itemx -mno-aes 9573@opindex mmmx 9574@opindex mno-mmx 9575@opindex msse 9576@opindex mno-sse 9577@opindex m3dnow 9578@opindex mno-3dnow 9579These switches enable or disable the use of instructions in the MMX, 9580SSE, SSE2, SSE3, SSSE3, SSE4A, ABM, AES or 3DNow! extended 9581instruction sets. These extensions are also available as built-in 9582functions: see @ref{X86 Built-in Functions}, for details of the functions 9583enabled and disabled by these switches. 9584 9585To have SSE/SSE2 instructions generated automatically from floating-point 9586code (as opposed to 387 instructions), see @option{-mfpmath=sse}. 9587 9588These options will enable GCC to use these extended instructions in 9589generated code, even without @option{-mfpmath=sse}. Applications which 9590perform runtime CPU detection must compile separate files for each 9591supported architecture, using the appropriate flags. In particular, 9592the file containing the CPU detection code should be compiled without 9593these options. 9594 9595@item -mpush-args 9596@itemx -mno-push-args 9597@opindex mpush-args 9598@opindex mno-push-args 9599Use PUSH operations to store outgoing parameters. This method is shorter 9600and usually equally fast as method using SUB/MOV operations and is enabled 9601by default. In some cases disabling it may improve performance because of 9602improved scheduling and reduced dependencies. 9603 9604@item -maccumulate-outgoing-args 9605@opindex maccumulate-outgoing-args 9606If enabled, the maximum amount of space required for outgoing arguments will be 9607computed in the function prologue. This is faster on most modern CPUs 9608because of reduced dependencies, improved scheduling and reduced stack usage 9609when preferred stack boundary is not equal to 2. The drawback is a notable 9610increase in code size. This switch implies @option{-mno-push-args}. 9611 9612@item -mthreads 9613@opindex mthreads 9614Support thread-safe exception handling on @samp{Mingw32}. Code that relies 9615on thread-safe exception handling must compile and link all code with the 9616@option{-mthreads} option. When compiling, @option{-mthreads} defines 9617@option{-D_MT}; when linking, it links in a special thread helper library 9618@option{-lmingwthrd} which cleans up per thread exception handling data. 9619 9620@item -mno-align-stringops 9621@opindex mno-align-stringops 9622Do not align destination of inlined string operations. This switch reduces 9623code size and improves performance in case the destination is already aligned, 9624but GCC doesn't know about it. 9625 9626@item -minline-all-stringops 9627@opindex minline-all-stringops 9628By default GCC inlines string operations only when destination is known to be 9629aligned at least to 4 byte boundary. This enables more inlining, increase code 9630size, but may improve performance of code that depends on fast memcpy, strlen 9631and memset for short lengths. 9632 9633@item -momit-leaf-frame-pointer 9634@opindex momit-leaf-frame-pointer 9635Don't keep the frame pointer in a register for leaf functions. This 9636avoids the instructions to save, set up and restore frame pointers and 9637makes an extra register available in leaf functions. The option 9638@option{-fomit-frame-pointer} removes the frame pointer for all functions 9639which might make debugging harder. 9640 9641@item -mtls-direct-seg-refs 9642@itemx -mno-tls-direct-seg-refs 9643@opindex mtls-direct-seg-refs 9644Controls whether TLS variables may be accessed with offsets from the 9645TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit), 9646or whether the thread base pointer must be added. Whether or not this 9647is legal depends on the operating system, and whether it maps the 9648segment to cover the entire TLS area. 9649 9650For systems that use GNU libc, the default is on. 9651@end table 9652 9653These @samp{-m} switches are supported in addition to the above 9654on AMD x86-64 processors in 64-bit environments. 9655 9656@table @gcctabopt 9657@item -m32 9658@itemx -m64 9659@opindex m32 9660@opindex m64 9661Generate code for a 32-bit or 64-bit environment. 9662The 32-bit environment sets int, long and pointer to 32 bits and 9663generates code that runs on any i386 system. 9664The 64-bit environment sets int to 32 bits and long and pointer 9665to 64 bits and generates code for AMD's x86-64 architecture. For 9666darwin only the -m64 option turns off the @option{-fno-pic} and 9667@option{-mdynamic-no-pic} options. 9668 9669@item -mno-red-zone 9670@opindex no-red-zone 9671Do not use a so called red zone for x86-64 code. The red zone is mandated 9672by the x86-64 ABI, it is a 128-byte area beyond the location of the 9673stack pointer that will not be modified by signal or interrupt handlers 9674and therefore can be used for temporary data without adjusting the stack 9675pointer. The flag @option{-mno-red-zone} disables this red zone. 9676 9677@item -mcmodel=small 9678@opindex mcmodel=small 9679Generate code for the small code model: the program and its symbols must 9680be linked in the lower 2 GB of the address space. Pointers are 64 bits. 9681Programs can be statically or dynamically linked. This is the default 9682code model. 9683 9684@item -mcmodel=kernel 9685@opindex mcmodel=kernel 9686Generate code for the kernel code model. The kernel runs in the 9687negative 2 GB of the address space. 9688This model has to be used for Linux kernel code. 9689 9690@item -mcmodel=medium 9691@opindex mcmodel=medium 9692Generate code for the medium model: The program is linked in the lower 2 9693GB of the address space but symbols can be located anywhere in the 9694address space. Programs can be statically or dynamically linked, but 9695building of shared libraries are not supported with the medium model. 9696 9697@item -mcmodel=large 9698@opindex mcmodel=large 9699Generate code for the large model: This model makes no assumptions 9700about addresses and sizes of sections. Currently GCC does not implement 9701this model. 9702@end table 9703 9704@node IA-64 Options 9705@subsection IA-64 Options 9706@cindex IA-64 Options 9707 9708These are the @samp{-m} options defined for the Intel IA-64 architecture. 9709 9710@table @gcctabopt 9711@item -mbig-endian 9712@opindex mbig-endian 9713Generate code for a big endian target. This is the default for HP-UX@. 9714 9715@item -mlittle-endian 9716@opindex mlittle-endian 9717Generate code for a little endian target. This is the default for AIX5 9718and GNU/Linux. 9719 9720@item -mgnu-as 9721@itemx -mno-gnu-as 9722@opindex mgnu-as 9723@opindex mno-gnu-as 9724Generate (or don't) code for the GNU assembler. This is the default. 9725@c Also, this is the default if the configure option @option{--with-gnu-as} 9726@c is used. 9727 9728@item -mgnu-ld 9729@itemx -mno-gnu-ld 9730@opindex mgnu-ld 9731@opindex mno-gnu-ld 9732Generate (or don't) code for the GNU linker. This is the default. 9733@c Also, this is the default if the configure option @option{--with-gnu-ld} 9734@c is used. 9735 9736@item -mno-pic 9737@opindex mno-pic 9738Generate code that does not use a global pointer register. The result 9739is not position independent code, and violates the IA-64 ABI@. 9740 9741@item -mvolatile-asm-stop 9742@itemx -mno-volatile-asm-stop 9743@opindex mvolatile-asm-stop 9744@opindex mno-volatile-asm-stop 9745Generate (or don't) a stop bit immediately before and after volatile asm 9746statements. 9747 9748@item -mregister-names 9749@itemx -mno-register-names 9750@opindex mregister-names 9751@opindex mno-register-names 9752Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for 9753the stacked registers. This may make assembler output more readable. 9754 9755@item -mno-sdata 9756@itemx -msdata 9757@opindex mno-sdata 9758@opindex msdata 9759Disable (or enable) optimizations that use the small data section. This may 9760be useful for working around optimizer bugs. 9761 9762@item -mconstant-gp 9763@opindex mconstant-gp 9764Generate code that uses a single constant global pointer value. This is 9765useful when compiling kernel code. 9766 9767@item -mauto-pic 9768@opindex mauto-pic 9769Generate code that is self-relocatable. This implies @option{-mconstant-gp}. 9770This is useful when compiling firmware code. 9771 9772@item -minline-float-divide-min-latency 9773@opindex minline-float-divide-min-latency 9774Generate code for inline divides of floating point values 9775using the minimum latency algorithm. 9776 9777@item -minline-float-divide-max-throughput 9778@opindex minline-float-divide-max-throughput 9779Generate code for inline divides of floating point values 9780using the maximum throughput algorithm. 9781 9782@item -minline-int-divide-min-latency 9783@opindex minline-int-divide-min-latency 9784Generate code for inline divides of integer values 9785using the minimum latency algorithm. 9786 9787@item -minline-int-divide-max-throughput 9788@opindex minline-int-divide-max-throughput 9789Generate code for inline divides of integer values 9790using the maximum throughput algorithm. 9791 9792@item -minline-sqrt-min-latency 9793@opindex minline-sqrt-min-latency 9794Generate code for inline square roots 9795using the minimum latency algorithm. 9796 9797@item -minline-sqrt-max-throughput 9798@opindex minline-sqrt-max-throughput 9799Generate code for inline square roots 9800using the maximum throughput algorithm. 9801 9802@item -mno-dwarf2-asm 9803@itemx -mdwarf2-asm 9804@opindex mno-dwarf2-asm 9805@opindex mdwarf2-asm 9806Don't (or do) generate assembler code for the DWARF2 line number debugging 9807info. This may be useful when not using the GNU assembler. 9808 9809@item -mearly-stop-bits 9810@itemx -mno-early-stop-bits 9811@opindex mearly-stop-bits 9812@opindex mno-early-stop-bits 9813Allow stop bits to be placed earlier than immediately preceding the 9814instruction that triggered the stop bit. This can improve instruction 9815scheduling, but does not always do so. 9816 9817@item -mfixed-range=@var{register-range} 9818@opindex mfixed-range 9819Generate code treating the given register range as fixed registers. 9820A fixed register is one that the register allocator can not use. This is 9821useful when compiling kernel code. A register range is specified as 9822two registers separated by a dash. Multiple register ranges can be 9823specified separated by a comma. 9824 9825@item -mtls-size=@var{tls-size} 9826@opindex mtls-size 9827Specify bit size of immediate TLS offsets. Valid values are 14, 22, and 982864. 9829 9830@item -mtune=@var{cpu-type} 9831@opindex mtune 9832Tune the instruction scheduling for a particular CPU, Valid values are 9833itanium, itanium1, merced, itanium2, and mckinley. 9834 9835@item -mt 9836@itemx -pthread 9837@opindex mt 9838@opindex pthread 9839Add support for multithreading using the POSIX threads library. This 9840option sets flags for both the preprocessor and linker. It does 9841not affect the thread safety of object code produced by the compiler or 9842that of libraries supplied with it. These are HP-UX specific flags. 9843 9844@item -milp32 9845@itemx -mlp64 9846@opindex milp32 9847@opindex mlp64 9848Generate code for a 32-bit or 64-bit environment. 9849The 32-bit environment sets int, long and pointer to 32 bits. 9850The 64-bit environment sets int to 32 bits and long and pointer 9851to 64 bits. These are HP-UX specific flags. 9852 9853@item -mno-sched-br-data-spec 9854@itemx -msched-br-data-spec 9855@opindex mno-sched-br-data-spec 9856@opindex msched-br-data-spec 9857(Dis/En)able data speculative scheduling before reload. 9858This will result in generation of the ld.a instructions and 9859the corresponding check instructions (ld.c / chk.a). 9860The default is 'disable'. 9861 9862@item -msched-ar-data-spec 9863@itemx -mno-sched-ar-data-spec 9864@opindex msched-ar-data-spec 9865@opindex mno-sched-ar-data-spec 9866(En/Dis)able data speculative scheduling after reload. 9867This will result in generation of the ld.a instructions and 9868the corresponding check instructions (ld.c / chk.a). 9869The default is 'enable'. 9870 9871@item -mno-sched-control-spec 9872@itemx -msched-control-spec 9873@opindex mno-sched-control-spec 9874@opindex msched-control-spec 9875(Dis/En)able control speculative scheduling. This feature is 9876available only during region scheduling (i.e. before reload). 9877This will result in generation of the ld.s instructions and 9878the corresponding check instructions chk.s . 9879The default is 'disable'. 9880 9881@item -msched-br-in-data-spec 9882@itemx -mno-sched-br-in-data-spec 9883@opindex msched-br-in-data-spec 9884@opindex mno-sched-br-in-data-spec 9885(En/Dis)able speculative scheduling of the instructions that 9886are dependent on the data speculative loads before reload. 9887This is effective only with @option{-msched-br-data-spec} enabled. 9888The default is 'enable'. 9889 9890@item -msched-ar-in-data-spec 9891@itemx -mno-sched-ar-in-data-spec 9892@opindex msched-ar-in-data-spec 9893@opindex mno-sched-ar-in-data-spec 9894(En/Dis)able speculative scheduling of the instructions that 9895are dependent on the data speculative loads after reload. 9896This is effective only with @option{-msched-ar-data-spec} enabled. 9897The default is 'enable'. 9898 9899@item -msched-in-control-spec 9900@itemx -mno-sched-in-control-spec 9901@opindex msched-in-control-spec 9902@opindex mno-sched-in-control-spec 9903(En/Dis)able speculative scheduling of the instructions that 9904are dependent on the control speculative loads. 9905This is effective only with @option{-msched-control-spec} enabled. 9906The default is 'enable'. 9907 9908@item -msched-ldc 9909@itemx -mno-sched-ldc 9910@opindex msched-ldc 9911@opindex mno-sched-ldc 9912(En/Dis)able use of simple data speculation checks ld.c . 9913If disabled, only chk.a instructions will be emitted to check 9914data speculative loads. 9915The default is 'enable'. 9916 9917@item -mno-sched-control-ldc 9918@itemx -msched-control-ldc 9919@opindex mno-sched-control-ldc 9920@opindex msched-control-ldc 9921(Dis/En)able use of ld.c instructions to check control speculative loads. 9922If enabled, in case of control speculative load with no speculatively 9923scheduled dependent instructions this load will be emitted as ld.sa and 9924ld.c will be used to check it. 9925The default is 'disable'. 9926 9927@item -mno-sched-spec-verbose 9928@itemx -msched-spec-verbose 9929@opindex mno-sched-spec-verbose 9930@opindex msched-spec-verbose 9931(Dis/En)able printing of the information about speculative motions. 9932 9933@item -mno-sched-prefer-non-data-spec-insns 9934@itemx -msched-prefer-non-data-spec-insns 9935@opindex mno-sched-prefer-non-data-spec-insns 9936@opindex msched-prefer-non-data-spec-insns 9937If enabled, data speculative instructions will be chosen for schedule 9938only if there are no other choices at the moment. This will make 9939the use of the data speculation much more conservative. 9940The default is 'disable'. 9941 9942@item -mno-sched-prefer-non-control-spec-insns 9943@itemx -msched-prefer-non-control-spec-insns 9944@opindex mno-sched-prefer-non-control-spec-insns 9945@opindex msched-prefer-non-control-spec-insns 9946If enabled, control speculative instructions will be chosen for schedule 9947only if there are no other choices at the moment. This will make 9948the use of the control speculation much more conservative. 9949The default is 'disable'. 9950 9951@item -mno-sched-count-spec-in-critical-path 9952@itemx -msched-count-spec-in-critical-path 9953@opindex mno-sched-count-spec-in-critical-path 9954@opindex msched-count-spec-in-critical-path 9955If enabled, speculative dependencies will be considered during 9956computation of the instructions priorities. This will make the use of the 9957speculation a bit more conservative. 9958The default is 'disable'. 9959 9960@end table 9961 9962@node M32C Options 9963@subsection M32C Options 9964@cindex M32C options 9965 9966@table @gcctabopt 9967@item -mcpu=@var{name} 9968@opindex mcpu= 9969Select the CPU for which code is generated. @var{name} may be one of 9970@samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to 9971/60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for 9972the M32C/80 series. 9973 9974@item -msim 9975@opindex msim 9976Specifies that the program will be run on the simulator. This causes 9977an alternate runtime library to be linked in which supports, for 9978example, file I/O. You must not use this option when generating 9979programs that will run on real hardware; you must provide your own 9980runtime library for whatever I/O functions are needed. 9981 9982@item -memregs=@var{number} 9983@opindex memregs= 9984Specifies the number of memory-based pseudo-registers GCC will use 9985during code generation. These pseudo-registers will be used like real 9986registers, so there is a tradeoff between GCC's ability to fit the 9987code into available registers, and the performance penalty of using 9988memory instead of registers. Note that all modules in a program must 9989be compiled with the same value for this option. Because of that, you 9990must not use this option with the default runtime libraries gcc 9991builds. 9992 9993@end table 9994 9995@node M32R/D Options 9996@subsection M32R/D Options 9997@cindex M32R/D options 9998 9999These @option{-m} options are defined for Renesas M32R/D architectures: 10000 10001@table @gcctabopt 10002@item -m32r2 10003@opindex m32r2 10004Generate code for the M32R/2@. 10005 10006@item -m32rx 10007@opindex m32rx 10008Generate code for the M32R/X@. 10009 10010@item -m32r 10011@opindex m32r 10012Generate code for the M32R@. This is the default. 10013 10014@item -mmodel=small 10015@opindex mmodel=small 10016Assume all objects live in the lower 16MB of memory (so that their addresses 10017can be loaded with the @code{ld24} instruction), and assume all subroutines 10018are reachable with the @code{bl} instruction. 10019This is the default. 10020 10021The addressability of a particular object can be set with the 10022@code{model} attribute. 10023 10024@item -mmodel=medium 10025@opindex mmodel=medium 10026Assume objects may be anywhere in the 32-bit address space (the compiler 10027will generate @code{seth/add3} instructions to load their addresses), and 10028assume all subroutines are reachable with the @code{bl} instruction. 10029 10030@item -mmodel=large 10031@opindex mmodel=large 10032Assume objects may be anywhere in the 32-bit address space (the compiler 10033will generate @code{seth/add3} instructions to load their addresses), and 10034assume subroutines may not be reachable with the @code{bl} instruction 10035(the compiler will generate the much slower @code{seth/add3/jl} 10036instruction sequence). 10037 10038@item -msdata=none 10039@opindex msdata=none 10040Disable use of the small data area. Variables will be put into 10041one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the 10042@code{section} attribute has been specified). 10043This is the default. 10044 10045The small data area consists of sections @samp{.sdata} and @samp{.sbss}. 10046Objects may be explicitly put in the small data area with the 10047@code{section} attribute using one of these sections. 10048 10049@item -msdata=sdata 10050@opindex msdata=sdata 10051Put small global and static data in the small data area, but do not 10052generate special code to reference them. 10053 10054@item -msdata=use 10055@opindex msdata=use 10056Put small global and static data in the small data area, and generate 10057special instructions to reference them. 10058 10059@item -G @var{num} 10060@opindex G 10061@cindex smaller data references 10062Put global and static objects less than or equal to @var{num} bytes 10063into the small data or bss sections instead of the normal data or bss 10064sections. The default value of @var{num} is 8. 10065The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use} 10066for this option to have any effect. 10067 10068All modules should be compiled with the same @option{-G @var{num}} value. 10069Compiling with different values of @var{num} may or may not work; if it 10070doesn't the linker will give an error message---incorrect code will not be 10071generated. 10072 10073@item -mdebug 10074@opindex mdebug 10075Makes the M32R specific code in the compiler display some statistics 10076that might help in debugging programs. 10077 10078@item -malign-loops 10079@opindex malign-loops 10080Align all loops to a 32-byte boundary. 10081 10082@item -mno-align-loops 10083@opindex mno-align-loops 10084Do not enforce a 32-byte alignment for loops. This is the default. 10085 10086@item -missue-rate=@var{number} 10087@opindex missue-rate=@var{number} 10088Issue @var{number} instructions per cycle. @var{number} can only be 1 10089or 2. 10090 10091@item -mbranch-cost=@var{number} 10092@opindex mbranch-cost=@var{number} 10093@var{number} can only be 1 or 2. If it is 1 then branches will be 10094preferred over conditional code, if it is 2, then the opposite will 10095apply. 10096 10097@item -mflush-trap=@var{number} 10098@opindex mflush-trap=@var{number} 10099Specifies the trap number to use to flush the cache. The default is 1010012. Valid numbers are between 0 and 15 inclusive. 10101 10102@item -mno-flush-trap 10103@opindex mno-flush-trap 10104Specifies that the cache cannot be flushed by using a trap. 10105 10106@item -mflush-func=@var{name} 10107@opindex mflush-func=@var{name} 10108Specifies the name of the operating system function to call to flush 10109the cache. The default is @emph{_flush_cache}, but a function call 10110will only be used if a trap is not available. 10111 10112@item -mno-flush-func 10113@opindex mno-flush-func 10114Indicates that there is no OS function for flushing the cache. 10115 10116@end table 10117 10118@node M680x0 Options 10119@subsection M680x0 Options 10120@cindex M680x0 options 10121 10122These are the @samp{-m} options defined for the 68000 series. The default 10123values for these options depends on which style of 68000 was selected when 10124the compiler was configured; the defaults for the most common choices are 10125given below. 10126 10127@table @gcctabopt 10128@item -m68000 10129@itemx -mc68000 10130@opindex m68000 10131@opindex mc68000 10132Generate output for a 68000. This is the default 10133when the compiler is configured for 68000-based systems. 10134 10135Use this option for microcontrollers with a 68000 or EC000 core, 10136including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356. 10137 10138@item -m68020 10139@itemx -mc68020 10140@opindex m68020 10141@opindex mc68020 10142Generate output for a 68020. This is the default 10143when the compiler is configured for 68020-based systems. 10144 10145@item -m68881 10146@opindex m68881 10147Generate output containing 68881 instructions for floating point. 10148This is the default for most 68020 systems unless @option{--nfp} was 10149specified when the compiler was configured. 10150 10151@item -m68030 10152@opindex m68030 10153Generate output for a 68030. This is the default when the compiler is 10154configured for 68030-based systems. 10155 10156@item -m68040 10157@opindex m68040 10158Generate output for a 68040. This is the default when the compiler is 10159configured for 68040-based systems. 10160 10161This option inhibits the use of 68881/68882 instructions that have to be 10162emulated by software on the 68040. Use this option if your 68040 does not 10163have code to emulate those instructions. 10164 10165@item -m68060 10166@opindex m68060 10167Generate output for a 68060. This is the default when the compiler is 10168configured for 68060-based systems. 10169 10170This option inhibits the use of 68020 and 68881/68882 instructions that 10171have to be emulated by software on the 68060. Use this option if your 68060 10172does not have code to emulate those instructions. 10173 10174@item -mcpu32 10175@opindex mcpu32 10176Generate output for a CPU32. This is the default 10177when the compiler is configured for CPU32-based systems. 10178 10179Use this option for microcontrollers with a 10180CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334, 1018168336, 68340, 68341, 68349 and 68360. 10182 10183@item -m5200 10184@opindex m5200 10185Generate output for a 520X ``coldfire'' family cpu. This is the default 10186when the compiler is configured for 520X-based systems. 10187 10188Use this option for microcontroller with a 5200 core, including 10189the MCF5202, MCF5203, MCF5204 and MCF5202. 10190 10191@item -mcfv4e 10192@opindex mcfv4e 10193Generate output for a ColdFire V4e family cpu (e.g.@: 547x/548x). 10194This includes use of hardware floating point instructions. 10195 10196@item -m68020-40 10197@opindex m68020-40 10198Generate output for a 68040, without using any of the new instructions. 10199This results in code which can run relatively efficiently on either a 1020068020/68881 or a 68030 or a 68040. The generated code does use the 1020168881 instructions that are emulated on the 68040. 10202 10203@item -m68020-60 10204@opindex m68020-60 10205Generate output for a 68060, without using any of the new instructions. 10206This results in code which can run relatively efficiently on either a 1020768020/68881 or a 68030 or a 68040. The generated code does use the 1020868881 instructions that are emulated on the 68060. 10209 10210@item -msoft-float 10211@opindex msoft-float 10212Generate output containing library calls for floating point. 10213@strong{Warning:} the requisite libraries are not available for all m68k 10214targets. Normally the facilities of the machine's usual C compiler are 10215used, but this can't be done directly in cross-compilation. You must 10216make your own arrangements to provide suitable library functions for 10217cross-compilation. The embedded targets @samp{m68k-*-aout} and 10218@samp{m68k-*-coff} do provide software floating point support. 10219 10220@item -mshort 10221@opindex mshort 10222Consider type @code{int} to be 16 bits wide, like @code{short int}. 10223Additionally, parameters passed on the stack are also aligned to a 1022416-bit boundary even on targets whose API mandates promotion to 32-bit. 10225 10226@item -mnobitfield 10227@opindex mnobitfield 10228Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32} 10229and @option{-m5200} options imply @w{@option{-mnobitfield}}. 10230 10231@item -mbitfield 10232@opindex mbitfield 10233Do use the bit-field instructions. The @option{-m68020} option implies 10234@option{-mbitfield}. This is the default if you use a configuration 10235designed for a 68020. 10236 10237@item -mrtd 10238@opindex mrtd 10239Use a different function-calling convention, in which functions 10240that take a fixed number of arguments return with the @code{rtd} 10241instruction, which pops their arguments while returning. This 10242saves one instruction in the caller since there is no need to pop 10243the arguments there. 10244 10245This calling convention is incompatible with the one normally 10246used on Unix, so you cannot use it if you need to call libraries 10247compiled with the Unix compiler. 10248 10249Also, you must provide function prototypes for all functions that 10250take variable numbers of arguments (including @code{printf}); 10251otherwise incorrect code will be generated for calls to those 10252functions. 10253 10254In addition, seriously incorrect code will result if you call a 10255function with too many arguments. (Normally, extra arguments are 10256harmlessly ignored.) 10257 10258The @code{rtd} instruction is supported by the 68010, 68020, 68030, 1025968040, 68060 and CPU32 processors, but not by the 68000 or 5200. 10260 10261@item -malign-int 10262@itemx -mno-align-int 10263@opindex malign-int 10264@opindex mno-align-int 10265Control whether GCC aligns @code{int}, @code{long}, @code{long long}, 10266@code{float}, @code{double}, and @code{long double} variables on a 32-bit 10267boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}). 10268Aligning variables on 32-bit boundaries produces code that runs somewhat 10269faster on processors with 32-bit busses at the expense of more memory. 10270 10271@strong{Warning:} if you use the @option{-malign-int} switch, GCC will 10272align structures containing the above types differently than 10273most published application binary interface specifications for the m68k. 10274 10275@item -mpcrel 10276@opindex mpcrel 10277Use the pc-relative addressing mode of the 68000 directly, instead of 10278using a global offset table. At present, this option implies @option{-fpic}, 10279allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is 10280not presently supported with @option{-mpcrel}, though this could be supported for 1028168020 and higher processors. 10282 10283@item -mno-strict-align 10284@itemx -mstrict-align 10285@opindex mno-strict-align 10286@opindex mstrict-align 10287Do not (do) assume that unaligned memory references will be handled by 10288the system. 10289 10290@item -msep-data 10291Generate code that allows the data segment to be located in a different 10292area of memory from the text segment. This allows for execute in place in 10293an environment without virtual memory management. This option implies 10294@option{-fPIC}. 10295 10296@item -mno-sep-data 10297Generate code that assumes that the data segment follows the text segment. 10298This is the default. 10299 10300@item -mid-shared-library 10301Generate code that supports shared libraries via the library ID method. 10302This allows for execute in place and shared libraries in an environment 10303without virtual memory management. This option implies @option{-fPIC}. 10304 10305@item -mno-id-shared-library 10306Generate code that doesn't assume ID based shared libraries are being used. 10307This is the default. 10308 10309@item -mshared-library-id=n 10310Specified the identification number of the ID based shared library being 10311compiled. Specifying a value of 0 will generate more compact code, specifying 10312other values will force the allocation of that number to the current 10313library but is no more space or time efficient than omitting this option. 10314 10315@end table 10316 10317@node M68hc1x Options 10318@subsection M68hc1x Options 10319@cindex M68hc1x options 10320 10321These are the @samp{-m} options defined for the 68hc11 and 68hc12 10322microcontrollers. The default values for these options depends on 10323which style of microcontroller was selected when the compiler was configured; 10324the defaults for the most common choices are given below. 10325 10326@table @gcctabopt 10327@item -m6811 10328@itemx -m68hc11 10329@opindex m6811 10330@opindex m68hc11 10331Generate output for a 68HC11. This is the default 10332when the compiler is configured for 68HC11-based systems. 10333 10334@item -m6812 10335@itemx -m68hc12 10336@opindex m6812 10337@opindex m68hc12 10338Generate output for a 68HC12. This is the default 10339when the compiler is configured for 68HC12-based systems. 10340 10341@item -m68S12 10342@itemx -m68hcs12 10343@opindex m68S12 10344@opindex m68hcs12 10345Generate output for a 68HCS12. 10346 10347@item -mauto-incdec 10348@opindex mauto-incdec 10349Enable the use of 68HC12 pre and post auto-increment and auto-decrement 10350addressing modes. 10351 10352@item -minmax 10353@itemx -nominmax 10354@opindex minmax 10355@opindex mnominmax 10356Enable the use of 68HC12 min and max instructions. 10357 10358@item -mlong-calls 10359@itemx -mno-long-calls 10360@opindex mlong-calls 10361@opindex mno-long-calls 10362Treat all calls as being far away (near). If calls are assumed to be 10363far away, the compiler will use the @code{call} instruction to 10364call a function and the @code{rtc} instruction for returning. 10365 10366@item -mshort 10367@opindex mshort 10368Consider type @code{int} to be 16 bits wide, like @code{short int}. 10369 10370@item -msoft-reg-count=@var{count} 10371@opindex msoft-reg-count 10372Specify the number of pseudo-soft registers which are used for the 10373code generation. The maximum number is 32. Using more pseudo-soft 10374register may or may not result in better code depending on the program. 10375The default is 4 for 68HC11 and 2 for 68HC12. 10376 10377@end table 10378 10379@node MCore Options 10380@subsection MCore Options 10381@cindex MCore options 10382 10383These are the @samp{-m} options defined for the Motorola M*Core 10384processors. 10385 10386@table @gcctabopt 10387 10388@item -mhardlit 10389@itemx -mno-hardlit 10390@opindex mhardlit 10391@opindex mno-hardlit 10392Inline constants into the code stream if it can be done in two 10393instructions or less. 10394 10395@item -mdiv 10396@itemx -mno-div 10397@opindex mdiv 10398@opindex mno-div 10399Use the divide instruction. (Enabled by default). 10400 10401@item -mrelax-immediate 10402@itemx -mno-relax-immediate 10403@opindex mrelax-immediate 10404@opindex mno-relax-immediate 10405Allow arbitrary sized immediates in bit operations. 10406 10407@item -mwide-bitfields 10408@itemx -mno-wide-bitfields 10409@opindex mwide-bitfields 10410@opindex mno-wide-bitfields 10411Always treat bit-fields as int-sized. 10412 10413@item -m4byte-functions 10414@itemx -mno-4byte-functions 10415@opindex m4byte-functions 10416@opindex mno-4byte-functions 10417Force all functions to be aligned to a four byte boundary. 10418 10419@item -mcallgraph-data 10420@itemx -mno-callgraph-data 10421@opindex mcallgraph-data 10422@opindex mno-callgraph-data 10423Emit callgraph information. 10424 10425@item -mslow-bytes 10426@itemx -mno-slow-bytes 10427@opindex mslow-bytes 10428@opindex mno-slow-bytes 10429Prefer word access when reading byte quantities. 10430 10431@item -mlittle-endian 10432@itemx -mbig-endian 10433@opindex mlittle-endian 10434@opindex mbig-endian 10435Generate code for a little endian target. 10436 10437@item -m210 10438@itemx -m340 10439@opindex m210 10440@opindex m340 10441Generate code for the 210 processor. 10442@end table 10443 10444@node MIPS Options 10445@subsection MIPS Options 10446@cindex MIPS options 10447 10448@table @gcctabopt 10449 10450@item -EB 10451@opindex EB 10452Generate big-endian code. 10453 10454@item -EL 10455@opindex EL 10456Generate little-endian code. This is the default for @samp{mips*el-*-*} 10457configurations. 10458 10459@item -march=@var{arch} 10460@opindex march 10461Generate code that will run on @var{arch}, which can be the name of a 10462generic MIPS ISA, or the name of a particular processor. 10463The ISA names are: 10464@samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4}, 10465@samp{mips32}, @samp{mips32r2}, and @samp{mips64}. 10466The processor names are: 10467@samp{4kc}, @samp{4km}, @samp{4kp}, 10468@samp{5kc}, @samp{5kf}, 10469@samp{20kc}, 10470@samp{24k}, @samp{24kc}, @samp{24kf}, @samp{24kx}, 10471@samp{m4k}, 10472@samp{orion}, 10473@samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400}, 10474@samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000}, 10475@samp{rm7000}, @samp{rm9000}, 10476@samp{sb1}, 10477@samp{sr71000}, 10478@samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300}, 10479@samp{vr5000}, @samp{vr5400} and @samp{vr5500}. 10480The special value @samp{from-abi} selects the 10481most compatible architecture for the selected ABI (that is, 10482@samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@. 10483 10484In processor names, a final @samp{000} can be abbreviated as @samp{k} 10485(for example, @samp{-march=r2k}). Prefixes are optional, and 10486@samp{vr} may be written @samp{r}. 10487 10488GCC defines two macros based on the value of this option. The first 10489is @samp{_MIPS_ARCH}, which gives the name of target architecture, as 10490a string. The second has the form @samp{_MIPS_ARCH_@var{foo}}, 10491where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@. 10492For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH} 10493to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}. 10494 10495Note that the @samp{_MIPS_ARCH} macro uses the processor names given 10496above. In other words, it will have the full prefix and will not 10497abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi}, 10498the macro names the resolved architecture (either @samp{"mips1"} or 10499@samp{"mips3"}). It names the default architecture when no 10500@option{-march} option is given. 10501 10502@item -mtune=@var{arch} 10503@opindex mtune 10504Optimize for @var{arch}. Among other things, this option controls 10505the way instructions are scheduled, and the perceived cost of arithmetic 10506operations. The list of @var{arch} values is the same as for 10507@option{-march}. 10508 10509When this option is not used, GCC will optimize for the processor 10510specified by @option{-march}. By using @option{-march} and 10511@option{-mtune} together, it is possible to generate code that will 10512run on a family of processors, but optimize the code for one 10513particular member of that family. 10514 10515@samp{-mtune} defines the macros @samp{_MIPS_TUNE} and 10516@samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the 10517@samp{-march} ones described above. 10518 10519@item -mips1 10520@opindex mips1 10521Equivalent to @samp{-march=mips1}. 10522 10523@item -mips2 10524@opindex mips2 10525Equivalent to @samp{-march=mips2}. 10526 10527@item -mips3 10528@opindex mips3 10529Equivalent to @samp{-march=mips3}. 10530 10531@item -mips4 10532@opindex mips4 10533Equivalent to @samp{-march=mips4}. 10534 10535@item -mips32 10536@opindex mips32 10537Equivalent to @samp{-march=mips32}. 10538 10539@item -mips32r2 10540@opindex mips32r2 10541Equivalent to @samp{-march=mips32r2}. 10542 10543@item -mips64 10544@opindex mips64 10545Equivalent to @samp{-march=mips64}. 10546 10547@item -mips16 10548@itemx -mno-mips16 10549@opindex mips16 10550@opindex mno-mips16 10551Generate (do not generate) MIPS16 code. If GCC is targetting a 10552MIPS32 or MIPS64 architecture, it will make use of the MIPS16e ASE@. 10553 10554@item -mabi=32 10555@itemx -mabi=o64 10556@itemx -mabi=n32 10557@itemx -mabi=64 10558@itemx -mabi=eabi 10559@opindex mabi=32 10560@opindex mabi=o64 10561@opindex mabi=n32 10562@opindex mabi=64 10563@opindex mabi=eabi 10564Generate code for the given ABI@. 10565 10566Note that the EABI has a 32-bit and a 64-bit variant. GCC normally 10567generates 64-bit code when you select a 64-bit architecture, but you 10568can use @option{-mgp32} to get 32-bit code instead. 10569 10570For information about the O64 ABI, see 10571@w{@uref{http://gcc.gnu.org/projects/mipso64-abi.html}}. 10572 10573@item -mabicalls 10574@itemx -mno-abicalls 10575@opindex mabicalls 10576@opindex mno-abicalls 10577Generate (do not generate) code that is suitable for SVR4-style 10578dynamic objects. @option{-mabicalls} is the default for SVR4-based 10579systems. 10580 10581@item -mshared 10582@itemx -mno-shared 10583Generate (do not generate) code that is fully position-independent, 10584and that can therefore be linked into shared libraries. This option 10585only affects @option{-mabicalls}. 10586 10587All @option{-mabicalls} code has traditionally been position-independent, 10588regardless of options like @option{-fPIC} and @option{-fpic}. However, 10589as an extension, the GNU toolchain allows executables to use absolute 10590accesses for locally-binding symbols. It can also use shorter GP 10591initialization sequences and generate direct calls to locally-defined 10592functions. This mode is selected by @option{-mno-shared}. 10593 10594@option{-mno-shared} depends on binutils 2.16 or higher and generates 10595objects that can only be linked by the GNU linker. However, the option 10596does not affect the ABI of the final executable; it only affects the ABI 10597of relocatable objects. Using @option{-mno-shared} will generally make 10598executables both smaller and quicker. 10599 10600@option{-mshared} is the default. 10601 10602@item -mxgot 10603@itemx -mno-xgot 10604@opindex mxgot 10605@opindex mno-xgot 10606Lift (do not lift) the usual restrictions on the size of the global 10607offset table. 10608 10609GCC normally uses a single instruction to load values from the GOT@. 10610While this is relatively efficient, it will only work if the GOT 10611is smaller than about 64k. Anything larger will cause the linker 10612to report an error such as: 10613 10614@cindex relocation truncated to fit (MIPS) 10615@smallexample 10616relocation truncated to fit: R_MIPS_GOT16 foobar 10617@end smallexample 10618 10619If this happens, you should recompile your code with @option{-mxgot}. 10620It should then work with very large GOTs, although it will also be 10621less efficient, since it will take three instructions to fetch the 10622value of a global symbol. 10623 10624Note that some linkers can create multiple GOTs. If you have such a 10625linker, you should only need to use @option{-mxgot} when a single object 10626file accesses more than 64k's worth of GOT entries. Very few do. 10627 10628These options have no effect unless GCC is generating position 10629independent code. 10630 10631@item -mgp32 10632@opindex mgp32 10633Assume that general-purpose registers are 32 bits wide. 10634 10635@item -mgp64 10636@opindex mgp64 10637Assume that general-purpose registers are 64 bits wide. 10638 10639@item -mfp32 10640@opindex mfp32 10641Assume that floating-point registers are 32 bits wide. 10642 10643@item -mfp64 10644@opindex mfp64 10645Assume that floating-point registers are 64 bits wide. 10646 10647@item -mhard-float 10648@opindex mhard-float 10649Use floating-point coprocessor instructions. 10650 10651@item -msoft-float 10652@opindex msoft-float 10653Do not use floating-point coprocessor instructions. Implement 10654floating-point calculations using library calls instead. 10655 10656@item -msingle-float 10657@opindex msingle-float 10658Assume that the floating-point coprocessor only supports single-precision 10659operations. 10660 10661@itemx -mdouble-float 10662@opindex mdouble-float 10663Assume that the floating-point coprocessor supports double-precision 10664operations. This is the default. 10665 10666@itemx -mdsp 10667@itemx -mno-dsp 10668@opindex mdsp 10669@opindex mno-dsp 10670Use (do not use) the MIPS DSP ASE. @xref{MIPS DSP Built-in Functions}. 10671 10672@itemx -mpaired-single 10673@itemx -mno-paired-single 10674@opindex mpaired-single 10675@opindex mno-paired-single 10676Use (do not use) paired-single floating-point instructions. 10677@xref{MIPS Paired-Single Support}. This option can only be used 10678when generating 64-bit code and requires hardware floating-point 10679support to be enabled. 10680 10681@itemx -mips3d 10682@itemx -mno-mips3d 10683@opindex mips3d 10684@opindex mno-mips3d 10685Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}. 10686The option @option{-mips3d} implies @option{-mpaired-single}. 10687 10688@item -mlong64 10689@opindex mlong64 10690Force @code{long} types to be 64 bits wide. See @option{-mlong32} for 10691an explanation of the default and the way that the pointer size is 10692determined. 10693 10694@item -mlong32 10695@opindex mlong32 10696Force @code{long}, @code{int}, and pointer types to be 32 bits wide. 10697 10698The default size of @code{int}s, @code{long}s and pointers depends on 10699the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI 10700uses 64-bit @code{long}s, as does the 64-bit EABI; the others use 1070132-bit @code{long}s. Pointers are the same size as @code{long}s, 10702or the same size as integer registers, whichever is smaller. 10703 10704@item -msym32 10705@itemx -mno-sym32 10706@opindex msym32 10707@opindex mno-sym32 10708Assume (do not assume) that all symbols have 32-bit values, regardless 10709of the selected ABI@. This option is useful in combination with 10710@option{-mabi=64} and @option{-mno-abicalls} because it allows GCC 10711to generate shorter and faster references to symbolic addresses. 10712 10713@item -G @var{num} 10714@opindex G 10715@cindex smaller data references (MIPS) 10716@cindex gp-relative references (MIPS) 10717Put global and static items less than or equal to @var{num} bytes into 10718the small data or bss section instead of the normal data or bss section. 10719This allows the data to be accessed using a single instruction. 10720 10721All modules should be compiled with the same @option{-G @var{num}} 10722value. 10723 10724@item -membedded-data 10725@itemx -mno-embedded-data 10726@opindex membedded-data 10727@opindex mno-embedded-data 10728Allocate variables to the read-only data section first if possible, then 10729next in the small data section if possible, otherwise in data. This gives 10730slightly slower code than the default, but reduces the amount of RAM required 10731when executing, and thus may be preferred for some embedded systems. 10732 10733@item -muninit-const-in-rodata 10734@itemx -mno-uninit-const-in-rodata 10735@opindex muninit-const-in-rodata 10736@opindex mno-uninit-const-in-rodata 10737Put uninitialized @code{const} variables in the read-only data section. 10738This option is only meaningful in conjunction with @option{-membedded-data}. 10739 10740@item -msplit-addresses 10741@itemx -mno-split-addresses 10742@opindex msplit-addresses 10743@opindex mno-split-addresses 10744Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler 10745relocation operators. This option has been superseded by 10746@option{-mexplicit-relocs} but is retained for backwards compatibility. 10747 10748@item -mexplicit-relocs 10749@itemx -mno-explicit-relocs 10750@opindex mexplicit-relocs 10751@opindex mno-explicit-relocs 10752Use (do not use) assembler relocation operators when dealing with symbolic 10753addresses. The alternative, selected by @option{-mno-explicit-relocs}, 10754is to use assembler macros instead. 10755 10756@option{-mexplicit-relocs} is the default if GCC was configured 10757to use an assembler that supports relocation operators. 10758 10759@item -mcheck-zero-division 10760@itemx -mno-check-zero-division 10761@opindex mcheck-zero-division 10762@opindex mno-check-zero-division 10763Trap (do not trap) on integer division by zero. The default is 10764@option{-mcheck-zero-division}. 10765 10766@item -mdivide-traps 10767@itemx -mdivide-breaks 10768@opindex mdivide-traps 10769@opindex mdivide-breaks 10770MIPS systems check for division by zero by generating either a 10771conditional trap or a break instruction. Using traps results in 10772smaller code, but is only supported on MIPS II and later. Also, some 10773versions of the Linux kernel have a bug that prevents trap from 10774generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to 10775allow conditional traps on architectures that support them and 10776@option{-mdivide-breaks} to force the use of breaks. 10777 10778The default is usually @option{-mdivide-traps}, but this can be 10779overridden at configure time using @option{--with-divide=breaks}. 10780Divide-by-zero checks can be completely disabled using 10781@option{-mno-check-zero-division}. 10782 10783@item -mmemcpy 10784@itemx -mno-memcpy 10785@opindex mmemcpy 10786@opindex mno-memcpy 10787Force (do not force) the use of @code{memcpy()} for non-trivial block 10788moves. The default is @option{-mno-memcpy}, which allows GCC to inline 10789most constant-sized copies. 10790 10791@item -mlong-calls 10792@itemx -mno-long-calls 10793@opindex mlong-calls 10794@opindex mno-long-calls 10795Disable (do not disable) use of the @code{jal} instruction. Calling 10796functions using @code{jal} is more efficient but requires the caller 10797and callee to be in the same 256 megabyte segment. 10798 10799This option has no effect on abicalls code. The default is 10800@option{-mno-long-calls}. 10801 10802@item -mmad 10803@itemx -mno-mad 10804@opindex mmad 10805@opindex mno-mad 10806Enable (disable) use of the @code{mad}, @code{madu} and @code{mul} 10807instructions, as provided by the R4650 ISA@. 10808 10809@item -mfused-madd 10810@itemx -mno-fused-madd 10811@opindex mfused-madd 10812@opindex mno-fused-madd 10813Enable (disable) use of the floating point multiply-accumulate 10814instructions, when they are available. The default is 10815@option{-mfused-madd}. 10816 10817When multiply-accumulate instructions are used, the intermediate 10818product is calculated to infinite precision and is not subject to 10819the FCSR Flush to Zero bit. This may be undesirable in some 10820circumstances. 10821 10822@item -nocpp 10823@opindex nocpp 10824Tell the MIPS assembler to not run its preprocessor over user 10825assembler files (with a @samp{.s} suffix) when assembling them. 10826 10827@item -mfix-r4000 10828@itemx -mno-fix-r4000 10829@opindex mfix-r4000 10830@opindex mno-fix-r4000 10831Work around certain R4000 CPU errata: 10832@itemize @minus 10833@item 10834A double-word or a variable shift may give an incorrect result if executed 10835immediately after starting an integer division. 10836@item 10837A double-word or a variable shift may give an incorrect result if executed 10838while an integer multiplication is in progress. 10839@item 10840An integer division may give an incorrect result if started in a delay slot 10841of a taken branch or a jump. 10842@end itemize 10843 10844@item -mfix-r4400 10845@itemx -mno-fix-r4400 10846@opindex mfix-r4400 10847@opindex mno-fix-r4400 10848Work around certain R4400 CPU errata: 10849@itemize @minus 10850@item 10851A double-word or a variable shift may give an incorrect result if executed 10852immediately after starting an integer division. 10853@end itemize 10854 10855@item -mfix-vr4120 10856@itemx -mno-fix-vr4120 10857@opindex mfix-vr4120 10858Work around certain VR4120 errata: 10859@itemize @minus 10860@item 10861@code{dmultu} does not always produce the correct result. 10862@item 10863@code{div} and @code{ddiv} do not always produce the correct result if one 10864of the operands is negative. 10865@end itemize 10866The workarounds for the division errata rely on special functions in 10867@file{libgcc.a}. At present, these functions are only provided by 10868the @code{mips64vr*-elf} configurations. 10869 10870Other VR4120 errata require a nop to be inserted between certain pairs of 10871instructions. These errata are handled by the assembler, not by GCC itself. 10872 10873@item -mfix-vr4130 10874@opindex mfix-vr4130 10875Work around the VR4130 @code{mflo}/@code{mfhi} errata. The 10876workarounds are implemented by the assembler rather than by GCC, 10877although GCC will avoid using @code{mflo} and @code{mfhi} if the 10878VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi} 10879instructions are available instead. 10880 10881@item -mfix-sb1 10882@itemx -mno-fix-sb1 10883@opindex mfix-sb1 10884Work around certain SB-1 CPU core errata. 10885(This flag currently works around the SB-1 revision 2 10886``F1'' and ``F2'' floating point errata.) 10887 10888@item -mflush-func=@var{func} 10889@itemx -mno-flush-func 10890@opindex mflush-func 10891Specifies the function to call to flush the I and D caches, or to not 10892call any such function. If called, the function must take the same 10893arguments as the common @code{_flush_func()}, that is, the address of the 10894memory range for which the cache is being flushed, the size of the 10895memory range, and the number 3 (to flush both caches). The default 10896depends on the target GCC was configured for, but commonly is either 10897@samp{_flush_func} or @samp{__cpu_flush}. 10898 10899@item -mbranch-likely 10900@itemx -mno-branch-likely 10901@opindex mbranch-likely 10902@opindex mno-branch-likely 10903Enable or disable use of Branch Likely instructions, regardless of the 10904default for the selected architecture. By default, Branch Likely 10905instructions may be generated if they are supported by the selected 10906architecture. An exception is for the MIPS32 and MIPS64 architectures 10907and processors which implement those architectures; for those, Branch 10908Likely instructions will not be generated by default because the MIPS32 10909and MIPS64 architectures specifically deprecate their use. 10910 10911@item -mfp-exceptions 10912@itemx -mno-fp-exceptions 10913@opindex mfp-exceptions 10914Specifies whether FP exceptions are enabled. This affects how we schedule 10915FP instructions for some processors. The default is that FP exceptions are 10916enabled. 10917 10918For instance, on the SB-1, if FP exceptions are disabled, and we are emitting 1091964-bit code, then we can use both FP pipes. Otherwise, we can only use one 10920FP pipe. 10921 10922@item -mvr4130-align 10923@itemx -mno-vr4130-align 10924@opindex mvr4130-align 10925The VR4130 pipeline is two-way superscalar, but can only issue two 10926instructions together if the first one is 8-byte aligned. When this 10927option is enabled, GCC will align pairs of instructions that it 10928thinks should execute in parallel. 10929 10930This option only has an effect when optimizing for the VR4130. 10931It normally makes code faster, but at the expense of making it bigger. 10932It is enabled by default at optimization level @option{-O3}. 10933@end table 10934 10935@node MMIX Options 10936@subsection MMIX Options 10937@cindex MMIX Options 10938 10939These options are defined for the MMIX: 10940 10941@table @gcctabopt 10942@item -mlibfuncs 10943@itemx -mno-libfuncs 10944@opindex mlibfuncs 10945@opindex mno-libfuncs 10946Specify that intrinsic library functions are being compiled, passing all 10947values in registers, no matter the size. 10948 10949@item -mepsilon 10950@itemx -mno-epsilon 10951@opindex mepsilon 10952@opindex mno-epsilon 10953Generate floating-point comparison instructions that compare with respect 10954to the @code{rE} epsilon register. 10955 10956@item -mabi=mmixware 10957@itemx -mabi=gnu 10958@opindex mabi-mmixware 10959@opindex mabi=gnu 10960Generate code that passes function parameters and return values that (in 10961the called function) are seen as registers @code{$0} and up, as opposed to 10962the GNU ABI which uses global registers @code{$231} and up. 10963 10964@item -mzero-extend 10965@itemx -mno-zero-extend 10966@opindex mzero-extend 10967@opindex mno-zero-extend 10968When reading data from memory in sizes shorter than 64 bits, use (do not 10969use) zero-extending load instructions by default, rather than 10970sign-extending ones. 10971 10972@item -mknuthdiv 10973@itemx -mno-knuthdiv 10974@opindex mknuthdiv 10975@opindex mno-knuthdiv 10976Make the result of a division yielding a remainder have the same sign as 10977the divisor. With the default, @option{-mno-knuthdiv}, the sign of the 10978remainder follows the sign of the dividend. Both methods are 10979arithmetically valid, the latter being almost exclusively used. 10980 10981@item -mtoplevel-symbols 10982@itemx -mno-toplevel-symbols 10983@opindex mtoplevel-symbols 10984@opindex mno-toplevel-symbols 10985Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly 10986code can be used with the @code{PREFIX} assembly directive. 10987 10988@item -melf 10989@opindex melf 10990Generate an executable in the ELF format, rather than the default 10991@samp{mmo} format used by the @command{mmix} simulator. 10992 10993@item -mbranch-predict 10994@itemx -mno-branch-predict 10995@opindex mbranch-predict 10996@opindex mno-branch-predict 10997Use (do not use) the probable-branch instructions, when static branch 10998prediction indicates a probable branch. 10999 11000@item -mbase-addresses 11001@itemx -mno-base-addresses 11002@opindex mbase-addresses 11003@opindex mno-base-addresses 11004Generate (do not generate) code that uses @emph{base addresses}. Using a 11005base address automatically generates a request (handled by the assembler 11006and the linker) for a constant to be set up in a global register. The 11007register is used for one or more base address requests within the range 0 11008to 255 from the value held in the register. The generally leads to short 11009and fast code, but the number of different data items that can be 11010addressed is limited. This means that a program that uses lots of static 11011data may require @option{-mno-base-addresses}. 11012 11013@item -msingle-exit 11014@itemx -mno-single-exit 11015@opindex msingle-exit 11016@opindex mno-single-exit 11017Force (do not force) generated code to have a single exit point in each 11018function. 11019@end table 11020 11021@node MN10300 Options 11022@subsection MN10300 Options 11023@cindex MN10300 options 11024 11025These @option{-m} options are defined for Matsushita MN10300 architectures: 11026 11027@table @gcctabopt 11028@item -mmult-bug 11029@opindex mmult-bug 11030Generate code to avoid bugs in the multiply instructions for the MN10300 11031processors. This is the default. 11032 11033@item -mno-mult-bug 11034@opindex mno-mult-bug 11035Do not generate code to avoid bugs in the multiply instructions for the 11036MN10300 processors. 11037 11038@item -mam33 11039@opindex mam33 11040Generate code which uses features specific to the AM33 processor. 11041 11042@item -mno-am33 11043@opindex mno-am33 11044Do not generate code which uses features specific to the AM33 processor. This 11045is the default. 11046 11047@item -mreturn-pointer-on-d0 11048@opindex mreturn-pointer-on-d0 11049When generating a function which returns a pointer, return the pointer 11050in both @code{a0} and @code{d0}. Otherwise, the pointer is returned 11051only in a0, and attempts to call such functions without a prototype 11052would result in errors. Note that this option is on by default; use 11053@option{-mno-return-pointer-on-d0} to disable it. 11054 11055@item -mno-crt0 11056@opindex mno-crt0 11057Do not link in the C run-time initialization object file. 11058 11059@item -mrelax 11060@opindex mrelax 11061Indicate to the linker that it should perform a relaxation optimization pass 11062to shorten branches, calls and absolute memory addresses. This option only 11063has an effect when used on the command line for the final link step. 11064 11065This option makes symbolic debugging impossible. 11066@end table 11067 11068@node MT Options 11069@subsection MT Options 11070@cindex MT options 11071 11072These @option{-m} options are defined for Morpho MT architectures: 11073 11074@table @gcctabopt 11075 11076@item -march=@var{cpu-type} 11077@opindex march 11078Generate code that will run on @var{cpu-type}, which is the name of a system 11079representing a certain processor type. Possible values for 11080@var{cpu-type} are @samp{ms1-64-001}, @samp{ms1-16-002}, 11081@samp{ms1-16-003} and @samp{ms2}. 11082 11083When this option is not used, the default is @option{-march=ms1-16-002}. 11084 11085@item -mbacc 11086@opindex mbacc 11087Use byte loads and stores when generating code. 11088 11089@item -mno-bacc 11090@opindex mno-bacc 11091Do not use byte loads and stores when generating code. 11092 11093@item -msim 11094@opindex msim 11095Use simulator runtime 11096 11097@item -mno-crt0 11098@opindex mno-crt0 11099Do not link in the C run-time initialization object file 11100@file{crti.o}. Other run-time initialization and termination files 11101such as @file{startup.o} and @file{exit.o} are still included on the 11102linker command line. 11103 11104@end table 11105 11106@node PDP-11 Options 11107@subsection PDP-11 Options 11108@cindex PDP-11 Options 11109 11110These options are defined for the PDP-11: 11111 11112@table @gcctabopt 11113@item -mfpu 11114@opindex mfpu 11115Use hardware FPP floating point. This is the default. (FIS floating 11116point on the PDP-11/40 is not supported.) 11117 11118@item -msoft-float 11119@opindex msoft-float 11120Do not use hardware floating point. 11121 11122@item -mac0 11123@opindex mac0 11124Return floating-point results in ac0 (fr0 in Unix assembler syntax). 11125 11126@item -mno-ac0 11127@opindex mno-ac0 11128Return floating-point results in memory. This is the default. 11129 11130@item -m40 11131@opindex m40 11132Generate code for a PDP-11/40. 11133 11134@item -m45 11135@opindex m45 11136Generate code for a PDP-11/45. This is the default. 11137 11138@item -m10 11139@opindex m10 11140Generate code for a PDP-11/10. 11141 11142@item -mbcopy-builtin 11143@opindex bcopy-builtin 11144Use inline @code{movmemhi} patterns for copying memory. This is the 11145default. 11146 11147@item -mbcopy 11148@opindex mbcopy 11149Do not use inline @code{movmemhi} patterns for copying memory. 11150 11151@item -mint16 11152@itemx -mno-int32 11153@opindex mint16 11154@opindex mno-int32 11155Use 16-bit @code{int}. This is the default. 11156 11157@item -mint32 11158@itemx -mno-int16 11159@opindex mint32 11160@opindex mno-int16 11161Use 32-bit @code{int}. 11162 11163@item -mfloat64 11164@itemx -mno-float32 11165@opindex mfloat64 11166@opindex mno-float32 11167Use 64-bit @code{float}. This is the default. 11168 11169@item -mfloat32 11170@itemx -mno-float64 11171@opindex mfloat32 11172@opindex mno-float64 11173Use 32-bit @code{float}. 11174 11175@item -mabshi 11176@opindex mabshi 11177Use @code{abshi2} pattern. This is the default. 11178 11179@item -mno-abshi 11180@opindex mno-abshi 11181Do not use @code{abshi2} pattern. 11182 11183@item -mbranch-expensive 11184@opindex mbranch-expensive 11185Pretend that branches are expensive. This is for experimenting with 11186code generation only. 11187 11188@item -mbranch-cheap 11189@opindex mbranch-cheap 11190Do not pretend that branches are expensive. This is the default. 11191 11192@item -msplit 11193@opindex msplit 11194Generate code for a system with split I&D@. 11195 11196@item -mno-split 11197@opindex mno-split 11198Generate code for a system without split I&D@. This is the default. 11199 11200@item -munix-asm 11201@opindex munix-asm 11202Use Unix assembler syntax. This is the default when configured for 11203@samp{pdp11-*-bsd}. 11204 11205@item -mdec-asm 11206@opindex mdec-asm 11207Use DEC assembler syntax. This is the default when configured for any 11208PDP-11 target other than @samp{pdp11-*-bsd}. 11209@end table 11210 11211@node PowerPC Options 11212@subsection PowerPC Options 11213@cindex PowerPC options 11214 11215These are listed under @xref{RS/6000 and PowerPC Options}. 11216 11217@node RS/6000 and PowerPC Options 11218@subsection IBM RS/6000 and PowerPC Options 11219@cindex RS/6000 and PowerPC Options 11220@cindex IBM RS/6000 and PowerPC Options 11221 11222These @samp{-m} options are defined for the IBM RS/6000 and PowerPC: 11223@table @gcctabopt 11224@item -mpower 11225@itemx -mno-power 11226@itemx -mpower2 11227@itemx -mno-power2 11228@itemx -mpowerpc 11229@itemx -mno-powerpc 11230@itemx -mpowerpc-gpopt 11231@itemx -mno-powerpc-gpopt 11232@itemx -mpowerpc-gfxopt 11233@itemx -mno-powerpc-gfxopt 11234@itemx -mpowerpc64 11235@itemx -mno-powerpc64 11236@itemx -mmfcrf 11237@itemx -mno-mfcrf 11238@itemx -mpopcntb 11239@itemx -mno-popcntb 11240@itemx -mfprnd 11241@itemx -mno-fprnd 11242@opindex mpower 11243@opindex mno-power 11244@opindex mpower2 11245@opindex mno-power2 11246@opindex mpowerpc 11247@opindex mno-powerpc 11248@opindex mpowerpc-gpopt 11249@opindex mno-powerpc-gpopt 11250@opindex mpowerpc-gfxopt 11251@opindex mno-powerpc-gfxopt 11252@opindex mpowerpc64 11253@opindex mno-powerpc64 11254@opindex mmfcrf 11255@opindex mno-mfcrf 11256@opindex mpopcntb 11257@opindex mno-popcntb 11258@opindex mfprnd 11259@opindex mno-fprnd 11260GCC supports two related instruction set architectures for the 11261RS/6000 and PowerPC@. The @dfn{POWER} instruction set are those 11262instructions supported by the @samp{rios} chip set used in the original 11263RS/6000 systems and the @dfn{PowerPC} instruction set is the 11264architecture of the Freescale MPC5xx, MPC6xx, MPC8xx microprocessors, and 11265the IBM 4xx, 6xx, and follow-on microprocessors. 11266 11267Neither architecture is a subset of the other. However there is a 11268large common subset of instructions supported by both. An MQ 11269register is included in processors supporting the POWER architecture. 11270 11271You use these options to specify which instructions are available on the 11272processor you are using. The default value of these options is 11273determined when configuring GCC@. Specifying the 11274@option{-mcpu=@var{cpu_type}} overrides the specification of these 11275options. We recommend you use the @option{-mcpu=@var{cpu_type}} option 11276rather than the options listed above. 11277 11278The @option{-mpower} option allows GCC to generate instructions that 11279are found only in the POWER architecture and to use the MQ register. 11280Specifying @option{-mpower2} implies @option{-power} and also allows GCC 11281to generate instructions that are present in the POWER2 architecture but 11282not the original POWER architecture. 11283 11284The @option{-mpowerpc} option allows GCC to generate instructions that 11285are found only in the 32-bit subset of the PowerPC architecture. 11286Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows 11287GCC to use the optional PowerPC architecture instructions in the 11288General Purpose group, including floating-point square root. Specifying 11289@option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to 11290use the optional PowerPC architecture instructions in the Graphics 11291group, including floating-point select. 11292 11293The @option{-mmfcrf} option allows GCC to generate the move from 11294condition register field instruction implemented on the POWER4 11295processor and other processors that support the PowerPC V2.01 11296architecture. 11297The @option{-mpopcntb} option allows GCC to generate the popcount and 11298double precision FP reciprocal estimate instruction implemented on the 11299POWER5 processor and other processors that support the PowerPC V2.02 11300architecture. 11301The @option{-mfprnd} option allows GCC to generate the FP round to 11302integer instructions implemented on the POWER5+ processor and other 11303processors that support the PowerPC V2.03 architecture. 11304 11305The @option{-mpowerpc64} option allows GCC to generate the additional 1130664-bit instructions that are found in the full PowerPC64 architecture 11307and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to 11308@option{-mno-powerpc64}. 11309 11310If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC 11311will use only the instructions in the common subset of both 11312architectures plus some special AIX common-mode calls, and will not use 11313the MQ register. Specifying both @option{-mpower} and @option{-mpowerpc} 11314permits GCC to use any instruction from either architecture and to 11315allow use of the MQ register; specify this for the Motorola MPC601. 11316 11317@item -mnew-mnemonics 11318@itemx -mold-mnemonics 11319@opindex mnew-mnemonics 11320@opindex mold-mnemonics 11321Select which mnemonics to use in the generated assembler code. With 11322@option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for 11323the PowerPC architecture. With @option{-mold-mnemonics} it uses the 11324assembler mnemonics defined for the POWER architecture. Instructions 11325defined in only one architecture have only one mnemonic; GCC uses that 11326mnemonic irrespective of which of these options is specified. 11327 11328GCC defaults to the mnemonics appropriate for the architecture in 11329use. Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the 11330value of these option. Unless you are building a cross-compiler, you 11331should normally not specify either @option{-mnew-mnemonics} or 11332@option{-mold-mnemonics}, but should instead accept the default. 11333 11334@item -mcpu=@var{cpu_type} 11335@opindex mcpu 11336Set architecture type, register usage, choice of mnemonics, and 11337instruction scheduling parameters for machine type @var{cpu_type}. 11338Supported values for @var{cpu_type} are @samp{401}, @samp{403}, 11339@samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{505}, 11340@samp{601}, @samp{602}, @samp{603}, @samp{603e}, @samp{604}, 11341@samp{604e}, @samp{620}, @samp{630}, @samp{740}, @samp{7400}, 11342@samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823}, 11343@samp{860}, @samp{970}, @samp{8540}, @samp{ec603e}, @samp{G3}, 11344@samp{G4}, @samp{G5}, @samp{power}, @samp{power2}, @samp{power3}, 11345@samp{power4}, @samp{power5}, @samp{power5+}, @samp{power6}, 11346@samp{common}, @samp{powerpc}, @samp{powerpc64}, 11347@samp{rios}, @samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64}. 11348 11349@option{-mcpu=common} selects a completely generic processor. Code 11350generated under this option will run on any POWER or PowerPC processor. 11351GCC will use only the instructions in the common subset of both 11352architectures, and will not use the MQ register. GCC assumes a generic 11353processor model for scheduling purposes. 11354 11355@option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and 11356@option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit 11357PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine 11358types, with an appropriate, generic processor model assumed for 11359scheduling purposes. 11360 11361The other options specify a specific processor. Code generated under 11362those options will run best on that processor, and may not run at all on 11363others. 11364 11365The @option{-mcpu} options automatically enable or disable the 11366following options: @option{-maltivec}, @option{-mfprnd}, 11367@option{-mhard-float}, @option{-mmfcrf}, @option{-mmultiple}, 11368@option{-mnew-mnemonics}, @option{-mpopcntb}, @option{-mpower}, 11369@option{-mpower2}, @option{-mpowerpc64}, @option{-mpowerpc-gpopt}, 11370@option{-mpowerpc-gfxopt}, @option{-mstring}, @option{-mmulhw}, @option{-mdlmzb}. 11371The particular options 11372set for any particular CPU will vary between compiler versions, 11373depending on what setting seems to produce optimal code for that CPU; 11374it doesn't necessarily reflect the actual hardware's capabilities. If 11375you wish to set an individual option to a particular value, you may 11376specify it after the @option{-mcpu} option, like @samp{-mcpu=970 11377-mno-altivec}. 11378 11379On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are 11380not enabled or disabled by the @option{-mcpu} option at present because 11381AIX does not have full support for these options. You may still 11382enable or disable them individually if you're sure it'll work in your 11383environment. 11384 11385@item -mtune=@var{cpu_type} 11386@opindex mtune 11387Set the instruction scheduling parameters for machine type 11388@var{cpu_type}, but do not set the architecture type, register usage, or 11389choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would. The same 11390values for @var{cpu_type} are used for @option{-mtune} as for 11391@option{-mcpu}. If both are specified, the code generated will use the 11392architecture, registers, and mnemonics set by @option{-mcpu}, but the 11393scheduling parameters set by @option{-mtune}. 11394 11395@item -mswdiv 11396@itemx -mno-swdiv 11397@opindex mswdiv 11398@opindex mno-swdiv 11399Generate code to compute division as reciprocal estimate and iterative 11400refinement, creating opportunities for increased throughput. This 11401feature requires: optional PowerPC Graphics instruction set for single 11402precision and FRE instruction for double precision, assuming divides 11403cannot generate user-visible traps, and the domain values not include 11404Infinities, denormals or zero denominator. 11405 11406@item -maltivec 11407@itemx -mno-altivec 11408@opindex maltivec 11409@opindex mno-altivec 11410Generate code that uses (does not use) AltiVec instructions, and also 11411enable the use of built-in functions that allow more direct access to 11412the AltiVec instruction set. You may also need to set 11413@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI 11414enhancements. 11415 11416@item -mvrsave 11417@item -mno-vrsave 11418@opindex mvrsave 11419@opindex mno-vrsave 11420Generate VRSAVE instructions when generating AltiVec code. 11421 11422@item -msecure-plt 11423@opindex msecure-plt 11424Generate code that allows ld and ld.so to build executables and shared 11425libraries with non-exec .plt and .got sections. This is a PowerPC 1142632-bit SYSV ABI option. 11427 11428@item -mbss-plt 11429@opindex mbss-plt 11430Generate code that uses a BSS .plt section that ld.so fills in, and 11431requires .plt and .got sections that are both writable and executable. 11432This is a PowerPC 32-bit SYSV ABI option. 11433 11434@item -misel 11435@itemx -mno-isel 11436@opindex misel 11437@opindex mno-isel 11438This switch enables or disables the generation of ISEL instructions. 11439 11440@item -misel=@var{yes/no} 11441This switch has been deprecated. Use @option{-misel} and 11442@option{-mno-isel} instead. 11443 11444@item -mspe 11445@itemx -mno-spe 11446@opindex mspe 11447@opindex mno-spe 11448This switch enables or disables the generation of SPE simd 11449instructions. 11450 11451@item -mspe=@var{yes/no} 11452This option has been deprecated. Use @option{-mspe} and 11453@option{-mno-spe} instead. 11454 11455@item -mfloat-gprs=@var{yes/single/double/no} 11456@itemx -mfloat-gprs 11457@opindex mfloat-gprs 11458This switch enables or disables the generation of floating point 11459operations on the general purpose registers for architectures that 11460support it. 11461 11462The argument @var{yes} or @var{single} enables the use of 11463single-precision floating point operations. 11464 11465The argument @var{double} enables the use of single and 11466double-precision floating point operations. 11467 11468The argument @var{no} disables floating point operations on the 11469general purpose registers. 11470 11471This option is currently only available on the MPC854x. 11472 11473@item -m32 11474@itemx -m64 11475@opindex m32 11476@opindex m64 11477Generate code for 32-bit or 64-bit environments of Darwin and SVR4 11478targets (including GNU/Linux). The 32-bit environment sets int, long 11479and pointer to 32 bits and generates code that runs on any PowerPC 11480variant. The 64-bit environment sets int to 32 bits and long and 11481pointer to 64 bits, and generates code for PowerPC64, as for 11482@option{-mpowerpc64}. 11483 11484@item -mfull-toc 11485@itemx -mno-fp-in-toc 11486@itemx -mno-sum-in-toc 11487@itemx -mminimal-toc 11488@opindex mfull-toc 11489@opindex mno-fp-in-toc 11490@opindex mno-sum-in-toc 11491@opindex mminimal-toc 11492Modify generation of the TOC (Table Of Contents), which is created for 11493every executable file. The @option{-mfull-toc} option is selected by 11494default. In that case, GCC will allocate at least one TOC entry for 11495each unique non-automatic variable reference in your program. GCC 11496will also place floating-point constants in the TOC@. However, only 1149716,384 entries are available in the TOC@. 11498 11499If you receive a linker error message that saying you have overflowed 11500the available TOC space, you can reduce the amount of TOC space used 11501with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options. 11502@option{-mno-fp-in-toc} prevents GCC from putting floating-point 11503constants in the TOC and @option{-mno-sum-in-toc} forces GCC to 11504generate code to calculate the sum of an address and a constant at 11505run-time instead of putting that sum into the TOC@. You may specify one 11506or both of these options. Each causes GCC to produce very slightly 11507slower and larger code at the expense of conserving TOC space. 11508 11509If you still run out of space in the TOC even when you specify both of 11510these options, specify @option{-mminimal-toc} instead. This option causes 11511GCC to make only one TOC entry for every file. When you specify this 11512option, GCC will produce code that is slower and larger but which 11513uses extremely little TOC space. You may wish to use this option 11514only on files that contain less frequently executed code. 11515 11516@item -maix64 11517@itemx -maix32 11518@opindex maix64 11519@opindex maix32 11520Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit 11521@code{long} type, and the infrastructure needed to support them. 11522Specifying @option{-maix64} implies @option{-mpowerpc64} and 11523@option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and 11524implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}. 11525 11526@item -mxl-compat 11527@itemx -mno-xl-compat 11528@opindex mxl-compat 11529@opindex mno-xl-compat 11530Produce code that conforms more closely to IBM XL compiler semantics 11531when using AIX-compatible ABI. Pass floating-point arguments to 11532prototyped functions beyond the register save area (RSA) on the stack 11533in addition to argument FPRs. Do not assume that most significant 11534double in 128-bit long double value is properly rounded when comparing 11535values and converting to double. Use XL symbol names for long double 11536support routines. 11537 11538The AIX calling convention was extended but not initially documented to 11539handle an obscure K&R C case of calling a function that takes the 11540address of its arguments with fewer arguments than declared. IBM XL 11541compilers access floating point arguments which do not fit in the 11542RSA from the stack when a subroutine is compiled without 11543optimization. Because always storing floating-point arguments on the 11544stack is inefficient and rarely needed, this option is not enabled by 11545default and only is necessary when calling subroutines compiled by IBM 11546XL compilers without optimization. 11547 11548@item -mpe 11549@opindex mpe 11550Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an 11551application written to use message passing with special startup code to 11552enable the application to run. The system must have PE installed in the 11553standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file 11554must be overridden with the @option{-specs=} option to specify the 11555appropriate directory location. The Parallel Environment does not 11556support threads, so the @option{-mpe} option and the @option{-pthread} 11557option are incompatible. 11558 11559@item -malign-natural 11560@itemx -malign-power 11561@opindex malign-natural 11562@opindex malign-power 11563On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option 11564@option{-malign-natural} overrides the ABI-defined alignment of larger 11565types, such as floating-point doubles, on their natural size-based boundary. 11566The option @option{-malign-power} instructs GCC to follow the ABI-specified 11567alignment rules. GCC defaults to the standard alignment defined in the ABI@. 11568 11569On 64-bit Darwin, natural alignment is the default, and @option{-malign-power} 11570is not supported. 11571 11572@item -msoft-float 11573@itemx -mhard-float 11574@opindex msoft-float 11575@opindex mhard-float 11576Generate code that does not use (uses) the floating-point register set. 11577Software floating point emulation is provided if you use the 11578@option{-msoft-float} option, and pass the option to GCC when linking. 11579 11580@item -mmultiple 11581@itemx -mno-multiple 11582@opindex mmultiple 11583@opindex mno-multiple 11584Generate code that uses (does not use) the load multiple word 11585instructions and the store multiple word instructions. These 11586instructions are generated by default on POWER systems, and not 11587generated on PowerPC systems. Do not use @option{-mmultiple} on little 11588endian PowerPC systems, since those instructions do not work when the 11589processor is in little endian mode. The exceptions are PPC740 and 11590PPC750 which permit the instructions usage in little endian mode. 11591 11592@item -mstring 11593@itemx -mno-string 11594@opindex mstring 11595@opindex mno-string 11596Generate code that uses (does not use) the load string instructions 11597and the store string word instructions to save multiple registers and 11598do small block moves. These instructions are generated by default on 11599POWER systems, and not generated on PowerPC systems. Do not use 11600@option{-mstring} on little endian PowerPC systems, since those 11601instructions do not work when the processor is in little endian mode. 11602The exceptions are PPC740 and PPC750 which permit the instructions 11603usage in little endian mode. 11604 11605@item -mupdate 11606@itemx -mno-update 11607@opindex mupdate 11608@opindex mno-update 11609Generate code that uses (does not use) the load or store instructions 11610that update the base register to the address of the calculated memory 11611location. These instructions are generated by default. If you use 11612@option{-mno-update}, there is a small window between the time that the 11613stack pointer is updated and the address of the previous frame is 11614stored, which means code that walks the stack frame across interrupts or 11615signals may get corrupted data. 11616 11617@item -mfused-madd 11618@itemx -mno-fused-madd 11619@opindex mfused-madd 11620@opindex mno-fused-madd 11621Generate code that uses (does not use) the floating point multiply and 11622accumulate instructions. These instructions are generated by default if 11623hardware floating is used. 11624 11625@item -mmulhw 11626@itemx -mno-mulhw 11627@opindex mmulhw 11628@opindex mno-mulhw 11629Generate code that uses (does not use) the half-word multiply and 11630multiply-accumulate instructions on the IBM 405 and 440 processors. 11631These instructions are generated by default when targetting those 11632processors. 11633 11634@item -mdlmzb 11635@itemx -mno-dlmzb 11636@opindex mdlmzb 11637@opindex mno-dlmzb 11638Generate code that uses (does not use) the string-search @samp{dlmzb} 11639instruction on the IBM 405 and 440 processors. This instruction is 11640generated by default when targetting those processors. 11641 11642@item -mno-bit-align 11643@itemx -mbit-align 11644@opindex mno-bit-align 11645@opindex mbit-align 11646On System V.4 and embedded PowerPC systems do not (do) force structures 11647and unions that contain bit-fields to be aligned to the base type of the 11648bit-field. 11649 11650For example, by default a structure containing nothing but 8 11651@code{unsigned} bit-fields of length 1 would be aligned to a 4 byte 11652boundary and have a size of 4 bytes. By using @option{-mno-bit-align}, 11653the structure would be aligned to a 1 byte boundary and be one byte in 11654size. 11655 11656@item -mno-strict-align 11657@itemx -mstrict-align 11658@opindex mno-strict-align 11659@opindex mstrict-align 11660On System V.4 and embedded PowerPC systems do not (do) assume that 11661unaligned memory references will be handled by the system. 11662 11663@item -mrelocatable 11664@itemx -mno-relocatable 11665@opindex mrelocatable 11666@opindex mno-relocatable 11667On embedded PowerPC systems generate code that allows (does not allow) 11668the program to be relocated to a different address at runtime. If you 11669use @option{-mrelocatable} on any module, all objects linked together must 11670be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}. 11671 11672@item -mrelocatable-lib 11673@itemx -mno-relocatable-lib 11674@opindex mrelocatable-lib 11675@opindex mno-relocatable-lib 11676On embedded PowerPC systems generate code that allows (does not allow) 11677the program to be relocated to a different address at runtime. Modules 11678compiled with @option{-mrelocatable-lib} can be linked with either modules 11679compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or 11680with modules compiled with the @option{-mrelocatable} options. 11681 11682@item -mno-toc 11683@itemx -mtoc 11684@opindex mno-toc 11685@opindex mtoc 11686On System V.4 and embedded PowerPC systems do not (do) assume that 11687register 2 contains a pointer to a global area pointing to the addresses 11688used in the program. 11689 11690@item -mlittle 11691@itemx -mlittle-endian 11692@opindex mlittle 11693@opindex mlittle-endian 11694On System V.4 and embedded PowerPC systems compile code for the 11695processor in little endian mode. The @option{-mlittle-endian} option is 11696the same as @option{-mlittle}. 11697 11698@item -mbig 11699@itemx -mbig-endian 11700@opindex mbig 11701@opindex mbig-endian 11702On System V.4 and embedded PowerPC systems compile code for the 11703processor in big endian mode. The @option{-mbig-endian} option is 11704the same as @option{-mbig}. 11705 11706@item -mdynamic-no-pic 11707@opindex mdynamic-no-pic 11708On Darwin and Mac OS X systems, compile code so that it is not 11709relocatable, but that its external references are relocatable. The 11710resulting code is suitable for applications, but not shared 11711libraries. 11712 11713@item -mprioritize-restricted-insns=@var{priority} 11714@opindex mprioritize-restricted-insns 11715This option controls the priority that is assigned to 11716dispatch-slot restricted instructions during the second scheduling 11717pass. The argument @var{priority} takes the value @var{0/1/2} to assign 11718@var{no/highest/second-highest} priority to dispatch slot restricted 11719instructions. 11720 11721@item -msched-costly-dep=@var{dependence_type} 11722@opindex msched-costly-dep 11723This option controls which dependences are considered costly 11724by the target during instruction scheduling. The argument 11725@var{dependence_type} takes one of the following values: 11726@var{no}: no dependence is costly, 11727@var{all}: all dependences are costly, 11728@var{true_store_to_load}: a true dependence from store to load is costly, 11729@var{store_to_load}: any dependence from store to load is costly, 11730@var{number}: any dependence which latency >= @var{number} is costly. 11731 11732@item -minsert-sched-nops=@var{scheme} 11733@opindex minsert-sched-nops 11734This option controls which nop insertion scheme will be used during 11735the second scheduling pass. The argument @var{scheme} takes one of the 11736following values: 11737@var{no}: Don't insert nops. 11738@var{pad}: Pad with nops any dispatch group which has vacant issue slots, 11739according to the scheduler's grouping. 11740@var{regroup_exact}: Insert nops to force costly dependent insns into 11741separate groups. Insert exactly as many nops as needed to force an insn 11742to a new group, according to the estimated processor grouping. 11743@var{number}: Insert nops to force costly dependent insns into 11744separate groups. Insert @var{number} nops to force an insn to a new group. 11745 11746@item -mcall-sysv 11747@opindex mcall-sysv 11748On System V.4 and embedded PowerPC systems compile code using calling 11749conventions that adheres to the March 1995 draft of the System V 11750Application Binary Interface, PowerPC processor supplement. This is the 11751default unless you configured GCC using @samp{powerpc-*-eabiaix}. 11752 11753@item -mcall-sysv-eabi 11754@opindex mcall-sysv-eabi 11755Specify both @option{-mcall-sysv} and @option{-meabi} options. 11756 11757@item -mcall-sysv-noeabi 11758@opindex mcall-sysv-noeabi 11759Specify both @option{-mcall-sysv} and @option{-mno-eabi} options. 11760 11761@item -mcall-solaris 11762@opindex mcall-solaris 11763On System V.4 and embedded PowerPC systems compile code for the Solaris 11764operating system. 11765 11766@item -mcall-linux 11767@opindex mcall-linux 11768On System V.4 and embedded PowerPC systems compile code for the 11769Linux-based GNU system. 11770 11771@item -mcall-gnu 11772@opindex mcall-gnu 11773On System V.4 and embedded PowerPC systems compile code for the 11774Hurd-based GNU system. 11775 11776@item -mcall-netbsd 11777@opindex mcall-netbsd 11778On System V.4 and embedded PowerPC systems compile code for the 11779NetBSD operating system. 11780 11781@item -maix-struct-return 11782@opindex maix-struct-return 11783Return all structures in memory (as specified by the AIX ABI)@. 11784 11785@item -msvr4-struct-return 11786@opindex msvr4-struct-return 11787Return structures smaller than 8 bytes in registers (as specified by the 11788SVR4 ABI)@. 11789 11790@item -mabi=@var{abi-type} 11791@opindex mabi 11792Extend the current ABI with a particular extension, or remove such extension. 11793Valid values are @var{altivec}, @var{no-altivec}, @var{spe}, 11794@var{no-spe}, @var{ibmlongdouble}, @var{ieeelongdouble}@. 11795 11796@item -mabi=spe 11797@opindex mabi=spe 11798Extend the current ABI with SPE ABI extensions. This does not change 11799the default ABI, instead it adds the SPE ABI extensions to the current 11800ABI@. 11801 11802@item -mabi=no-spe 11803@opindex mabi=no-spe 11804Disable Booke SPE ABI extensions for the current ABI@. 11805 11806@item -mabi=ibmlongdouble 11807@opindex mabi=ibmlongdouble 11808Change the current ABI to use IBM extended precision long double. 11809This is a PowerPC 32-bit SYSV ABI option. 11810 11811@item -mabi=ieeelongdouble 11812@opindex mabi=ieeelongdouble 11813Change the current ABI to use IEEE extended precision long double. 11814This is a PowerPC 32-bit Linux ABI option. 11815 11816@item -mprototype 11817@itemx -mno-prototype 11818@opindex mprototype 11819@opindex mno-prototype 11820On System V.4 and embedded PowerPC systems assume that all calls to 11821variable argument functions are properly prototyped. Otherwise, the 11822compiler must insert an instruction before every non prototyped call to 11823set or clear bit 6 of the condition code register (@var{CR}) to 11824indicate whether floating point values were passed in the floating point 11825registers in case the function takes a variable arguments. With 11826@option{-mprototype}, only calls to prototyped variable argument functions 11827will set or clear the bit. 11828 11829@item -msim 11830@opindex msim 11831On embedded PowerPC systems, assume that the startup module is called 11832@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and 11833@file{libc.a}. This is the default for @samp{powerpc-*-eabisim}. 11834configurations. 11835 11836@item -mmvme 11837@opindex mmvme 11838On embedded PowerPC systems, assume that the startup module is called 11839@file{crt0.o} and the standard C libraries are @file{libmvme.a} and 11840@file{libc.a}. 11841 11842@item -mads 11843@opindex mads 11844On embedded PowerPC systems, assume that the startup module is called 11845@file{crt0.o} and the standard C libraries are @file{libads.a} and 11846@file{libc.a}. 11847 11848@item -myellowknife 11849@opindex myellowknife 11850On embedded PowerPC systems, assume that the startup module is called 11851@file{crt0.o} and the standard C libraries are @file{libyk.a} and 11852@file{libc.a}. 11853 11854@item -mvxworks 11855@opindex mvxworks 11856On System V.4 and embedded PowerPC systems, specify that you are 11857compiling for a VxWorks system. 11858 11859@item -mwindiss 11860@opindex mwindiss 11861Specify that you are compiling for the WindISS simulation environment. 11862 11863@item -memb 11864@opindex memb 11865On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags 11866header to indicate that @samp{eabi} extended relocations are used. 11867 11868@item -meabi 11869@itemx -mno-eabi 11870@opindex meabi 11871@opindex mno-eabi 11872On System V.4 and embedded PowerPC systems do (do not) adhere to the 11873Embedded Applications Binary Interface (eabi) which is a set of 11874modifications to the System V.4 specifications. Selecting @option{-meabi} 11875means that the stack is aligned to an 8 byte boundary, a function 11876@code{__eabi} is called to from @code{main} to set up the eabi 11877environment, and the @option{-msdata} option can use both @code{r2} and 11878@code{r13} to point to two separate small data areas. Selecting 11879@option{-mno-eabi} means that the stack is aligned to a 16 byte boundary, 11880do not call an initialization function from @code{main}, and the 11881@option{-msdata} option will only use @code{r13} to point to a single 11882small data area. The @option{-meabi} option is on by default if you 11883configured GCC using one of the @samp{powerpc*-*-eabi*} options. 11884 11885@item -msdata=eabi 11886@opindex msdata=eabi 11887On System V.4 and embedded PowerPC systems, put small initialized 11888@code{const} global and static data in the @samp{.sdata2} section, which 11889is pointed to by register @code{r2}. Put small initialized 11890non-@code{const} global and static data in the @samp{.sdata} section, 11891which is pointed to by register @code{r13}. Put small uninitialized 11892global and static data in the @samp{.sbss} section, which is adjacent to 11893the @samp{.sdata} section. The @option{-msdata=eabi} option is 11894incompatible with the @option{-mrelocatable} option. The 11895@option{-msdata=eabi} option also sets the @option{-memb} option. 11896 11897@item -msdata=sysv 11898@opindex msdata=sysv 11899On System V.4 and embedded PowerPC systems, put small global and static 11900data in the @samp{.sdata} section, which is pointed to by register 11901@code{r13}. Put small uninitialized global and static data in the 11902@samp{.sbss} section, which is adjacent to the @samp{.sdata} section. 11903The @option{-msdata=sysv} option is incompatible with the 11904@option{-mrelocatable} option. 11905 11906@item -msdata=default 11907@itemx -msdata 11908@opindex msdata=default 11909@opindex msdata 11910On System V.4 and embedded PowerPC systems, if @option{-meabi} is used, 11911compile code the same as @option{-msdata=eabi}, otherwise compile code the 11912same as @option{-msdata=sysv}. 11913 11914@item -msdata-data 11915@opindex msdata-data 11916On System V.4 and embedded PowerPC systems, put small global 11917data in the @samp{.sdata} section. Put small uninitialized global 11918data in the @samp{.sbss} section. Do not use register @code{r13} 11919to address small data however. This is the default behavior unless 11920other @option{-msdata} options are used. 11921 11922@item -msdata=none 11923@itemx -mno-sdata 11924@opindex msdata=none 11925@opindex mno-sdata 11926On embedded PowerPC systems, put all initialized global and static data 11927in the @samp{.data} section, and all uninitialized data in the 11928@samp{.bss} section. 11929 11930@item -G @var{num} 11931@opindex G 11932@cindex smaller data references (PowerPC) 11933@cindex .sdata/.sdata2 references (PowerPC) 11934On embedded PowerPC systems, put global and static items less than or 11935equal to @var{num} bytes into the small data or bss sections instead of 11936the normal data or bss section. By default, @var{num} is 8. The 11937@option{-G @var{num}} switch is also passed to the linker. 11938All modules should be compiled with the same @option{-G @var{num}} value. 11939 11940@item -mregnames 11941@itemx -mno-regnames 11942@opindex mregnames 11943@opindex mno-regnames 11944On System V.4 and embedded PowerPC systems do (do not) emit register 11945names in the assembly language output using symbolic forms. 11946 11947@item -mlongcall 11948@itemx -mno-longcall 11949@opindex mlongcall 11950@opindex mno-longcall 11951By default assume that all calls are far away so that a longer more 11952expensive calling sequence is required. This is required for calls 11953further than 32 megabytes (33,554,432 bytes) from the current location. 11954A short call will be generated if the compiler knows 11955the call cannot be that far away. This setting can be overridden by 11956the @code{shortcall} function attribute, or by @code{#pragma 11957longcall(0)}. 11958 11959Some linkers are capable of detecting out-of-range calls and generating 11960glue code on the fly. On these systems, long calls are unnecessary and 11961generate slower code. As of this writing, the AIX linker can do this, 11962as can the GNU linker for PowerPC/64. It is planned to add this feature 11963to the GNU linker for 32-bit PowerPC systems as well. 11964 11965On Darwin/PPC systems, @code{#pragma longcall} will generate ``jbsr 11966callee, L42'', plus a ``branch island'' (glue code). The two target 11967addresses represent the callee and the ``branch island''. The 11968Darwin/PPC linker will prefer the first address and generate a ``bl 11969callee'' if the PPC ``bl'' instruction will reach the callee directly; 11970otherwise, the linker will generate ``bl L42'' to call the ``branch 11971island''. The ``branch island'' is appended to the body of the 11972calling function; it computes the full 32-bit address of the callee 11973and jumps to it. 11974 11975On Mach-O (Darwin) systems, this option directs the compiler emit to 11976the glue for every direct call, and the Darwin linker decides whether 11977to use or discard it. 11978 11979In the future, we may cause GCC to ignore all longcall specifications 11980when the linker is known to generate glue. 11981 11982@item -pthread 11983@opindex pthread 11984Adds support for multithreading with the @dfn{pthreads} library. 11985This option sets flags for both the preprocessor and linker. 11986 11987@end table 11988 11989@node S/390 and zSeries Options 11990@subsection S/390 and zSeries Options 11991@cindex S/390 and zSeries Options 11992 11993These are the @samp{-m} options defined for the S/390 and zSeries architecture. 11994 11995@table @gcctabopt 11996@item -mhard-float 11997@itemx -msoft-float 11998@opindex mhard-float 11999@opindex msoft-float 12000Use (do not use) the hardware floating-point instructions and registers 12001for floating-point operations. When @option{-msoft-float} is specified, 12002functions in @file{libgcc.a} will be used to perform floating-point 12003operations. When @option{-mhard-float} is specified, the compiler 12004generates IEEE floating-point instructions. This is the default. 12005 12006@item -mlong-double-64 12007@itemx -mlong-double-128 12008@opindex mlong-double-64 12009@opindex mlong-double-128 12010These switches control the size of @code{long double} type. A size 12011of 64bit makes the @code{long double} type equivalent to the @code{double} 12012type. This is the default. 12013 12014@item -mbackchain 12015@itemx -mno-backchain 12016@opindex mbackchain 12017@opindex mno-backchain 12018Store (do not store) the address of the caller's frame as backchain pointer 12019into the callee's stack frame. 12020A backchain may be needed to allow debugging using tools that do not understand 12021DWARF-2 call frame information. 12022When @option{-mno-packed-stack} is in effect, the backchain pointer is stored 12023at the bottom of the stack frame; when @option{-mpacked-stack} is in effect, 12024the backchain is placed into the topmost word of the 96/160 byte register 12025save area. 12026 12027In general, code compiled with @option{-mbackchain} is call-compatible with 12028code compiled with @option{-mmo-backchain}; however, use of the backchain 12029for debugging purposes usually requires that the whole binary is built with 12030@option{-mbackchain}. Note that the combination of @option{-mbackchain}, 12031@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order 12032to build a linux kernel use @option{-msoft-float}. 12033 12034The default is to not maintain the backchain. 12035 12036@item -mpacked-stack 12037@item -mno-packed-stack 12038@opindex mpacked-stack 12039@opindex mno-packed-stack 12040Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is 12041specified, the compiler uses the all fields of the 96/160 byte register save 12042area only for their default purpose; unused fields still take up stack space. 12043When @option{-mpacked-stack} is specified, register save slots are densely 12044packed at the top of the register save area; unused space is reused for other 12045purposes, allowing for more efficient use of the available stack space. 12046However, when @option{-mbackchain} is also in effect, the topmost word of 12047the save area is always used to store the backchain, and the return address 12048register is always saved two words below the backchain. 12049 12050As long as the stack frame backchain is not used, code generated with 12051@option{-mpacked-stack} is call-compatible with code generated with 12052@option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for 12053S/390 or zSeries generated code that uses the stack frame backchain at run 12054time, not just for debugging purposes. Such code is not call-compatible 12055with code compiled with @option{-mpacked-stack}. Also, note that the 12056combination of @option{-mbackchain}, 12057@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order 12058to build a linux kernel use @option{-msoft-float}. 12059 12060The default is to not use the packed stack layout. 12061 12062@item -msmall-exec 12063@itemx -mno-small-exec 12064@opindex msmall-exec 12065@opindex mno-small-exec 12066Generate (or do not generate) code using the @code{bras} instruction 12067to do subroutine calls. 12068This only works reliably if the total executable size does not 12069exceed 64k. The default is to use the @code{basr} instruction instead, 12070which does not have this limitation. 12071 12072@item -m64 12073@itemx -m31 12074@opindex m64 12075@opindex m31 12076When @option{-m31} is specified, generate code compliant to the 12077GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate 12078code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in 12079particular to generate 64-bit instructions. For the @samp{s390} 12080targets, the default is @option{-m31}, while the @samp{s390x} 12081targets default to @option{-m64}. 12082 12083@item -mzarch 12084@itemx -mesa 12085@opindex mzarch 12086@opindex mesa 12087When @option{-mzarch} is specified, generate code using the 12088instructions available on z/Architecture. 12089When @option{-mesa} is specified, generate code using the 12090instructions available on ESA/390. Note that @option{-mesa} is 12091not possible with @option{-m64}. 12092When generating code compliant to the GNU/Linux for S/390 ABI, 12093the default is @option{-mesa}. When generating code compliant 12094to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}. 12095 12096@item -mmvcle 12097@itemx -mno-mvcle 12098@opindex mmvcle 12099@opindex mno-mvcle 12100Generate (or do not generate) code using the @code{mvcle} instruction 12101to perform block moves. When @option{-mno-mvcle} is specified, 12102use a @code{mvc} loop instead. This is the default unless optimizing for 12103size. 12104 12105@item -mdebug 12106@itemx -mno-debug 12107@opindex mdebug 12108@opindex mno-debug 12109Print (or do not print) additional debug information when compiling. 12110The default is to not print debug information. 12111 12112@item -march=@var{cpu-type} 12113@opindex march 12114Generate code that will run on @var{cpu-type}, which is the name of a system 12115representing a certain processor type. Possible values for 12116@var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, and @samp{z990}. 12117When generating code using the instructions available on z/Architecture, 12118the default is @option{-march=z900}. Otherwise, the default is 12119@option{-march=g5}. 12120 12121@item -mtune=@var{cpu-type} 12122@opindex mtune 12123Tune to @var{cpu-type} everything applicable about the generated code, 12124except for the ABI and the set of available instructions. 12125The list of @var{cpu-type} values is the same as for @option{-march}. 12126The default is the value used for @option{-march}. 12127 12128@item -mtpf-trace 12129@itemx -mno-tpf-trace 12130@opindex mtpf-trace 12131@opindex mno-tpf-trace 12132Generate code that adds (does not add) in TPF OS specific branches to trace 12133routines in the operating system. This option is off by default, even 12134when compiling for the TPF OS@. 12135 12136@item -mfused-madd 12137@itemx -mno-fused-madd 12138@opindex mfused-madd 12139@opindex mno-fused-madd 12140Generate code that uses (does not use) the floating point multiply and 12141accumulate instructions. These instructions are generated by default if 12142hardware floating point is used. 12143 12144@item -mwarn-framesize=@var{framesize} 12145@opindex mwarn-framesize 12146Emit a warning if the current function exceeds the given frame size. Because 12147this is a compile time check it doesn't need to be a real problem when the program 12148runs. It is intended to identify functions which most probably cause 12149a stack overflow. It is useful to be used in an environment with limited stack 12150size e.g.@: the linux kernel. 12151 12152@item -mwarn-dynamicstack 12153@opindex mwarn-dynamicstack 12154Emit a warning if the function calls alloca or uses dynamically 12155sized arrays. This is generally a bad idea with a limited stack size. 12156 12157@item -mstack-guard=@var{stack-guard} 12158@item -mstack-size=@var{stack-size} 12159@opindex mstack-guard 12160@opindex mstack-size 12161These arguments always have to be used in conjunction. If they are present the s390 12162back end emits additional instructions in the function prologue which trigger a trap 12163if the stack size is @var{stack-guard} bytes above the @var{stack-size} 12164(remember that the stack on s390 grows downward). These options are intended to 12165be used to help debugging stack overflow problems. The additionally emitted code 12166causes only little overhead and hence can also be used in production like systems 12167without greater performance degradation. The given values have to be exact 12168powers of 2 and @var{stack-size} has to be greater than @var{stack-guard} without 12169exceeding 64k. 12170In order to be efficient the extra code makes the assumption that the stack starts 12171at an address aligned to the value given by @var{stack-size}. 12172@end table 12173 12174@node Score Options 12175@subsection Score Options 12176@cindex Score Options 12177 12178These options are defined for Score implementations: 12179 12180@table @gcctabopt 12181@item -meb 12182@opindex meb 12183Compile code for big endian mode. This is the default. 12184 12185@item -mel 12186@opindex mel 12187Compile code for little endian mode. 12188 12189@item -mnhwloop 12190@opindex mnhwloop 12191Disable generate bcnz instruction. 12192 12193@item -muls 12194@opindex muls 12195Enable generate unaligned load and store instruction. 12196 12197@item -mmac 12198@opindex mmac 12199Enable the use of multiply-accumulate instructions. Disabled by default. 12200 12201@item -mscore5 12202@opindex mscore5 12203Specify the SCORE5 as the target architecture. 12204 12205@item -mscore5u 12206@opindex mscore5u 12207Specify the SCORE5U of the target architecture. 12208 12209@item -mscore7 12210@opindex mscore7 12211Specify the SCORE7 as the target architecture. This is the default. 12212 12213@item -mscore7d 12214@opindex mscore7d 12215Specify the SCORE7D as the target architecture. 12216@end table 12217 12218@node SH Options 12219@subsection SH Options 12220 12221These @samp{-m} options are defined for the SH implementations: 12222 12223@table @gcctabopt 12224@item -m1 12225@opindex m1 12226Generate code for the SH1. 12227 12228@item -m2 12229@opindex m2 12230Generate code for the SH2. 12231 12232@item -m2e 12233Generate code for the SH2e. 12234 12235@item -m3 12236@opindex m3 12237Generate code for the SH3. 12238 12239@item -m3e 12240@opindex m3e 12241Generate code for the SH3e. 12242 12243@item -m4-nofpu 12244@opindex m4-nofpu 12245Generate code for the SH4 without a floating-point unit. 12246 12247@item -m4-single-only 12248@opindex m4-single-only 12249Generate code for the SH4 with a floating-point unit that only 12250supports single-precision arithmetic. 12251 12252@item -m4-single 12253@opindex m4-single 12254Generate code for the SH4 assuming the floating-point unit is in 12255single-precision mode by default. 12256 12257@item -m4 12258@opindex m4 12259Generate code for the SH4. 12260 12261@item -m4a-nofpu 12262@opindex m4a-nofpu 12263Generate code for the SH4al-dsp, or for a SH4a in such a way that the 12264floating-point unit is not used. 12265 12266@item -m4a-single-only 12267@opindex m4a-single-only 12268Generate code for the SH4a, in such a way that no double-precision 12269floating point operations are used. 12270 12271@item -m4a-single 12272@opindex m4a-single 12273Generate code for the SH4a assuming the floating-point unit is in 12274single-precision mode by default. 12275 12276@item -m4a 12277@opindex m4a 12278Generate code for the SH4a. 12279 12280@item -m4al 12281@opindex m4al 12282Same as @option{-m4a-nofpu}, except that it implicitly passes 12283@option{-dsp} to the assembler. GCC doesn't generate any DSP 12284instructions at the moment. 12285 12286@item -mb 12287@opindex mb 12288Compile code for the processor in big endian mode. 12289 12290@item -ml 12291@opindex ml 12292Compile code for the processor in little endian mode. 12293 12294@item -mdalign 12295@opindex mdalign 12296Align doubles at 64-bit boundaries. Note that this changes the calling 12297conventions, and thus some functions from the standard C library will 12298not work unless you recompile it first with @option{-mdalign}. 12299 12300@item -mrelax 12301@opindex mrelax 12302Shorten some address references at link time, when possible; uses the 12303linker option @option{-relax}. 12304 12305@item -mbigtable 12306@opindex mbigtable 12307Use 32-bit offsets in @code{switch} tables. The default is to use 1230816-bit offsets. 12309 12310@item -mfmovd 12311@opindex mfmovd 12312Enable the use of the instruction @code{fmovd}. 12313 12314@item -mhitachi 12315@opindex mhitachi 12316Comply with the calling conventions defined by Renesas. 12317 12318@item -mrenesas 12319@opindex mhitachi 12320Comply with the calling conventions defined by Renesas. 12321 12322@item -mno-renesas 12323@opindex mhitachi 12324Comply with the calling conventions defined for GCC before the Renesas 12325conventions were available. This option is the default for all 12326targets of the SH toolchain except for @samp{sh-symbianelf}. 12327 12328@item -mnomacsave 12329@opindex mnomacsave 12330Mark the @code{MAC} register as call-clobbered, even if 12331@option{-mhitachi} is given. 12332 12333@item -mieee 12334@opindex mieee 12335Increase IEEE-compliance of floating-point code. 12336At the moment, this is equivalent to @option{-fno-finite-math-only}. 12337When generating 16 bit SH opcodes, getting IEEE-conforming results for 12338comparisons of NANs / infinities incurs extra overhead in every 12339floating point comparison, therefore the default is set to 12340@option{-ffinite-math-only}. 12341 12342@item -misize 12343@opindex misize 12344Dump instruction size and location in the assembly code. 12345 12346@item -mpadstruct 12347@opindex mpadstruct 12348This option is deprecated. It pads structures to multiple of 4 bytes, 12349which is incompatible with the SH ABI@. 12350 12351@item -mspace 12352@opindex mspace 12353Optimize for space instead of speed. Implied by @option{-Os}. 12354 12355@item -mprefergot 12356@opindex mprefergot 12357When generating position-independent code, emit function calls using 12358the Global Offset Table instead of the Procedure Linkage Table. 12359 12360@item -musermode 12361@opindex musermode 12362Generate a library function call to invalidate instruction cache 12363entries, after fixing up a trampoline. This library function call 12364doesn't assume it can write to the whole memory address space. This 12365is the default when the target is @code{sh-*-linux*}. 12366 12367@item -multcost=@var{number} 12368@opindex multcost=@var{number} 12369Set the cost to assume for a multiply insn. 12370 12371@item -mdiv=@var{strategy} 12372@opindex mdiv=@var{strategy} 12373Set the division strategy to use for SHmedia code. @var{strategy} must be 12374one of: call, call2, fp, inv, inv:minlat, inv20u, inv20l, inv:call, 12375inv:call2, inv:fp . 12376"fp" performs the operation in floating point. This has a very high latency, 12377but needs only a few instructions, so it might be a good choice if 12378your code has enough easily exploitable ILP to allow the compiler to 12379schedule the floating point instructions together with other instructions. 12380Division by zero causes a floating point exception. 12381"inv" uses integer operations to calculate the inverse of the divisor, 12382and then multiplies the dividend with the inverse. This strategy allows 12383cse and hoisting of the inverse calculation. Division by zero calculates 12384an unspecified result, but does not trap. 12385"inv:minlat" is a variant of "inv" where if no cse / hoisting opportunities 12386have been found, or if the entire operation has been hoisted to the same 12387place, the last stages of the inverse calculation are intertwined with the 12388final multiply to reduce the overall latency, at the expense of using a few 12389more instructions, and thus offering fewer scheduling opportunities with 12390other code. 12391"call" calls a library function that usually implements the inv:minlat 12392strategy. 12393This gives high code density for m5-*media-nofpu compilations. 12394"call2" uses a different entry point of the same library function, where it 12395assumes that a pointer to a lookup table has already been set up, which 12396exposes the pointer load to cse / code hoisting optimizations. 12397"inv:call", "inv:call2" and "inv:fp" all use the "inv" algorithm for initial 12398code generation, but if the code stays unoptimized, revert to the "call", 12399"call2", or "fp" strategies, respectively. Note that the 12400potentially-trapping side effect of division by zero is carried by a 12401separate instruction, so it is possible that all the integer instructions 12402are hoisted out, but the marker for the side effect stays where it is. 12403A recombination to fp operations or a call is not possible in that case. 12404"inv20u" and "inv20l" are variants of the "inv:minlat" strategy. In the case 12405that the inverse calculation was nor separated from the multiply, they speed 12406up division where the dividend fits into 20 bits (plus sign where applicable), 12407by inserting a test to skip a number of operations in this case; this test 12408slows down the case of larger dividends. inv20u assumes the case of a such 12409a small dividend to be unlikely, and inv20l assumes it to be likely. 12410 12411@item -mdivsi3_libfunc=@var{name} 12412@opindex mdivsi3_libfunc=@var{name} 12413Set the name of the library function used for 32 bit signed division to 12414@var{name}. This only affect the name used in the call and inv:call 12415division strategies, and the compiler will still expect the same 12416sets of input/output/clobbered registers as if this option was not present. 12417 12418@item -madjust-unroll 12419@opindex madjust-unroll 12420Throttle unrolling to avoid thrashing target registers. 12421This option only has an effect if the gcc code base supports the 12422TARGET_ADJUST_UNROLL_MAX target hook. 12423 12424@item -mindexed-addressing 12425@opindex mindexed-addressing 12426Enable the use of the indexed addressing mode for SHmedia32/SHcompact. 12427This is only safe if the hardware and/or OS implement 32 bit wrap-around 12428semantics for the indexed addressing mode. The architecture allows the 12429implementation of processors with 64 bit MMU, which the OS could use to 12430get 32 bit addressing, but since no current hardware implementation supports 12431this or any other way to make the indexed addressing mode safe to use in 12432the 32 bit ABI, the default is -mno-indexed-addressing. 12433 12434@item -mgettrcost=@var{number} 12435@opindex mgettrcost=@var{number} 12436Set the cost assumed for the gettr instruction to @var{number}. 12437The default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise. 12438 12439@item -mpt-fixed 12440@opindex mpt-fixed 12441Assume pt* instructions won't trap. This will generally generate better 12442scheduled code, but is unsafe on current hardware. The current architecture 12443definition says that ptabs and ptrel trap when the target anded with 3 is 3. 12444This has the unintentional effect of making it unsafe to schedule ptabs / 12445ptrel before a branch, or hoist it out of a loop. For example, 12446__do_global_ctors, a part of libgcc that runs constructors at program 12447startup, calls functions in a list which is delimited by -1. With the 12448-mpt-fixed option, the ptabs will be done before testing against -1. 12449That means that all the constructors will be run a bit quicker, but when 12450the loop comes to the end of the list, the program crashes because ptabs 12451loads -1 into a target register. Since this option is unsafe for any 12452hardware implementing the current architecture specification, the default 12453is -mno-pt-fixed. Unless the user specifies a specific cost with 12454@option{-mgettrcost}, -mno-pt-fixed also implies @option{-mgettrcost=100}; 12455this deters register allocation using target registers for storing 12456ordinary integers. 12457 12458@item -minvalid-symbols 12459@opindex minvalid-symbols 12460Assume symbols might be invalid. Ordinary function symbols generated by 12461the compiler will always be valid to load with movi/shori/ptabs or 12462movi/shori/ptrel, but with assembler and/or linker tricks it is possible 12463to generate symbols that will cause ptabs / ptrel to trap. 12464This option is only meaningful when @option{-mno-pt-fixed} is in effect. 12465It will then prevent cross-basic-block cse, hoisting and most scheduling 12466of symbol loads. The default is @option{-mno-invalid-symbols}. 12467@end table 12468 12469@node SPARC Options 12470@subsection SPARC Options 12471@cindex SPARC options 12472 12473These @samp{-m} options are supported on the SPARC: 12474 12475@table @gcctabopt 12476@item -mno-app-regs 12477@itemx -mapp-regs 12478@opindex mno-app-regs 12479@opindex mapp-regs 12480Specify @option{-mapp-regs} to generate output using the global registers 124812 through 4, which the SPARC SVR4 ABI reserves for applications. This 12482is the default. 12483 12484To be fully SVR4 ABI compliant at the cost of some performance loss, 12485specify @option{-mno-app-regs}. You should compile libraries and system 12486software with this option. 12487 12488@item -mfpu 12489@itemx -mhard-float 12490@opindex mfpu 12491@opindex mhard-float 12492Generate output containing floating point instructions. This is the 12493default. 12494 12495@item -mno-fpu 12496@itemx -msoft-float 12497@opindex mno-fpu 12498@opindex msoft-float 12499Generate output containing library calls for floating point. 12500@strong{Warning:} the requisite libraries are not available for all SPARC 12501targets. Normally the facilities of the machine's usual C compiler are 12502used, but this cannot be done directly in cross-compilation. You must make 12503your own arrangements to provide suitable library functions for 12504cross-compilation. The embedded targets @samp{sparc-*-aout} and 12505@samp{sparclite-*-*} do provide software floating point support. 12506 12507@option{-msoft-float} changes the calling convention in the output file; 12508therefore, it is only useful if you compile @emph{all} of a program with 12509this option. In particular, you need to compile @file{libgcc.a}, the 12510library that comes with GCC, with @option{-msoft-float} in order for 12511this to work. 12512 12513@item -mhard-quad-float 12514@opindex mhard-quad-float 12515Generate output containing quad-word (long double) floating point 12516instructions. 12517 12518@item -msoft-quad-float 12519@opindex msoft-quad-float 12520Generate output containing library calls for quad-word (long double) 12521floating point instructions. The functions called are those specified 12522in the SPARC ABI@. This is the default. 12523 12524As of this writing, there are no SPARC implementations that have hardware 12525support for the quad-word floating point instructions. They all invoke 12526a trap handler for one of these instructions, and then the trap handler 12527emulates the effect of the instruction. Because of the trap handler overhead, 12528this is much slower than calling the ABI library routines. Thus the 12529@option{-msoft-quad-float} option is the default. 12530 12531@item -mno-unaligned-doubles 12532@itemx -munaligned-doubles 12533@opindex mno-unaligned-doubles 12534@opindex munaligned-doubles 12535Assume that doubles have 8 byte alignment. This is the default. 12536 12537With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte 12538alignment only if they are contained in another type, or if they have an 12539absolute address. Otherwise, it assumes they have 4 byte alignment. 12540Specifying this option avoids some rare compatibility problems with code 12541generated by other compilers. It is not the default because it results 12542in a performance loss, especially for floating point code. 12543 12544@item -mno-faster-structs 12545@itemx -mfaster-structs 12546@opindex mno-faster-structs 12547@opindex mfaster-structs 12548With @option{-mfaster-structs}, the compiler assumes that structures 12549should have 8 byte alignment. This enables the use of pairs of 12550@code{ldd} and @code{std} instructions for copies in structure 12551assignment, in place of twice as many @code{ld} and @code{st} pairs. 12552However, the use of this changed alignment directly violates the SPARC 12553ABI@. Thus, it's intended only for use on targets where the developer 12554acknowledges that their resulting code will not be directly in line with 12555the rules of the ABI@. 12556 12557@item -mimpure-text 12558@opindex mimpure-text 12559@option{-mimpure-text}, used in addition to @option{-shared}, tells 12560the compiler to not pass @option{-z text} to the linker when linking a 12561shared object. Using this option, you can link position-dependent 12562code into a shared object. 12563 12564@option{-mimpure-text} suppresses the ``relocations remain against 12565allocatable but non-writable sections'' linker error message. 12566However, the necessary relocations will trigger copy-on-write, and the 12567shared object is not actually shared across processes. Instead of 12568using @option{-mimpure-text}, you should compile all source code with 12569@option{-fpic} or @option{-fPIC}. 12570 12571This option is only available on SunOS and Solaris. 12572 12573@item -mcpu=@var{cpu_type} 12574@opindex mcpu 12575Set the instruction set, register set, and instruction scheduling parameters 12576for machine type @var{cpu_type}. Supported values for @var{cpu_type} are 12577@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite}, 12578@samp{f930}, @samp{f934}, @samp{hypersparc}, @samp{sparclite86x}, 12579@samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc}, 12580@samp{ultrasparc3}, and @samp{niagara}. 12581 12582Default instruction scheduling parameters are used for values that select 12583an architecture and not an implementation. These are @samp{v7}, @samp{v8}, 12584@samp{sparclite}, @samp{sparclet}, @samp{v9}. 12585 12586Here is a list of each supported architecture and their supported 12587implementations. 12588 12589@smallexample 12590 v7: cypress 12591 v8: supersparc, hypersparc 12592 sparclite: f930, f934, sparclite86x 12593 sparclet: tsc701 12594 v9: ultrasparc, ultrasparc3, niagara 12595@end smallexample 12596 12597By default (unless configured otherwise), GCC generates code for the V7 12598variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler 12599additionally optimizes it for the Cypress CY7C602 chip, as used in the 12600SPARCStation/SPARCServer 3xx series. This is also appropriate for the older 12601SPARCStation 1, 2, IPX etc. 12602 12603With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC 12604architecture. The only difference from V7 code is that the compiler emits 12605the integer multiply and integer divide instructions which exist in SPARC-V8 12606but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally 12607optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and 126082000 series. 12609 12610With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of 12611the SPARC architecture. This adds the integer multiply, integer divide step 12612and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7. 12613With @option{-mcpu=f930}, the compiler additionally optimizes it for the 12614Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With 12615@option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu 12616MB86934 chip, which is the more recent SPARClite with FPU@. 12617 12618With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of 12619the SPARC architecture. This adds the integer multiply, multiply/accumulate, 12620integer divide step and scan (@code{ffs}) instructions which exist in SPARClet 12621but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally 12622optimizes it for the TEMIC SPARClet chip. 12623 12624With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC 12625architecture. This adds 64-bit integer and floating-point move instructions, 126263 additional floating-point condition code registers and conditional move 12627instructions. With @option{-mcpu=ultrasparc}, the compiler additionally 12628optimizes it for the Sun UltraSPARC I/II/IIi chips. With 12629@option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the 12630Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With 12631@option{-mcpu=niagara}, the compiler additionally optimizes it for 12632Sun UltraSPARC T1 chips. 12633 12634@item -mtune=@var{cpu_type} 12635@opindex mtune 12636Set the instruction scheduling parameters for machine type 12637@var{cpu_type}, but do not set the instruction set or register set that the 12638option @option{-mcpu=@var{cpu_type}} would. 12639 12640The same values for @option{-mcpu=@var{cpu_type}} can be used for 12641@option{-mtune=@var{cpu_type}}, but the only useful values are those 12642that select a particular cpu implementation. Those are @samp{cypress}, 12643@samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934}, 12644@samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc}, 12645@samp{ultrasparc3}, and @samp{niagara}. 12646 12647@item -mv8plus 12648@itemx -mno-v8plus 12649@opindex mv8plus 12650@opindex mno-v8plus 12651With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The 12652difference from the V8 ABI is that the global and out registers are 12653considered 64-bit wide. This is enabled by default on Solaris in 32-bit 12654mode for all SPARC-V9 processors. 12655 12656@item -mvis 12657@itemx -mno-vis 12658@opindex mvis 12659@opindex mno-vis 12660With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC 12661Visual Instruction Set extensions. The default is @option{-mno-vis}. 12662@end table 12663 12664These @samp{-m} options are supported in addition to the above 12665on SPARC-V9 processors in 64-bit environments: 12666 12667@table @gcctabopt 12668@item -mlittle-endian 12669@opindex mlittle-endian 12670Generate code for a processor running in little-endian mode. It is only 12671available for a few configurations and most notably not on Solaris and Linux. 12672 12673@item -m32 12674@itemx -m64 12675@opindex m32 12676@opindex m64 12677Generate code for a 32-bit or 64-bit environment. 12678The 32-bit environment sets int, long and pointer to 32 bits. 12679The 64-bit environment sets int to 32 bits and long and pointer 12680to 64 bits. 12681 12682@item -mcmodel=medlow 12683@opindex mcmodel=medlow 12684Generate code for the Medium/Low code model: 64-bit addresses, programs 12685must be linked in the low 32 bits of memory. Programs can be statically 12686or dynamically linked. 12687 12688@item -mcmodel=medmid 12689@opindex mcmodel=medmid 12690Generate code for the Medium/Middle code model: 64-bit addresses, programs 12691must be linked in the low 44 bits of memory, the text and data segments must 12692be less than 2GB in size and the data segment must be located within 2GB of 12693the text segment. 12694 12695@item -mcmodel=medany 12696@opindex mcmodel=medany 12697Generate code for the Medium/Anywhere code model: 64-bit addresses, programs 12698may be linked anywhere in memory, the text and data segments must be less 12699than 2GB in size and the data segment must be located within 2GB of the 12700text segment. 12701 12702@item -mcmodel=embmedany 12703@opindex mcmodel=embmedany 12704Generate code for the Medium/Anywhere code model for embedded systems: 1270564-bit addresses, the text and data segments must be less than 2GB in 12706size, both starting anywhere in memory (determined at link time). The 12707global register %g4 points to the base of the data segment. Programs 12708are statically linked and PIC is not supported. 12709 12710@item -mstack-bias 12711@itemx -mno-stack-bias 12712@opindex mstack-bias 12713@opindex mno-stack-bias 12714With @option{-mstack-bias}, GCC assumes that the stack pointer, and 12715frame pointer if present, are offset by @minus{}2047 which must be added back 12716when making stack frame references. This is the default in 64-bit mode. 12717Otherwise, assume no such offset is present. 12718@end table 12719 12720These switches are supported in addition to the above on Solaris: 12721 12722@table @gcctabopt 12723@item -threads 12724@opindex threads 12725Add support for multithreading using the Solaris threads library. This 12726option sets flags for both the preprocessor and linker. This option does 12727not affect the thread safety of object code produced by the compiler or 12728that of libraries supplied with it. 12729 12730@item -pthreads 12731@opindex pthreads 12732Add support for multithreading using the POSIX threads library. This 12733option sets flags for both the preprocessor and linker. This option does 12734not affect the thread safety of object code produced by the compiler or 12735that of libraries supplied with it. 12736 12737@item -pthread 12738@opindex pthread 12739This is a synonym for @option{-pthreads}. 12740@end table 12741 12742@node System V Options 12743@subsection Options for System V 12744 12745These additional options are available on System V Release 4 for 12746compatibility with other compilers on those systems: 12747 12748@table @gcctabopt 12749@item -G 12750@opindex G 12751Create a shared object. 12752It is recommended that @option{-symbolic} or @option{-shared} be used instead. 12753 12754@item -Qy 12755@opindex Qy 12756Identify the versions of each tool used by the compiler, in a 12757@code{.ident} assembler directive in the output. 12758 12759@item -Qn 12760@opindex Qn 12761Refrain from adding @code{.ident} directives to the output file (this is 12762the default). 12763 12764@item -YP,@var{dirs} 12765@opindex YP 12766Search the directories @var{dirs}, and no others, for libraries 12767specified with @option{-l}. 12768 12769@item -Ym,@var{dir} 12770@opindex Ym 12771Look in the directory @var{dir} to find the M4 preprocessor. 12772The assembler uses this option. 12773@c This is supposed to go with a -Yd for predefined M4 macro files, but 12774@c the generic assembler that comes with Solaris takes just -Ym. 12775@end table 12776 12777@node TMS320C3x/C4x Options 12778@subsection TMS320C3x/C4x Options 12779@cindex TMS320C3x/C4x Options 12780 12781These @samp{-m} options are defined for TMS320C3x/C4x implementations: 12782 12783@table @gcctabopt 12784 12785@item -mcpu=@var{cpu_type} 12786@opindex mcpu 12787Set the instruction set, register set, and instruction scheduling 12788parameters for machine type @var{cpu_type}. Supported values for 12789@var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and 12790@samp{c44}. The default is @samp{c40} to generate code for the 12791TMS320C40. 12792 12793@item -mbig-memory 12794@itemx -mbig 12795@itemx -msmall-memory 12796@itemx -msmall 12797@opindex mbig-memory 12798@opindex mbig 12799@opindex msmall-memory 12800@opindex msmall 12801Generates code for the big or small memory model. The small memory 12802model assumed that all data fits into one 64K word page. At run-time 12803the data page (DP) register must be set to point to the 64K page 12804containing the .bss and .data program sections. The big memory model is 12805the default and requires reloading of the DP register for every direct 12806memory access. 12807 12808@item -mbk 12809@itemx -mno-bk 12810@opindex mbk 12811@opindex mno-bk 12812Allow (disallow) allocation of general integer operands into the block 12813count register BK@. 12814 12815@item -mdb 12816@itemx -mno-db 12817@opindex mdb 12818@opindex mno-db 12819Enable (disable) generation of code using decrement and branch, 12820DBcond(D), instructions. This is enabled by default for the C4x. To be 12821on the safe side, this is disabled for the C3x, since the maximum 12822iteration count on the C3x is @math{2^{23} + 1} (but who iterates loops more than 12823@math{2^{23}} times on the C3x?). Note that GCC will try to reverse a loop so 12824that it can utilize the decrement and branch instruction, but will give 12825up if there is more than one memory reference in the loop. Thus a loop 12826where the loop counter is decremented can generate slightly more 12827efficient code, in cases where the RPTB instruction cannot be utilized. 12828 12829@item -mdp-isr-reload 12830@itemx -mparanoid 12831@opindex mdp-isr-reload 12832@opindex mparanoid 12833Force the DP register to be saved on entry to an interrupt service 12834routine (ISR), reloaded to point to the data section, and restored on 12835exit from the ISR@. This should not be required unless someone has 12836violated the small memory model by modifying the DP register, say within 12837an object library. 12838 12839@item -mmpyi 12840@itemx -mno-mpyi 12841@opindex mmpyi 12842@opindex mno-mpyi 12843For the C3x use the 24-bit MPYI instruction for integer multiplies 12844instead of a library call to guarantee 32-bit results. Note that if one 12845of the operands is a constant, then the multiplication will be performed 12846using shifts and adds. If the @option{-mmpyi} option is not specified for the C3x, 12847then squaring operations are performed inline instead of a library call. 12848 12849@item -mfast-fix 12850@itemx -mno-fast-fix 12851@opindex mfast-fix 12852@opindex mno-fast-fix 12853The C3x/C4x FIX instruction to convert a floating point value to an 12854integer value chooses the nearest integer less than or equal to the 12855floating point value rather than to the nearest integer. Thus if the 12856floating point number is negative, the result will be incorrectly 12857truncated an additional code is necessary to detect and correct this 12858case. This option can be used to disable generation of the additional 12859code required to correct the result. 12860 12861@item -mrptb 12862@itemx -mno-rptb 12863@opindex mrptb 12864@opindex mno-rptb 12865Enable (disable) generation of repeat block sequences using the RPTB 12866instruction for zero overhead looping. The RPTB construct is only used 12867for innermost loops that do not call functions or jump across the loop 12868boundaries. There is no advantage having nested RPTB loops due to the 12869overhead required to save and restore the RC, RS, and RE registers. 12870This is enabled by default with @option{-O2}. 12871 12872@item -mrpts=@var{count} 12873@itemx -mno-rpts 12874@opindex mrpts 12875@opindex mno-rpts 12876Enable (disable) the use of the single instruction repeat instruction 12877RPTS@. If a repeat block contains a single instruction, and the loop 12878count can be guaranteed to be less than the value @var{count}, GCC will 12879emit a RPTS instruction instead of a RPTB@. If no value is specified, 12880then a RPTS will be emitted even if the loop count cannot be determined 12881at compile time. Note that the repeated instruction following RPTS does 12882not have to be reloaded from memory each iteration, thus freeing up the 12883CPU buses for operands. However, since interrupts are blocked by this 12884instruction, it is disabled by default. 12885 12886@item -mloop-unsigned 12887@itemx -mno-loop-unsigned 12888@opindex mloop-unsigned 12889@opindex mno-loop-unsigned 12890The maximum iteration count when using RPTS and RPTB (and DB on the C40) 12891is @math{2^{31} + 1} since these instructions test if the iteration count is 12892negative to terminate the loop. If the iteration count is unsigned 12893there is a possibility than the @math{2^{31} + 1} maximum iteration count may be 12894exceeded. This switch allows an unsigned iteration count. 12895 12896@item -mti 12897@opindex mti 12898Try to emit an assembler syntax that the TI assembler (asm30) is happy 12899with. This also enforces compatibility with the API employed by the TI 12900C3x C compiler. For example, long doubles are passed as structures 12901rather than in floating point registers. 12902 12903@item -mregparm 12904@itemx -mmemparm 12905@opindex mregparm 12906@opindex mmemparm 12907Generate code that uses registers (stack) for passing arguments to functions. 12908By default, arguments are passed in registers where possible rather 12909than by pushing arguments on to the stack. 12910 12911@item -mparallel-insns 12912@itemx -mno-parallel-insns 12913@opindex mparallel-insns 12914@opindex mno-parallel-insns 12915Allow the generation of parallel instructions. This is enabled by 12916default with @option{-O2}. 12917 12918@item -mparallel-mpy 12919@itemx -mno-parallel-mpy 12920@opindex mparallel-mpy 12921@opindex mno-parallel-mpy 12922Allow the generation of MPY||ADD and MPY||SUB parallel instructions, 12923provided @option{-mparallel-insns} is also specified. These instructions have 12924tight register constraints which can pessimize the code generation 12925of large functions. 12926 12927@end table 12928 12929@node V850 Options 12930@subsection V850 Options 12931@cindex V850 Options 12932 12933These @samp{-m} options are defined for V850 implementations: 12934 12935@table @gcctabopt 12936@item -mlong-calls 12937@itemx -mno-long-calls 12938@opindex mlong-calls 12939@opindex mno-long-calls 12940Treat all calls as being far away (near). If calls are assumed to be 12941far away, the compiler will always load the functions address up into a 12942register, and call indirect through the pointer. 12943 12944@item -mno-ep 12945@itemx -mep 12946@opindex mno-ep 12947@opindex mep 12948Do not optimize (do optimize) basic blocks that use the same index 12949pointer 4 or more times to copy pointer into the @code{ep} register, and 12950use the shorter @code{sld} and @code{sst} instructions. The @option{-mep} 12951option is on by default if you optimize. 12952 12953@item -mno-prolog-function 12954@itemx -mprolog-function 12955@opindex mno-prolog-function 12956@opindex mprolog-function 12957Do not use (do use) external functions to save and restore registers 12958at the prologue and epilogue of a function. The external functions 12959are slower, but use less code space if more than one function saves 12960the same number of registers. The @option{-mprolog-function} option 12961is on by default if you optimize. 12962 12963@item -mspace 12964@opindex mspace 12965Try to make the code as small as possible. At present, this just turns 12966on the @option{-mep} and @option{-mprolog-function} options. 12967 12968@item -mtda=@var{n} 12969@opindex mtda 12970Put static or global variables whose size is @var{n} bytes or less into 12971the tiny data area that register @code{ep} points to. The tiny data 12972area can hold up to 256 bytes in total (128 bytes for byte references). 12973 12974@item -msda=@var{n} 12975@opindex msda 12976Put static or global variables whose size is @var{n} bytes or less into 12977the small data area that register @code{gp} points to. The small data 12978area can hold up to 64 kilobytes. 12979 12980@item -mzda=@var{n} 12981@opindex mzda 12982Put static or global variables whose size is @var{n} bytes or less into 12983the first 32 kilobytes of memory. 12984 12985@item -mv850 12986@opindex mv850 12987Specify that the target processor is the V850. 12988 12989@item -mbig-switch 12990@opindex mbig-switch 12991Generate code suitable for big switch tables. Use this option only if 12992the assembler/linker complain about out of range branches within a switch 12993table. 12994 12995@item -mapp-regs 12996@opindex mapp-regs 12997This option will cause r2 and r5 to be used in the code generated by 12998the compiler. This setting is the default. 12999 13000@item -mno-app-regs 13001@opindex mno-app-regs 13002This option will cause r2 and r5 to be treated as fixed registers. 13003 13004@item -mv850e1 13005@opindex mv850e1 13006Specify that the target processor is the V850E1. The preprocessor 13007constants @samp{__v850e1__} and @samp{__v850e__} will be defined if 13008this option is used. 13009 13010@item -mv850e 13011@opindex mv850e 13012Specify that the target processor is the V850E@. The preprocessor 13013constant @samp{__v850e__} will be defined if this option is used. 13014 13015If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1} 13016are defined then a default target processor will be chosen and the 13017relevant @samp{__v850*__} preprocessor constant will be defined. 13018 13019The preprocessor constants @samp{__v850} and @samp{__v851__} are always 13020defined, regardless of which processor variant is the target. 13021 13022@item -mdisable-callt 13023@opindex mdisable-callt 13024This option will suppress generation of the CALLT instruction for the 13025v850e and v850e1 flavors of the v850 architecture. The default is 13026@option{-mno-disable-callt} which allows the CALLT instruction to be used. 13027 13028@end table 13029 13030@node VAX Options 13031@subsection VAX Options 13032@cindex VAX options 13033 13034These @samp{-m} options are defined for the VAX: 13035 13036@table @gcctabopt 13037@item -munix 13038@opindex munix 13039Do not output certain jump instructions (@code{aobleq} and so on) 13040that the Unix assembler for the VAX cannot handle across long 13041ranges. 13042 13043@item -mgnu 13044@opindex mgnu 13045Do output those jump instructions, on the assumption that you 13046will assemble with the GNU assembler. 13047 13048@item -mg 13049@opindex mg 13050Output code for g-format floating point numbers instead of d-format. 13051@end table 13052 13053@node x86-64 Options 13054@subsection x86-64 Options 13055@cindex x86-64 options 13056 13057These are listed under @xref{i386 and x86-64 Options}. 13058 13059@node Xstormy16 Options 13060@subsection Xstormy16 Options 13061@cindex Xstormy16 Options 13062 13063These options are defined for Xstormy16: 13064 13065@table @gcctabopt 13066@item -msim 13067@opindex msim 13068Choose startup files and linker script suitable for the simulator. 13069@end table 13070 13071@node Xtensa Options 13072@subsection Xtensa Options 13073@cindex Xtensa Options 13074 13075These options are supported for Xtensa targets: 13076 13077@table @gcctabopt 13078@item -mconst16 13079@itemx -mno-const16 13080@opindex mconst16 13081@opindex mno-const16 13082Enable or disable use of @code{CONST16} instructions for loading 13083constant values. The @code{CONST16} instruction is currently not a 13084standard option from Tensilica. When enabled, @code{CONST16} 13085instructions are always used in place of the standard @code{L32R} 13086instructions. The use of @code{CONST16} is enabled by default only if 13087the @code{L32R} instruction is not available. 13088 13089@item -mfused-madd 13090@itemx -mno-fused-madd 13091@opindex mfused-madd 13092@opindex mno-fused-madd 13093Enable or disable use of fused multiply/add and multiply/subtract 13094instructions in the floating-point option. This has no effect if the 13095floating-point option is not also enabled. Disabling fused multiply/add 13096and multiply/subtract instructions forces the compiler to use separate 13097instructions for the multiply and add/subtract operations. This may be 13098desirable in some cases where strict IEEE 754-compliant results are 13099required: the fused multiply add/subtract instructions do not round the 13100intermediate result, thereby producing results with @emph{more} bits of 13101precision than specified by the IEEE standard. Disabling fused multiply 13102add/subtract instructions also ensures that the program output is not 13103sensitive to the compiler's ability to combine multiply and add/subtract 13104operations. 13105 13106@item -mtext-section-literals 13107@itemx -mno-text-section-literals 13108@opindex mtext-section-literals 13109@opindex mno-text-section-literals 13110Control the treatment of literal pools. The default is 13111@option{-mno-text-section-literals}, which places literals in a separate 13112section in the output file. This allows the literal pool to be placed 13113in a data RAM/ROM, and it also allows the linker to combine literal 13114pools from separate object files to remove redundant literals and 13115improve code size. With @option{-mtext-section-literals}, the literals 13116are interspersed in the text section in order to keep them as close as 13117possible to their references. This may be necessary for large assembly 13118files. 13119 13120@item -mtarget-align 13121@itemx -mno-target-align 13122@opindex mtarget-align 13123@opindex mno-target-align 13124When this option is enabled, GCC instructs the assembler to 13125automatically align instructions to reduce branch penalties at the 13126expense of some code density. The assembler attempts to widen density 13127instructions to align branch targets and the instructions following call 13128instructions. If there are not enough preceding safe density 13129instructions to align a target, no widening will be performed. The 13130default is @option{-mtarget-align}. These options do not affect the 13131treatment of auto-aligned instructions like @code{LOOP}, which the 13132assembler will always align, either by widening density instructions or 13133by inserting no-op instructions. 13134 13135@item -mlongcalls 13136@itemx -mno-longcalls 13137@opindex mlongcalls 13138@opindex mno-longcalls 13139When this option is enabled, GCC instructs the assembler to translate 13140direct calls to indirect calls unless it can determine that the target 13141of a direct call is in the range allowed by the call instruction. This 13142translation typically occurs for calls to functions in other source 13143files. Specifically, the assembler translates a direct @code{CALL} 13144instruction into an @code{L32R} followed by a @code{CALLX} instruction. 13145The default is @option{-mno-longcalls}. This option should be used in 13146programs where the call target can potentially be out of range. This 13147option is implemented in the assembler, not the compiler, so the 13148assembly code generated by GCC will still show direct call 13149instructions---look at the disassembled object code to see the actual 13150instructions. Note that the assembler will use an indirect call for 13151every cross-file call, not just those that really will be out of range. 13152@end table 13153 13154@node zSeries Options 13155@subsection zSeries Options 13156@cindex zSeries options 13157 13158These are listed under @xref{S/390 and zSeries Options}. 13159 13160@node Code Gen Options 13161@section Options for Code Generation Conventions 13162@cindex code generation conventions 13163@cindex options, code generation 13164@cindex run-time options 13165 13166These machine-independent options control the interface conventions 13167used in code generation. 13168 13169Most of them have both positive and negative forms; the negative form 13170of @option{-ffoo} would be @option{-fno-foo}. In the table below, only 13171one of the forms is listed---the one which is not the default. You 13172can figure out the other form by either removing @samp{no-} or adding 13173it. 13174 13175@table @gcctabopt 13176@item -fbounds-check 13177@opindex fbounds-check 13178For front-ends that support it, generate additional code to check that 13179indices used to access arrays are within the declared range. This is 13180currently only supported by the Java and Fortran front-ends, where 13181this option defaults to true and false respectively. 13182 13183@item -ftrapv 13184@opindex ftrapv 13185This option generates traps for signed overflow on addition, subtraction, 13186multiplication operations. 13187 13188@item -fwrapv 13189@opindex fwrapv 13190This option instructs the compiler to assume that signed arithmetic 13191overflow of addition, subtraction and multiplication wraps around 13192using twos-complement representation. This flag enables some optimizations 13193and disables others. This option is enabled by default for the Java 13194front-end, as required by the Java language specification. 13195 13196@item -fexceptions 13197@opindex fexceptions 13198Enable exception handling. Generates extra code needed to propagate 13199exceptions. For some targets, this implies GCC will generate frame 13200unwind information for all functions, which can produce significant data 13201size overhead, although it does not affect execution. If you do not 13202specify this option, GCC will enable it by default for languages like 13203C++ which normally require exception handling, and disable it for 13204languages like C that do not normally require it. However, you may need 13205to enable this option when compiling C code that needs to interoperate 13206properly with exception handlers written in C++. You may also wish to 13207disable this option if you are compiling older C++ programs that don't 13208use exception handling. 13209 13210@item -fnon-call-exceptions 13211@opindex fnon-call-exceptions 13212Generate code that allows trapping instructions to throw exceptions. 13213Note that this requires platform-specific runtime support that does 13214not exist everywhere. Moreover, it only allows @emph{trapping} 13215instructions to throw exceptions, i.e.@: memory references or floating 13216point instructions. It does not allow exceptions to be thrown from 13217arbitrary signal handlers such as @code{SIGALRM}. 13218 13219@item -funwind-tables 13220@opindex funwind-tables 13221Similar to @option{-fexceptions}, except that it will just generate any needed 13222static data, but will not affect the generated code in any other way. 13223You will normally not enable this option; instead, a language processor 13224that needs this handling would enable it on your behalf. 13225 13226@item -fasynchronous-unwind-tables 13227@opindex fasynchronous-unwind-tables 13228Generate unwind table in dwarf2 format, if supported by target machine. The 13229table is exact at each instruction boundary, so it can be used for stack 13230unwinding from asynchronous events (such as debugger or garbage collector). 13231 13232@item -fpcc-struct-return 13233@opindex fpcc-struct-return 13234Return ``short'' @code{struct} and @code{union} values in memory like 13235longer ones, rather than in registers. This convention is less 13236efficient, but it has the advantage of allowing intercallability between 13237GCC-compiled files and files compiled with other compilers, particularly 13238the Portable C Compiler (pcc). 13239 13240The precise convention for returning structures in memory depends 13241on the target configuration macros. 13242 13243Short structures and unions are those whose size and alignment match 13244that of some integer type. 13245 13246@strong{Warning:} code compiled with the @option{-fpcc-struct-return} 13247switch is not binary compatible with code compiled with the 13248@option{-freg-struct-return} switch. 13249Use it to conform to a non-default application binary interface. 13250 13251@item -freg-struct-return 13252@opindex freg-struct-return 13253Return @code{struct} and @code{union} values in registers when possible. 13254This is more efficient for small structures than 13255@option{-fpcc-struct-return}. 13256 13257If you specify neither @option{-fpcc-struct-return} nor 13258@option{-freg-struct-return}, GCC defaults to whichever convention is 13259standard for the target. If there is no standard convention, GCC 13260defaults to @option{-fpcc-struct-return}, except on targets where GCC is 13261the principal compiler. In those cases, we can choose the standard, and 13262we chose the more efficient register return alternative. 13263 13264@strong{Warning:} code compiled with the @option{-freg-struct-return} 13265switch is not binary compatible with code compiled with the 13266@option{-fpcc-struct-return} switch. 13267Use it to conform to a non-default application binary interface. 13268 13269@item -fshort-enums 13270@opindex fshort-enums 13271Allocate to an @code{enum} type only as many bytes as it needs for the 13272declared range of possible values. Specifically, the @code{enum} type 13273will be equivalent to the smallest integer type which has enough room. 13274 13275@strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate 13276code that is not binary compatible with code generated without that switch. 13277Use it to conform to a non-default application binary interface. 13278 13279@item -fshort-double 13280@opindex fshort-double 13281Use the same size for @code{double} as for @code{float}. 13282 13283@strong{Warning:} the @option{-fshort-double} switch causes GCC to generate 13284code that is not binary compatible with code generated without that switch. 13285Use it to conform to a non-default application binary interface. 13286 13287@item -fshort-wchar 13288@opindex fshort-wchar 13289Override the underlying type for @samp{wchar_t} to be @samp{short 13290unsigned int} instead of the default for the target. This option is 13291useful for building programs to run under WINE@. 13292 13293@strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate 13294code that is not binary compatible with code generated without that switch. 13295Use it to conform to a non-default application binary interface. 13296 13297@item -fno-common 13298@opindex fno-common 13299In C, allocate even uninitialized global variables in the data section of the 13300object file, rather than generating them as common blocks. This has the 13301effect that if the same variable is declared (without @code{extern}) in 13302two different compilations, you will get an error when you link them. 13303The only reason this might be useful is if you wish to verify that the 13304program will work on other systems which always work this way. 13305 13306@item -fno-ident 13307@opindex fno-ident 13308Ignore the @samp{#ident} directive. 13309 13310@item -finhibit-size-directive 13311@opindex finhibit-size-directive 13312Don't output a @code{.size} assembler directive, or anything else that 13313would cause trouble if the function is split in the middle, and the 13314two halves are placed at locations far apart in memory. This option is 13315used when compiling @file{crtstuff.c}; you should not need to use it 13316for anything else. 13317 13318@item -fverbose-asm 13319@opindex fverbose-asm 13320Put extra commentary information in the generated assembly code to 13321make it more readable. This option is generally only of use to those 13322who actually need to read the generated assembly code (perhaps while 13323debugging the compiler itself). 13324 13325@option{-fno-verbose-asm}, the default, causes the 13326extra information to be omitted and is useful when comparing two assembler 13327files. 13328 13329@item -fpic 13330@opindex fpic 13331@cindex global offset table 13332@cindex PIC 13333Generate position-independent code (PIC) suitable for use in a shared 13334library, if supported for the target machine. Such code accesses all 13335constant addresses through a global offset table (GOT)@. The dynamic 13336loader resolves the GOT entries when the program starts (the dynamic 13337loader is not part of GCC; it is part of the operating system). If 13338the GOT size for the linked executable exceeds a machine-specific 13339maximum size, you get an error message from the linker indicating that 13340@option{-fpic} does not work; in that case, recompile with @option{-fPIC} 13341instead. (These maximums are 8k on the SPARC and 32k 13342on the m68k and RS/6000. The 386 has no such limit.) 13343 13344Position-independent code requires special support, and therefore works 13345only on certain machines. For the 386, GCC supports PIC for System V 13346but not for the Sun 386i. Code generated for the IBM RS/6000 is always 13347position-independent. 13348 13349When this flag is set, the macros @code{__pic__} and @code{__PIC__} 13350are defined to 1. 13351 13352@item -fPIC 13353@opindex fPIC 13354If supported for the target machine, emit position-independent code, 13355suitable for dynamic linking and avoiding any limit on the size of the 13356global offset table. This option makes a difference on the m68k, 13357PowerPC and SPARC@. 13358 13359Position-independent code requires special support, and therefore works 13360only on certain machines. 13361 13362When this flag is set, the macros @code{__pic__} and @code{__PIC__} 13363are defined to 2. 13364 13365@item -fpie 13366@itemx -fPIE 13367@opindex fpie 13368@opindex fPIE 13369These options are similar to @option{-fpic} and @option{-fPIC}, but 13370generated position independent code can be only linked into executables. 13371Usually these options are used when @option{-pie} GCC option will be 13372used during linking. 13373 13374@item -fno-jump-tables 13375@opindex fno-jump-tables 13376Do not use jump tables for switch statements even where it would be 13377more efficient than other code generation strategies. This option is 13378of use in conjunction with @option{-fpic} or @option{-fPIC} for 13379building code which forms part of a dynamic linker and cannot 13380reference the address of a jump table. On some targets, jump tables 13381do not require a GOT and this option is not needed. 13382 13383@item -ffixed-@var{reg} 13384@opindex ffixed 13385Treat the register named @var{reg} as a fixed register; generated code 13386should never refer to it (except perhaps as a stack pointer, frame 13387pointer or in some other fixed role). 13388 13389@var{reg} must be the name of a register. The register names accepted 13390are machine-specific and are defined in the @code{REGISTER_NAMES} 13391macro in the machine description macro file. 13392 13393This flag does not have a negative form, because it specifies a 13394three-way choice. 13395 13396@item -fcall-used-@var{reg} 13397@opindex fcall-used 13398Treat the register named @var{reg} as an allocable register that is 13399clobbered by function calls. It may be allocated for temporaries or 13400variables that do not live across a call. Functions compiled this way 13401will not save and restore the register @var{reg}. 13402 13403It is an error to used this flag with the frame pointer or stack pointer. 13404Use of this flag for other registers that have fixed pervasive roles in 13405the machine's execution model will produce disastrous results. 13406 13407This flag does not have a negative form, because it specifies a 13408three-way choice. 13409 13410@item -fcall-saved-@var{reg} 13411@opindex fcall-saved 13412Treat the register named @var{reg} as an allocable register saved by 13413functions. It may be allocated even for temporaries or variables that 13414live across a call. Functions compiled this way will save and restore 13415the register @var{reg} if they use it. 13416 13417It is an error to used this flag with the frame pointer or stack pointer. 13418Use of this flag for other registers that have fixed pervasive roles in 13419the machine's execution model will produce disastrous results. 13420 13421A different sort of disaster will result from the use of this flag for 13422a register in which function values may be returned. 13423 13424This flag does not have a negative form, because it specifies a 13425three-way choice. 13426 13427@item -fpack-struct[=@var{n}] 13428@opindex fpack-struct 13429Without a value specified, pack all structure members together without 13430holes. When a value is specified (which must be a small power of two), pack 13431structure members according to this value, representing the maximum 13432alignment (that is, objects with default alignment requirements larger than 13433this will be output potentially unaligned at the next fitting location. 13434 13435@strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate 13436code that is not binary compatible with code generated without that switch. 13437Additionally, it makes the code suboptimal. 13438Use it to conform to a non-default application binary interface. 13439 13440@item -finstrument-functions 13441@opindex finstrument-functions 13442Generate instrumentation calls for entry and exit to functions. Just 13443after function entry and just before function exit, the following 13444profiling functions will be called with the address of the current 13445function and its call site. (On some platforms, 13446@code{__builtin_return_address} does not work beyond the current 13447function, so the call site information may not be available to the 13448profiling functions otherwise.) 13449 13450@smallexample 13451void __cyg_profile_func_enter (void *this_fn, 13452 void *call_site); 13453void __cyg_profile_func_exit (void *this_fn, 13454 void *call_site); 13455@end smallexample 13456 13457The first argument is the address of the start of the current function, 13458which may be looked up exactly in the symbol table. 13459 13460This instrumentation is also done for functions expanded inline in other 13461functions. The profiling calls will indicate where, conceptually, the 13462inline function is entered and exited. This means that addressable 13463versions of such functions must be available. If all your uses of a 13464function are expanded inline, this may mean an additional expansion of 13465code size. If you use @samp{extern inline} in your C code, an 13466addressable version of such functions must be provided. (This is 13467normally the case anyways, but if you get lucky and the optimizer always 13468expands the functions inline, you might have gotten away without 13469providing static copies.) 13470 13471A function may be given the attribute @code{no_instrument_function}, in 13472which case this instrumentation will not be done. This can be used, for 13473example, for the profiling functions listed above, high-priority 13474interrupt routines, and any functions from which the profiling functions 13475cannot safely be called (perhaps signal handlers, if the profiling 13476routines generate output or allocate memory). 13477 13478@item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} 13479@opindex finstrument-functions-exclude-file-list 13480 13481Set the list of functions that are excluded from instrumentation (see 13482the description of @code{-finstrument-functions}). If the file that 13483contains a function definition matches with one of @var{file}, then 13484that function is not instrumented. The match is done on substrings: 13485if the @var{file} parameter is a substring of the file name, it is 13486considered to be a match. 13487 13488For example, 13489@code{-finstrument-functions-exclude-file-list=/bits/stl,include/sys} 13490will exclude any inline function defined in files whose pathnames 13491contain @code{/bits/stl} or @code{include/sys}. 13492 13493If, for some reason, you want to include letter @code{','} in one of 13494@var{sym}, write @code{'\,'}. For example, 13495@code{-finstrument-functions-exclude-file-list='\,\,tmp'} 13496(note the single quote surrounding the option). 13497 13498@item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} 13499@opindex finstrument-functions-exclude-function-list 13500 13501This is similar to @code{-finstrument-functions-exclude-file-list}, 13502but this option sets the list of function names to be excluded from 13503instrumentation. The function name to be matched is its user-visible 13504name, such as @code{vector<int> blah(const vector<int> &)}, not the 13505internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The 13506match is done on substrings: if the @var{sym} parameter is a substring 13507of the function name, it is considered to be a match. 13508 13509@item -fstack-check 13510@opindex fstack-check 13511Generate code to verify that you do not go beyond the boundary of the 13512stack. You should specify this flag if you are running in an 13513environment with multiple threads, but only rarely need to specify it in 13514a single-threaded environment since stack overflow is automatically 13515detected on nearly all systems if there is only one stack. 13516 13517Note that this switch does not actually cause checking to be done; the 13518operating system must do that. The switch causes generation of code 13519to ensure that the operating system sees the stack being extended. 13520 13521@item -fstack-limit-register=@var{reg} 13522@itemx -fstack-limit-symbol=@var{sym} 13523@itemx -fno-stack-limit 13524@opindex fstack-limit-register 13525@opindex fstack-limit-symbol 13526@opindex fno-stack-limit 13527Generate code to ensure that the stack does not grow beyond a certain value, 13528either the value of a register or the address of a symbol. If the stack 13529would grow beyond the value, a signal is raised. For most targets, 13530the signal is raised before the stack overruns the boundary, so 13531it is possible to catch the signal without taking special precautions. 13532 13533For instance, if the stack starts at absolute address @samp{0x80000000} 13534and grows downwards, you can use the flags 13535@option{-fstack-limit-symbol=__stack_limit} and 13536@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit 13537of 128KB@. Note that this may only work with the GNU linker. 13538 13539@cindex aliasing of parameters 13540@cindex parameters, aliased 13541@item -fargument-alias 13542@itemx -fargument-noalias 13543@itemx -fargument-noalias-global 13544@itemx -fargument-noalias-anything 13545@opindex fargument-alias 13546@opindex fargument-noalias 13547@opindex fargument-noalias-global 13548@opindex fargument-noalias-anything 13549Specify the possible relationships among parameters and between 13550parameters and global data. 13551 13552@option{-fargument-alias} specifies that arguments (parameters) may 13553alias each other and may alias global storage.@* 13554@option{-fargument-noalias} specifies that arguments do not alias 13555each other, but may alias global storage.@* 13556@option{-fargument-noalias-global} specifies that arguments do not 13557alias each other and do not alias global storage. 13558@option{-fargument-noalias-anything} specifies that arguments do not 13559alias any other storage. 13560 13561Each language will automatically use whatever option is required by 13562the language standard. You should not need to use these options yourself. 13563 13564@item -fleading-underscore 13565@opindex fleading-underscore 13566This option and its counterpart, @option{-fno-leading-underscore}, forcibly 13567change the way C symbols are represented in the object file. One use 13568is to help link with legacy assembly code. 13569 13570@strong{Warning:} the @option{-fleading-underscore} switch causes GCC to 13571generate code that is not binary compatible with code generated without that 13572switch. Use it to conform to a non-default application binary interface. 13573Not all targets provide complete support for this switch. 13574 13575@item -ftls-model=@var{model} 13576Alter the thread-local storage model to be used (@pxref{Thread-Local}). 13577The @var{model} argument should be one of @code{global-dynamic}, 13578@code{local-dynamic}, @code{initial-exec} or @code{local-exec}. 13579 13580The default without @option{-fpic} is @code{initial-exec}; with 13581@option{-fpic} the default is @code{global-dynamic}. 13582 13583@item -fvisibility=@var{default|internal|hidden|protected} 13584@opindex fvisibility 13585Set the default ELF image symbol visibility to the specified option---all 13586symbols will be marked with this unless overridden within the code. 13587Using this feature can very substantially improve linking and 13588load times of shared object libraries, produce more optimized 13589code, provide near-perfect API export and prevent symbol clashes. 13590It is @strong{strongly} recommended that you use this in any shared objects 13591you distribute. 13592 13593Despite the nomenclature, @code{default} always means public ie; 13594available to be linked against from outside the shared object. 13595@code{protected} and @code{internal} are pretty useless in real-world 13596usage so the only other commonly used option will be @code{hidden}. 13597The default if @option{-fvisibility} isn't specified is 13598@code{default}, i.e., make every 13599symbol public---this causes the same behavior as previous versions of 13600GCC@. 13601 13602A good explanation of the benefits offered by ensuring ELF 13603symbols have the correct visibility is given by ``How To Write 13604Shared Libraries'' by Ulrich Drepper (which can be found at 13605@w{@uref{http://people.redhat.com/~drepper/}})---however a superior 13606solution made possible by this option to marking things hidden when 13607the default is public is to make the default hidden and mark things 13608public. This is the norm with DLL's on Windows and with @option{-fvisibility=hidden} 13609and @code{__attribute__ ((visibility("default")))} instead of 13610@code{__declspec(dllexport)} you get almost identical semantics with 13611identical syntax. This is a great boon to those working with 13612cross-platform projects. 13613 13614For those adding visibility support to existing code, you may find 13615@samp{#pragma GCC visibility} of use. This works by you enclosing 13616the declarations you wish to set visibility for with (for example) 13617@samp{#pragma GCC visibility push(hidden)} and 13618@samp{#pragma GCC visibility pop}. 13619Bear in mind that symbol visibility should be viewed @strong{as 13620part of the API interface contract} and thus all new code should 13621always specify visibility when it is not the default ie; declarations 13622only for use within the local DSO should @strong{always} be marked explicitly 13623as hidden as so to avoid PLT indirection overheads---making this 13624abundantly clear also aids readability and self-documentation of the code. 13625Note that due to ISO C++ specification requirements, operator new and 13626operator delete must always be of default visibility. 13627 13628Be aware that headers from outside your project, in particular system 13629headers and headers from any other library you use, may not be 13630expecting to be compiled with visibility other than the default. You 13631may need to explicitly say @samp{#pragma GCC visibility push(default)} 13632before including any such headers. 13633 13634@samp{extern} declarations are not affected by @samp{-fvisibility}, so 13635a lot of code can be recompiled with @samp{-fvisibility=hidden} with 13636no modifications. However, this means that calls to @samp{extern} 13637functions with no explicit visibility will use the PLT, so it is more 13638effective to use @samp{__attribute ((visibility))} and/or 13639@samp{#pragma GCC visibility} to tell the compiler which @samp{extern} 13640declarations should be treated as hidden. 13641 13642Note that @samp{-fvisibility} does affect C++ vague linkage 13643entities. This means that, for instance, an exception class that will 13644be thrown between DSOs must be explicitly marked with default 13645visibility so that the @samp{type_info} nodes will be unified between 13646the DSOs. 13647 13648An overview of these techniques, their benefits and how to use them 13649is at @w{@uref{http://gcc.gnu.org/wiki/Visibility}}. 13650 13651@end table 13652 13653@c man end 13654 13655@node Environment Variables 13656@section Environment Variables Affecting GCC 13657@cindex environment variables 13658 13659@c man begin ENVIRONMENT 13660This section describes several environment variables that affect how GCC 13661operates. Some of them work by specifying directories or prefixes to use 13662when searching for various kinds of files. Some are used to specify other 13663aspects of the compilation environment. 13664 13665Note that you can also specify places to search using options such as 13666@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These 13667take precedence over places specified using environment variables, which 13668in turn take precedence over those specified by the configuration of GCC@. 13669@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint, 13670GNU Compiler Collection (GCC) Internals}. 13671 13672@table @env 13673@item LANG 13674@itemx LC_CTYPE 13675@c @itemx LC_COLLATE 13676@itemx LC_MESSAGES 13677@c @itemx LC_MONETARY 13678@c @itemx LC_NUMERIC 13679@c @itemx LC_TIME 13680@itemx LC_ALL 13681@findex LANG 13682@findex LC_CTYPE 13683@c @findex LC_COLLATE 13684@findex LC_MESSAGES 13685@c @findex LC_MONETARY 13686@c @findex LC_NUMERIC 13687@c @findex LC_TIME 13688@findex LC_ALL 13689@cindex locale 13690These environment variables control the way that GCC uses 13691localization information that allow GCC to work with different 13692national conventions. GCC inspects the locale categories 13693@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do 13694so. These locale categories can be set to any value supported by your 13695installation. A typical value is @samp{en_GB.UTF-8} for English in the United 13696Kingdom encoded in UTF-8. 13697 13698The @env{LC_CTYPE} environment variable specifies character 13699classification. GCC uses it to determine the character boundaries in 13700a string; this is needed for some multibyte encodings that contain quote 13701and escape characters that would otherwise be interpreted as a string 13702end or escape. 13703 13704The @env{LC_MESSAGES} environment variable specifies the language to 13705use in diagnostic messages. 13706 13707If the @env{LC_ALL} environment variable is set, it overrides the value 13708of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE} 13709and @env{LC_MESSAGES} default to the value of the @env{LANG} 13710environment variable. If none of these variables are set, GCC 13711defaults to traditional C English behavior. 13712 13713@item TMPDIR 13714@findex TMPDIR 13715If @env{TMPDIR} is set, it specifies the directory to use for temporary 13716files. GCC uses temporary files to hold the output of one stage of 13717compilation which is to be used as input to the next stage: for example, 13718the output of the preprocessor, which is the input to the compiler 13719proper. 13720 13721@item GCC_EXEC_PREFIX 13722@findex GCC_EXEC_PREFIX 13723If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the 13724names of the subprograms executed by the compiler. No slash is added 13725when this prefix is combined with the name of a subprogram, but you can 13726specify a prefix that ends with a slash if you wish. 13727 13728If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out 13729an appropriate prefix to use based on the pathname it was invoked with. 13730 13731If GCC cannot find the subprogram using the specified prefix, it 13732tries looking in the usual places for the subprogram. 13733 13734The default value of @env{GCC_EXEC_PREFIX} is 13735@file{@var{prefix}/lib/gcc/} where @var{prefix} is the value 13736of @code{prefix} when you ran the @file{configure} script. 13737 13738Other prefixes specified with @option{-B} take precedence over this prefix. 13739 13740This prefix is also used for finding files such as @file{crt0.o} that are 13741used for linking. 13742 13743In addition, the prefix is used in an unusual way in finding the 13744directories to search for header files. For each of the standard 13745directories whose name normally begins with @samp{/usr/local/lib/gcc} 13746(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries 13747replacing that beginning with the specified prefix to produce an 13748alternate directory name. Thus, with @option{-Bfoo/}, GCC will search 13749@file{foo/bar} where it would normally search @file{/usr/local/lib/bar}. 13750These alternate directories are searched first; the standard directories 13751come next. 13752 13753@item COMPILER_PATH 13754@findex COMPILER_PATH 13755The value of @env{COMPILER_PATH} is a colon-separated list of 13756directories, much like @env{PATH}. GCC tries the directories thus 13757specified when searching for subprograms, if it can't find the 13758subprograms using @env{GCC_EXEC_PREFIX}. 13759 13760@item LIBRARY_PATH 13761@findex LIBRARY_PATH 13762The value of @env{LIBRARY_PATH} is a colon-separated list of 13763directories, much like @env{PATH}. When configured as a native compiler, 13764GCC tries the directories thus specified when searching for special 13765linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking 13766using GCC also uses these directories when searching for ordinary 13767libraries for the @option{-l} option (but directories specified with 13768@option{-L} come first). 13769 13770@item LANG 13771@findex LANG 13772@cindex locale definition 13773This variable is used to pass locale information to the compiler. One way in 13774which this information is used is to determine the character set to be used 13775when character literals, string literals and comments are parsed in C and C++. 13776When the compiler is configured to allow multibyte characters, 13777the following values for @env{LANG} are recognized: 13778 13779@table @samp 13780@item C-JIS 13781Recognize JIS characters. 13782@item C-SJIS 13783Recognize SJIS characters. 13784@item C-EUCJP 13785Recognize EUCJP characters. 13786@end table 13787 13788If @env{LANG} is not defined, or if it has some other value, then the 13789compiler will use mblen and mbtowc as defined by the default locale to 13790recognize and translate multibyte characters. 13791@end table 13792 13793@noindent 13794Some additional environments variables affect the behavior of the 13795preprocessor. 13796 13797@include cppenv.texi 13798 13799@c man end 13800 13801@node Precompiled Headers 13802@section Using Precompiled Headers 13803@cindex precompiled headers 13804@cindex speed of compilation 13805 13806Often large projects have many header files that are included in every 13807source file. The time the compiler takes to process these header files 13808over and over again can account for nearly all of the time required to 13809build the project. To make builds faster, GCC allows users to 13810`precompile' a header file; then, if builds can use the precompiled 13811header file they will be much faster. 13812 13813To create a precompiled header file, simply compile it as you would any 13814other file, if necessary using the @option{-x} option to make the driver 13815treat it as a C or C++ header file. You will probably want to use a 13816tool like @command{make} to keep the precompiled header up-to-date when 13817the headers it contains change. 13818 13819A precompiled header file will be searched for when @code{#include} is 13820seen in the compilation. As it searches for the included file 13821(@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the 13822compiler looks for a precompiled header in each directory just before it 13823looks for the include file in that directory. The name searched for is 13824the name specified in the @code{#include} with @samp{.gch} appended. If 13825the precompiled header file can't be used, it is ignored. 13826 13827For instance, if you have @code{#include "all.h"}, and you have 13828@file{all.h.gch} in the same directory as @file{all.h}, then the 13829precompiled header file will be used if possible, and the original 13830header will be used otherwise. 13831 13832Alternatively, you might decide to put the precompiled header file in a 13833directory and use @option{-I} to ensure that directory is searched 13834before (or instead of) the directory containing the original header. 13835Then, if you want to check that the precompiled header file is always 13836used, you can put a file of the same name as the original header in this 13837directory containing an @code{#error} command. 13838 13839This also works with @option{-include}. So yet another way to use 13840precompiled headers, good for projects not designed with precompiled 13841header files in mind, is to simply take most of the header files used by 13842a project, include them from another header file, precompile that header 13843file, and @option{-include} the precompiled header. If the header files 13844have guards against multiple inclusion, they will be skipped because 13845they've already been included (in the precompiled header). 13846 13847If you need to precompile the same header file for different 13848languages, targets, or compiler options, you can instead make a 13849@emph{directory} named like @file{all.h.gch}, and put each precompiled 13850header in the directory, perhaps using @option{-o}. It doesn't matter 13851what you call the files in the directory, every precompiled header in 13852the directory will be considered. The first precompiled header 13853encountered in the directory that is valid for this compilation will 13854be used; they're searched in no particular order. 13855 13856There are many other possibilities, limited only by your imagination, 13857good sense, and the constraints of your build system. 13858 13859A precompiled header file can be used only when these conditions apply: 13860 13861@itemize 13862@item 13863Only one precompiled header can be used in a particular compilation. 13864 13865@item 13866A precompiled header can't be used once the first C token is seen. You 13867can have preprocessor directives before a precompiled header; you can 13868even include a precompiled header from inside another header, so long as 13869there are no C tokens before the @code{#include}. 13870 13871@item 13872The precompiled header file must be produced for the same language as 13873the current compilation. You can't use a C precompiled header for a C++ 13874compilation. 13875 13876@item 13877The precompiled header file must have been produced by the same compiler 13878binary as the current compilation is using. 13879 13880@item 13881Any macros defined before the precompiled header is included must 13882either be defined in the same way as when the precompiled header was 13883generated, or must not affect the precompiled header, which usually 13884means that they don't appear in the precompiled header at all. 13885 13886The @option{-D} option is one way to define a macro before a 13887precompiled header is included; using a @code{#define} can also do it. 13888There are also some options that define macros implicitly, like 13889@option{-O} and @option{-Wdeprecated}; the same rule applies to macros 13890defined this way. 13891 13892@item If debugging information is output when using the precompiled 13893header, using @option{-g} or similar, the same kind of debugging information 13894must have been output when building the precompiled header. However, 13895a precompiled header built using @option{-g} can be used in a compilation 13896when no debugging information is being output. 13897 13898@item The same @option{-m} options must generally be used when building 13899and using the precompiled header. @xref{Submodel Options}, 13900for any cases where this rule is relaxed. 13901 13902@item Each of the following options must be the same when building and using 13903the precompiled header: 13904 13905@gccoptlist{-fexceptions -funit-at-a-time} 13906 13907@item 13908Some other command-line options starting with @option{-f}, 13909@option{-p}, or @option{-O} must be defined in the same way as when 13910the precompiled header was generated. At present, it's not clear 13911which options are safe to change and which are not; the safest choice 13912is to use exactly the same options when generating and using the 13913precompiled header. The following are known to be safe: 13914 13915@gccoptlist{-fmessage-length= -fpreprocessed 13916-fsched-interblock -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous 13917-fsched-verbose=<number> -fschedule-insns -fvisibility= 13918-pedantic-errors} 13919 13920@end itemize 13921 13922For all of these except the last, the compiler will automatically 13923ignore the precompiled header if the conditions aren't met. If you 13924find an option combination that doesn't work and doesn't cause the 13925precompiled header to be ignored, please consider filing a bug report, 13926see @ref{Bugs}. 13927 13928If you do use differing options when generating and using the 13929precompiled header, the actual behavior will be a mixture of the 13930behavior for the options. For instance, if you use @option{-g} to 13931generate the precompiled header but not when using it, you may or may 13932not get debugging information for routines in the precompiled header. 13933 13934@node Running Protoize 13935@section Running Protoize 13936 13937The program @code{protoize} is an optional part of GCC@. You can use 13938it to add prototypes to a program, thus converting the program to ISO 13939C in one respect. The companion program @code{unprotoize} does the 13940reverse: it removes argument types from any prototypes that are found. 13941 13942When you run these programs, you must specify a set of source files as 13943command line arguments. The conversion programs start out by compiling 13944these files to see what functions they define. The information gathered 13945about a file @var{foo} is saved in a file named @file{@var{foo}.X}. 13946 13947After scanning comes actual conversion. The specified files are all 13948eligible to be converted; any files they include (whether sources or 13949just headers) are eligible as well. 13950 13951But not all the eligible files are converted. By default, 13952@code{protoize} and @code{unprotoize} convert only source and header 13953files in the current directory. You can specify additional directories 13954whose files should be converted with the @option{-d @var{directory}} 13955option. You can also specify particular files to exclude with the 13956@option{-x @var{file}} option. A file is converted if it is eligible, its 13957directory name matches one of the specified directory names, and its 13958name within the directory has not been excluded. 13959 13960Basic conversion with @code{protoize} consists of rewriting most 13961function definitions and function declarations to specify the types of 13962the arguments. The only ones not rewritten are those for varargs 13963functions. 13964 13965@code{protoize} optionally inserts prototype declarations at the 13966beginning of the source file, to make them available for any calls that 13967precede the function's definition. Or it can insert prototype 13968declarations with block scope in the blocks where undeclared functions 13969are called. 13970 13971Basic conversion with @code{unprotoize} consists of rewriting most 13972function declarations to remove any argument types, and rewriting 13973function definitions to the old-style pre-ISO form. 13974 13975Both conversion programs print a warning for any function declaration or 13976definition that they can't convert. You can suppress these warnings 13977with @option{-q}. 13978 13979The output from @code{protoize} or @code{unprotoize} replaces the 13980original source file. The original file is renamed to a name ending 13981with @samp{.save} (for DOS, the saved filename ends in @samp{.sav} 13982without the original @samp{.c} suffix). If the @samp{.save} (@samp{.sav} 13983for DOS) file already exists, then the source file is simply discarded. 13984 13985@code{protoize} and @code{unprotoize} both depend on GCC itself to 13986scan the program and collect information about the functions it uses. 13987So neither of these programs will work until GCC is installed. 13988 13989Here is a table of the options you can use with @code{protoize} and 13990@code{unprotoize}. Each option works with both programs unless 13991otherwise stated. 13992 13993@table @code 13994@item -B @var{directory} 13995Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the 13996usual directory (normally @file{/usr/local/lib}). This file contains 13997prototype information about standard system functions. This option 13998applies only to @code{protoize}. 13999 14000@item -c @var{compilation-options} 14001Use @var{compilation-options} as the options when running @command{gcc} to 14002produce the @samp{.X} files. The special option @option{-aux-info} is 14003always passed in addition, to tell @command{gcc} to write a @samp{.X} file. 14004 14005Note that the compilation options must be given as a single argument to 14006@code{protoize} or @code{unprotoize}. If you want to specify several 14007@command{gcc} options, you must quote the entire set of compilation options 14008to make them a single word in the shell. 14009 14010There are certain @command{gcc} arguments that you cannot use, because they 14011would produce the wrong kind of output. These include @option{-g}, 14012@option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in 14013the @var{compilation-options}, they are ignored. 14014 14015@item -C 14016Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file 14017systems) instead of @samp{.c}. This is convenient if you are converting 14018a C program to C++. This option applies only to @code{protoize}. 14019 14020@item -g 14021Add explicit global declarations. This means inserting explicit 14022declarations at the beginning of each source file for each function 14023that is called in the file and was not declared. These declarations 14024precede the first function definition that contains a call to an 14025undeclared function. This option applies only to @code{protoize}. 14026 14027@item -i @var{string} 14028Indent old-style parameter declarations with the string @var{string}. 14029This option applies only to @code{protoize}. 14030 14031@code{unprotoize} converts prototyped function definitions to old-style 14032function definitions, where the arguments are declared between the 14033argument list and the initial @samp{@{}. By default, @code{unprotoize} 14034uses five spaces as the indentation. If you want to indent with just 14035one space instead, use @option{-i " "}. 14036 14037@item -k 14038Keep the @samp{.X} files. Normally, they are deleted after conversion 14039is finished. 14040 14041@item -l 14042Add explicit local declarations. @code{protoize} with @option{-l} inserts 14043a prototype declaration for each function in each block which calls the 14044function without any declaration. This option applies only to 14045@code{protoize}. 14046 14047@item -n 14048Make no real changes. This mode just prints information about the conversions 14049that would have been done without @option{-n}. 14050 14051@item -N 14052Make no @samp{.save} files. The original files are simply deleted. 14053Use this option with caution. 14054 14055@item -p @var{program} 14056Use the program @var{program} as the compiler. Normally, the name 14057@file{gcc} is used. 14058 14059@item -q 14060Work quietly. Most warnings are suppressed. 14061 14062@item -v 14063Print the version number, just like @option{-v} for @command{gcc}. 14064@end table 14065 14066If you need special compiler options to compile one of your program's 14067source files, then you should generate that file's @samp{.X} file 14068specially, by running @command{gcc} on that source file with the 14069appropriate options and the option @option{-aux-info}. Then run 14070@code{protoize} on the entire set of files. @code{protoize} will use 14071the existing @samp{.X} file because it is newer than the source file. 14072For example: 14073 14074@smallexample 14075gcc -Dfoo=bar file1.c -aux-info file1.X 14076protoize *.c 14077@end smallexample 14078 14079@noindent 14080You need to include the special files along with the rest in the 14081@code{protoize} command, even though their @samp{.X} files already 14082exist, because otherwise they won't get converted. 14083 14084@xref{Protoize Caveats}, for more information on how to use 14085@code{protoize} successfully. 14086 14087