invoke.texi revision 259005
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-fno-asm -fno-builtin -fno-builtin-@var{function} @gol 168-fhosted -ffreestanding -fopenmp -fms-extensions @gol 169-trigraphs -no-integrated-cpp -traditional -traditional-cpp @gol 170-fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol 171-fsigned-bitfields -fsigned-char @gol 172-funsigned-bitfields -funsigned-char} 173 174@item C++ Language Options 175@xref{C++ Dialect Options,,Options Controlling C++ Dialect}. 176@gccoptlist{-fabi-version=@var{n} -fno-access-control -fcheck-new @gol 177-fconserve-space -ffriend-injection @gol 178-fno-elide-constructors @gol 179-fno-enforce-eh-specs @gol 180-ffor-scope -fno-for-scope -fno-gnu-keywords @gol 181-fno-implicit-templates @gol 182-fno-implicit-inline-templates @gol 183-fno-implement-inlines -fms-extensions @gol 184-fno-nonansi-builtins -fno-operator-names @gol 185-fno-optional-diags -fpermissive @gol 186-frepo -fno-rtti -fstats -ftemplate-depth-@var{n} @gol 187-fno-threadsafe-statics -fuse-cxa-atexit -fno-weak -nostdinc++ @gol 188-fno-default-inline -fvisibility-inlines-hidden @gol 189-Wabi -Wctor-dtor-privacy @gol 190-Wnon-virtual-dtor -Wreorder @gol 191-Weffc++ -Wno-deprecated -Wstrict-null-sentinel @gol 192-Wno-non-template-friend -Wold-style-cast @gol 193-Woverloaded-virtual -Wno-pmf-conversions @gol 194-Wsign-promo} 195 196@item Language Independent Options 197@xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}. 198@gccoptlist{-fmessage-length=@var{n} @gol 199-fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol 200-fdiagnostics-show-option} 201 202@item Warning Options 203@xref{Warning Options,,Options to Request or Suppress Warnings}. 204@gccoptlist{-fsyntax-only -pedantic -pedantic-errors @gol 205-w -Wextra -Wall -Waddress -Waggregate-return -Wno-attributes @gol 206-Wc++-compat -Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment @gol 207-Wconversion -Wno-deprecated-declarations @gol 208-Wdisabled-optimization -Wno-div-by-zero -Wno-endif-labels @gol 209-Werror -Werror=* -Werror-implicit-function-declaration @gol 210-Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol 211-Wno-format-extra-args -Wformat-nonliteral @gol 212-Wformat-security -Wformat-y2k @gol 213-Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol 214-Wimport -Wno-import -Winit-self -Winline @gol 215-Wno-int-to-pointer-cast @gol 216-Wno-invalid-offsetof -Winvalid-pch @gol 217-Wlarger-than-@var{len} -Wframe-larger-than-@var{len} @gol 218-Wunsafe-loop-optimizations -Wlong-long @gol 219-Wmain -Wmissing-braces -Wmissing-field-initializers @gol 220-Wmissing-format-attribute -Wmissing-include-dirs @gol 221-Wmissing-noreturn @gol 222-Wno-multichar -Wnonnull -Wno-overflow @gol 223-Woverlength-strings -Wpacked -Wpadded @gol 224-Wparentheses -Wpointer-arith -Wno-pointer-to-int-cast @gol 225-Wredundant-decls @gol 226-Wreturn-type -Wsequence-point -Wshadow @gol 227-Wsign-compare -Wstack-protector @gol 228-Wstrict-aliasing -Wstrict-aliasing=2 @gol 229-Wstrict-overflow -Wstrict-overflow=@var{n} @gol 230-Wswitch -Wswitch-default -Wswitch-enum @gol 231-Wsystem-headers -Wtrigraphs -Wundef -Wuninitialized @gol 232-Wunknown-pragmas -Wno-pragmas -Wunreachable-code @gol 233-Wunused -Wunused-function -Wunused-label -Wunused-parameter @gol 234-Wunused-value -Wunused-variable @gol 235-Wvariadic-macros -Wvla @gol 236-Wvolatile-register-var -Wwrite-strings} 237 238@item C-only Warning Options 239@gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol 240-Wmissing-prototypes -Wnested-externs -Wold-style-definition @gol 241-Wstrict-prototypes -Wtraditional @gol 242-Wdeclaration-after-statement -Wpointer-sign} 243 244@item Debugging Options 245@xref{Debugging Options,,Options for Debugging Your Program or GCC}. 246@gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol 247-fdump-noaddr -fdump-unnumbered -fdump-translation-unit@r{[}-@var{n}@r{]} @gol 248-fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol 249-fdump-ipa-all -fdump-ipa-cgraph @gol 250-fdump-tree-all @gol 251-fdump-tree-original@r{[}-@var{n}@r{]} @gol 252-fdump-tree-optimized@r{[}-@var{n}@r{]} @gol 253-fdump-tree-inlined@r{[}-@var{n}@r{]} @gol 254-fdump-tree-cfg -fdump-tree-vcg -fdump-tree-alias @gol 255-fdump-tree-ch @gol 256-fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol 257-fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol 258-fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol 259-fdump-tree-dom@r{[}-@var{n}@r{]} @gol 260-fdump-tree-dse@r{[}-@var{n}@r{]} @gol 261-fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol 262-fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol 263-fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol 264-fdump-tree-nrv -fdump-tree-vect @gol 265-fdump-tree-sink @gol 266-fdump-tree-sra@r{[}-@var{n}@r{]} @gol 267-fdump-tree-salias @gol 268-fdump-tree-fre@r{[}-@var{n}@r{]} @gol 269-fdump-tree-vrp@r{[}-@var{n}@r{]} @gol 270-ftree-vectorizer-verbose=@var{n} @gol 271-fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol 272-feliminate-dwarf2-dups -feliminate-unused-debug-types @gol 273-feliminate-unused-debug-symbols -femit-class-debug-always @gol 274-fmem-report -fprofile-arcs @gol 275-frandom-seed=@var{string} -fsched-verbose=@var{n} @gol 276-ftest-coverage -ftime-report -fvar-tracking @gol 277-g -g@var{level} -gcoff -gdwarf-2 @gol 278-ggdb -gstabs -gstabs+ -gvms -gxcoff -gxcoff+ @gol 279-femit-struct-debug-baseonly -femit-struct-debug-reduced @gol 280-femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol 281-p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol 282-print-multi-directory -print-multi-lib @gol 283-print-prog-name=@var{program} -print-search-dirs -Q @gol 284-save-temps -time} 285 286@item Optimization Options 287@xref{Optimize Options,,Options that Control Optimization}. 288@gccoptlist{-falign-functions=@var{n} -falign-jumps=@var{n} @gol 289-falign-labels=@var{n} -falign-loops=@var{n} @gol 290-fbounds-check -fmudflap -fmudflapth -fmudflapir @gol 291-fbranch-probabilities -fprofile-values -fvpt -fbranch-target-load-optimize @gol 292-fbranch-target-load-optimize2 -fbtr-bb-exclusive @gol 293-fcaller-saves -fcprop-registers -fcse-follow-jumps @gol 294-fcse-skip-blocks -fcx-limited-range -fdata-sections @gol 295-fdelayed-branch -fdelete-null-pointer-checks -fearly-inlining @gol 296-fexpensive-optimizations -ffast-math -ffloat-store @gol 297-fforce-addr -ffunction-sections @gol 298-fgcse -fgcse-lm -fgcse-sm -fgcse-las -fgcse-after-reload @gol 299-fcrossjumping -fif-conversion -fif-conversion2 @gol 300-finline-functions -finline-functions-called-once @gol 301-finline-limit=@var{n} -fkeep-inline-functions @gol 302-fkeep-static-consts -fmerge-constants -fmerge-all-constants @gol 303-fmodulo-sched -fno-branch-count-reg @gol 304-fno-default-inline -fno-defer-pop -fmove-loop-invariants @gol 305-fno-function-cse -fno-guess-branch-probability @gol 306-fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol 307-funsafe-math-optimizations -funsafe-loop-optimizations -ffinite-math-only @gol 308-fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol 309-fomit-frame-pointer -foptimize-register-move @gol 310-foptimize-sibling-calls -fprefetch-loop-arrays @gol 311-fprofile-generate -fprofile-use @gol 312-fregmove -frename-registers @gol 313-freorder-blocks -freorder-blocks-and-partition -freorder-functions @gol 314-frerun-cse-after-loop @gol 315-frounding-math -frtl-abstract-sequences @gol 316-fschedule-insns -fschedule-insns2 @gol 317-fno-sched-interblock -fno-sched-spec -fsched-spec-load @gol 318-fsched-spec-load-dangerous @gol 319-fsched-stalled-insns=@var{n} -fsched-stalled-insns-dep=@var{n} @gol 320-fsched2-use-superblocks @gol 321-fsched2-use-traces -fsee -freschedule-modulo-scheduled-loops @gol 322-fsection-anchors -fsignaling-nans -fsingle-precision-constant @gol 323-fstack-protector -fstack-protector-all @gol 324-fstrict-aliasing -fstrict-overflow -ftracer -fthread-jumps @gol 325-funroll-all-loops -funroll-loops -fpeel-loops @gol 326-fsplit-ivs-in-unroller -funswitch-loops @gol 327-fvariable-expansion-in-unroller @gol 328-ftree-pre -ftree-ccp -ftree-dce -ftree-loop-optimize @gol 329-ftree-loop-linear -ftree-loop-im -ftree-loop-ivcanon -fivopts @gol 330-ftree-dominator-opts -ftree-dse -ftree-copyrename -ftree-sink @gol 331-ftree-ch -ftree-sra -ftree-ter -ftree-lrs -ftree-fre -ftree-vectorize @gol 332-ftree-vect-loop-version -ftree-salias -fipa-pta -fweb @gol 333-ftree-copy-prop -ftree-store-ccp -ftree-store-copy-prop -fwhole-program @gol 334--param @var{name}=@var{value} 335-O -O0 -O1 -O2 -O3 -Os} 336 337@item Preprocessor Options 338@xref{Preprocessor Options,,Options Controlling the Preprocessor}. 339@gccoptlist{-A@var{question}=@var{answer} @gol 340-A-@var{question}@r{[}=@var{answer}@r{]} @gol 341-C -dD -dI -dM -dN @gol 342-D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol 343-idirafter @var{dir} @gol 344-include @var{file} -imacros @var{file} @gol 345-iprefix @var{file} -iwithprefix @var{dir} @gol 346-iwithprefixbefore @var{dir} -isystem @var{dir} @gol 347-imultilib @var{dir} -isysroot @var{dir} @gol 348-M -MM -MF -MG -MP -MQ -MT -nostdinc @gol 349-P -fworking-directory -remap @gol 350-trigraphs -undef -U@var{macro} -Wp,@var{option} @gol 351-Xpreprocessor @var{option}} 352 353@item Assembler Option 354@xref{Assembler Options,,Passing Options to the Assembler}. 355@gccoptlist{-Wa,@var{option} -Xassembler @var{option}} 356 357@item Linker Options 358@xref{Link Options,,Options for Linking}. 359@gccoptlist{@var{object-file-name} -l@var{library} @gol 360-nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol 361-s -static -static-libgcc -shared -shared-libgcc -symbolic @gol 362-Wl,@var{option} -Xlinker @var{option} @gol 363-u @var{symbol}} 364 365@item Directory Options 366@xref{Directory Options,,Options for Directory Search}. 367@gccoptlist{-B@var{prefix} -I@var{dir} -iquote@var{dir} -L@var{dir} 368-specs=@var{file} -I- --sysroot=@var{dir}} 369 370@item Target Options 371@c I wrote this xref this way to avoid overfull hbox. -- rms 372@xref{Target Options}. 373@gccoptlist{-V @var{version} -b @var{machine}} 374 375@item Machine Dependent Options 376@xref{Submodel Options,,Hardware Models and Configurations}. 377@c This list is ordered alphanumerically by subsection name. 378@c Try and put the significant identifier (CPU or system) first, 379@c so users have a clue at guessing where the ones they want will be. 380 381@emph{ARC Options} 382@gccoptlist{-EB -EL @gol 383-mmangle-cpu -mcpu=@var{cpu} -mtext=@var{text-section} @gol 384-mdata=@var{data-section} -mrodata=@var{readonly-data-section}} 385 386@emph{ARM Options} 387@gccoptlist{-mapcs-frame -mno-apcs-frame @gol 388-mabi=@var{name} @gol 389-mapcs-stack-check -mno-apcs-stack-check @gol 390-mapcs-float -mno-apcs-float @gol 391-mapcs-reentrant -mno-apcs-reentrant @gol 392-msched-prolog -mno-sched-prolog @gol 393-mlittle-endian -mbig-endian -mwords-little-endian @gol 394-mfloat-abi=@var{name} -msoft-float -mhard-float -mfpe @gol 395-mthumb-interwork -mno-thumb-interwork @gol 396-mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol 397-mstructure-size-boundary=@var{n} @gol 398-mabort-on-noreturn @gol 399-mlong-calls -mno-long-calls @gol 400-msingle-pic-base -mno-single-pic-base @gol 401-mpic-register=@var{reg} @gol 402-mnop-fun-dllimport @gol 403-mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol 404-mpoke-function-name @gol 405-mthumb -marm @gol 406-mtpcs-frame -mtpcs-leaf-frame @gol 407-mcaller-super-interworking -mcallee-super-interworking @gol 408-mtp=@var{name}} 409 410@emph{AVR Options} 411@gccoptlist{-mmcu=@var{mcu} -msize -minit-stack=@var{n} -mno-interrupts @gol 412-mcall-prologues -mno-tablejump -mtiny-stack -mint8} 413 414@emph{Blackfin Options} 415@gccoptlist{-momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol 416-mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol 417-mlow-64k -mno-low64k -mid-shared-library @gol 418-mno-id-shared-library -mshared-library-id=@var{n} @gol 419-mlong-calls -mno-long-calls} 420 421@emph{CRIS Options} 422@gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol 423-mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol 424-metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol 425-mstack-align -mdata-align -mconst-align @gol 426-m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol 427-melf -maout -melinux -mlinux -sim -sim2 @gol 428-mmul-bug-workaround -mno-mul-bug-workaround} 429 430@emph{CRX Options} 431@gccoptlist{-mmac -mpush-args} 432 433@emph{Darwin Options} 434@gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol 435-arch_only -bind_at_load -bundle -bundle_loader @gol 436-client_name -compatibility_version -current_version @gol 437-dead_strip @gol 438-dependency-file -dylib_file -dylinker_install_name @gol 439-dynamic -dynamiclib -exported_symbols_list @gol 440-filelist -flat_namespace -force_cpusubtype_ALL @gol 441-force_flat_namespace -headerpad_max_install_names @gol 442-image_base -init -install_name -keep_private_externs @gol 443-multi_module -multiply_defined -multiply_defined_unused @gol 444-noall_load -no_dead_strip_inits_and_terms @gol 445-nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol 446-pagezero_size -prebind -prebind_all_twolevel_modules @gol 447-private_bundle -read_only_relocs -sectalign @gol 448-sectobjectsymbols -whyload -seg1addr @gol 449-sectcreate -sectobjectsymbols -sectorder @gol 450-segaddr -segs_read_only_addr -segs_read_write_addr @gol 451-seg_addr_table -seg_addr_table_filename -seglinkedit @gol 452-segprot -segs_read_only_addr -segs_read_write_addr @gol 453-single_module -static -sub_library -sub_umbrella @gol 454-twolevel_namespace -umbrella -undefined @gol 455-unexported_symbols_list -weak_reference_mismatches @gol 456-whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol 457-mkernel -mone-byte-bool} 458 459@emph{DEC Alpha Options} 460@gccoptlist{-mno-fp-regs -msoft-float -malpha-as -mgas @gol 461-mieee -mieee-with-inexact -mieee-conformant @gol 462-mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol 463-mtrap-precision=@var{mode} -mbuild-constants @gol 464-mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol 465-mbwx -mmax -mfix -mcix @gol 466-mfloat-vax -mfloat-ieee @gol 467-mexplicit-relocs -msmall-data -mlarge-data @gol 468-msmall-text -mlarge-text @gol 469-mmemory-latency=@var{time}} 470 471@emph{DEC Alpha/VMS Options} 472@gccoptlist{-mvms-return-codes} 473 474@emph{FRV Options} 475@gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol 476-mhard-float -msoft-float @gol 477-malloc-cc -mfixed-cc -mdword -mno-dword @gol 478-mdouble -mno-double @gol 479-mmedia -mno-media -mmuladd -mno-muladd @gol 480-mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol 481-mlinked-fp -mlong-calls -malign-labels @gol 482-mlibrary-pic -macc-4 -macc-8 @gol 483-mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol 484-moptimize-membar -mno-optimize-membar @gol 485-mscc -mno-scc -mcond-exec -mno-cond-exec @gol 486-mvliw-branch -mno-vliw-branch @gol 487-mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol 488-mno-nested-cond-exec -mtomcat-stats @gol 489-mTLS -mtls @gol 490-mcpu=@var{cpu}} 491 492@emph{GNU/Linux Options} 493@gccoptlist{-muclibc} 494 495@emph{H8/300 Options} 496@gccoptlist{-mrelax -mh -ms -mn -mint32 -malign-300} 497 498@emph{HPPA Options} 499@gccoptlist{-march=@var{architecture-type} @gol 500-mbig-switch -mdisable-fpregs -mdisable-indexing @gol 501-mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol 502-mfixed-range=@var{register-range} @gol 503-mjump-in-delay -mlinker-opt -mlong-calls @gol 504-mlong-load-store -mno-big-switch -mno-disable-fpregs @gol 505-mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol 506-mno-jump-in-delay -mno-long-load-store @gol 507-mno-portable-runtime -mno-soft-float @gol 508-mno-space-regs -msoft-float -mpa-risc-1-0 @gol 509-mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol 510-mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol 511-munix=@var{unix-std} -nolibdld -static -threads} 512 513@emph{i386 and x86-64 Options} 514@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol 515-mfpmath=@var{unit} @gol 516-masm=@var{dialect} -mno-fancy-math-387 @gol 517-mno-fp-ret-in-387 -msoft-float -msvr3-shlib @gol 518-mno-wide-multiply -mrtd -malign-double @gol 519-mpreferred-stack-boundary=@var{num} @gol 520-mmmx -msse -msse2 -msse3 -mssse3 -msse4a -m3dnow -mpopcnt -mabm -maes @gol 521-mthreads -mno-align-stringops -minline-all-stringops @gol 522-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol 523-m96bit-long-double -mregparm=@var{num} -msseregparm @gol 524-mstackrealign @gol 525-momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol 526-mcmodel=@var{code-model} @gol 527-m32 -m64 -mlarge-data-threshold=@var{num}} 528 529@emph{IA-64 Options} 530@gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol 531-mvolatile-asm-stop -mregister-names -mno-sdata @gol 532-mconstant-gp -mauto-pic -minline-float-divide-min-latency @gol 533-minline-float-divide-max-throughput @gol 534-minline-int-divide-min-latency @gol 535-minline-int-divide-max-throughput @gol 536-minline-sqrt-min-latency -minline-sqrt-max-throughput @gol 537-mno-dwarf2-asm -mearly-stop-bits @gol 538-mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol 539-mtune=@var{cpu-type} -mt -pthread -milp32 -mlp64 @gol 540-mno-sched-br-data-spec -msched-ar-data-spec -mno-sched-control-spec @gol 541-msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol 542-msched-ldc -mno-sched-control-ldc -mno-sched-spec-verbose @gol 543-mno-sched-prefer-non-data-spec-insns @gol 544-mno-sched-prefer-non-control-spec-insns @gol 545-mno-sched-count-spec-in-critical-path} 546 547@emph{M32R/D Options} 548@gccoptlist{-m32r2 -m32rx -m32r @gol 549-mdebug @gol 550-malign-loops -mno-align-loops @gol 551-missue-rate=@var{number} @gol 552-mbranch-cost=@var{number} @gol 553-mmodel=@var{code-size-model-type} @gol 554-msdata=@var{sdata-type} @gol 555-mno-flush-func -mflush-func=@var{name} @gol 556-mno-flush-trap -mflush-trap=@var{number} @gol 557-G @var{num}} 558 559@emph{M32C Options} 560@gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}} 561 562@emph{M680x0 Options} 563@gccoptlist{-m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol 564-m68060 -mcpu32 -m5200 -mcfv4e -m68881 -mbitfield @gol 565-mc68000 -mc68020 @gol 566-mnobitfield -mrtd -mshort -msoft-float -mpcrel @gol 567-malign-int -mstrict-align -msep-data -mno-sep-data @gol 568-mshared-library-id=n -mid-shared-library -mno-id-shared-library} 569 570@emph{M68hc1x Options} 571@gccoptlist{-m6811 -m6812 -m68hc11 -m68hc12 -m68hcs12 @gol 572-mauto-incdec -minmax -mlong-calls -mshort @gol 573-msoft-reg-count=@var{count}} 574 575@emph{MCore Options} 576@gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol 577-mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol 578-m4byte-functions -mno-4byte-functions -mcallgraph-data @gol 579-mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol 580-mlittle-endian -mbig-endian -m210 -m340 -mstack-increment} 581 582@emph{MIPS Options} 583@gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol 584-mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips64 @gol 585-mips16 -mno-mips16 -mabi=@var{abi} -mabicalls -mno-abicalls @gol 586-mshared -mno-shared -mxgot -mno-xgot -mgp32 -mgp64 @gol 587-mfp32 -mfp64 -mhard-float -msoft-float @gol 588-msingle-float -mdouble-float -mdsp -mpaired-single -mips3d @gol 589-mlong64 -mlong32 -msym32 -mno-sym32 @gol 590-G@var{num} -membedded-data -mno-embedded-data @gol 591-muninit-const-in-rodata -mno-uninit-const-in-rodata @gol 592-msplit-addresses -mno-split-addresses @gol 593-mexplicit-relocs -mno-explicit-relocs @gol 594-mcheck-zero-division -mno-check-zero-division @gol 595-mdivide-traps -mdivide-breaks @gol 596-mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol 597-mmad -mno-mad -mfused-madd -mno-fused-madd -nocpp @gol 598-mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol 599-mfix-vr4120 -mno-fix-vr4120 -mfix-vr4130 @gol 600-mfix-sb1 -mno-fix-sb1 @gol 601-mflush-func=@var{func} -mno-flush-func @gol 602-mbranch-likely -mno-branch-likely @gol 603-mfp-exceptions -mno-fp-exceptions @gol 604-mvr4130-align -mno-vr4130-align} 605 606@emph{MMIX Options} 607@gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol 608-mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol 609-melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol 610-mno-base-addresses -msingle-exit -mno-single-exit} 611 612@emph{MN10300 Options} 613@gccoptlist{-mmult-bug -mno-mult-bug @gol 614-mam33 -mno-am33 @gol 615-mam33-2 -mno-am33-2 @gol 616-mreturn-pointer-on-d0 @gol 617-mno-crt0 -mrelax} 618 619@emph{MT Options} 620@gccoptlist{-mno-crt0 -mbacc -msim @gol 621-march=@var{cpu-type} } 622 623@emph{PDP-11 Options} 624@gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol 625-mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol 626-mint16 -mno-int32 -mfloat32 -mno-float64 @gol 627-mfloat64 -mno-float32 -mabshi -mno-abshi @gol 628-mbranch-expensive -mbranch-cheap @gol 629-msplit -mno-split -munix-asm -mdec-asm} 630 631@emph{PowerPC Options} 632See RS/6000 and PowerPC Options. 633 634@emph{RS/6000 and PowerPC Options} 635@gccoptlist{-mcpu=@var{cpu-type} @gol 636-mtune=@var{cpu-type} @gol 637-mpower -mno-power -mpower2 -mno-power2 @gol 638-mpowerpc -mpowerpc64 -mno-powerpc @gol 639-maltivec -mno-altivec @gol 640-mpowerpc-gpopt -mno-powerpc-gpopt @gol 641-mpowerpc-gfxopt -mno-powerpc-gfxopt @gol 642-mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mfprnd -mno-fprnd @gol 643-mnew-mnemonics -mold-mnemonics @gol 644-mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol 645-m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol 646-malign-power -malign-natural @gol 647-msoft-float -mhard-float -mmultiple -mno-multiple @gol 648-mstring -mno-string -mupdate -mno-update @gol 649-mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol 650-mstrict-align -mno-strict-align -mrelocatable @gol 651-mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol 652-mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol 653-mdynamic-no-pic -maltivec -mswdiv @gol 654-mprioritize-restricted-insns=@var{priority} @gol 655-msched-costly-dep=@var{dependence_type} @gol 656-minsert-sched-nops=@var{scheme} @gol 657-mcall-sysv -mcall-netbsd @gol 658-maix-struct-return -msvr4-struct-return @gol 659-mabi=@var{abi-type} -msecure-plt -mbss-plt @gol 660-misel -mno-isel @gol 661-misel=yes -misel=no @gol 662-mspe -mno-spe @gol 663-mspe=yes -mspe=no @gol 664-mvrsave -mno-vrsave @gol 665-mmulhw -mno-mulhw @gol 666-mdlmzb -mno-dlmzb @gol 667-mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol 668-mprototype -mno-prototype @gol 669-msim -mmvme -mads -myellowknife -memb -msdata @gol 670-msdata=@var{opt} -mvxworks -mwindiss -G @var{num} -pthread} 671 672@emph{S/390 and zSeries Options} 673@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol 674-mhard-float -msoft-float -mlong-double-64 -mlong-double-128 @gol 675-mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol 676-msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol 677-m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol 678-mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol 679-mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard} 680 681@emph{Score Options} 682@gccoptlist{-meb -mel @gol 683-mnhwloop @gol 684-muls @gol 685-mmac @gol 686-mscore5 -mscore5u -mscore7 -mscore7d} 687 688@emph{SH Options} 689@gccoptlist{-m1 -m2 -m2e -m3 -m3e @gol 690-m4-nofpu -m4-single-only -m4-single -m4 @gol 691-m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol 692-m5-64media -m5-64media-nofpu @gol 693-m5-32media -m5-32media-nofpu @gol 694-m5-compact -m5-compact-nofpu @gol 695-mb -ml -mdalign -mrelax @gol 696-mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol 697-mieee -misize -mpadstruct -mspace @gol 698-mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol 699-mdivsi3_libfunc=@var{name} @gol 700-madjust-unroll -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol 701 -minvalid-symbols} 702 703@emph{SPARC Options} 704@gccoptlist{-mcpu=@var{cpu-type} @gol 705-mtune=@var{cpu-type} @gol 706-mcmodel=@var{code-model} @gol 707-m32 -m64 -mapp-regs -mno-app-regs @gol 708-mfaster-structs -mno-faster-structs @gol 709-mfpu -mno-fpu -mhard-float -msoft-float @gol 710-mhard-quad-float -msoft-quad-float @gol 711-mimpure-text -mno-impure-text -mlittle-endian @gol 712-mstack-bias -mno-stack-bias @gol 713-munaligned-doubles -mno-unaligned-doubles @gol 714-mv8plus -mno-v8plus -mvis -mno-vis 715-threads -pthreads -pthread} 716 717@emph{System V Options} 718@gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}} 719 720@emph{TMS320C3x/C4x Options} 721@gccoptlist{-mcpu=@var{cpu} -mbig -msmall -mregparm -mmemparm @gol 722-mfast-fix -mmpyi -mbk -mti -mdp-isr-reload @gol 723-mrpts=@var{count} -mrptb -mdb -mloop-unsigned @gol 724-mparallel-insns -mparallel-mpy -mpreserve-float} 725 726@emph{V850 Options} 727@gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol 728-mprolog-function -mno-prolog-function -mspace @gol 729-mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol 730-mapp-regs -mno-app-regs @gol 731-mdisable-callt -mno-disable-callt @gol 732-mv850e1 @gol 733-mv850e @gol 734-mv850 -mbig-switch} 735 736@emph{VAX Options} 737@gccoptlist{-mg -mgnu -munix} 738 739@emph{x86-64 Options} 740See i386 and x86-64 Options. 741 742@emph{Xstormy16 Options} 743@gccoptlist{-msim} 744 745@emph{Xtensa Options} 746@gccoptlist{-mconst16 -mno-const16 @gol 747-mfused-madd -mno-fused-madd @gol 748-mtext-section-literals -mno-text-section-literals @gol 749-mtarget-align -mno-target-align @gol 750-mlongcalls -mno-longcalls} 751 752@emph{zSeries Options} 753See S/390 and zSeries Options. 754 755@item Code Generation Options 756@xref{Code Gen Options,,Options for Code Generation Conventions}. 757@gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol 758-ffixed-@var{reg} -fexceptions @gol 759-fnon-call-exceptions -funwind-tables @gol 760-fasynchronous-unwind-tables @gol 761-finhibit-size-directive -finstrument-functions @gol 762-finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol 763-finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @gol 764-fno-common -fno-ident @gol 765-fpcc-struct-return -fpic -fPIC -fpie -fPIE @gol 766-fno-jump-tables @gol 767-freg-struct-return -fshort-enums @gol 768-fshort-double -fshort-wchar @gol 769-fverbose-asm -fpack-struct[=@var{n}] -fstack-check @gol 770-fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol 771-fargument-alias -fargument-noalias @gol 772-fargument-noalias-global -fargument-noalias-anything 773-fleading-underscore -ftls-model=@var{model} @gol 774-ftrapv -fwrapv -fbounds-check @gol 775-fvisibility} 776@end table 777 778@menu 779* Overall Options:: Controlling the kind of output: 780 an executable, object files, assembler files, 781 or preprocessed source. 782* C Dialect Options:: Controlling the variant of C language compiled. 783* C++ Dialect Options:: Variations on C++. 784* Language Independent Options:: Controlling how diagnostics should be 785 formatted. 786* Warning Options:: How picky should the compiler be? 787* Debugging Options:: Symbol tables, measurements, and debugging dumps. 788* Optimize Options:: How much optimization? 789* Preprocessor Options:: Controlling header files and macro definitions. 790 Also, getting dependency information for Make. 791* Assembler Options:: Passing options to the assembler. 792* Link Options:: Specifying libraries and so on. 793* Directory Options:: Where to find header files and libraries. 794 Where to find the compiler executable files. 795* Spec Files:: How to pass switches to sub-processes. 796* Target Options:: Running a cross-compiler, or an old version of GCC. 797@end menu 798 799@node Overall Options 800@section Options Controlling the Kind of Output 801 802Compilation can involve up to four stages: preprocessing, compilation 803proper, assembly and linking, always in that order. GCC is capable of 804preprocessing and compiling several files either into several 805assembler input files, or into one assembler input file; then each 806assembler input file produces an object file, and linking combines all 807the object files (those newly compiled, and those specified as input) 808into an executable file. 809 810@cindex file name suffix 811For any given input file, the file name suffix determines what kind of 812compilation is done: 813 814@table @gcctabopt 815@item @var{file}.c 816C source code which must be preprocessed. 817 818@item @var{file}.i 819C source code which should not be preprocessed. 820 821@item @var{file}.ii 822C++ source code which should not be preprocessed. 823 824@item @var{file}.h 825C, or C++ header file to be turned into a precompiled header. 826 827@item @var{file}.cc 828@itemx @var{file}.cp 829@itemx @var{file}.cxx 830@itemx @var{file}.cpp 831@itemx @var{file}.CPP 832@itemx @var{file}.c++ 833@itemx @var{file}.C 834C++ source code which must be preprocessed. Note that in @samp{.cxx}, 835the last two letters must both be literally @samp{x}. Likewise, 836@samp{.C} refers to a literal capital C@. 837 838@item @var{file}.hh 839@itemx @var{file}.H 840C++ header file to be turned into a precompiled header. 841 842@item @var{file}.f 843@itemx @var{file}.for 844@itemx @var{file}.FOR 845Fixed form Fortran source code which should not be preprocessed. 846 847@item @var{file}.F 848@itemx @var{file}.fpp 849@itemx @var{file}.FPP 850Fixed form Fortran source code which must be preprocessed (with the traditional 851preprocessor). 852 853@item @var{file}.f90 854@itemx @var{file}.f95 855Free form Fortran source code which should not be preprocessed. 856 857@item @var{file}.F90 858@itemx @var{file}.F95 859Free form Fortran source code which must be preprocessed (with the 860traditional preprocessor). 861 862@c FIXME: Descriptions of Java file types. 863@c @var{file}.java 864@c @var{file}.class 865@c @var{file}.zip 866@c @var{file}.jar 867 868@item @var{file}.ads 869Ada source code file which contains a library unit declaration (a 870declaration of a package, subprogram, or generic, or a generic 871instantiation), or a library unit renaming declaration (a package, 872generic, or subprogram renaming declaration). Such files are also 873called @dfn{specs}. 874 875@itemx @var{file}.adb 876Ada source code file containing a library unit body (a subprogram or 877package body). Such files are also called @dfn{bodies}. 878 879@c GCC also knows about some suffixes for languages not yet included: 880@c Pascal: 881@c @var{file}.p 882@c @var{file}.pas 883@c Ratfor: 884@c @var{file}.r 885 886@item @var{file}.s 887Assembler code. 888 889@item @var{file}.S 890Assembler code which must be preprocessed. 891 892@item @var{other} 893An object file to be fed straight into linking. 894Any file name with no recognized suffix is treated this way. 895@end table 896 897@opindex x 898You can specify the input language explicitly with the @option{-x} option: 899 900@table @gcctabopt 901@item -x @var{language} 902Specify explicitly the @var{language} for the following input files 903(rather than letting the compiler choose a default based on the file 904name suffix). This option applies to all following input files until 905the next @option{-x} option. Possible values for @var{language} are: 906@smallexample 907c c-header c-cpp-output 908c++ c++-header c++-cpp-output 909assembler assembler-with-cpp 910ada 911f95 f95-cpp-input 912java 913treelang 914@end smallexample 915 916@item -x none 917Turn off any specification of a language, so that subsequent files are 918handled according to their file name suffixes (as they are if @option{-x} 919has not been used at all). 920 921@item -pass-exit-codes 922@opindex pass-exit-codes 923Normally the @command{gcc} program will exit with the code of 1 if any 924phase of the compiler returns a non-success return code. If you specify 925@option{-pass-exit-codes}, the @command{gcc} program will instead return with 926numerically highest error produced by any phase that returned an error 927indication. The C, C++, and Fortran frontends return 4, if an internal 928compiler error is encountered. 929@end table 930 931If you only want some of the stages of compilation, you can use 932@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and 933one of the options @option{-c}, @option{-S}, or @option{-E} to say where 934@command{gcc} is to stop. Note that some combinations (for example, 935@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all. 936 937@table @gcctabopt 938@item -c 939@opindex c 940Compile or assemble the source files, but do not link. The linking 941stage simply is not done. The ultimate output is in the form of an 942object file for each source file. 943 944By default, the object file name for a source file is made by replacing 945the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}. 946 947Unrecognized input files, not requiring compilation or assembly, are 948ignored. 949 950@item -S 951@opindex S 952Stop after the stage of compilation proper; do not assemble. The output 953is in the form of an assembler code file for each non-assembler input 954file specified. 955 956By default, the assembler file name for a source file is made by 957replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}. 958 959Input files that don't require compilation are ignored. 960 961@item -E 962@opindex E 963Stop after the preprocessing stage; do not run the compiler proper. The 964output is in the form of preprocessed source code, which is sent to the 965standard output. 966 967Input files which don't require preprocessing are ignored. 968 969@cindex output file option 970@item -o @var{file} 971@opindex o 972Place output in file @var{file}. This applies regardless to whatever 973sort of output is being produced, whether it be an executable file, 974an object file, an assembler file or preprocessed C code. 975 976If @option{-o} is not specified, the default is to put an executable 977file in @file{a.out}, the object file for 978@file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its 979assembler file in @file{@var{source}.s}, a precompiled header file in 980@file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on 981standard output. 982 983@item -v 984@opindex v 985Print (on standard error output) the commands executed to run the stages 986of compilation. Also print the version number of the compiler driver 987program and of the preprocessor and the compiler proper. 988 989@item -### 990@opindex ### 991Like @option{-v} except the commands are not executed and all command 992arguments are quoted. This is useful for shell scripts to capture the 993driver-generated command lines. 994 995@item -pipe 996@opindex pipe 997Use pipes rather than temporary files for communication between the 998various stages of compilation. This fails to work on some systems where 999the assembler is unable to read from a pipe; but the GNU assembler has 1000no trouble. 1001 1002@item -combine 1003@opindex combine 1004If you are compiling multiple source files, this option tells the driver 1005to pass all the source files to the compiler at once (for those 1006languages for which the compiler can handle this). This will allow 1007intermodule analysis (IMA) to be performed by the compiler. Currently the only 1008language for which this is supported is C@. If you pass source files for 1009multiple languages to the driver, using this option, the driver will invoke 1010the compiler(s) that support IMA once each, passing each compiler all the 1011source files appropriate for it. For those languages that do not support 1012IMA this option will be ignored, and the compiler will be invoked once for 1013each source file in that language. If you use this option in conjunction 1014with @option{-save-temps}, the compiler will generate multiple 1015pre-processed files 1016(one for each source file), but only one (combined) @file{.o} or 1017@file{.s} file. 1018 1019@item --help 1020@opindex help 1021Print (on the standard output) a description of the command line options 1022understood by @command{gcc}. If the @option{-v} option is also specified 1023then @option{--help} will also be passed on to the various processes 1024invoked by @command{gcc}, so that they can display the command line options 1025they accept. If the @option{-Wextra} option is also specified then command 1026line options which have no documentation associated with them will also 1027be displayed. 1028 1029@item --target-help 1030@opindex target-help 1031Print (on the standard output) a description of target specific command 1032line options for each tool. 1033 1034@item --version 1035@opindex version 1036Display the version number and copyrights of the invoked GCC@. 1037 1038@include @value{srcdir}/../libiberty/at-file.texi 1039@end table 1040 1041@node Invoking G++ 1042@section Compiling C++ Programs 1043 1044@cindex suffixes for C++ source 1045@cindex C++ source file suffixes 1046C++ source files conventionally use one of the suffixes @samp{.C}, 1047@samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or 1048@samp{.cxx}; C++ header files often use @samp{.hh} or @samp{.H}; and 1049preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes 1050files with these names and compiles them as C++ programs even if you 1051call the compiler the same way as for compiling C programs (usually 1052with the name @command{gcc}). 1053 1054@findex g++ 1055@findex c++ 1056However, the use of @command{gcc} does not add the C++ library. 1057@command{g++} is a program that calls GCC and treats @samp{.c}, 1058@samp{.h} and @samp{.i} files as C++ source files instead of C source 1059files unless @option{-x} is used, and automatically specifies linking 1060against the C++ library. This program is also useful when 1061precompiling a C header file with a @samp{.h} extension for use in C++ 1062compilations. On many systems, @command{g++} is also installed with 1063the name @command{c++}. 1064 1065@cindex invoking @command{g++} 1066When you compile C++ programs, you may specify many of the same 1067command-line options that you use for compiling programs in any 1068language; or command-line options meaningful for C and related 1069languages; or options that are meaningful only for C++ programs. 1070@xref{C Dialect Options,,Options Controlling C Dialect}, for 1071explanations of options for languages related to C@. 1072@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for 1073explanations of options that are meaningful only for C++ programs. 1074 1075@node C Dialect Options 1076@section Options Controlling C Dialect 1077@cindex dialect options 1078@cindex language dialect options 1079@cindex options, dialect 1080 1081The following options control the dialect of C (or languages derived 1082from C, such as C++) that the compiler accepts: 1083 1084@table @gcctabopt 1085@cindex ANSI support 1086@cindex ISO support 1087@item -ansi 1088@opindex ansi 1089In C mode, support all ISO C90 programs. In C++ mode, 1090remove GNU extensions that conflict with ISO C++. 1091 1092This turns off certain features of GCC that are incompatible with ISO 1093C90 (when compiling C code), or of standard C++ (when compiling C++ code), 1094such as the @code{asm} and @code{typeof} keywords, and 1095predefined macros such as @code{unix} and @code{vax} that identify the 1096type of system you are using. It also enables the undesirable and 1097rarely used ISO trigraph feature. For the C compiler, 1098it disables recognition of C++ style @samp{//} comments as well as 1099the @code{inline} keyword. 1100 1101The alternate keywords @code{__asm__}, @code{__extension__}, 1102@code{__inline__} and @code{__typeof__} continue to work despite 1103@option{-ansi}. You would not want to use them in an ISO C program, of 1104course, but it is useful to put them in header files that might be included 1105in compilations done with @option{-ansi}. Alternate predefined macros 1106such as @code{__unix__} and @code{__vax__} are also available, with or 1107without @option{-ansi}. 1108 1109The @option{-ansi} option does not cause non-ISO programs to be 1110rejected gratuitously. For that, @option{-pedantic} is required in 1111addition to @option{-ansi}. @xref{Warning Options}. 1112 1113The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi} 1114option is used. Some header files may notice this macro and refrain 1115from declaring certain functions or defining certain macros that the 1116ISO standard doesn't call for; this is to avoid interfering with any 1117programs that might use these names for other things. 1118 1119Functions which would normally be built in but do not have semantics 1120defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in 1121functions with @option{-ansi} is used. @xref{Other Builtins,,Other 1122built-in functions provided by GCC}, for details of the functions 1123affected. 1124 1125@item -std= 1126@opindex std 1127Determine the language standard. This option is currently only 1128supported when compiling C or C++. A value for this option must be 1129provided; possible values are 1130 1131@table @samp 1132@item c89 1133@itemx iso9899:1990 1134ISO C90 (same as @option{-ansi}). 1135 1136@item iso9899:199409 1137ISO C90 as modified in amendment 1. 1138 1139@item c99 1140@itemx c9x 1141@itemx iso9899:1999 1142@itemx iso9899:199x 1143ISO C99. Note that this standard is not yet fully supported; see 1144@w{@uref{http://gcc.gnu.org/gcc-4.2/c99status.html}} for more information. The 1145names @samp{c9x} and @samp{iso9899:199x} are deprecated. 1146 1147@item gnu89 1148Default, ISO C90 plus GNU extensions (including some C99 features). 1149 1150@item gnu99 1151@itemx gnu9x 1152ISO C99 plus GNU extensions. When ISO C99 is fully implemented in GCC, 1153this will become the default. The name @samp{gnu9x} is deprecated. 1154 1155@item c++98 1156The 1998 ISO C++ standard plus amendments. 1157 1158@item gnu++98 1159The same as @option{-std=c++98} plus GNU extensions. This is the 1160default for C++ code. 1161@end table 1162 1163Even when this option is not specified, you can still use some of the 1164features of newer standards in so far as they do not conflict with 1165previous C standards. For example, you may use @code{__restrict__} even 1166when @option{-std=c99} is not specified. 1167 1168The @option{-std} options specifying some version of ISO C have the same 1169effects as @option{-ansi}, except that features that were not in ISO C90 1170but are in the specified version (for example, @samp{//} comments and 1171the @code{inline} keyword in ISO C99) are not disabled. 1172 1173@xref{Standards,,Language Standards Supported by GCC}, for details of 1174these standard versions. 1175 1176@item -fgnu89-inline 1177@opindex fgnu89-inline 1178The option @option{-fgnu89-inline} tells GCC to use the traditional 1179GNU semantics for @code{inline} functions when in C99 mode. 1180@xref{Inline,,An Inline Function is As Fast As a Macro}. Using this 1181option is roughly equivalent to adding the @code{gnu_inline} function 1182attribute to all inline functions (@pxref{Function Attributes}). 1183 1184This option is accepted by GCC versions 4.1.3 and up. In GCC versions 1185prior to 4.3, C99 inline semantics are not supported, and thus this 1186option is effectively assumed to be present regardless of whether or not 1187it is specified; the only effect of specifying it explicitly is to 1188disable warnings about using inline functions in C99 mode. Likewise, 1189the option @option{-fno-gnu89-inline} is not supported in versions of 1190GCC before 4.3. It will be supported only in C99 or gnu99 mode, not in 1191C89 or gnu89 mode. 1192 1193The preprocesor macros @code{__GNUC_GNU_INLINE__} and 1194@code{__GNUC_STDC_INLINE__} may be used to check which semantics are 1195in effect for @code{inline} functions. @xref{Common Predefined 1196Macros,,,cpp,The C Preprocessor}. 1197 1198@item -aux-info @var{filename} 1199@opindex aux-info 1200Output to the given filename prototyped declarations for all functions 1201declared and/or defined in a translation unit, including those in header 1202files. This option is silently ignored in any language other than C@. 1203 1204Besides declarations, the file indicates, in comments, the origin of 1205each declaration (source file and line), whether the declaration was 1206implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or 1207@samp{O} for old, respectively, in the first character after the line 1208number and the colon), and whether it came from a declaration or a 1209definition (@samp{C} or @samp{F}, respectively, in the following 1210character). In the case of function definitions, a K&R-style list of 1211arguments followed by their declarations is also provided, inside 1212comments, after the declaration. 1213 1214@item -fno-asm 1215@opindex fno-asm 1216Do not recognize @code{asm}, @code{inline} or @code{typeof} as a 1217keyword, so that code can use these words as identifiers. You can use 1218the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__} 1219instead. @option{-ansi} implies @option{-fno-asm}. 1220 1221In C++, this switch only affects the @code{typeof} keyword, since 1222@code{asm} and @code{inline} are standard keywords. You may want to 1223use the @option{-fno-gnu-keywords} flag instead, which has the same 1224effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this 1225switch only affects the @code{asm} and @code{typeof} keywords, since 1226@code{inline} is a standard keyword in ISO C99. 1227 1228@item -fno-builtin 1229@itemx -fno-builtin-@var{function} 1230@opindex fno-builtin 1231@cindex built-in functions 1232Don't recognize built-in functions that do not begin with 1233@samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in 1234functions provided by GCC}, for details of the functions affected, 1235including those which are not built-in functions when @option{-ansi} or 1236@option{-std} options for strict ISO C conformance are used because they 1237do not have an ISO standard meaning. 1238 1239GCC normally generates special code to handle certain built-in functions 1240more efficiently; for instance, calls to @code{alloca} may become single 1241instructions that adjust the stack directly, and calls to @code{memcpy} 1242may become inline copy loops. The resulting code is often both smaller 1243and faster, but since the function calls no longer appear as such, you 1244cannot set a breakpoint on those calls, nor can you change the behavior 1245of the functions by linking with a different library. In addition, 1246when a function is recognized as a built-in function, GCC may use 1247information about that function to warn about problems with calls to 1248that function, or to generate more efficient code, even if the 1249resulting code still contains calls to that function. For example, 1250warnings are given with @option{-Wformat} for bad calls to 1251@code{printf}, when @code{printf} is built in, and @code{strlen} is 1252known not to modify global memory. 1253 1254With the @option{-fno-builtin-@var{function}} option 1255only the built-in function @var{function} is 1256disabled. @var{function} must not begin with @samp{__builtin_}. If a 1257function is named this is not built-in in this version of GCC, this 1258option is ignored. There is no corresponding 1259@option{-fbuiltin-@var{function}} option; if you wish to enable 1260built-in functions selectively when using @option{-fno-builtin} or 1261@option{-ffreestanding}, you may define macros such as: 1262 1263@smallexample 1264#define abs(n) __builtin_abs ((n)) 1265#define strcpy(d, s) __builtin_strcpy ((d), (s)) 1266@end smallexample 1267 1268@item -fhosted 1269@opindex fhosted 1270@cindex hosted environment 1271 1272Assert that compilation takes place in a hosted environment. This implies 1273@option{-fbuiltin}. A hosted environment is one in which the 1274entire standard library is available, and in which @code{main} has a return 1275type of @code{int}. Examples are nearly everything except a kernel. 1276This is equivalent to @option{-fno-freestanding}. 1277 1278@item -ffreestanding 1279@opindex ffreestanding 1280@cindex hosted environment 1281 1282Assert that compilation takes place in a freestanding environment. This 1283implies @option{-fno-builtin}. A freestanding environment 1284is one in which the standard library may not exist, and program startup may 1285not necessarily be at @code{main}. The most obvious example is an OS kernel. 1286This is equivalent to @option{-fno-hosted}. 1287 1288@xref{Standards,,Language Standards Supported by GCC}, for details of 1289freestanding and hosted environments. 1290 1291@item -fopenmp 1292@opindex fopenmp 1293@cindex openmp parallel 1294Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and 1295@code{!$omp} in Fortran. When @option{-fopenmp} is specified, the 1296compiler generates parallel code according to the OpenMP Application 1297Program Interface v2.5 @w{@uref{http://www.openmp.org/}}. 1298 1299@item -fms-extensions 1300@opindex fms-extensions 1301Accept some non-standard constructs used in Microsoft header files. 1302 1303Some cases of unnamed fields in structures and unions are only 1304accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union 1305fields within structs/unions}, for details. 1306 1307@item -trigraphs 1308@opindex trigraphs 1309Support ISO C trigraphs. The @option{-ansi} option (and @option{-std} 1310options for strict ISO C conformance) implies @option{-trigraphs}. 1311 1312@item -no-integrated-cpp 1313@opindex no-integrated-cpp 1314Performs a compilation in two passes: preprocessing and compiling. This 1315option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the 1316@option{-B} option. The user supplied compilation step can then add in 1317an additional preprocessing step after normal preprocessing but before 1318compiling. The default is to use the integrated cpp (internal cpp) 1319 1320The semantics of this option will change if "cc1", "cc1plus", and 1321"cc1obj" are merged. 1322 1323@cindex traditional C language 1324@cindex C language, traditional 1325@item -traditional 1326@itemx -traditional-cpp 1327@opindex traditional-cpp 1328@opindex traditional 1329Formerly, these options caused GCC to attempt to emulate a pre-standard 1330C compiler. They are now only supported with the @option{-E} switch. 1331The preprocessor continues to support a pre-standard mode. See the GNU 1332CPP manual for details. 1333 1334@item -fcond-mismatch 1335@opindex fcond-mismatch 1336Allow conditional expressions with mismatched types in the second and 1337third arguments. The value of such an expression is void. This option 1338is not supported for C++. 1339 1340@item -flax-vector-conversions 1341@opindex flax-vector-conversions 1342Allow implicit conversions between vectors with differing numbers of 1343elements and/or incompatible element types. This option should not be 1344used for new code. 1345 1346@item -funsigned-char 1347@opindex funsigned-char 1348Let the type @code{char} be unsigned, like @code{unsigned char}. 1349 1350Each kind of machine has a default for what @code{char} should 1351be. It is either like @code{unsigned char} by default or like 1352@code{signed char} by default. 1353 1354Ideally, a portable program should always use @code{signed char} or 1355@code{unsigned char} when it depends on the signedness of an object. 1356But many programs have been written to use plain @code{char} and 1357expect it to be signed, or expect it to be unsigned, depending on the 1358machines they were written for. This option, and its inverse, let you 1359make such a program work with the opposite default. 1360 1361The type @code{char} is always a distinct type from each of 1362@code{signed char} or @code{unsigned char}, even though its behavior 1363is always just like one of those two. 1364 1365@item -fsigned-char 1366@opindex fsigned-char 1367Let the type @code{char} be signed, like @code{signed char}. 1368 1369Note that this is equivalent to @option{-fno-unsigned-char}, which is 1370the negative form of @option{-funsigned-char}. Likewise, the option 1371@option{-fno-signed-char} is equivalent to @option{-funsigned-char}. 1372 1373@item -fsigned-bitfields 1374@itemx -funsigned-bitfields 1375@itemx -fno-signed-bitfields 1376@itemx -fno-unsigned-bitfields 1377@opindex fsigned-bitfields 1378@opindex funsigned-bitfields 1379@opindex fno-signed-bitfields 1380@opindex fno-unsigned-bitfields 1381These options control whether a bit-field is signed or unsigned, when the 1382declaration does not use either @code{signed} or @code{unsigned}. By 1383default, such a bit-field is signed, because this is consistent: the 1384basic integer types such as @code{int} are signed types. 1385@end table 1386 1387@node C++ Dialect Options 1388@section Options Controlling C++ Dialect 1389 1390@cindex compiler options, C++ 1391@cindex C++ options, command line 1392@cindex options, C++ 1393This section describes the command-line options that are only meaningful 1394for C++ programs; but you can also use most of the GNU compiler options 1395regardless of what language your program is in. For example, you 1396might compile a file @code{firstClass.C} like this: 1397 1398@smallexample 1399g++ -g -frepo -O -c firstClass.C 1400@end smallexample 1401 1402@noindent 1403In this example, only @option{-frepo} is an option meant 1404only for C++ programs; you can use the other options with any 1405language supported by GCC@. 1406 1407Here is a list of options that are @emph{only} for compiling C++ programs: 1408 1409@table @gcctabopt 1410 1411@item -fabi-version=@var{n} 1412@opindex fabi-version 1413Use version @var{n} of the C++ ABI@. Version 2 is the version of the 1414C++ ABI that first appeared in G++ 3.4. Version 1 is the version of 1415the C++ ABI that first appeared in G++ 3.2. Version 0 will always be 1416the version that conforms most closely to the C++ ABI specification. 1417Therefore, the ABI obtained using version 0 will change as ABI bugs 1418are fixed. 1419 1420The default is version 2. 1421 1422@item -fno-access-control 1423@opindex fno-access-control 1424Turn off all access checking. This switch is mainly useful for working 1425around bugs in the access control code. 1426 1427@item -fcheck-new 1428@opindex fcheck-new 1429Check that the pointer returned by @code{operator new} is non-null 1430before attempting to modify the storage allocated. This check is 1431normally unnecessary because the C++ standard specifies that 1432@code{operator new} will only return @code{0} if it is declared 1433@samp{throw()}, in which case the compiler will always check the 1434return value even without this option. In all other cases, when 1435@code{operator new} has a non-empty exception specification, memory 1436exhaustion is signalled by throwing @code{std::bad_alloc}. See also 1437@samp{new (nothrow)}. 1438 1439@item -fconserve-space 1440@opindex fconserve-space 1441Put uninitialized or runtime-initialized global variables into the 1442common segment, as C does. This saves space in the executable at the 1443cost of not diagnosing duplicate definitions. If you compile with this 1444flag and your program mysteriously crashes after @code{main()} has 1445completed, you may have an object that is being destroyed twice because 1446two definitions were merged. 1447 1448This option is no longer useful on most targets, now that support has 1449been added for putting variables into BSS without making them common. 1450 1451@item -ffriend-injection 1452@opindex ffriend-injection 1453Inject friend functions into the enclosing namespace, so that they are 1454visible outside the scope of the class in which they are declared. 1455Friend functions were documented to work this way in the old Annotated 1456C++ Reference Manual, and versions of G++ before 4.1 always worked 1457that way. However, in ISO C++ a friend function which is not declared 1458in an enclosing scope can only be found using argument dependent 1459lookup. This option causes friends to be injected as they were in 1460earlier releases. 1461 1462This option is for compatibility, and may be removed in a future 1463release of G++. 1464 1465@item -fno-elide-constructors 1466@opindex fno-elide-constructors 1467The C++ standard allows an implementation to omit creating a temporary 1468which is only used to initialize another object of the same type. 1469Specifying this option disables that optimization, and forces G++ to 1470call the copy constructor in all cases. 1471 1472@item -fno-enforce-eh-specs 1473@opindex fno-enforce-eh-specs 1474Don't generate code to check for violation of exception specifications 1475at runtime. This option violates the C++ standard, but may be useful 1476for reducing code size in production builds, much like defining 1477@samp{NDEBUG}. This does not give user code permission to throw 1478exceptions in violation of the exception specifications; the compiler 1479will still optimize based on the specifications, so throwing an 1480unexpected exception will result in undefined behavior. 1481 1482@item -ffor-scope 1483@itemx -fno-for-scope 1484@opindex ffor-scope 1485@opindex fno-for-scope 1486If @option{-ffor-scope} is specified, the scope of variables declared in 1487a @i{for-init-statement} is limited to the @samp{for} loop itself, 1488as specified by the C++ standard. 1489If @option{-fno-for-scope} is specified, the scope of variables declared in 1490a @i{for-init-statement} extends to the end of the enclosing scope, 1491as was the case in old versions of G++, and other (traditional) 1492implementations of C++. 1493 1494The default if neither flag is given to follow the standard, 1495but to allow and give a warning for old-style code that would 1496otherwise be invalid, or have different behavior. 1497 1498@item -fno-gnu-keywords 1499@opindex fno-gnu-keywords 1500Do not recognize @code{typeof} as a keyword, so that code can use this 1501word as an identifier. You can use the keyword @code{__typeof__} instead. 1502@option{-ansi} implies @option{-fno-gnu-keywords}. 1503 1504@item -fno-implicit-templates 1505@opindex fno-implicit-templates 1506Never emit code for non-inline templates which are instantiated 1507implicitly (i.e.@: by use); only emit code for explicit instantiations. 1508@xref{Template Instantiation}, for more information. 1509 1510@item -fno-implicit-inline-templates 1511@opindex fno-implicit-inline-templates 1512Don't emit code for implicit instantiations of inline templates, either. 1513The default is to handle inlines differently so that compiles with and 1514without optimization will need the same set of explicit instantiations. 1515 1516@item -fno-implement-inlines 1517@opindex fno-implement-inlines 1518To save space, do not emit out-of-line copies of inline functions 1519controlled by @samp{#pragma implementation}. This will cause linker 1520errors if these functions are not inlined everywhere they are called. 1521 1522@item -fms-extensions 1523@opindex fms-extensions 1524Disable pedantic warnings about constructs used in MFC, such as implicit 1525int and getting a pointer to member function via non-standard syntax. 1526 1527@item -fno-nonansi-builtins 1528@opindex fno-nonansi-builtins 1529Disable built-in declarations of functions that are not mandated by 1530ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit}, 1531@code{index}, @code{bzero}, @code{conjf}, and other related functions. 1532 1533@item -fno-operator-names 1534@opindex fno-operator-names 1535Do not treat the operator name keywords @code{and}, @code{bitand}, 1536@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as 1537synonyms as keywords. 1538 1539@item -fno-optional-diags 1540@opindex fno-optional-diags 1541Disable diagnostics that the standard says a compiler does not need to 1542issue. Currently, the only such diagnostic issued by G++ is the one for 1543a name having multiple meanings within a class. 1544 1545@item -fpermissive 1546@opindex fpermissive 1547Downgrade some diagnostics about nonconformant code from errors to 1548warnings. Thus, using @option{-fpermissive} will allow some 1549nonconforming code to compile. 1550 1551@item -frepo 1552@opindex frepo 1553Enable automatic template instantiation at link time. This option also 1554implies @option{-fno-implicit-templates}. @xref{Template 1555Instantiation}, for more information. 1556 1557@item -fno-rtti 1558@opindex fno-rtti 1559Disable generation of information about every class with virtual 1560functions for use by the C++ runtime type identification features 1561(@samp{dynamic_cast} and @samp{typeid}). If you don't use those parts 1562of the language, you can save some space by using this flag. Note that 1563exception handling uses the same information, but it will generate it as 1564needed. The @samp{dynamic_cast} operator can still be used for casts that 1565do not require runtime type information, i.e. casts to @code{void *} or to 1566unambiguous base classes. 1567 1568@item -fstats 1569@opindex fstats 1570Emit statistics about front-end processing at the end of the compilation. 1571This information is generally only useful to the G++ development team. 1572 1573@item -ftemplate-depth-@var{n} 1574@opindex ftemplate-depth 1575Set the maximum instantiation depth for template classes to @var{n}. 1576A limit on the template instantiation depth is needed to detect 1577endless recursions during template class instantiation. ANSI/ISO C++ 1578conforming programs must not rely on a maximum depth greater than 17. 1579 1580@item -fno-threadsafe-statics 1581@opindex fno-threadsafe-statics 1582Do not emit the extra code to use the routines specified in the C++ 1583ABI for thread-safe initialization of local statics. You can use this 1584option to reduce code size slightly in code that doesn't need to be 1585thread-safe. 1586 1587@item -fuse-cxa-atexit 1588@opindex fuse-cxa-atexit 1589Register destructors for objects with static storage duration with the 1590@code{__cxa_atexit} function rather than the @code{atexit} function. 1591This option is required for fully standards-compliant handling of static 1592destructors, but will only work if your C library supports 1593@code{__cxa_atexit}. 1594 1595@item -fno-use-cxa-get-exception-ptr 1596@opindex fno-use-cxa-get-exception-ptr 1597Don't use the @code{__cxa_get_exception_ptr} runtime routine. This 1598will cause @code{std::uncaught_exception} to be incorrect, but is necessary 1599if the runtime routine is not available. 1600 1601@item -fvisibility-inlines-hidden 1602@opindex fvisibility-inlines-hidden 1603This switch declares that the user does not attempt to compare 1604pointers to inline methods where the addresses of the two functions 1605were taken in different shared objects. 1606 1607The effect of this is that GCC may, effectively, mark inline methods with 1608@code{__attribute__ ((visibility ("hidden")))} so that they do not 1609appear in the export table of a DSO and do not require a PLT indirection 1610when used within the DSO@. Enabling this option can have a dramatic effect 1611on load and link times of a DSO as it massively reduces the size of the 1612dynamic export table when the library makes heavy use of templates. 1613 1614The behaviour of this switch is not quite the same as marking the 1615methods as hidden directly, because it does not affect static variables 1616local to the function or cause the compiler to deduce that 1617the function is defined in only one shared object. 1618 1619You may mark a method as having a visibility explicitly to negate the 1620effect of the switch for that method. For example, if you do want to 1621compare pointers to a particular inline method, you might mark it as 1622having default visibility. Marking the enclosing class with explicit 1623visibility will have no effect. 1624 1625Explicitly instantiated inline methods are unaffected by this option 1626as their linkage might otherwise cross a shared library boundary. 1627@xref{Template Instantiation}. 1628 1629@item -fno-weak 1630@opindex fno-weak 1631Do not use weak symbol support, even if it is provided by the linker. 1632By default, G++ will use weak symbols if they are available. This 1633option exists only for testing, and should not be used by end-users; 1634it will result in inferior code and has no benefits. This option may 1635be removed in a future release of G++. 1636 1637@item -nostdinc++ 1638@opindex nostdinc++ 1639Do not search for header files in the standard directories specific to 1640C++, but do still search the other standard directories. (This option 1641is used when building the C++ library.) 1642@end table 1643 1644In addition, these optimization, warning, and code generation options 1645have meanings only for C++ programs: 1646 1647@table @gcctabopt 1648@item -fno-default-inline 1649@opindex fno-default-inline 1650Do not assume @samp{inline} for functions defined inside a class scope. 1651@xref{Optimize Options,,Options That Control Optimization}. Note that these 1652functions will have linkage like inline functions; they just won't be 1653inlined by default. 1654 1655@item -Wabi @r{(C++ only)} 1656@opindex Wabi 1657Warn when G++ generates code that is probably not compatible with the 1658vendor-neutral C++ ABI@. Although an effort has been made to warn about 1659all such cases, there are probably some cases that are not warned about, 1660even though G++ is generating incompatible code. There may also be 1661cases where warnings are emitted even though the code that is generated 1662will be compatible. 1663 1664You should rewrite your code to avoid these warnings if you are 1665concerned about the fact that code generated by G++ may not be binary 1666compatible with code generated by other compilers. 1667 1668The known incompatibilities at this point include: 1669 1670@itemize @bullet 1671 1672@item 1673Incorrect handling of tail-padding for bit-fields. G++ may attempt to 1674pack data into the same byte as a base class. For example: 1675 1676@smallexample 1677struct A @{ virtual void f(); int f1 : 1; @}; 1678struct B : public A @{ int f2 : 1; @}; 1679@end smallexample 1680 1681@noindent 1682In this case, G++ will place @code{B::f2} into the same byte 1683as@code{A::f1}; other compilers will not. You can avoid this problem 1684by explicitly padding @code{A} so that its size is a multiple of the 1685byte size on your platform; that will cause G++ and other compilers to 1686layout @code{B} identically. 1687 1688@item 1689Incorrect handling of tail-padding for virtual bases. G++ does not use 1690tail padding when laying out virtual bases. For example: 1691 1692@smallexample 1693struct A @{ virtual void f(); char c1; @}; 1694struct B @{ B(); char c2; @}; 1695struct C : public A, public virtual B @{@}; 1696@end smallexample 1697 1698@noindent 1699In this case, G++ will not place @code{B} into the tail-padding for 1700@code{A}; other compilers will. You can avoid this problem by 1701explicitly padding @code{A} so that its size is a multiple of its 1702alignment (ignoring virtual base classes); that will cause G++ and other 1703compilers to layout @code{C} identically. 1704 1705@item 1706Incorrect handling of bit-fields with declared widths greater than that 1707of their underlying types, when the bit-fields appear in a union. For 1708example: 1709 1710@smallexample 1711union U @{ int i : 4096; @}; 1712@end smallexample 1713 1714@noindent 1715Assuming that an @code{int} does not have 4096 bits, G++ will make the 1716union too small by the number of bits in an @code{int}. 1717 1718@item 1719Empty classes can be placed at incorrect offsets. For example: 1720 1721@smallexample 1722struct A @{@}; 1723 1724struct B @{ 1725 A a; 1726 virtual void f (); 1727@}; 1728 1729struct C : public B, public A @{@}; 1730@end smallexample 1731 1732@noindent 1733G++ will place the @code{A} base class of @code{C} at a nonzero offset; 1734it should be placed at offset zero. G++ mistakenly believes that the 1735@code{A} data member of @code{B} is already at offset zero. 1736 1737@item 1738Names of template functions whose types involve @code{typename} or 1739template template parameters can be mangled incorrectly. 1740 1741@smallexample 1742template <typename Q> 1743void f(typename Q::X) @{@} 1744 1745template <template <typename> class Q> 1746void f(typename Q<int>::X) @{@} 1747@end smallexample 1748 1749@noindent 1750Instantiations of these templates may be mangled incorrectly. 1751 1752@end itemize 1753 1754@item -Wctor-dtor-privacy @r{(C++ only)} 1755@opindex Wctor-dtor-privacy 1756Warn when a class seems unusable because all the constructors or 1757destructors in that class are private, and it has neither friends nor 1758public static member functions. 1759 1760@item -Wnon-virtual-dtor @r{(C++ only)} 1761@opindex Wnon-virtual-dtor 1762Warn when a class appears to be polymorphic, thereby requiring a virtual 1763destructor, yet it declares a non-virtual one. This warning is also 1764enabled if -Weffc++ is specified. 1765 1766@item -Wreorder @r{(C++ only)} 1767@opindex Wreorder 1768@cindex reordering, warning 1769@cindex warning for reordering of member initializers 1770Warn when the order of member initializers given in the code does not 1771match the order in which they must be executed. For instance: 1772 1773@smallexample 1774struct A @{ 1775 int i; 1776 int j; 1777 A(): j (0), i (1) @{ @} 1778@}; 1779@end smallexample 1780 1781The compiler will rearrange the member initializers for @samp{i} 1782and @samp{j} to match the declaration order of the members, emitting 1783a warning to that effect. This warning is enabled by @option{-Wall}. 1784@end table 1785 1786The following @option{-W@dots{}} options are not affected by @option{-Wall}. 1787 1788@table @gcctabopt 1789@item -Weffc++ @r{(C++ only)} 1790@opindex Weffc++ 1791Warn about violations of the following style guidelines from Scott Meyers' 1792@cite{Effective C++} book: 1793 1794@itemize @bullet 1795@item 1796Item 11: Define a copy constructor and an assignment operator for classes 1797with dynamically allocated memory. 1798 1799@item 1800Item 12: Prefer initialization to assignment in constructors. 1801 1802@item 1803Item 14: Make destructors virtual in base classes. 1804 1805@item 1806Item 15: Have @code{operator=} return a reference to @code{*this}. 1807 1808@item 1809Item 23: Don't try to return a reference when you must return an object. 1810 1811@end itemize 1812 1813Also warn about violations of the following style guidelines from 1814Scott Meyers' @cite{More Effective C++} book: 1815 1816@itemize @bullet 1817@item 1818Item 6: Distinguish between prefix and postfix forms of increment and 1819decrement operators. 1820 1821@item 1822Item 7: Never overload @code{&&}, @code{||}, or @code{,}. 1823 1824@end itemize 1825 1826When selecting this option, be aware that the standard library 1827headers do not obey all of these guidelines; use @samp{grep -v} 1828to filter out those warnings. 1829 1830@item -Wno-deprecated @r{(C++ only)} 1831@opindex Wno-deprecated 1832Do not warn about usage of deprecated features. @xref{Deprecated Features}. 1833 1834@item -Wstrict-null-sentinel @r{(C++ only)} 1835@opindex Wstrict-null-sentinel 1836Warn also about the use of an uncasted @code{NULL} as sentinel. When 1837compiling only with GCC this is a valid sentinel, as @code{NULL} is defined 1838to @code{__null}. Although it is a null pointer constant not a null pointer, 1839it is guaranteed to of the same size as a pointer. But this use is 1840not portable across different compilers. 1841 1842@item -Wno-non-template-friend @r{(C++ only)} 1843@opindex Wno-non-template-friend 1844Disable warnings when non-templatized friend functions are declared 1845within a template. Since the advent of explicit template specification 1846support in G++, if the name of the friend is an unqualified-id (i.e., 1847@samp{friend foo(int)}), the C++ language specification demands that the 1848friend declare or define an ordinary, nontemplate function. (Section 184914.5.3). Before G++ implemented explicit specification, unqualified-ids 1850could be interpreted as a particular specialization of a templatized 1851function. Because this non-conforming behavior is no longer the default 1852behavior for G++, @option{-Wnon-template-friend} allows the compiler to 1853check existing code for potential trouble spots and is on by default. 1854This new compiler behavior can be turned off with 1855@option{-Wno-non-template-friend} which keeps the conformant compiler code 1856but disables the helpful warning. 1857 1858@item -Wold-style-cast @r{(C++ only)} 1859@opindex Wold-style-cast 1860Warn if an old-style (C-style) cast to a non-void type is used within 1861a C++ program. The new-style casts (@samp{dynamic_cast}, 1862@samp{static_cast}, @samp{reinterpret_cast}, and @samp{const_cast}) are 1863less vulnerable to unintended effects and much easier to search for. 1864 1865@item -Woverloaded-virtual @r{(C++ only)} 1866@opindex Woverloaded-virtual 1867@cindex overloaded virtual fn, warning 1868@cindex warning for overloaded virtual fn 1869Warn when a function declaration hides virtual functions from a 1870base class. For example, in: 1871 1872@smallexample 1873struct A @{ 1874 virtual void f(); 1875@}; 1876 1877struct B: public A @{ 1878 void f(int); 1879@}; 1880@end smallexample 1881 1882the @code{A} class version of @code{f} is hidden in @code{B}, and code 1883like: 1884 1885@smallexample 1886B* b; 1887b->f(); 1888@end smallexample 1889 1890will fail to compile. 1891 1892@item -Wno-pmf-conversions @r{(C++ only)} 1893@opindex Wno-pmf-conversions 1894Disable the diagnostic for converting a bound pointer to member function 1895to a plain pointer. 1896 1897@item -Wsign-promo @r{(C++ only)} 1898@opindex Wsign-promo 1899Warn when overload resolution chooses a promotion from unsigned or 1900enumerated type to a signed type, over a conversion to an unsigned type of 1901the same size. Previous versions of G++ would try to preserve 1902unsignedness, but the standard mandates the current behavior. 1903 1904@smallexample 1905struct A @{ 1906 operator int (); 1907 A& operator = (int); 1908@}; 1909 1910main () 1911@{ 1912 A a,b; 1913 a = b; 1914@} 1915@end smallexample 1916 1917In this example, G++ will synthesize a default @samp{A& operator = 1918(const A&);}, while cfront will use the user-defined @samp{operator =}. 1919@end table 1920 1921@node Language Independent Options 1922@section Options to Control Diagnostic Messages Formatting 1923@cindex options to control diagnostics formatting 1924@cindex diagnostic messages 1925@cindex message formatting 1926 1927Traditionally, diagnostic messages have been formatted irrespective of 1928the output device's aspect (e.g.@: its width, @dots{}). The options described 1929below can be used to control the diagnostic messages formatting 1930algorithm, e.g.@: how many characters per line, how often source location 1931information should be reported. Right now, only the C++ front end can 1932honor these options. However it is expected, in the near future, that 1933the remaining front ends would be able to digest them correctly. 1934 1935@table @gcctabopt 1936@item -fmessage-length=@var{n} 1937@opindex fmessage-length 1938Try to format error messages so that they fit on lines of about @var{n} 1939characters. The default is 72 characters for @command{g++} and 0 for the rest of 1940the front ends supported by GCC@. If @var{n} is zero, then no 1941line-wrapping will be done; each error message will appear on a single 1942line. 1943 1944@opindex fdiagnostics-show-location 1945@item -fdiagnostics-show-location=once 1946Only meaningful in line-wrapping mode. Instructs the diagnostic messages 1947reporter to emit @emph{once} source location information; that is, in 1948case the message is too long to fit on a single physical line and has to 1949be wrapped, the source location won't be emitted (as prefix) again, 1950over and over, in subsequent continuation lines. This is the default 1951behavior. 1952 1953@item -fdiagnostics-show-location=every-line 1954Only meaningful in line-wrapping mode. Instructs the diagnostic 1955messages reporter to emit the same source location information (as 1956prefix) for physical lines that result from the process of breaking 1957a message which is too long to fit on a single line. 1958 1959@item -fdiagnostics-show-option 1960@opindex fdiagnostics-show-option 1961This option instructs the diagnostic machinery to add text to each 1962diagnostic emitted, which indicates which command line option directly 1963controls that diagnostic, when such an option is known to the 1964diagnostic machinery. 1965 1966@end table 1967 1968@node Warning Options 1969@section Options to Request or Suppress Warnings 1970@cindex options to control warnings 1971@cindex warning messages 1972@cindex messages, warning 1973@cindex suppressing warnings 1974 1975Warnings are diagnostic messages that report constructions which 1976are not inherently erroneous but which are risky or suggest there 1977may have been an error. 1978 1979You can request many specific warnings with options beginning @samp{-W}, 1980for example @option{-Wimplicit} to request warnings on implicit 1981declarations. Each of these specific warning options also has a 1982negative form beginning @samp{-Wno-} to turn off warnings; 1983for example, @option{-Wno-implicit}. This manual lists only one of the 1984two forms, whichever is not the default. 1985 1986The following options control the amount and kinds of warnings produced 1987by GCC; for further, language-specific options also refer to 1988@ref{C++ Dialect Options}. 1989 1990@table @gcctabopt 1991@cindex syntax checking 1992@item -fsyntax-only 1993@opindex fsyntax-only 1994Check the code for syntax errors, but don't do anything beyond that. 1995 1996@item -pedantic 1997@opindex pedantic 1998Issue all the warnings demanded by strict ISO C and ISO C++; 1999reject all programs that use forbidden extensions, and some other 2000programs that do not follow ISO C and ISO C++. For ISO C, follows the 2001version of the ISO C standard specified by any @option{-std} option used. 2002 2003Valid ISO C and ISO C++ programs should compile properly with or without 2004this option (though a rare few will require @option{-ansi} or a 2005@option{-std} option specifying the required version of ISO C)@. However, 2006without this option, certain GNU extensions and traditional C and C++ 2007features are supported as well. With this option, they are rejected. 2008 2009@option{-pedantic} does not cause warning messages for use of the 2010alternate keywords whose names begin and end with @samp{__}. Pedantic 2011warnings are also disabled in the expression that follows 2012@code{__extension__}. However, only system header files should use 2013these escape routes; application programs should avoid them. 2014@xref{Alternate Keywords}. 2015 2016Some users try to use @option{-pedantic} to check programs for strict ISO 2017C conformance. They soon find that it does not do quite what they want: 2018it finds some non-ISO practices, but not all---only those for which 2019ISO C @emph{requires} a diagnostic, and some others for which 2020diagnostics have been added. 2021 2022A feature to report any failure to conform to ISO C might be useful in 2023some instances, but would require considerable additional work and would 2024be quite different from @option{-pedantic}. We don't have plans to 2025support such a feature in the near future. 2026 2027Where the standard specified with @option{-std} represents a GNU 2028extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a 2029corresponding @dfn{base standard}, the version of ISO C on which the GNU 2030extended dialect is based. Warnings from @option{-pedantic} are given 2031where they are required by the base standard. (It would not make sense 2032for such warnings to be given only for features not in the specified GNU 2033C dialect, since by definition the GNU dialects of C include all 2034features the compiler supports with the given option, and there would be 2035nothing to warn about.) 2036 2037@item -pedantic-errors 2038@opindex pedantic-errors 2039Like @option{-pedantic}, except that errors are produced rather than 2040warnings. 2041 2042@item -w 2043@opindex w 2044Inhibit all warning messages. 2045 2046@item -Wno-import 2047@opindex Wno-import 2048Inhibit warning messages about the use of @samp{#import}. 2049 2050@item -Wchar-subscripts 2051@opindex Wchar-subscripts 2052Warn if an array subscript has type @code{char}. This is a common cause 2053of error, as programmers often forget that this type is signed on some 2054machines. 2055This warning is enabled by @option{-Wall}. 2056 2057@item -Wcomment 2058@opindex Wcomment 2059Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*} 2060comment, or whenever a Backslash-Newline appears in a @samp{//} comment. 2061This warning is enabled by @option{-Wall}. 2062 2063@item -Wfatal-errors 2064@opindex Wfatal-errors 2065This option causes the compiler to abort compilation on the first error 2066occurred rather than trying to keep going and printing further error 2067messages. 2068 2069@item -Wformat 2070@opindex Wformat 2071@opindex ffreestanding 2072@opindex fno-builtin 2073Check calls to @code{printf} and @code{scanf}, etc., to make sure that 2074the arguments supplied have types appropriate to the format string 2075specified, and that the conversions specified in the format string make 2076sense. This includes standard functions, and others specified by format 2077attributes (@pxref{Function Attributes}), in the @code{printf}, 2078@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension, 2079not in the C standard) families (or other target-specific families). 2080Which functions are checked without format attributes having been 2081specified depends on the standard version selected, and such checks of 2082functions without the attribute specified are disabled by 2083@option{-ffreestanding} or @option{-fno-builtin}. 2084 2085The formats are checked against the format features supported by GNU 2086libc version 2.2. These include all ISO C90 and C99 features, as well 2087as features from the Single Unix Specification and some BSD and GNU 2088extensions. Other library implementations may not support all these 2089features; GCC does not support warning about features that go beyond a 2090particular library's limitations. However, if @option{-pedantic} is used 2091with @option{-Wformat}, warnings will be given about format features not 2092in the selected standard version (but not for @code{strfmon} formats, 2093since those are not in any version of the C standard). @xref{C Dialect 2094Options,,Options Controlling C Dialect}. 2095 2096Since @option{-Wformat} also checks for null format arguments for 2097several functions, @option{-Wformat} also implies @option{-Wnonnull}. 2098 2099@option{-Wformat} is included in @option{-Wall}. For more control over some 2100aspects of format checking, the options @option{-Wformat-y2k}, 2101@option{-Wno-format-extra-args}, @option{-Wno-format-zero-length}, 2102@option{-Wformat-nonliteral}, @option{-Wformat-security}, and 2103@option{-Wformat=2} are available, but are not included in @option{-Wall}. 2104 2105@item -Wformat-y2k 2106@opindex Wformat-y2k 2107If @option{-Wformat} is specified, also warn about @code{strftime} 2108formats which may yield only a two-digit year. 2109 2110@item -Wno-format-extra-args 2111@opindex Wno-format-extra-args 2112If @option{-Wformat} is specified, do not warn about excess arguments to a 2113@code{printf} or @code{scanf} format function. The C standard specifies 2114that such arguments are ignored. 2115 2116Where the unused arguments lie between used arguments that are 2117specified with @samp{$} operand number specifications, normally 2118warnings are still given, since the implementation could not know what 2119type to pass to @code{va_arg} to skip the unused arguments. However, 2120in the case of @code{scanf} formats, this option will suppress the 2121warning if the unused arguments are all pointers, since the Single 2122Unix Specification says that such unused arguments are allowed. 2123 2124@item -Wno-format-zero-length 2125@opindex Wno-format-zero-length 2126If @option{-Wformat} is specified, do not warn about zero-length formats. 2127The C standard specifies that zero-length formats are allowed. 2128 2129@item -Wformat-nonliteral 2130@opindex Wformat-nonliteral 2131If @option{-Wformat} is specified, also warn if the format string is not a 2132string literal and so cannot be checked, unless the format function 2133takes its format arguments as a @code{va_list}. 2134 2135@item -Wformat-security 2136@opindex Wformat-security 2137If @option{-Wformat} is specified, also warn about uses of format 2138functions that represent possible security problems. At present, this 2139warns about calls to @code{printf} and @code{scanf} functions where the 2140format string is not a string literal and there are no format arguments, 2141as in @code{printf (foo);}. This may be a security hole if the format 2142string came from untrusted input and contains @samp{%n}. (This is 2143currently a subset of what @option{-Wformat-nonliteral} warns about, but 2144in future warnings may be added to @option{-Wformat-security} that are not 2145included in @option{-Wformat-nonliteral}.) 2146 2147@item -Wformat=2 2148@opindex Wformat=2 2149Enable @option{-Wformat} plus format checks not included in 2150@option{-Wformat}. Currently equivalent to @samp{-Wformat 2151-Wformat-nonliteral -Wformat-security -Wformat-y2k}. 2152 2153@item -Wnonnull 2154@opindex Wnonnull 2155Warn about passing a null pointer for arguments marked as 2156requiring a non-null value by the @code{nonnull} function attribute. 2157 2158@option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It 2159can be disabled with the @option{-Wno-nonnull} option. 2160 2161@item -Winit-self @r{(C and C++ only)} 2162@opindex Winit-self 2163Warn about uninitialized variables which are initialized with themselves. 2164Note this option can only be used with the @option{-Wuninitialized} option, 2165which in turn only works with @option{-O1} and above. 2166 2167For example, GCC will warn about @code{i} being uninitialized in the 2168following snippet only when @option{-Winit-self} has been specified: 2169@smallexample 2170@group 2171int f() 2172@{ 2173 int i = i; 2174 return i; 2175@} 2176@end group 2177@end smallexample 2178 2179@item -Wimplicit-int 2180@opindex Wimplicit-int 2181Warn when a declaration does not specify a type. 2182This warning is enabled by @option{-Wall}. 2183 2184@item -Wimplicit-function-declaration 2185@itemx -Werror-implicit-function-declaration 2186@opindex Wimplicit-function-declaration 2187@opindex Werror-implicit-function-declaration 2188Give a warning (or error) whenever a function is used before being 2189declared. The form @option{-Wno-error-implicit-function-declaration} 2190is not supported. 2191This warning is enabled by @option{-Wall} (as a warning, not an error). 2192 2193@item -Wimplicit 2194@opindex Wimplicit 2195Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}. 2196This warning is enabled by @option{-Wall}. 2197 2198@item -Wmain 2199@opindex Wmain 2200Warn if the type of @samp{main} is suspicious. @samp{main} should be a 2201function with external linkage, returning int, taking either zero 2202arguments, two, or three arguments of appropriate types. 2203This warning is enabled by @option{-Wall}. 2204 2205@item -Wmissing-braces 2206@opindex Wmissing-braces 2207Warn if an aggregate or union initializer is not fully bracketed. In 2208the following example, the initializer for @samp{a} is not fully 2209bracketed, but that for @samp{b} is fully bracketed. 2210 2211@smallexample 2212int a[2][2] = @{ 0, 1, 2, 3 @}; 2213int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @}; 2214@end smallexample 2215 2216This warning is enabled by @option{-Wall}. 2217 2218@item -Wmissing-include-dirs @r{(C and C++ only)} 2219@opindex Wmissing-include-dirs 2220Warn if a user-supplied include directory does not exist. 2221 2222@item -Wparentheses 2223@opindex Wparentheses 2224Warn if parentheses are omitted in certain contexts, such 2225as when there is an assignment in a context where a truth value 2226is expected, or when operators are nested whose precedence people 2227often get confused about. 2228 2229Also warn if a comparison like @samp{x<=y<=z} appears; this is 2230equivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different 2231interpretation from that of ordinary mathematical notation. 2232 2233Also warn about constructions where there may be confusion to which 2234@code{if} statement an @code{else} branch belongs. Here is an example of 2235such a case: 2236 2237@smallexample 2238@group 2239@{ 2240 if (a) 2241 if (b) 2242 foo (); 2243 else 2244 bar (); 2245@} 2246@end group 2247@end smallexample 2248 2249In C/C++, every @code{else} branch belongs to the innermost possible 2250@code{if} statement, which in this example is @code{if (b)}. This is 2251often not what the programmer expected, as illustrated in the above 2252example by indentation the programmer chose. When there is the 2253potential for this confusion, GCC will issue a warning when this flag 2254is specified. To eliminate the warning, add explicit braces around 2255the innermost @code{if} statement so there is no way the @code{else} 2256could belong to the enclosing @code{if}. The resulting code would 2257look like this: 2258 2259@smallexample 2260@group 2261@{ 2262 if (a) 2263 @{ 2264 if (b) 2265 foo (); 2266 else 2267 bar (); 2268 @} 2269@} 2270@end group 2271@end smallexample 2272 2273This warning is enabled by @option{-Wall}. 2274 2275@item -Wsequence-point 2276@opindex Wsequence-point 2277Warn about code that may have undefined semantics because of violations 2278of sequence point rules in the C and C++ standards. 2279 2280The C and C++ standards defines the order in which expressions in a C/C++ 2281program are evaluated in terms of @dfn{sequence points}, which represent 2282a partial ordering between the execution of parts of the program: those 2283executed before the sequence point, and those executed after it. These 2284occur after the evaluation of a full expression (one which is not part 2285of a larger expression), after the evaluation of the first operand of a 2286@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a 2287function is called (but after the evaluation of its arguments and the 2288expression denoting the called function), and in certain other places. 2289Other than as expressed by the sequence point rules, the order of 2290evaluation of subexpressions of an expression is not specified. All 2291these rules describe only a partial order rather than a total order, 2292since, for example, if two functions are called within one expression 2293with no sequence point between them, the order in which the functions 2294are called is not specified. However, the standards committee have 2295ruled that function calls do not overlap. 2296 2297It is not specified when between sequence points modifications to the 2298values of objects take effect. Programs whose behavior depends on this 2299have undefined behavior; the C and C++ standards specify that ``Between 2300the previous and next sequence point an object shall have its stored 2301value modified at most once by the evaluation of an expression. 2302Furthermore, the prior value shall be read only to determine the value 2303to be stored.''. If a program breaks these rules, the results on any 2304particular implementation are entirely unpredictable. 2305 2306Examples of code with undefined behavior are @code{a = a++;}, @code{a[n] 2307= b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not 2308diagnosed by this option, and it may give an occasional false positive 2309result, but in general it has been found fairly effective at detecting 2310this sort of problem in programs. 2311 2312The standard is worded confusingly, therefore there is some debate 2313over the precise meaning of the sequence point rules in subtle cases. 2314Links to discussions of the problem, including proposed formal 2315definitions, may be found on the GCC readings page, at 2316@w{@uref{http://gcc.gnu.org/readings.html}}. 2317 2318This warning is enabled by @option{-Wall} for C and C++. 2319 2320@item -Wreturn-type 2321@opindex Wreturn-type 2322Warn whenever a function is defined with a return-type that defaults to 2323@code{int}. Also warn about any @code{return} statement with no 2324return-value in a function whose return-type is not @code{void}. 2325 2326For C, also warn if the return type of a function has a type qualifier 2327such as @code{const}. Such a type qualifier has no effect, since the 2328value returned by a function is not an lvalue. ISO C prohibits 2329qualified @code{void} return types on function definitions, so such 2330return types always receive a warning even without this option. 2331 2332For C++, a function without return type always produces a diagnostic 2333message, even when @option{-Wno-return-type} is specified. The only 2334exceptions are @samp{main} and functions defined in system headers. 2335 2336This warning is enabled by @option{-Wall}. 2337 2338@item -Wswitch 2339@opindex Wswitch 2340Warn whenever a @code{switch} statement has an index of enumerated type 2341and lacks a @code{case} for one or more of the named codes of that 2342enumeration. (The presence of a @code{default} label prevents this 2343warning.) @code{case} labels outside the enumeration range also 2344provoke warnings when this option is used. 2345This warning is enabled by @option{-Wall}. 2346 2347@item -Wswitch-default 2348@opindex Wswitch-switch 2349Warn whenever a @code{switch} statement does not have a @code{default} 2350case. 2351 2352@item -Wswitch-enum 2353@opindex Wswitch-enum 2354Warn whenever a @code{switch} statement has an index of enumerated type 2355and lacks a @code{case} for one or more of the named codes of that 2356enumeration. @code{case} labels outside the enumeration range also 2357provoke warnings when this option is used. 2358 2359@item -Wtrigraphs 2360@opindex Wtrigraphs 2361Warn if any trigraphs are encountered that might change the meaning of 2362the program (trigraphs within comments are not warned about). 2363This warning is enabled by @option{-Wall}. 2364 2365@item -Wunused-function 2366@opindex Wunused-function 2367Warn whenever a static function is declared but not defined or a 2368non-inline static function is unused. 2369This warning is enabled by @option{-Wall}. 2370 2371@item -Wunused-label 2372@opindex Wunused-label 2373Warn whenever a label is declared but not used. 2374This warning is enabled by @option{-Wall}. 2375 2376To suppress this warning use the @samp{unused} attribute 2377(@pxref{Variable Attributes}). 2378 2379@item -Wunused-parameter 2380@opindex Wunused-parameter 2381Warn whenever a function parameter is unused aside from its declaration. 2382 2383To suppress this warning use the @samp{unused} attribute 2384(@pxref{Variable Attributes}). 2385 2386@item -Wunused-variable 2387@opindex Wunused-variable 2388Warn whenever a local variable or non-constant static variable is unused 2389aside from its declaration. 2390This warning is enabled by @option{-Wall}. 2391 2392To suppress this warning use the @samp{unused} attribute 2393(@pxref{Variable Attributes}). 2394 2395@item -Wunused-value 2396@opindex Wunused-value 2397Warn whenever a statement computes a result that is explicitly not used. 2398This warning is enabled by @option{-Wall}. 2399 2400To suppress this warning cast the expression to @samp{void}. 2401 2402@item -Wunused 2403@opindex Wunused 2404All the above @option{-Wunused} options combined. 2405 2406In order to get a warning about an unused function parameter, you must 2407either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies 2408@samp{-Wunused}), or separately specify @option{-Wunused-parameter}. 2409 2410@item -Wuninitialized 2411@opindex Wuninitialized 2412Warn if an automatic variable is used without first being initialized or 2413if a variable may be clobbered by a @code{setjmp} call. 2414 2415These warnings are possible only in optimizing compilation, 2416because they require data flow information that is computed only 2417when optimizing. If you do not specify @option{-O}, you will not get 2418these warnings. Instead, GCC will issue a warning about @option{-Wuninitialized} 2419requiring @option{-O}. 2420 2421If you want to warn about code which uses the uninitialized value of the 2422variable in its own initializer, use the @option{-Winit-self} option. 2423 2424These warnings occur for individual uninitialized or clobbered 2425elements of structure, union or array variables as well as for 2426variables which are uninitialized or clobbered as a whole. They do 2427not occur for variables or elements declared @code{volatile}. Because 2428these warnings depend on optimization, the exact variables or elements 2429for which there are warnings will depend on the precise optimization 2430options and version of GCC used. 2431 2432Note that there may be no warning about a variable that is used only 2433to compute a value that itself is never used, because such 2434computations may be deleted by data flow analysis before the warnings 2435are printed. 2436 2437These warnings are made optional because GCC is not smart 2438enough to see all the reasons why the code might be correct 2439despite appearing to have an error. Here is one example of how 2440this can happen: 2441 2442@smallexample 2443@group 2444@{ 2445 int x; 2446 switch (y) 2447 @{ 2448 case 1: x = 1; 2449 break; 2450 case 2: x = 4; 2451 break; 2452 case 3: x = 5; 2453 @} 2454 foo (x); 2455@} 2456@end group 2457@end smallexample 2458 2459@noindent 2460If the value of @code{y} is always 1, 2 or 3, then @code{x} is 2461always initialized, but GCC doesn't know this. Here is 2462another common case: 2463 2464@smallexample 2465@{ 2466 int save_y; 2467 if (change_y) save_y = y, y = new_y; 2468 @dots{} 2469 if (change_y) y = save_y; 2470@} 2471@end smallexample 2472 2473@noindent 2474This has no bug because @code{save_y} is used only if it is set. 2475 2476@cindex @code{longjmp} warnings 2477This option also warns when a non-volatile automatic variable might be 2478changed by a call to @code{longjmp}. These warnings as well are possible 2479only in optimizing compilation. 2480 2481The compiler sees only the calls to @code{setjmp}. It cannot know 2482where @code{longjmp} will be called; in fact, a signal handler could 2483call it at any point in the code. As a result, you may get a warning 2484even when there is in fact no problem because @code{longjmp} cannot 2485in fact be called at the place which would cause a problem. 2486 2487Some spurious warnings can be avoided if you declare all the functions 2488you use that never return as @code{noreturn}. @xref{Function 2489Attributes}. 2490 2491This warning is enabled by @option{-Wall}. 2492 2493@item -Wunknown-pragmas 2494@opindex Wunknown-pragmas 2495@cindex warning for unknown pragmas 2496@cindex unknown pragmas, warning 2497@cindex pragmas, warning of unknown 2498Warn when a #pragma directive is encountered which is not understood by 2499GCC@. If this command line option is used, warnings will even be issued 2500for unknown pragmas in system header files. This is not the case if 2501the warnings were only enabled by the @option{-Wall} command line option. 2502 2503@item -Wno-pragmas 2504@opindex Wno-pragmas 2505@opindex Wpragmas 2506Do not warn about misuses of pragmas, such as incorrect parameters, 2507invalid syntax, or conflicts between pragmas. See also 2508@samp{-Wunknown-pragmas}. 2509 2510@item -Wstrict-aliasing 2511@opindex Wstrict-aliasing 2512This option is only active when @option{-fstrict-aliasing} is active. 2513It warns about code which might break the strict aliasing rules that the 2514compiler is using for optimization. The warning does not catch all 2515cases, but does attempt to catch the more common pitfalls. It is 2516included in @option{-Wall}. 2517It is equivalent to -Wstrict-aliasing=3 2518 2519@item -Wstrict-aliasing=n 2520@opindex Wstrict-aliasing=n 2521This option is only active when @option{-fstrict-aliasing} is active. 2522It warns about code which might break the strict aliasing rules that the 2523compiler is using for optimization. 2524Higher levels correspond to higher accuracy (fewer false positives). 2525Higher levels also correspond to more effort, similar to the way -O works. 2526@option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=n}, 2527with n=3. 2528 2529Level 1: Most aggressive, quick, least accurate. 2530Possibly useful when higher levels 2531do not warn but -fstrict-aliasing still breaks the code, as it has very few 2532false negatives. However, it has many false positives. 2533Warns for all pointer conversions between possibly incompatible types, 2534even if never dereferenced. Runs in the frontend only. 2535 2536Level 2: Aggressive, quick, not too precise. 2537May still have many false positives (not as many as level 1 though), 2538and few false negatives (but possibly more than level 1). 2539Unlike level 1, it only warns when an address is taken. Warns about 2540incomplete types. Runs in the frontend only. 2541 2542Level 3 (default for @option{-Wstrict-aliasing}): 2543Should have very few false positives and few false 2544negatives. Slightly slower than levels 1 or 2 when optimization is enabled. 2545Takes care of the common punn+dereference pattern in the frontend: 2546@code{*(int*)&some_float}. 2547If optimization is enabled, it also runs in the backend, where it deals 2548with multiple statement cases using flow-sensitive points-to information. 2549Only warns when the converted pointer is dereferenced. 2550Does not warn about incomplete types. 2551 2552@item -Wstrict-overflow 2553@item -Wstrict-overflow=@var{n} 2554@opindex Wstrict-overflow 2555This option is only active when @option{-fstrict-overflow} is active. 2556It warns about cases where the compiler optimizes based on the 2557assumption that signed overflow does not occur. Note that it does not 2558warn about all cases where the code might overflow: it only warns 2559about cases where the compiler implements some optimization. Thus 2560this warning depends on the optimization level. 2561 2562An optimization which assumes that signed overflow does not occur is 2563perfectly safe if the values of the variables involved are such that 2564overflow never does, in fact, occur. Therefore this warning can 2565easily give a false positive: a warning about code which is not 2566actually a problem. To help focus on important issues, several 2567warning levels are defined. No warnings are issued for the use of 2568undefined signed overflow when estimating how many iterations a loop 2569will require, in particular when determining whether a loop will be 2570executed at all. 2571 2572@table @option 2573@item -Wstrict-overflow=1 2574Warn about cases which are both questionable and easy to avoid. For 2575example: @code{x + 1 > x}; with @option{-fstrict-overflow}, the 2576compiler will simplify this to @code{1}. This level of 2577@option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels 2578are not, and must be explicitly requested. 2579 2580@item -Wstrict-overflow=2 2581Also warn about other cases where a comparison is simplified to a 2582constant. For example: @code{abs (x) >= 0}. This can only be 2583simplified when @option{-fstrict-overflow} is in effect, because 2584@code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than 2585zero. @option{-Wstrict-overflow} (with no level) is the same as 2586@option{-Wstrict-overflow=2}. 2587 2588@item -Wstrict-overflow=3 2589Also warn about other cases where a comparison is simplified. For 2590example: @code{x + 1 > 1} will be simplified to @code{x > 0}. 2591 2592@item -Wstrict-overflow=4 2593Also warn about other simplifications not covered by the above cases. 2594For example: @code{(x * 10) / 5} will be simplified to @code{x * 2}. 2595 2596@item -Wstrict-overflow=5 2597Also warn about cases where the compiler reduces the magnitude of a 2598constant involved in a comparison. For example: @code{x + 2 > y} will 2599be simplified to @code{x + 1 >= y}. This is reported only at the 2600highest warning level because this simplification applies to many 2601comparisons, so this warning level will give a very large number of 2602false positives. 2603@end table 2604 2605@item -Wall 2606@opindex Wall 2607All of the above @samp{-W} options combined. This enables all the 2608warnings about constructions that some users consider questionable, and 2609that are easy to avoid (or modify to prevent the warning), even in 2610conjunction with macros. This also enables some language-specific 2611warnings described in @ref{C++ Dialect Options}. 2612@end table 2613 2614The following @option{-W@dots{}} options are not implied by @option{-Wall}. 2615Some of them warn about constructions that users generally do not 2616consider questionable, but which occasionally you might wish to check 2617for; others warn about constructions that are necessary or hard to avoid 2618in some cases, and there is no simple way to modify the code to suppress 2619the warning. 2620 2621@table @gcctabopt 2622@item -Wextra 2623@opindex W 2624@opindex Wextra 2625(This option used to be called @option{-W}. The older name is still 2626supported, but the newer name is more descriptive.) Print extra warning 2627messages for these events: 2628 2629@itemize @bullet 2630@item 2631A function can return either with or without a value. (Falling 2632off the end of the function body is considered returning without 2633a value.) For example, this function would evoke such a 2634warning: 2635 2636@smallexample 2637@group 2638foo (a) 2639@{ 2640 if (a > 0) 2641 return a; 2642@} 2643@end group 2644@end smallexample 2645 2646@item 2647An expression-statement or the left-hand side of a comma expression 2648contains no side effects. 2649To suppress the warning, cast the unused expression to void. 2650For example, an expression such as @samp{x[i,j]} will cause a warning, 2651but @samp{x[(void)i,j]} will not. 2652 2653@item 2654An unsigned value is compared against zero with @samp{<} or @samp{>=}. 2655 2656@item 2657Storage-class specifiers like @code{static} are not the first things in 2658a declaration. According to the C Standard, this usage is obsolescent. 2659 2660@item 2661If @option{-Wall} or @option{-Wunused} is also specified, warn about unused 2662arguments. 2663 2664@item 2665A comparison between signed and unsigned values could produce an 2666incorrect result when the signed value is converted to unsigned. 2667(But don't warn if @option{-Wno-sign-compare} is also specified.) 2668 2669@item 2670An aggregate has an initializer which does not initialize all members. 2671This warning can be independently controlled by 2672@option{-Wmissing-field-initializers}. 2673 2674@item 2675An initialized field without side effects is overridden when using 2676designated initializers (@pxref{Designated Inits, , Designated 2677Initializers}). This warning can be independently controlled by 2678@option{-Woverride-init}. 2679 2680@item 2681A function parameter is declared without a type specifier in K&R-style 2682functions: 2683 2684@smallexample 2685void foo(bar) @{ @} 2686@end smallexample 2687 2688@item 2689An empty body occurs in an @samp{if} or @samp{else} statement. 2690 2691@item 2692A pointer is compared against integer zero with @samp{<}, @samp{<=}, 2693@samp{>}, or @samp{>=}. 2694 2695@item 2696A variable might be changed by @samp{longjmp} or @samp{vfork}. 2697 2698@item @r{(C++ only)} 2699An enumerator and a non-enumerator both appear in a conditional expression. 2700 2701@item @r{(C++ only)} 2702A non-static reference or non-static @samp{const} member appears in a 2703class without constructors. 2704 2705@item @r{(C++ only)} 2706Ambiguous virtual bases. 2707 2708@item @r{(C++ only)} 2709Subscripting an array which has been declared @samp{register}. 2710 2711@item @r{(C++ only)} 2712Taking the address of a variable which has been declared @samp{register}. 2713 2714@item @r{(C++ only)} 2715A base class is not initialized in a derived class' copy constructor. 2716@end itemize 2717 2718@item -Wno-div-by-zero 2719@opindex Wno-div-by-zero 2720@opindex Wdiv-by-zero 2721Do not warn about compile-time integer division by zero. Floating point 2722division by zero is not warned about, as it can be a legitimate way of 2723obtaining infinities and NaNs. 2724 2725@item -Wsystem-headers 2726@opindex Wsystem-headers 2727@cindex warnings from system headers 2728@cindex system headers, warnings from 2729Print warning messages for constructs found in system header files. 2730Warnings from system headers are normally suppressed, on the assumption 2731that they usually do not indicate real problems and would only make the 2732compiler output harder to read. Using this command line option tells 2733GCC to emit warnings from system headers as if they occurred in user 2734code. However, note that using @option{-Wall} in conjunction with this 2735option will @emph{not} warn about unknown pragmas in system 2736headers---for that, @option{-Wunknown-pragmas} must also be used. 2737 2738@item -Wfloat-equal 2739@opindex Wfloat-equal 2740Warn if floating point values are used in equality comparisons. 2741 2742The idea behind this is that sometimes it is convenient (for the 2743programmer) to consider floating-point values as approximations to 2744infinitely precise real numbers. If you are doing this, then you need 2745to compute (by analyzing the code, or in some other way) the maximum or 2746likely maximum error that the computation introduces, and allow for it 2747when performing comparisons (and when producing output, but that's a 2748different problem). In particular, instead of testing for equality, you 2749would check to see whether the two values have ranges that overlap; and 2750this is done with the relational operators, so equality comparisons are 2751probably mistaken. 2752 2753@item -Wtraditional @r{(C only)} 2754@opindex Wtraditional 2755Warn about certain constructs that behave differently in traditional and 2756ISO C@. Also warn about ISO C constructs that have no traditional C 2757equivalent, and/or problematic constructs which should be avoided. 2758 2759@itemize @bullet 2760@item 2761Macro parameters that appear within string literals in the macro body. 2762In traditional C macro replacement takes place within string literals, 2763but does not in ISO C@. 2764 2765@item 2766In traditional C, some preprocessor directives did not exist. 2767Traditional preprocessors would only consider a line to be a directive 2768if the @samp{#} appeared in column 1 on the line. Therefore 2769@option{-Wtraditional} warns about directives that traditional C 2770understands but would ignore because the @samp{#} does not appear as the 2771first character on the line. It also suggests you hide directives like 2772@samp{#pragma} not understood by traditional C by indenting them. Some 2773traditional implementations would not recognize @samp{#elif}, so it 2774suggests avoiding it altogether. 2775 2776@item 2777A function-like macro that appears without arguments. 2778 2779@item 2780The unary plus operator. 2781 2782@item 2783The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point 2784constant suffixes. (Traditional C does support the @samp{L} suffix on integer 2785constants.) Note, these suffixes appear in macros defined in the system 2786headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}. 2787Use of these macros in user code might normally lead to spurious 2788warnings, however GCC's integrated preprocessor has enough context to 2789avoid warning in these cases. 2790 2791@item 2792A function declared external in one block and then used after the end of 2793the block. 2794 2795@item 2796A @code{switch} statement has an operand of type @code{long}. 2797 2798@item 2799A non-@code{static} function declaration follows a @code{static} one. 2800This construct is not accepted by some traditional C compilers. 2801 2802@item 2803The ISO type of an integer constant has a different width or 2804signedness from its traditional type. This warning is only issued if 2805the base of the constant is ten. I.e.@: hexadecimal or octal values, which 2806typically represent bit patterns, are not warned about. 2807 2808@item 2809Usage of ISO string concatenation is detected. 2810 2811@item 2812Initialization of automatic aggregates. 2813 2814@item 2815Identifier conflicts with labels. Traditional C lacks a separate 2816namespace for labels. 2817 2818@item 2819Initialization of unions. If the initializer is zero, the warning is 2820omitted. This is done under the assumption that the zero initializer in 2821user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing 2822initializer warnings and relies on default initialization to zero in the 2823traditional C case. 2824 2825@item 2826Conversions by prototypes between fixed/floating point values and vice 2827versa. The absence of these prototypes when compiling with traditional 2828C would cause serious problems. This is a subset of the possible 2829conversion warnings, for the full set use @option{-Wconversion}. 2830 2831@item 2832Use of ISO C style function definitions. This warning intentionally is 2833@emph{not} issued for prototype declarations or variadic functions 2834because these ISO C features will appear in your code when using 2835libiberty's traditional C compatibility macros, @code{PARAMS} and 2836@code{VPARAMS}. This warning is also bypassed for nested functions 2837because that feature is already a GCC extension and thus not relevant to 2838traditional C compatibility. 2839@end itemize 2840 2841@item -Wdeclaration-after-statement @r{(C only)} 2842@opindex Wdeclaration-after-statement 2843Warn when a declaration is found after a statement in a block. This 2844construct, known from C++, was introduced with ISO C99 and is by default 2845allowed in GCC@. It is not supported by ISO C90 and was not supported by 2846GCC versions before GCC 3.0. @xref{Mixed Declarations}. 2847 2848@item -Wundef 2849@opindex Wundef 2850Warn if an undefined identifier is evaluated in an @samp{#if} directive. 2851 2852@item -Wno-endif-labels 2853@opindex Wno-endif-labels 2854@opindex Wendif-labels 2855Do not warn whenever an @samp{#else} or an @samp{#endif} are followed by text. 2856 2857@item -Wshadow 2858@opindex Wshadow 2859Warn whenever a local variable shadows another local variable, parameter or 2860global variable or whenever a built-in function is shadowed. 2861 2862@item -Wlarger-than-@var{len} 2863@opindex Wlarger-than 2864Warn whenever an object of larger than @var{len} bytes is defined. 2865 2866@item -Wframe-larger-than-@var{len} 2867@opindex Wframe-larger-than 2868Warn whenever the frame size of a function is larger than @var{len} bytes. 2869 2870@item -Wunsafe-loop-optimizations 2871@opindex Wunsafe-loop-optimizations 2872Warn if the loop cannot be optimized because the compiler could not 2873assume anything on the bounds of the loop indices. With 2874@option{-funsafe-loop-optimizations} warn if the compiler made 2875such assumptions. 2876 2877@item -Wpointer-arith 2878@opindex Wpointer-arith 2879Warn about anything that depends on the ``size of'' a function type or 2880of @code{void}. GNU C assigns these types a size of 1, for 2881convenience in calculations with @code{void *} pointers and pointers 2882to functions. 2883 2884@item -Wbad-function-cast @r{(C only)} 2885@opindex Wbad-function-cast 2886Warn whenever a function call is cast to a non-matching type. 2887For example, warn if @code{int malloc()} is cast to @code{anything *}. 2888 2889@item -Wc++-compat 2890Warn about ISO C constructs that are outside of the common subset of 2891ISO C and ISO C++, e.g.@: request for implicit conversion from 2892@code{void *} to a pointer to non-@code{void} type. 2893 2894@item -Wcast-qual 2895@opindex Wcast-qual 2896Warn whenever a pointer is cast so as to remove a type qualifier from 2897the target type. For example, warn if a @code{const char *} is cast 2898to an ordinary @code{char *}. 2899 2900@item -Wcast-align 2901@opindex Wcast-align 2902Warn whenever a pointer is cast such that the required alignment of the 2903target is increased. For example, warn if a @code{char *} is cast to 2904an @code{int *} on machines where integers can only be accessed at 2905two- or four-byte boundaries. 2906 2907@item -Wwrite-strings 2908@opindex Wwrite-strings 2909When compiling C, give string constants the type @code{const 2910char[@var{length}]} so that 2911copying the address of one into a non-@code{const} @code{char *} 2912pointer will get a warning; when compiling C++, warn about the 2913deprecated conversion from string literals to @code{char *}. This 2914warning, by default, is enabled for C++ programs. 2915These warnings will help you find at 2916compile time code that can try to write into a string constant, but 2917only if you have been very careful about using @code{const} in 2918declarations and prototypes. Otherwise, it will just be a nuisance; 2919this is why we did not make @option{-Wall} request these warnings. 2920 2921@item -Wconversion 2922@opindex Wconversion 2923Warn if a prototype causes a type conversion that is different from what 2924would happen to the same argument in the absence of a prototype. This 2925includes conversions of fixed point to floating and vice versa, and 2926conversions changing the width or signedness of a fixed point argument 2927except when the same as the default promotion. 2928 2929Also, warn if a negative integer constant expression is implicitly 2930converted to an unsigned type. For example, warn about the assignment 2931@code{x = -1} if @code{x} is unsigned. But do not warn about explicit 2932casts like @code{(unsigned) -1}. 2933 2934@item -Wsign-compare 2935@opindex Wsign-compare 2936@cindex warning for comparison of signed and unsigned values 2937@cindex comparison of signed and unsigned values, warning 2938@cindex signed and unsigned values, comparison warning 2939Warn when a comparison between signed and unsigned values could produce 2940an incorrect result when the signed value is converted to unsigned. 2941This warning is also enabled by @option{-Wextra}; to get the other warnings 2942of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}. 2943 2944@item -Waddress 2945@opindex Waddress 2946@opindex Wno-address 2947Warn about suspicious uses of memory addresses. These include using 2948the address of a function in a conditional expression, such as 2949@code{void func(void); if (func)}, and comparisons against the memory 2950address of a string literal, such as @code{if (x == "abc")}. Such 2951uses typically indicate a programmer error: the address of a function 2952always evaluates to true, so their use in a conditional usually 2953indicate that the programmer forgot the parentheses in a function 2954call; and comparisons against string literals result in unspecified 2955behavior and are not portable in C, so they usually indicate that the 2956programmer intended to use @code{strcmp}. This warning is enabled by 2957@option{-Wall}. 2958 2959@item -Waggregate-return 2960@opindex Waggregate-return 2961Warn if any functions that return structures or unions are defined or 2962called. (In languages where you can return an array, this also elicits 2963a warning.) 2964 2965@item -Wno-attributes 2966@opindex Wno-attributes 2967@opindex Wattributes 2968Do not warn if an unexpected @code{__attribute__} is used, such as 2969unrecognized attributes, function attributes applied to variables, 2970etc. This will not stop errors for incorrect use of supported 2971attributes. 2972 2973@item -Wstrict-prototypes @r{(C only)} 2974@opindex Wstrict-prototypes 2975Warn if a function is declared or defined without specifying the 2976argument types. (An old-style function definition is permitted without 2977a warning if preceded by a declaration which specifies the argument 2978types.) 2979 2980@item -Wold-style-definition @r{(C only)} 2981@opindex Wold-style-definition 2982Warn if an old-style function definition is used. A warning is given 2983even if there is a previous prototype. 2984 2985@item -Wmissing-prototypes @r{(C only)} 2986@opindex Wmissing-prototypes 2987Warn if a global function is defined without a previous prototype 2988declaration. This warning is issued even if the definition itself 2989provides a prototype. The aim is to detect global functions that fail 2990to be declared in header files. 2991 2992@item -Wmissing-declarations @r{(C only)} 2993@opindex Wmissing-declarations 2994Warn if a global function is defined without a previous declaration. 2995Do so even if the definition itself provides a prototype. 2996Use this option to detect global functions that are not declared in 2997header files. 2998 2999@item -Wmissing-field-initializers 3000@opindex Wmissing-field-initializers 3001@opindex W 3002@opindex Wextra 3003Warn if a structure's initializer has some fields missing. For 3004example, the following code would cause such a warning, because 3005@code{x.h} is implicitly zero: 3006 3007@smallexample 3008struct s @{ int f, g, h; @}; 3009struct s x = @{ 3, 4 @}; 3010@end smallexample 3011 3012This option does not warn about designated initializers, so the following 3013modification would not trigger a warning: 3014 3015@smallexample 3016struct s @{ int f, g, h; @}; 3017struct s x = @{ .f = 3, .g = 4 @}; 3018@end smallexample 3019 3020This warning is included in @option{-Wextra}. To get other @option{-Wextra} 3021warnings without this one, use @samp{-Wextra -Wno-missing-field-initializers}. 3022 3023@item -Wmissing-noreturn 3024@opindex Wmissing-noreturn 3025Warn about functions which might be candidates for attribute @code{noreturn}. 3026Note these are only possible candidates, not absolute ones. Care should 3027be taken to manually verify functions actually do not ever return before 3028adding the @code{noreturn} attribute, otherwise subtle code generation 3029bugs could be introduced. You will not get a warning for @code{main} in 3030hosted C environments. 3031 3032@item -Wmissing-format-attribute 3033@opindex Wmissing-format-attribute 3034@opindex Wformat 3035Warn about function pointers which might be candidates for @code{format} 3036attributes. Note these are only possible candidates, not absolute ones. 3037GCC will guess that function pointers with @code{format} attributes that 3038are used in assignment, initialization, parameter passing or return 3039statements should have a corresponding @code{format} attribute in the 3040resulting type. I.e.@: the left-hand side of the assignment or 3041initialization, the type of the parameter variable, or the return type 3042of the containing function respectively should also have a @code{format} 3043attribute to avoid the warning. 3044 3045GCC will also warn about function definitions which might be 3046candidates for @code{format} attributes. Again, these are only 3047possible candidates. GCC will guess that @code{format} attributes 3048might be appropriate for any function that calls a function like 3049@code{vprintf} or @code{vscanf}, but this might not always be the 3050case, and some functions for which @code{format} attributes are 3051appropriate may not be detected. 3052 3053@item -Wno-multichar 3054@opindex Wno-multichar 3055@opindex Wmultichar 3056Do not warn if a multicharacter constant (@samp{'FOOF'}) is used. 3057Usually they indicate a typo in the user's code, as they have 3058implementation-defined values, and should not be used in portable code. 3059 3060@item -Wnormalized=<none|id|nfc|nfkc> 3061@opindex Wnormalized 3062@cindex NFC 3063@cindex NFKC 3064@cindex character set, input normalization 3065In ISO C and ISO C++, two identifiers are different if they are 3066different sequences of characters. However, sometimes when characters 3067outside the basic ASCII character set are used, you can have two 3068different character sequences that look the same. To avoid confusion, 3069the ISO 10646 standard sets out some @dfn{normalization rules} which 3070when applied ensure that two sequences that look the same are turned into 3071the same sequence. GCC can warn you if you are using identifiers which 3072have not been normalized; this option controls that warning. 3073 3074There are four levels of warning that GCC supports. The default is 3075@option{-Wnormalized=nfc}, which warns about any identifier which is 3076not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the 3077recommended form for most uses. 3078 3079Unfortunately, there are some characters which ISO C and ISO C++ allow 3080in identifiers that when turned into NFC aren't allowable as 3081identifiers. That is, there's no way to use these symbols in portable 3082ISO C or C++ and have all your identifiers in NFC. 3083@option{-Wnormalized=id} suppresses the warning for these characters. 3084It is hoped that future versions of the standards involved will correct 3085this, which is why this option is not the default. 3086 3087You can switch the warning off for all characters by writing 3088@option{-Wnormalized=none}. You would only want to do this if you 3089were using some other normalization scheme (like ``D''), because 3090otherwise you can easily create bugs that are literally impossible to see. 3091 3092Some characters in ISO 10646 have distinct meanings but look identical 3093in some fonts or display methodologies, especially once formatting has 3094been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL 3095LETTER N'', will display just like a regular @code{n} which has been 3096placed in a superscript. ISO 10646 defines the @dfn{NFKC} 3097normalization scheme to convert all these into a standard form as 3098well, and GCC will warn if your code is not in NFKC if you use 3099@option{-Wnormalized=nfkc}. This warning is comparable to warning 3100about every identifier that contains the letter O because it might be 3101confused with the digit 0, and so is not the default, but may be 3102useful as a local coding convention if the programming environment is 3103unable to be fixed to display these characters distinctly. 3104 3105@item -Wno-deprecated-declarations 3106@opindex Wno-deprecated-declarations 3107Do not warn about uses of functions (@pxref{Function Attributes}), 3108variables (@pxref{Variable Attributes}), and types (@pxref{Type 3109Attributes}) marked as deprecated by using the @code{deprecated} 3110attribute. 3111 3112@item -Wno-overflow 3113@opindex Wno-overflow 3114Do not warn about compile-time overflow in constant expressions. 3115 3116@item -Woverride-init 3117@opindex Woverride-init 3118@opindex W 3119@opindex Wextra 3120Warn if an initialized field without side effects is overridden when 3121using designated initializers (@pxref{Designated Inits, , Designated 3122Initializers}). 3123 3124This warning is included in @option{-Wextra}. To get other 3125@option{-Wextra} warnings without this one, use @samp{-Wextra 3126-Wno-override-init}. 3127 3128@item -Wpacked 3129@opindex Wpacked 3130Warn if a structure is given the packed attribute, but the packed 3131attribute has no effect on the layout or size of the structure. 3132Such structures may be mis-aligned for little benefit. For 3133instance, in this code, the variable @code{f.x} in @code{struct bar} 3134will be misaligned even though @code{struct bar} does not itself 3135have the packed attribute: 3136 3137@smallexample 3138@group 3139struct foo @{ 3140 int x; 3141 char a, b, c, d; 3142@} __attribute__((packed)); 3143struct bar @{ 3144 char z; 3145 struct foo f; 3146@}; 3147@end group 3148@end smallexample 3149 3150@item -Wpadded 3151@opindex Wpadded 3152Warn if padding is included in a structure, either to align an element 3153of the structure or to align the whole structure. Sometimes when this 3154happens it is possible to rearrange the fields of the structure to 3155reduce the padding and so make the structure smaller. 3156 3157@item -Wredundant-decls 3158@opindex Wredundant-decls 3159Warn if anything is declared more than once in the same scope, even in 3160cases where multiple declaration is valid and changes nothing. 3161 3162@item -Wnested-externs @r{(C only)} 3163@opindex Wnested-externs 3164Warn if an @code{extern} declaration is encountered within a function. 3165 3166@item -Wunreachable-code 3167@opindex Wunreachable-code 3168Warn if the compiler detects that code will never be executed. 3169 3170This option is intended to warn when the compiler detects that at 3171least a whole line of source code will never be executed, because 3172some condition is never satisfied or because it is after a 3173procedure that never returns. 3174 3175It is possible for this option to produce a warning even though there 3176are circumstances under which part of the affected line can be executed, 3177so care should be taken when removing apparently-unreachable code. 3178 3179For instance, when a function is inlined, a warning may mean that the 3180line is unreachable in only one inlined copy of the function. 3181 3182This option is not made part of @option{-Wall} because in a debugging 3183version of a program there is often substantial code which checks 3184correct functioning of the program and is, hopefully, unreachable 3185because the program does work. Another common use of unreachable 3186code is to provide behavior which is selectable at compile-time. 3187 3188@item -Winline 3189@opindex Winline 3190Warn if a function can not be inlined and it was declared as inline. 3191Even with this option, the compiler will not warn about failures to 3192inline functions declared in system headers. 3193 3194The compiler uses a variety of heuristics to determine whether or not 3195to inline a function. For example, the compiler takes into account 3196the size of the function being inlined and the amount of inlining 3197that has already been done in the current function. Therefore, 3198seemingly insignificant changes in the source program can cause the 3199warnings produced by @option{-Winline} to appear or disappear. 3200 3201@item -Wno-invalid-offsetof @r{(C++ only)} 3202@opindex Wno-invalid-offsetof 3203Suppress warnings from applying the @samp{offsetof} macro to a non-POD 3204type. According to the 1998 ISO C++ standard, applying @samp{offsetof} 3205to a non-POD type is undefined. In existing C++ implementations, 3206however, @samp{offsetof} typically gives meaningful results even when 3207applied to certain kinds of non-POD types. (Such as a simple 3208@samp{struct} that fails to be a POD type only by virtue of having a 3209constructor.) This flag is for users who are aware that they are 3210writing nonportable code and who have deliberately chosen to ignore the 3211warning about it. 3212 3213The restrictions on @samp{offsetof} may be relaxed in a future version 3214of the C++ standard. 3215 3216@item -Wno-int-to-pointer-cast @r{(C only)} 3217@opindex Wno-int-to-pointer-cast 3218Suppress warnings from casts to pointer type of an integer of a 3219different size. 3220 3221@item -Wno-pointer-to-int-cast @r{(C only)} 3222@opindex Wno-pointer-to-int-cast 3223Suppress warnings from casts from a pointer to an integer type of a 3224different size. 3225 3226@item -Winvalid-pch 3227@opindex Winvalid-pch 3228Warn if a precompiled header (@pxref{Precompiled Headers}) is found in 3229the search path but can't be used. 3230 3231@item -Wlong-long 3232@opindex Wlong-long 3233@opindex Wno-long-long 3234Warn if @samp{long long} type is used. This is default. To inhibit 3235the warning messages, use @option{-Wno-long-long}. Flags 3236@option{-Wlong-long} and @option{-Wno-long-long} are taken into account 3237only when @option{-pedantic} flag is used. 3238 3239@item -Wvariadic-macros 3240@opindex Wvariadic-macros 3241@opindex Wno-variadic-macros 3242Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU 3243alternate syntax when in pedantic ISO C99 mode. This is default. 3244To inhibit the warning messages, use @option{-Wno-variadic-macros}. 3245 3246@item -Wvla 3247@opindex Wvla 3248@opindex Wno-vla 3249Warn if variable length array is used in the code. 3250@option{-Wno-vla} will prevent the @option{-pedantic} warning of 3251the variable length array. 3252 3253@item -Wvolatile-register-var 3254@opindex Wvolatile-register-var 3255@opindex Wno-volatile-register-var 3256Warn if a register variable is declared volatile. The volatile 3257modifier does not inhibit all optimizations that may eliminate reads 3258and/or writes to register variables. 3259 3260@item -Wdisabled-optimization 3261@opindex Wdisabled-optimization 3262Warn if a requested optimization pass is disabled. This warning does 3263not generally indicate that there is anything wrong with your code; it 3264merely indicates that GCC's optimizers were unable to handle the code 3265effectively. Often, the problem is that your code is too big or too 3266complex; GCC will refuse to optimize programs when the optimization 3267itself is likely to take inordinate amounts of time. 3268 3269@item -Wpointer-sign 3270@opindex Wpointer-sign 3271@opindex Wno-pointer-sign 3272Warn for pointer argument passing or assignment with different signedness. 3273This option is only supported for C. It is implied by @option{-Wall} 3274and by @option{-pedantic}, which can be disabled with 3275@option{-Wno-pointer-sign}. 3276 3277@item -Werror 3278@opindex Werror 3279Make all warnings into errors. 3280 3281@item -Werror= 3282@opindex Werror= 3283Make the specified warning into an errors. The specifier for a 3284warning is appended, for example @option{-Werror=switch} turns the 3285warnings controlled by @option{-Wswitch} into errors. This switch 3286takes a negative form, to be used to negate @option{-Werror} for 3287specific warnings, for example @option{-Wno-error=switch} makes 3288@option{-Wswitch} warnings not be errors, even when @option{-Werror} 3289is in effect. You can use the @option{-fdiagnostics-show-option} 3290option to have each controllable warning amended with the option which 3291controls it, to determine what to use with this option. 3292 3293Note that specifying @option{-Werror=}@var{foo} automatically implies 3294@option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not 3295imply anything. 3296 3297@item -Wstack-protector 3298@opindex Wstack-protector 3299This option is only active when @option{-fstack-protector} is active. It 3300warns about functions that will not be protected against stack smashing. 3301 3302@item -Woverlength-strings 3303@opindex Woverlength-strings 3304Warn about string constants which are longer than the ``minimum 3305maximum'' length specified in the C standard. Modern compilers 3306generally allow string constants which are much longer than the 3307standard's minimum limit, but very portable programs should avoid 3308using longer strings. 3309 3310The limit applies @emph{after} string constant concatenation, and does 3311not count the trailing NUL@. In C89, the limit was 509 characters; in 3312C99, it was raised to 4095. C++98 does not specify a normative 3313minimum maximum, so we do not diagnose overlength strings in C++@. 3314 3315This option is implied by @option{-pedantic}, and can be disabled with 3316@option{-Wno-overlength-strings}. 3317@end table 3318 3319@node Debugging Options 3320@section Options for Debugging Your Program or GCC 3321@cindex options, debugging 3322@cindex debugging information options 3323 3324GCC has various special options that are used for debugging 3325either your program or GCC: 3326 3327@table @gcctabopt 3328@item -g 3329@opindex g 3330Produce debugging information in the operating system's native format 3331(stabs, COFF, XCOFF, or DWARF 2)@. GDB can work with this debugging 3332information. 3333 3334On most systems that use stabs format, @option{-g} enables use of extra 3335debugging information that only GDB can use; this extra information 3336makes debugging work better in GDB but will probably make other debuggers 3337crash or 3338refuse to read the program. If you want to control for certain whether 3339to generate the extra information, use @option{-gstabs+}, @option{-gstabs}, 3340@option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below). 3341 3342GCC allows you to use @option{-g} with 3343@option{-O}. The shortcuts taken by optimized code may occasionally 3344produce surprising results: some variables you declared may not exist 3345at all; flow of control may briefly move where you did not expect it; 3346some statements may not be executed because they compute constant 3347results or their values were already at hand; some statements may 3348execute in different places because they were moved out of loops. 3349 3350Nevertheless it proves possible to debug optimized output. This makes 3351it reasonable to use the optimizer for programs that might have bugs. 3352 3353The following options are useful when GCC is generated with the 3354capability for more than one debugging format. 3355 3356@item -ggdb 3357@opindex ggdb 3358Produce debugging information for use by GDB@. This means to use the 3359most expressive format available (DWARF 2, stabs, or the native format 3360if neither of those are supported), including GDB extensions if at all 3361possible. 3362 3363@item -gstabs 3364@opindex gstabs 3365Produce debugging information in stabs format (if that is supported), 3366without GDB extensions. This is the format used by DBX on most BSD 3367systems. On MIPS, Alpha and System V Release 4 systems this option 3368produces stabs debugging output which is not understood by DBX or SDB@. 3369On System V Release 4 systems this option requires the GNU assembler. 3370 3371@item -feliminate-unused-debug-symbols 3372@opindex feliminate-unused-debug-symbols 3373Produce debugging information in stabs format (if that is supported), 3374for only symbols that are actually used. 3375 3376@item -femit-class-debug-always 3377Instead of emitting debugging information for a C++ class in only one 3378object file, emit it in all object files using the class. This option 3379should be used only with debuggers that are unable to handle the way GCC 3380normally emits debugging information for classes because using this 3381option will increase the size of debugging information by as much as a 3382factor of two. 3383 3384@item -gstabs+ 3385@opindex gstabs+ 3386Produce debugging information in stabs format (if that is supported), 3387using GNU extensions understood only by the GNU debugger (GDB)@. The 3388use of these extensions is likely to make other debuggers crash or 3389refuse to read the program. 3390 3391@item -gcoff 3392@opindex gcoff 3393Produce debugging information in COFF format (if that is supported). 3394This is the format used by SDB on most System V systems prior to 3395System V Release 4. 3396 3397@item -gxcoff 3398@opindex gxcoff 3399Produce debugging information in XCOFF format (if that is supported). 3400This is the format used by the DBX debugger on IBM RS/6000 systems. 3401 3402@item -gxcoff+ 3403@opindex gxcoff+ 3404Produce debugging information in XCOFF format (if that is supported), 3405using GNU extensions understood only by the GNU debugger (GDB)@. The 3406use of these extensions is likely to make other debuggers crash or 3407refuse to read the program, and may cause assemblers other than the GNU 3408assembler (GAS) to fail with an error. 3409 3410@item -gdwarf-2 3411@opindex gdwarf-2 3412Produce debugging information in DWARF version 2 format (if that is 3413supported). This is the format used by DBX on IRIX 6. With this 3414option, GCC uses features of DWARF version 3 when they are useful; 3415version 3 is upward compatible with version 2, but may still cause 3416problems for older debuggers. 3417 3418@item -gvms 3419@opindex gvms 3420Produce debugging information in VMS debug format (if that is 3421supported). This is the format used by DEBUG on VMS systems. 3422 3423@item -g@var{level} 3424@itemx -ggdb@var{level} 3425@itemx -gstabs@var{level} 3426@itemx -gcoff@var{level} 3427@itemx -gxcoff@var{level} 3428@itemx -gvms@var{level} 3429Request debugging information and also use @var{level} to specify how 3430much information. The default level is 2. 3431 3432Level 1 produces minimal information, enough for making backtraces in 3433parts of the program that you don't plan to debug. This includes 3434descriptions of functions and external variables, but no information 3435about local variables and no line numbers. 3436 3437Level 3 includes extra information, such as all the macro definitions 3438present in the program. Some debuggers support macro expansion when 3439you use @option{-g3}. 3440 3441@option{-gdwarf-2} does not accept a concatenated debug level, because 3442GCC used to support an option @option{-gdwarf} that meant to generate 3443debug information in version 1 of the DWARF format (which is very 3444different from version 2), and it would have been too confusing. That 3445debug format is long obsolete, but the option cannot be changed now. 3446Instead use an additional @option{-g@var{level}} option to change the 3447debug level for DWARF2. 3448 3449@item -feliminate-dwarf2-dups 3450@opindex feliminate-dwarf2-dups 3451Compress DWARF2 debugging information by eliminating duplicated 3452information about each symbol. This option only makes sense when 3453generating DWARF2 debugging information with @option{-gdwarf-2}. 3454 3455@item -femit-struct-debug-baseonly 3456Emit debug information for struct-like types 3457only when the base name of the compilation source file 3458matches the base name of file in which the struct was defined. 3459 3460This option substantially reduces the size of debugging information, 3461but at significant potential loss in type information to the debugger. 3462See @option{-femit-struct-debug-reduced} for a less aggressive option. 3463See @option{-femit-struct-debug-detailed} for more detailed control. 3464 3465This option works only with DWARF 2. 3466 3467@item -femit-struct-debug-reduced 3468Emit debug information for struct-like types 3469only when the base name of the compilation source file 3470matches the base name of file in which the type was defined, 3471unless the struct is a template or defined in a system header. 3472 3473This option significantly reduces the size of debugging information, 3474with some potential loss in type information to the debugger. 3475See @option{-femit-struct-debug-baseonly} for a more aggressive option. 3476See @option{-femit-struct-debug-detailed} for more detailed control. 3477 3478This option works only with DWARF 2. 3479 3480@item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} 3481Specify the struct-like types 3482for which the compiler will generate debug information. 3483The intent is to reduce duplicate struct debug information 3484between different object files within the same program. 3485 3486This option is a detailed version of 3487@option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly}, 3488which will serve for most needs. 3489 3490A specification has the syntax 3491[@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none}) 3492 3493The optional first word limits the specification to 3494structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}). 3495A struct type is used directly when it is the type of a variable, member. 3496Indirect uses arise through pointers to structs. 3497That is, when use of an incomplete struct would be legal, the use is indirect. 3498An example is 3499@samp{struct one direct; struct two * indirect;}. 3500 3501The optional second word limits the specification to 3502ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}). 3503Generic structs are a bit complicated to explain. 3504For C++, these are non-explicit specializations of template classes, 3505or non-template classes within the above. 3506Other programming languages have generics, 3507but @samp{-femit-struct-debug-detailed} does not yet implement them. 3508 3509The third word specifies the source files for those 3510structs for which the compiler will emit debug information. 3511The values @samp{none} and @samp{any} have the normal meaning. 3512The value @samp{base} means that 3513the base of name of the file in which the type declaration appears 3514must match the base of the name of the main compilation file. 3515In practice, this means that 3516types declared in @file{foo.c} and @file{foo.h} will have debug information, 3517but types declared in other header will not. 3518The value @samp{sys} means those types satisfying @samp{base} 3519or declared in system or compiler headers. 3520 3521You may need to experiment to determine the best settings for your application. 3522 3523The default is @samp{-femit-struct-debug-detailed=all}. 3524 3525This option works only with DWARF 2. 3526 3527@cindex @command{prof} 3528@item -p 3529@opindex p 3530Generate extra code to write profile information suitable for the 3531analysis program @command{prof}. You must use this option when compiling 3532the source files you want data about, and you must also use it when 3533linking. 3534 3535@cindex @command{gprof} 3536@item -pg 3537@opindex pg 3538Generate extra code to write profile information suitable for the 3539analysis program @command{gprof}. You must use this option when compiling 3540the source files you want data about, and you must also use it when 3541linking. 3542 3543@item -Q 3544@opindex Q 3545Makes the compiler print out each function name as it is compiled, and 3546print some statistics about each pass when it finishes. 3547 3548@item -ftime-report 3549@opindex ftime-report 3550Makes the compiler print some statistics about the time consumed by each 3551pass when it finishes. 3552 3553@item -fmem-report 3554@opindex fmem-report 3555Makes the compiler print some statistics about permanent memory 3556allocation when it finishes. 3557 3558@item -fprofile-arcs 3559@opindex fprofile-arcs 3560Add code so that program flow @dfn{arcs} are instrumented. During 3561execution the program records how many times each branch and call is 3562executed and how many times it is taken or returns. When the compiled 3563program exits it saves this data to a file called 3564@file{@var{auxname}.gcda} for each source file. The data may be used for 3565profile-directed optimizations (@option{-fbranch-probabilities}), or for 3566test coverage analysis (@option{-ftest-coverage}). Each object file's 3567@var{auxname} is generated from the name of the output file, if 3568explicitly specified and it is not the final executable, otherwise it is 3569the basename of the source file. In both cases any suffix is removed 3570(e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or 3571@file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}). 3572@xref{Cross-profiling}. 3573 3574@cindex @command{gcov} 3575@item --coverage 3576@opindex coverage 3577 3578This option is used to compile and link code instrumented for coverage 3579analysis. The option is a synonym for @option{-fprofile-arcs} 3580@option{-ftest-coverage} (when compiling) and @option{-lgcov} (when 3581linking). See the documentation for those options for more details. 3582 3583@itemize 3584 3585@item 3586Compile the source files with @option{-fprofile-arcs} plus optimization 3587and code generation options. For test coverage analysis, use the 3588additional @option{-ftest-coverage} option. You do not need to profile 3589every source file in a program. 3590 3591@item 3592Link your object files with @option{-lgcov} or @option{-fprofile-arcs} 3593(the latter implies the former). 3594 3595@item 3596Run the program on a representative workload to generate the arc profile 3597information. This may be repeated any number of times. You can run 3598concurrent instances of your program, and provided that the file system 3599supports locking, the data files will be correctly updated. Also 3600@code{fork} calls are detected and correctly handled (double counting 3601will not happen). 3602 3603@item 3604For profile-directed optimizations, compile the source files again with 3605the same optimization and code generation options plus 3606@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that 3607Control Optimization}). 3608 3609@item 3610For test coverage analysis, use @command{gcov} to produce human readable 3611information from the @file{.gcno} and @file{.gcda} files. Refer to the 3612@command{gcov} documentation for further information. 3613 3614@end itemize 3615 3616With @option{-fprofile-arcs}, for each function of your program GCC 3617creates a program flow graph, then finds a spanning tree for the graph. 3618Only arcs that are not on the spanning tree have to be instrumented: the 3619compiler adds code to count the number of times that these arcs are 3620executed. When an arc is the only exit or only entrance to a block, the 3621instrumentation code can be added to the block; otherwise, a new basic 3622block must be created to hold the instrumentation code. 3623 3624@need 2000 3625@item -ftest-coverage 3626@opindex ftest-coverage 3627Produce a notes file that the @command{gcov} code-coverage utility 3628(@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to 3629show program coverage. Each source file's note file is called 3630@file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option 3631above for a description of @var{auxname} and instructions on how to 3632generate test coverage data. Coverage data will match the source files 3633more closely, if you do not optimize. 3634 3635@item -d@var{letters} 3636@item -fdump-rtl-@var{pass} 3637@opindex d 3638Says to make debugging dumps during compilation at times specified by 3639@var{letters}. This is used for debugging the RTL-based passes of the 3640compiler. The file names for most of the dumps are made by appending a 3641pass number and a word to the @var{dumpname}. @var{dumpname} is generated 3642from the name of the output file, if explicitly specified and it is not 3643an executable, otherwise it is the basename of the source file. 3644 3645Most debug dumps can be enabled either passing a letter to the @option{-d} 3646option, or with a long @option{-fdump-rtl} switch; here are the possible 3647letters for use in @var{letters} and @var{pass}, and their meanings: 3648 3649@table @gcctabopt 3650@item -dA 3651@opindex dA 3652Annotate the assembler output with miscellaneous debugging information. 3653 3654@item -dB 3655@itemx -fdump-rtl-bbro 3656@opindex dB 3657@opindex fdump-rtl-bbro 3658Dump after block reordering, to @file{@var{file}.148r.bbro}. 3659 3660@item -dc 3661@itemx -fdump-rtl-combine 3662@opindex dc 3663@opindex fdump-rtl-combine 3664Dump after instruction combination, to the file @file{@var{file}.129r.combine}. 3665 3666@item -dC 3667@itemx -fdump-rtl-ce1 3668@itemx -fdump-rtl-ce2 3669@opindex dC 3670@opindex fdump-rtl-ce1 3671@opindex fdump-rtl-ce2 3672@option{-dC} and @option{-fdump-rtl-ce1} enable dumping after the 3673first if conversion, to the file @file{@var{file}.117r.ce1}. @option{-dC} 3674and @option{-fdump-rtl-ce2} enable dumping after the second if 3675conversion, to the file @file{@var{file}.130r.ce2}. 3676 3677@item -dd 3678@itemx -fdump-rtl-btl 3679@itemx -fdump-rtl-dbr 3680@opindex dd 3681@opindex fdump-rtl-btl 3682@opindex fdump-rtl-dbr 3683@option{-dd} and @option{-fdump-rtl-btl} enable dumping after branch 3684target load optimization, to @file{@var{file}.31.btl}. @option{-dd} 3685and @option{-fdump-rtl-dbr} enable dumping after delayed branch 3686scheduling, to @file{@var{file}.36.dbr}. 3687 3688@item -dD 3689@opindex dD 3690Dump all macro definitions, at the end of preprocessing, in addition to 3691normal output. 3692 3693@item -dE 3694@itemx -fdump-rtl-ce3 3695@opindex dE 3696@opindex fdump-rtl-ce3 3697Dump after the third if conversion, to @file{@var{file}.146r.ce3}. 3698 3699@item -df 3700@itemx -fdump-rtl-cfg 3701@itemx -fdump-rtl-life 3702@opindex df 3703@opindex fdump-rtl-cfg 3704@opindex fdump-rtl-life 3705@option{-df} and @option{-fdump-rtl-cfg} enable dumping after control 3706and data flow analysis, to @file{@var{file}.116r.cfg}. @option{-df} 3707and @option{-fdump-rtl-cfg} enable dumping dump after life analysis, 3708to @file{@var{file}.128r.life1} and @file{@var{file}.135r.life2}. 3709 3710@item -dg 3711@itemx -fdump-rtl-greg 3712@opindex dg 3713@opindex fdump-rtl-greg 3714Dump after global register allocation, to @file{@var{file}.139r.greg}. 3715 3716@item -dG 3717@itemx -fdump-rtl-gcse 3718@itemx -fdump-rtl-bypass 3719@opindex dG 3720@opindex fdump-rtl-gcse 3721@opindex fdump-rtl-bypass 3722@option{-dG} and @option{-fdump-rtl-gcse} enable dumping after GCSE, to 3723@file{@var{file}.114r.gcse}. @option{-dG} and @option{-fdump-rtl-bypass} 3724enable dumping after jump bypassing and control flow optimizations, to 3725@file{@var{file}.115r.bypass}. 3726 3727@item -dh 3728@itemx -fdump-rtl-eh 3729@opindex dh 3730@opindex fdump-rtl-eh 3731Dump after finalization of EH handling code, to @file{@var{file}.02.eh}. 3732 3733@item -di 3734@itemx -fdump-rtl-sibling 3735@opindex di 3736@opindex fdump-rtl-sibling 3737Dump after sibling call optimizations, to @file{@var{file}.106r.sibling}. 3738 3739@item -dj 3740@itemx -fdump-rtl-jump 3741@opindex dj 3742@opindex fdump-rtl-jump 3743Dump after the first jump optimization, to @file{@var{file}.112r.jump}. 3744 3745@item -dk 3746@itemx -fdump-rtl-stack 3747@opindex dk 3748@opindex fdump-rtl-stack 3749Dump after conversion from registers to stack, to @file{@var{file}.152r.stack}. 3750 3751@item -dl 3752@itemx -fdump-rtl-lreg 3753@opindex dl 3754@opindex fdump-rtl-lreg 3755Dump after local register allocation, to @file{@var{file}.138r.lreg}. 3756 3757@item -dL 3758@itemx -fdump-rtl-loop2 3759@opindex dL 3760@opindex fdump-rtl-loop2 3761@option{-dL} and @option{-fdump-rtl-loop2} enable dumping after the 3762loop optimization pass, to @file{@var{file}.119r.loop2}, 3763@file{@var{file}.120r.loop2_init}, 3764@file{@var{file}.121r.loop2_invariant}, and 3765@file{@var{file}.125r.loop2_done}. 3766 3767@item -dm 3768@itemx -fdump-rtl-sms 3769@opindex dm 3770@opindex fdump-rtl-sms 3771Dump after modulo scheduling, to @file{@var{file}.136r.sms}. 3772 3773@item -dM 3774@itemx -fdump-rtl-mach 3775@opindex dM 3776@opindex fdump-rtl-mach 3777Dump after performing the machine dependent reorganization pass, to 3778@file{@var{file}.155r.mach}. 3779 3780@item -dn 3781@itemx -fdump-rtl-rnreg 3782@opindex dn 3783@opindex fdump-rtl-rnreg 3784Dump after register renumbering, to @file{@var{file}.147r.rnreg}. 3785 3786@item -dN 3787@itemx -fdump-rtl-regmove 3788@opindex dN 3789@opindex fdump-rtl-regmove 3790Dump after the register move pass, to @file{@var{file}.132r.regmove}. 3791 3792@item -do 3793@itemx -fdump-rtl-postreload 3794@opindex do 3795@opindex fdump-rtl-postreload 3796Dump after post-reload optimizations, to @file{@var{file}.24.postreload}. 3797 3798@item -dr 3799@itemx -fdump-rtl-expand 3800@opindex dr 3801@opindex fdump-rtl-expand 3802Dump after RTL generation, to @file{@var{file}.104r.expand}. 3803 3804@item -dR 3805@itemx -fdump-rtl-sched2 3806@opindex dR 3807@opindex fdump-rtl-sched2 3808Dump after the second scheduling pass, to @file{@var{file}.150r.sched2}. 3809 3810@item -ds 3811@itemx -fdump-rtl-cse 3812@opindex ds 3813@opindex fdump-rtl-cse 3814Dump after CSE (including the jump optimization that sometimes follows 3815CSE), to @file{@var{file}.113r.cse}. 3816 3817@item -dS 3818@itemx -fdump-rtl-sched 3819@opindex dS 3820@opindex fdump-rtl-sched 3821Dump after the first scheduling pass, to @file{@var{file}.21.sched}. 3822 3823@item -dt 3824@itemx -fdump-rtl-cse2 3825@opindex dt 3826@opindex fdump-rtl-cse2 3827Dump after the second CSE pass (including the jump optimization that 3828sometimes follows CSE), to @file{@var{file}.127r.cse2}. 3829 3830@item -dT 3831@itemx -fdump-rtl-tracer 3832@opindex dT 3833@opindex fdump-rtl-tracer 3834Dump after running tracer, to @file{@var{file}.118r.tracer}. 3835 3836@item -dV 3837@itemx -fdump-rtl-vpt 3838@itemx -fdump-rtl-vartrack 3839@opindex dV 3840@opindex fdump-rtl-vpt 3841@opindex fdump-rtl-vartrack 3842@option{-dV} and @option{-fdump-rtl-vpt} enable dumping after the value 3843profile transformations, to @file{@var{file}.10.vpt}. @option{-dV} 3844and @option{-fdump-rtl-vartrack} enable dumping after variable tracking, 3845to @file{@var{file}.154r.vartrack}. 3846 3847@item -dw 3848@itemx -fdump-rtl-flow2 3849@opindex dw 3850@opindex fdump-rtl-flow2 3851Dump after the second flow pass, to @file{@var{file}.142r.flow2}. 3852 3853@item -dz 3854@itemx -fdump-rtl-peephole2 3855@opindex dz 3856@opindex fdump-rtl-peephole2 3857Dump after the peephole pass, to @file{@var{file}.145r.peephole2}. 3858 3859@item -dZ 3860@itemx -fdump-rtl-web 3861@opindex dZ 3862@opindex fdump-rtl-web 3863Dump after live range splitting, to @file{@var{file}.126r.web}. 3864 3865@item -da 3866@itemx -fdump-rtl-all 3867@opindex da 3868@opindex fdump-rtl-all 3869Produce all the dumps listed above. 3870 3871@item -dH 3872@opindex dH 3873Produce a core dump whenever an error occurs. 3874 3875@item -dm 3876@opindex dm 3877Print statistics on memory usage, at the end of the run, to 3878standard error. 3879 3880@item -dp 3881@opindex dp 3882Annotate the assembler output with a comment indicating which 3883pattern and alternative was used. The length of each instruction is 3884also printed. 3885 3886@item -dP 3887@opindex dP 3888Dump the RTL in the assembler output as a comment before each instruction. 3889Also turns on @option{-dp} annotation. 3890 3891@item -dv 3892@opindex dv 3893For each of the other indicated dump files (either with @option{-d} or 3894@option{-fdump-rtl-@var{pass}}), dump a representation of the control flow 3895graph suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}. 3896 3897@item -dx 3898@opindex dx 3899Just generate RTL for a function instead of compiling it. Usually used 3900with @samp{r} (@option{-fdump-rtl-expand}). 3901 3902@item -dy 3903@opindex dy 3904Dump debugging information during parsing, to standard error. 3905@end table 3906 3907@item -fdump-noaddr 3908@opindex fdump-noaddr 3909When doing debugging dumps (see @option{-d} option above), suppress 3910address output. This makes it more feasible to use diff on debugging 3911dumps for compiler invocations with different compiler binaries and/or 3912different text / bss / data / heap / stack / dso start locations. 3913 3914@item -fdump-unnumbered 3915@opindex fdump-unnumbered 3916When doing debugging dumps (see @option{-d} option above), suppress instruction 3917numbers, line number note and address output. This makes it more feasible to 3918use diff on debugging dumps for compiler invocations with different 3919options, in particular with and without @option{-g}. 3920 3921@item -fdump-translation-unit @r{(C++ only)} 3922@itemx -fdump-translation-unit-@var{options} @r{(C++ only)} 3923@opindex fdump-translation-unit 3924Dump a representation of the tree structure for the entire translation 3925unit to a file. The file name is made by appending @file{.tu} to the 3926source file name. If the @samp{-@var{options}} form is used, @var{options} 3927controls the details of the dump as described for the 3928@option{-fdump-tree} options. 3929 3930@item -fdump-class-hierarchy @r{(C++ only)} 3931@itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)} 3932@opindex fdump-class-hierarchy 3933Dump a representation of each class's hierarchy and virtual function 3934table layout to a file. The file name is made by appending @file{.class} 3935to the source file name. If the @samp{-@var{options}} form is used, 3936@var{options} controls the details of the dump as described for the 3937@option{-fdump-tree} options. 3938 3939@item -fdump-ipa-@var{switch} 3940@opindex fdump-ipa 3941Control the dumping at various stages of inter-procedural analysis 3942language tree to a file. The file name is generated by appending a switch 3943specific suffix to the source file name. The following dumps are possible: 3944 3945@table @samp 3946@item all 3947Enables all inter-procedural analysis dumps; currently the only produced 3948dump is the @samp{cgraph} dump. 3949 3950@item cgraph 3951Dumps information about call-graph optimization, unused function removal, 3952and inlining decisions. 3953@end table 3954 3955@item -fdump-tree-@var{switch} 3956@itemx -fdump-tree-@var{switch}-@var{options} 3957@opindex fdump-tree 3958Control the dumping at various stages of processing the intermediate 3959language tree to a file. The file name is generated by appending a switch 3960specific suffix to the source file name. If the @samp{-@var{options}} 3961form is used, @var{options} is a list of @samp{-} separated options that 3962control the details of the dump. Not all options are applicable to all 3963dumps, those which are not meaningful will be ignored. The following 3964options are available 3965 3966@table @samp 3967@item address 3968Print the address of each node. Usually this is not meaningful as it 3969changes according to the environment and source file. Its primary use 3970is for tying up a dump file with a debug environment. 3971@item slim 3972Inhibit dumping of members of a scope or body of a function merely 3973because that scope has been reached. Only dump such items when they 3974are directly reachable by some other path. When dumping pretty-printed 3975trees, this option inhibits dumping the bodies of control structures. 3976@item raw 3977Print a raw representation of the tree. By default, trees are 3978pretty-printed into a C-like representation. 3979@item details 3980Enable more detailed dumps (not honored by every dump option). 3981@item stats 3982Enable dumping various statistics about the pass (not honored by every dump 3983option). 3984@item blocks 3985Enable showing basic block boundaries (disabled in raw dumps). 3986@item vops 3987Enable showing virtual operands for every statement. 3988@item lineno 3989Enable showing line numbers for statements. 3990@item uid 3991Enable showing the unique ID (@code{DECL_UID}) for each variable. 3992@item all 3993Turn on all options, except @option{raw}, @option{slim} and @option{lineno}. 3994@end table 3995 3996The following tree dumps are possible: 3997@table @samp 3998 3999@item original 4000Dump before any tree based optimization, to @file{@var{file}.original}. 4001 4002@item optimized 4003Dump after all tree based optimization, to @file{@var{file}.optimized}. 4004 4005@item inlined 4006Dump after function inlining, to @file{@var{file}.inlined}. 4007 4008@item gimple 4009@opindex fdump-tree-gimple 4010Dump each function before and after the gimplification pass to a file. The 4011file name is made by appending @file{.gimple} to the source file name. 4012 4013@item cfg 4014@opindex fdump-tree-cfg 4015Dump the control flow graph of each function to a file. The file name is 4016made by appending @file{.cfg} to the source file name. 4017 4018@item vcg 4019@opindex fdump-tree-vcg 4020Dump the control flow graph of each function to a file in VCG format. The 4021file name is made by appending @file{.vcg} to the source file name. Note 4022that if the file contains more than one function, the generated file cannot 4023be used directly by VCG@. You will need to cut and paste each function's 4024graph into its own separate file first. 4025 4026@item ch 4027@opindex fdump-tree-ch 4028Dump each function after copying loop headers. The file name is made by 4029appending @file{.ch} to the source file name. 4030 4031@item ssa 4032@opindex fdump-tree-ssa 4033Dump SSA related information to a file. The file name is made by appending 4034@file{.ssa} to the source file name. 4035 4036@item salias 4037@opindex fdump-tree-salias 4038Dump structure aliasing variable information to a file. This file name 4039is made by appending @file{.salias} to the source file name. 4040 4041@item alias 4042@opindex fdump-tree-alias 4043Dump aliasing information for each function. The file name is made by 4044appending @file{.alias} to the source file name. 4045 4046@item ccp 4047@opindex fdump-tree-ccp 4048Dump each function after CCP@. The file name is made by appending 4049@file{.ccp} to the source file name. 4050 4051@item storeccp 4052@opindex fdump-tree-storeccp 4053Dump each function after STORE-CCP. The file name is made by appending 4054@file{.storeccp} to the source file name. 4055 4056@item pre 4057@opindex fdump-tree-pre 4058Dump trees after partial redundancy elimination. The file name is made 4059by appending @file{.pre} to the source file name. 4060 4061@item fre 4062@opindex fdump-tree-fre 4063Dump trees after full redundancy elimination. The file name is made 4064by appending @file{.fre} to the source file name. 4065 4066@item copyprop 4067@opindex fdump-tree-copyprop 4068Dump trees after copy propagation. The file name is made 4069by appending @file{.copyprop} to the source file name. 4070 4071@item store_copyprop 4072@opindex fdump-tree-store_copyprop 4073Dump trees after store copy-propagation. The file name is made 4074by appending @file{.store_copyprop} to the source file name. 4075 4076@item dce 4077@opindex fdump-tree-dce 4078Dump each function after dead code elimination. The file name is made by 4079appending @file{.dce} to the source file name. 4080 4081@item mudflap 4082@opindex fdump-tree-mudflap 4083Dump each function after adding mudflap instrumentation. The file name is 4084made by appending @file{.mudflap} to the source file name. 4085 4086@item sra 4087@opindex fdump-tree-sra 4088Dump each function after performing scalar replacement of aggregates. The 4089file name is made by appending @file{.sra} to the source file name. 4090 4091@item sink 4092@opindex fdump-tree-sink 4093Dump each function after performing code sinking. The file name is made 4094by appending @file{.sink} to the source file name. 4095 4096@item dom 4097@opindex fdump-tree-dom 4098Dump each function after applying dominator tree optimizations. The file 4099name is made by appending @file{.dom} to the source file name. 4100 4101@item dse 4102@opindex fdump-tree-dse 4103Dump each function after applying dead store elimination. The file 4104name is made by appending @file{.dse} to the source file name. 4105 4106@item phiopt 4107@opindex fdump-tree-phiopt 4108Dump each function after optimizing PHI nodes into straightline code. The file 4109name is made by appending @file{.phiopt} to the source file name. 4110 4111@item forwprop 4112@opindex fdump-tree-forwprop 4113Dump each function after forward propagating single use variables. The file 4114name is made by appending @file{.forwprop} to the source file name. 4115 4116@item copyrename 4117@opindex fdump-tree-copyrename 4118Dump each function after applying the copy rename optimization. The file 4119name is made by appending @file{.copyrename} to the source file name. 4120 4121@item nrv 4122@opindex fdump-tree-nrv 4123Dump each function after applying the named return value optimization on 4124generic trees. The file name is made by appending @file{.nrv} to the source 4125file name. 4126 4127@item vect 4128@opindex fdump-tree-vect 4129Dump each function after applying vectorization of loops. The file name is 4130made by appending @file{.vect} to the source file name. 4131 4132@item vrp 4133@opindex fdump-tree-vrp 4134Dump each function after Value Range Propagation (VRP). The file name 4135is made by appending @file{.vrp} to the source file name. 4136 4137@item all 4138@opindex fdump-tree-all 4139Enable all the available tree dumps with the flags provided in this option. 4140@end table 4141 4142@item -ftree-vectorizer-verbose=@var{n} 4143@opindex ftree-vectorizer-verbose 4144This option controls the amount of debugging output the vectorizer prints. 4145This information is written to standard error, unless 4146@option{-fdump-tree-all} or @option{-fdump-tree-vect} is specified, 4147in which case it is output to the usual dump listing file, @file{.vect}. 4148For @var{n}=0 no diagnostic information is reported. 4149If @var{n}=1 the vectorizer reports each loop that got vectorized, 4150and the total number of loops that got vectorized. 4151If @var{n}=2 the vectorizer also reports non-vectorized loops that passed 4152the first analysis phase (vect_analyze_loop_form) - i.e. countable, 4153inner-most, single-bb, single-entry/exit loops. This is the same verbosity 4154level that @option{-fdump-tree-vect-stats} uses. 4155Higher verbosity levels mean either more information dumped for each 4156reported loop, or same amount of information reported for more loops: 4157If @var{n}=3, alignment related information is added to the reports. 4158If @var{n}=4, data-references related information (e.g. memory dependences, 4159memory access-patterns) is added to the reports. 4160If @var{n}=5, the vectorizer reports also non-vectorized inner-most loops 4161that did not pass the first analysis phase (i.e. may not be countable, or 4162may have complicated control-flow). 4163If @var{n}=6, the vectorizer reports also non-vectorized nested loops. 4164For @var{n}=7, all the information the vectorizer generates during its 4165analysis and transformation is reported. This is the same verbosity level 4166that @option{-fdump-tree-vect-details} uses. 4167 4168@item -frandom-seed=@var{string} 4169@opindex frandom-string 4170This option provides a seed that GCC uses when it would otherwise use 4171random numbers. It is used to generate certain symbol names 4172that have to be different in every compiled file. It is also used to 4173place unique stamps in coverage data files and the object files that 4174produce them. You can use the @option{-frandom-seed} option to produce 4175reproducibly identical object files. 4176 4177The @var{string} should be different for every file you compile. 4178 4179@item -fsched-verbose=@var{n} 4180@opindex fsched-verbose 4181On targets that use instruction scheduling, this option controls the 4182amount of debugging output the scheduler prints. This information is 4183written to standard error, unless @option{-dS} or @option{-dR} is 4184specified, in which case it is output to the usual dump 4185listing file, @file{.sched} or @file{.sched2} respectively. However 4186for @var{n} greater than nine, the output is always printed to standard 4187error. 4188 4189For @var{n} greater than zero, @option{-fsched-verbose} outputs the 4190same information as @option{-dRS}. For @var{n} greater than one, it 4191also output basic block probabilities, detailed ready list information 4192and unit/insn info. For @var{n} greater than two, it includes RTL 4193at abort point, control-flow and regions info. And for @var{n} over 4194four, @option{-fsched-verbose} also includes dependence info. 4195 4196@item -save-temps 4197@opindex save-temps 4198Store the usual ``temporary'' intermediate files permanently; place them 4199in the current directory and name them based on the source file. Thus, 4200compiling @file{foo.c} with @samp{-c -save-temps} would produce files 4201@file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a 4202preprocessed @file{foo.i} output file even though the compiler now 4203normally uses an integrated preprocessor. 4204 4205When used in combination with the @option{-x} command line option, 4206@option{-save-temps} is sensible enough to avoid over writing an 4207input source file with the same extension as an intermediate file. 4208The corresponding intermediate file may be obtained by renaming the 4209source file before using @option{-save-temps}. 4210 4211@item -time 4212@opindex time 4213Report the CPU time taken by each subprocess in the compilation 4214sequence. For C source files, this is the compiler proper and assembler 4215(plus the linker if linking is done). The output looks like this: 4216 4217@smallexample 4218# cc1 0.12 0.01 4219# as 0.00 0.01 4220@end smallexample 4221 4222The first number on each line is the ``user time'', that is time spent 4223executing the program itself. The second number is ``system time'', 4224time spent executing operating system routines on behalf of the program. 4225Both numbers are in seconds. 4226 4227@item -fvar-tracking 4228@opindex fvar-tracking 4229Run variable tracking pass. It computes where variables are stored at each 4230position in code. Better debugging information is then generated 4231(if the debugging information format supports this information). 4232 4233It is enabled by default when compiling with optimization (@option{-Os}, 4234@option{-O}, @option{-O2}, ...), debugging information (@option{-g}) and 4235the debug info format supports it. 4236 4237@item -print-file-name=@var{library} 4238@opindex print-file-name 4239Print the full absolute name of the library file @var{library} that 4240would be used when linking---and don't do anything else. With this 4241option, GCC does not compile or link anything; it just prints the 4242file name. 4243 4244@item -print-multi-directory 4245@opindex print-multi-directory 4246Print the directory name corresponding to the multilib selected by any 4247other switches present in the command line. This directory is supposed 4248to exist in @env{GCC_EXEC_PREFIX}. 4249 4250@item -print-multi-lib 4251@opindex print-multi-lib 4252Print the mapping from multilib directory names to compiler switches 4253that enable them. The directory name is separated from the switches by 4254@samp{;}, and each switch starts with an @samp{@@} instead of the 4255@samp{-}, without spaces between multiple switches. This is supposed to 4256ease shell-processing. 4257 4258@item -print-prog-name=@var{program} 4259@opindex print-prog-name 4260Like @option{-print-file-name}, but searches for a program such as @samp{cpp}. 4261 4262@item -print-libgcc-file-name 4263@opindex print-libgcc-file-name 4264Same as @option{-print-file-name=libgcc.a}. 4265 4266This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs} 4267but you do want to link with @file{libgcc.a}. You can do 4268 4269@smallexample 4270gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name` 4271@end smallexample 4272 4273@item -print-search-dirs 4274@opindex print-search-dirs 4275Print the name of the configured installation directory and a list of 4276program and library directories @command{gcc} will search---and don't do anything else. 4277 4278This is useful when @command{gcc} prints the error message 4279@samp{installation problem, cannot exec cpp0: No such file or directory}. 4280To resolve this you either need to put @file{cpp0} and the other compiler 4281components where @command{gcc} expects to find them, or you can set the environment 4282variable @env{GCC_EXEC_PREFIX} to the directory where you installed them. 4283Don't forget the trailing @samp{/}. 4284@xref{Environment Variables}. 4285 4286@item -dumpmachine 4287@opindex dumpmachine 4288Print the compiler's target machine (for example, 4289@samp{i686-pc-linux-gnu})---and don't do anything else. 4290 4291@item -dumpversion 4292@opindex dumpversion 4293Print the compiler version (for example, @samp{3.0})---and don't do 4294anything else. 4295 4296@item -dumpspecs 4297@opindex dumpspecs 4298Print the compiler's built-in specs---and don't do anything else. (This 4299is used when GCC itself is being built.) @xref{Spec Files}. 4300 4301@item -feliminate-unused-debug-types 4302@opindex feliminate-unused-debug-types 4303Normally, when producing DWARF2 output, GCC will emit debugging 4304information for all types declared in a compilation 4305unit, regardless of whether or not they are actually used 4306in that compilation unit. Sometimes this is useful, such as 4307if, in the debugger, you want to cast a value to a type that is 4308not actually used in your program (but is declared). More often, 4309however, this results in a significant amount of wasted space. 4310With this option, GCC will avoid producing debug symbol output 4311for types that are nowhere used in the source file being compiled. 4312@end table 4313 4314@node Optimize Options 4315@section Options That Control Optimization 4316@cindex optimize options 4317@cindex options, optimization 4318 4319These options control various sorts of optimizations. 4320 4321Without any optimization option, the compiler's goal is to reduce the 4322cost of compilation and to make debugging produce the expected 4323results. Statements are independent: if you stop the program with a 4324breakpoint between statements, you can then assign a new value to any 4325variable or change the program counter to any other statement in the 4326function and get exactly the results you would expect from the source 4327code. 4328 4329Turning on optimization flags makes the compiler attempt to improve 4330the performance and/or code size at the expense of compilation time 4331and possibly the ability to debug the program. 4332 4333The compiler performs optimization based on the knowledge it has of 4334the program. Optimization levels @option{-O} and above, in 4335particular, enable @emph{unit-at-a-time} mode, which allows the 4336compiler to consider information gained from later functions in 4337the file when compiling a function. Compiling multiple files at 4338once to a single output file in @emph{unit-at-a-time} mode allows 4339the compiler to use information gained from all of the files when 4340compiling each of them. 4341 4342Not all optimizations are controlled directly by a flag. Only 4343optimizations that have a flag are listed. 4344 4345@table @gcctabopt 4346@item -O 4347@itemx -O1 4348@opindex O 4349@opindex O1 4350Optimize. Optimizing compilation takes somewhat more time, and a lot 4351more memory for a large function. 4352 4353With @option{-O}, the compiler tries to reduce code size and execution 4354time, without performing any optimizations that take a great deal of 4355compilation time. 4356 4357@option{-O} turns on the following optimization flags: 4358@gccoptlist{-fdefer-pop @gol 4359-fdelayed-branch @gol 4360-fguess-branch-probability @gol 4361-fcprop-registers @gol 4362-fif-conversion @gol 4363-fif-conversion2 @gol 4364-ftree-ccp @gol 4365-ftree-dce @gol 4366-ftree-dominator-opts @gol 4367-ftree-dse @gol 4368-ftree-ter @gol 4369-ftree-lrs @gol 4370-ftree-sra @gol 4371-ftree-copyrename @gol 4372-ftree-fre @gol 4373-ftree-ch @gol 4374-funit-at-a-time @gol 4375-fmerge-constants} 4376 4377@option{-O} also turns on @option{-fomit-frame-pointer} on machines 4378where doing so does not interfere with debugging. 4379 4380@item -O2 4381@opindex O2 4382Optimize even more. GCC performs nearly all supported optimizations 4383that do not involve a space-speed tradeoff. The compiler does not 4384perform loop unrolling or function inlining when you specify @option{-O2}. 4385As compared to @option{-O}, this option increases both compilation time 4386and the performance of the generated code. 4387 4388@option{-O2} turns on all optimization flags specified by @option{-O}. It 4389also turns on the following optimization flags: 4390@gccoptlist{-fthread-jumps @gol 4391-fcrossjumping @gol 4392-foptimize-sibling-calls @gol 4393-fcse-follow-jumps -fcse-skip-blocks @gol 4394-fgcse -fgcse-lm @gol 4395-fexpensive-optimizations @gol 4396-frerun-cse-after-loop @gol 4397-fcaller-saves @gol 4398-fpeephole2 @gol 4399-fschedule-insns -fschedule-insns2 @gol 4400-fsched-interblock -fsched-spec @gol 4401-fregmove @gol 4402-fstrict-aliasing -fstrict-overflow @gol 4403-fdelete-null-pointer-checks @gol 4404-freorder-blocks -freorder-functions @gol 4405-falign-functions -falign-jumps @gol 4406-falign-loops -falign-labels @gol 4407-ftree-vrp @gol 4408-ftree-pre} 4409 4410Please note the warning under @option{-fgcse} about 4411invoking @option{-O2} on programs that use computed gotos. 4412 4413@option{-O2} doesn't turn on @option{-ftree-vrp} for the Ada compiler. 4414This option must be explicitly specified on the command line to be 4415enabled for the Ada compiler. 4416 4417@item -O3 4418@opindex O3 4419Optimize yet more. @option{-O3} turns on all optimizations specified by 4420@option{-O2} and also turns on the @option{-finline-functions}, 4421@option{-funswitch-loops} and @option{-fgcse-after-reload} options. 4422 4423@item -O0 4424@opindex O0 4425Do not optimize. This is the default. 4426 4427@item -Os 4428@opindex Os 4429Optimize for size. @option{-Os} enables all @option{-O2} optimizations that 4430do not typically increase code size. It also performs further 4431optimizations designed to reduce code size. 4432 4433@option{-Os} disables the following optimization flags: 4434@gccoptlist{-falign-functions -falign-jumps -falign-loops @gol 4435-falign-labels -freorder-blocks -freorder-blocks-and-partition @gol 4436-fprefetch-loop-arrays -ftree-vect-loop-version} 4437 4438If you use multiple @option{-O} options, with or without level numbers, 4439the last such option is the one that is effective. 4440@end table 4441 4442Options of the form @option{-f@var{flag}} specify machine-independent 4443flags. Most flags have both positive and negative forms; the negative 4444form of @option{-ffoo} would be @option{-fno-foo}. In the table 4445below, only one of the forms is listed---the one you typically will 4446use. You can figure out the other form by either removing @samp{no-} 4447or adding it. 4448 4449The following options control specific optimizations. They are either 4450activated by @option{-O} options or are related to ones that are. You 4451can use the following flags in the rare cases when ``fine-tuning'' of 4452optimizations to be performed is desired. 4453 4454@table @gcctabopt 4455@item -fno-default-inline 4456@opindex fno-default-inline 4457Do not make member functions inline by default merely because they are 4458defined inside the class scope (C++ only). Otherwise, when you specify 4459@w{@option{-O}}, member functions defined inside class scope are compiled 4460inline by default; i.e., you don't need to add @samp{inline} in front of 4461the member function name. 4462 4463@item -fno-defer-pop 4464@opindex fno-defer-pop 4465Always pop the arguments to each function call as soon as that function 4466returns. For machines which must pop arguments after a function call, 4467the compiler normally lets arguments accumulate on the stack for several 4468function calls and pops them all at once. 4469 4470Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4471 4472@item -fforce-mem 4473@opindex fforce-mem 4474Force memory operands to be copied into registers before doing 4475arithmetic on them. This produces better code by making all memory 4476references potential common subexpressions. When they are not common 4477subexpressions, instruction combination should eliminate the separate 4478register-load. This option is now a nop and will be removed in 4.3. 4479 4480@item -fforce-addr 4481@opindex fforce-addr 4482Force memory address constants to be copied into registers before 4483doing arithmetic on them. 4484 4485@item -fomit-frame-pointer 4486@opindex fomit-frame-pointer 4487Don't keep the frame pointer in a register for functions that 4488don't need one. This avoids the instructions to save, set up and 4489restore frame pointers; it also makes an extra register available 4490in many functions. @strong{It also makes debugging impossible on 4491some machines.} 4492 4493On some machines, such as the VAX, this flag has no effect, because 4494the standard calling sequence automatically handles the frame pointer 4495and nothing is saved by pretending it doesn't exist. The 4496machine-description macro @code{FRAME_POINTER_REQUIRED} controls 4497whether a target machine supports this flag. @xref{Registers,,Register 4498Usage, gccint, GNU Compiler Collection (GCC) Internals}. 4499 4500Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4501 4502@item -foptimize-sibling-calls 4503@opindex foptimize-sibling-calls 4504Optimize sibling and tail recursive calls. 4505 4506Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4507 4508@item -fno-inline 4509@opindex fno-inline 4510Don't pay attention to the @code{inline} keyword. Normally this option 4511is used to keep the compiler from expanding any functions inline. 4512Note that if you are not optimizing, no functions can be expanded inline. 4513 4514@item -finline-functions 4515@opindex finline-functions 4516Integrate all simple functions into their callers. The compiler 4517heuristically decides which functions are simple enough to be worth 4518integrating in this way. 4519 4520If all calls to a given function are integrated, and the function is 4521declared @code{static}, then the function is normally not output as 4522assembler code in its own right. 4523 4524Enabled at level @option{-O3}. 4525 4526@item -finline-functions-called-once 4527@opindex finline-functions-called-once 4528Consider all @code{static} functions called once for inlining into their 4529caller even if they are not marked @code{inline}. If a call to a given 4530function is integrated, then the function is not output as assembler code 4531in its own right. 4532 4533Enabled if @option{-funit-at-a-time} is enabled. 4534 4535@item -fearly-inlining 4536@opindex fearly-inlining 4537Inline functions marked by @code{always_inline} and functions whose body seems 4538smaller than the function call overhead early before doing 4539@option{-fprofile-generate} instrumentation and real inlining pass. Doing so 4540makes profiling significantly cheaper and usually inlining faster on programs 4541having large chains of nested wrapper functions. 4542 4543Enabled by default. 4544 4545@item -finline-limit=@var{n} 4546@opindex finline-limit 4547By default, GCC limits the size of functions that can be inlined. This flag 4548allows the control of this limit for functions that are explicitly marked as 4549inline (i.e., marked with the inline keyword or defined within the class 4550definition in c++). @var{n} is the size of functions that can be inlined in 4551number of pseudo instructions (not counting parameter handling). The default 4552value of @var{n} is 600. 4553Increasing this value can result in more inlined code at 4554the cost of compilation time and memory consumption. Decreasing usually makes 4555the compilation faster and less code will be inlined (which presumably 4556means slower programs). This option is particularly useful for programs that 4557use inlining heavily such as those based on recursive templates with C++. 4558 4559Inlining is actually controlled by a number of parameters, which may be 4560specified individually by using @option{--param @var{name}=@var{value}}. 4561The @option{-finline-limit=@var{n}} option sets some of these parameters 4562as follows: 4563 4564@table @gcctabopt 4565@item max-inline-insns-single 4566 is set to @var{n}/2. 4567@item max-inline-insns-auto 4568 is set to @var{n}/2. 4569@item min-inline-insns 4570 is set to 130 or @var{n}/4, whichever is smaller. 4571@item max-inline-insns-rtl 4572 is set to @var{n}. 4573@end table 4574 4575See below for a documentation of the individual 4576parameters controlling inlining. 4577 4578@emph{Note:} pseudo instruction represents, in this particular context, an 4579abstract measurement of function's size. In no way does it represent a count 4580of assembly instructions and as such its exact meaning might change from one 4581release to an another. 4582 4583@item -fkeep-inline-functions 4584@opindex fkeep-inline-functions 4585In C, emit @code{static} functions that are declared @code{inline} 4586into the object file, even if the function has been inlined into all 4587of its callers. This switch does not affect functions using the 4588@code{extern inline} extension in GNU C@. In C++, emit any and all 4589inline functions into the object file. 4590 4591@item -fkeep-static-consts 4592@opindex fkeep-static-consts 4593Emit variables declared @code{static const} when optimization isn't turned 4594on, even if the variables aren't referenced. 4595 4596GCC enables this option by default. If you want to force the compiler to 4597check if the variable was referenced, regardless of whether or not 4598optimization is turned on, use the @option{-fno-keep-static-consts} option. 4599 4600@item -fmerge-constants 4601Attempt to merge identical constants (string constants and floating point 4602constants) across compilation units. 4603 4604This option is the default for optimized compilation if the assembler and 4605linker support it. Use @option{-fno-merge-constants} to inhibit this 4606behavior. 4607 4608Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4609 4610@item -fmerge-all-constants 4611Attempt to merge identical constants and identical variables. 4612 4613This option implies @option{-fmerge-constants}. In addition to 4614@option{-fmerge-constants} this considers e.g.@: even constant initialized 4615arrays or initialized constant variables with integral or floating point 4616types. Languages like C or C++ require each non-automatic variable to 4617have distinct location, so using this option will result in non-conforming 4618behavior. 4619 4620@item -fmodulo-sched 4621@opindex fmodulo-sched 4622Perform swing modulo scheduling immediately before the first scheduling 4623pass. This pass looks at innermost loops and reorders their 4624instructions by overlapping different iterations. 4625 4626@item -fno-branch-count-reg 4627@opindex fno-branch-count-reg 4628Do not use ``decrement and branch'' instructions on a count register, 4629but instead generate a sequence of instructions that decrement a 4630register, compare it against zero, then branch based upon the result. 4631This option is only meaningful on architectures that support such 4632instructions, which include x86, PowerPC, IA-64 and S/390. 4633 4634The default is @option{-fbranch-count-reg}. 4635 4636@item -fno-function-cse 4637@opindex fno-function-cse 4638Do not put function addresses in registers; make each instruction that 4639calls a constant function contain the function's address explicitly. 4640 4641This option results in less efficient code, but some strange hacks 4642that alter the assembler output may be confused by the optimizations 4643performed when this option is not used. 4644 4645The default is @option{-ffunction-cse} 4646 4647@item -fno-zero-initialized-in-bss 4648@opindex fno-zero-initialized-in-bss 4649If the target supports a BSS section, GCC by default puts variables that 4650are initialized to zero into BSS@. This can save space in the resulting 4651code. 4652 4653This option turns off this behavior because some programs explicitly 4654rely on variables going to the data section. E.g., so that the 4655resulting executable can find the beginning of that section and/or make 4656assumptions based on that. 4657 4658The default is @option{-fzero-initialized-in-bss}. 4659 4660@item -fbounds-check 4661@opindex fbounds-check 4662For front-ends that support it, generate additional code to check that 4663indices used to access arrays are within the declared range. This is 4664currently only supported by the Java and Fortran front-ends, where 4665this option defaults to true and false respectively. 4666 4667@item -fmudflap -fmudflapth -fmudflapir 4668@opindex fmudflap 4669@opindex fmudflapth 4670@opindex fmudflapir 4671@cindex bounds checking 4672@cindex mudflap 4673For front-ends that support it (C and C++), instrument all risky 4674pointer/array dereferencing operations, some standard library 4675string/heap functions, and some other associated constructs with 4676range/validity tests. Modules so instrumented should be immune to 4677buffer overflows, invalid heap use, and some other classes of C/C++ 4678programming errors. The instrumentation relies on a separate runtime 4679library (@file{libmudflap}), which will be linked into a program if 4680@option{-fmudflap} is given at link time. Run-time behavior of the 4681instrumented program is controlled by the @env{MUDFLAP_OPTIONS} 4682environment variable. See @code{env MUDFLAP_OPTIONS=-help a.out} 4683for its options. 4684 4685Use @option{-fmudflapth} instead of @option{-fmudflap} to compile and to 4686link if your program is multi-threaded. Use @option{-fmudflapir}, in 4687addition to @option{-fmudflap} or @option{-fmudflapth}, if 4688instrumentation should ignore pointer reads. This produces less 4689instrumentation (and therefore faster execution) and still provides 4690some protection against outright memory corrupting writes, but allows 4691erroneously read data to propagate within a program. 4692 4693@item -fthread-jumps 4694@opindex fthread-jumps 4695Perform optimizations where we check to see if a jump branches to a 4696location where another comparison subsumed by the first is found. If 4697so, the first branch is redirected to either the destination of the 4698second branch or a point immediately following it, depending on whether 4699the condition is known to be true or false. 4700 4701Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4702 4703@item -fcse-follow-jumps 4704@opindex fcse-follow-jumps 4705In common subexpression elimination, scan through jump instructions 4706when the target of the jump is not reached by any other path. For 4707example, when CSE encounters an @code{if} statement with an 4708@code{else} clause, CSE will follow the jump when the condition 4709tested is false. 4710 4711Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4712 4713@item -fcse-skip-blocks 4714@opindex fcse-skip-blocks 4715This is similar to @option{-fcse-follow-jumps}, but causes CSE to 4716follow jumps which conditionally skip over blocks. When CSE 4717encounters a simple @code{if} statement with no else clause, 4718@option{-fcse-skip-blocks} causes CSE to follow the jump around the 4719body of the @code{if}. 4720 4721Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4722 4723@item -frerun-cse-after-loop 4724@opindex frerun-cse-after-loop 4725Re-run common subexpression elimination after loop optimizations has been 4726performed. 4727 4728Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4729 4730@item -fgcse 4731@opindex fgcse 4732Perform a global common subexpression elimination pass. 4733This pass also performs global constant and copy propagation. 4734 4735@emph{Note:} When compiling a program using computed gotos, a GCC 4736extension, you may get better runtime performance if you disable 4737the global common subexpression elimination pass by adding 4738@option{-fno-gcse} to the command line. 4739 4740Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4741 4742@item -fgcse-lm 4743@opindex fgcse-lm 4744When @option{-fgcse-lm} is enabled, global common subexpression elimination will 4745attempt to move loads which are only killed by stores into themselves. This 4746allows a loop containing a load/store sequence to be changed to a load outside 4747the loop, and a copy/store within the loop. 4748 4749Enabled by default when gcse is enabled. 4750 4751@item -fgcse-sm 4752@opindex fgcse-sm 4753When @option{-fgcse-sm} is enabled, a store motion pass is run after 4754global common subexpression elimination. This pass will attempt to move 4755stores out of loops. When used in conjunction with @option{-fgcse-lm}, 4756loops containing a load/store sequence can be changed to a load before 4757the loop and a store after the loop. 4758 4759Not enabled at any optimization level. 4760 4761@item -fgcse-las 4762@opindex fgcse-las 4763When @option{-fgcse-las} is enabled, the global common subexpression 4764elimination pass eliminates redundant loads that come after stores to the 4765same memory location (both partial and full redundancies). 4766 4767Not enabled at any optimization level. 4768 4769@item -fgcse-after-reload 4770@opindex fgcse-after-reload 4771When @option{-fgcse-after-reload} is enabled, a redundant load elimination 4772pass is performed after reload. The purpose of this pass is to cleanup 4773redundant spilling. 4774 4775@item -funsafe-loop-optimizations 4776@opindex funsafe-loop-optimizations 4777If given, the loop optimizer will assume that loop indices do not 4778overflow, and that the loops with nontrivial exit condition are not 4779infinite. This enables a wider range of loop optimizations even if 4780the loop optimizer itself cannot prove that these assumptions are valid. 4781Using @option{-Wunsafe-loop-optimizations}, the compiler will warn you 4782if it finds this kind of loop. 4783 4784@item -fcrossjumping 4785@opindex crossjumping 4786Perform cross-jumping transformation. This transformation unifies equivalent code and save code size. The 4787resulting code may or may not perform better than without cross-jumping. 4788 4789Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4790 4791@item -fif-conversion 4792@opindex if-conversion 4793Attempt to transform conditional jumps into branch-less equivalents. This 4794include use of conditional moves, min, max, set flags and abs instructions, and 4795some tricks doable by standard arithmetics. The use of conditional execution 4796on chips where it is available is controlled by @code{if-conversion2}. 4797 4798Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4799 4800@item -fif-conversion2 4801@opindex if-conversion2 4802Use conditional execution (where available) to transform conditional jumps into 4803branch-less equivalents. 4804 4805Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4806 4807@item -fdelete-null-pointer-checks 4808@opindex fdelete-null-pointer-checks 4809Use global dataflow analysis to identify and eliminate useless checks 4810for null pointers. The compiler assumes that dereferencing a null 4811pointer would have halted the program. If a pointer is checked after 4812it has already been dereferenced, it cannot be null. 4813 4814In some environments, this assumption is not true, and programs can 4815safely dereference null pointers. Use 4816@option{-fno-delete-null-pointer-checks} to disable this optimization 4817for programs which depend on that behavior. 4818 4819Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4820 4821@item -fexpensive-optimizations 4822@opindex fexpensive-optimizations 4823Perform a number of minor optimizations that are relatively expensive. 4824 4825Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4826 4827@item -foptimize-register-move 4828@itemx -fregmove 4829@opindex foptimize-register-move 4830@opindex fregmove 4831Attempt to reassign register numbers in move instructions and as 4832operands of other simple instructions in order to maximize the amount of 4833register tying. This is especially helpful on machines with two-operand 4834instructions. 4835 4836Note @option{-fregmove} and @option{-foptimize-register-move} are the same 4837optimization. 4838 4839Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4840 4841@item -fdelayed-branch 4842@opindex fdelayed-branch 4843If supported for the target machine, attempt to reorder instructions 4844to exploit instruction slots available after delayed branch 4845instructions. 4846 4847Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4848 4849@item -fschedule-insns 4850@opindex fschedule-insns 4851If supported for the target machine, attempt to reorder instructions to 4852eliminate execution stalls due to required data being unavailable. This 4853helps machines that have slow floating point or memory load instructions 4854by allowing other instructions to be issued until the result of the load 4855or floating point instruction is required. 4856 4857Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4858 4859@item -fschedule-insns2 4860@opindex fschedule-insns2 4861Similar to @option{-fschedule-insns}, but requests an additional pass of 4862instruction scheduling after register allocation has been done. This is 4863especially useful on machines with a relatively small number of 4864registers and where memory load instructions take more than one cycle. 4865 4866Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4867 4868@item -fno-sched-interblock 4869@opindex fno-sched-interblock 4870Don't schedule instructions across basic blocks. This is normally 4871enabled by default when scheduling before register allocation, i.e.@: 4872with @option{-fschedule-insns} or at @option{-O2} or higher. 4873 4874@item -fno-sched-spec 4875@opindex fno-sched-spec 4876Don't allow speculative motion of non-load instructions. This is normally 4877enabled by default when scheduling before register allocation, i.e.@: 4878with @option{-fschedule-insns} or at @option{-O2} or higher. 4879 4880@item -fsched-spec-load 4881@opindex fsched-spec-load 4882Allow speculative motion of some load instructions. This only makes 4883sense when scheduling before register allocation, i.e.@: with 4884@option{-fschedule-insns} or at @option{-O2} or higher. 4885 4886@item -fsched-spec-load-dangerous 4887@opindex fsched-spec-load-dangerous 4888Allow speculative motion of more load instructions. This only makes 4889sense when scheduling before register allocation, i.e.@: with 4890@option{-fschedule-insns} or at @option{-O2} or higher. 4891 4892@item -fsched-stalled-insns=@var{n} 4893@opindex fsched-stalled-insns 4894Define how many insns (if any) can be moved prematurely from the queue 4895of stalled insns into the ready list, during the second scheduling pass. 4896 4897@item -fsched-stalled-insns-dep=@var{n} 4898@opindex fsched-stalled-insns-dep 4899Define how many insn groups (cycles) will be examined for a dependency 4900on a stalled insn that is candidate for premature removal from the queue 4901of stalled insns. Has an effect only during the second scheduling pass, 4902and only if @option{-fsched-stalled-insns} is used and its value is not zero. 4903 4904@item -fsched2-use-superblocks 4905@opindex fsched2-use-superblocks 4906When scheduling after register allocation, do use superblock scheduling 4907algorithm. Superblock scheduling allows motion across basic block boundaries 4908resulting on faster schedules. This option is experimental, as not all machine 4909descriptions used by GCC model the CPU closely enough to avoid unreliable 4910results from the algorithm. 4911 4912This only makes sense when scheduling after register allocation, i.e.@: with 4913@option{-fschedule-insns2} or at @option{-O2} or higher. 4914 4915@item -fsched2-use-traces 4916@opindex fsched2-use-traces 4917Use @option{-fsched2-use-superblocks} algorithm when scheduling after register 4918allocation and additionally perform code duplication in order to increase the 4919size of superblocks using tracer pass. See @option{-ftracer} for details on 4920trace formation. 4921 4922This mode should produce faster but significantly longer programs. Also 4923without @option{-fbranch-probabilities} the traces constructed may not 4924match the reality and hurt the performance. This only makes 4925sense when scheduling after register allocation, i.e.@: with 4926@option{-fschedule-insns2} or at @option{-O2} or higher. 4927 4928@item -fsee 4929@opindex fsee 4930Eliminates redundant extension instructions and move the non redundant 4931ones to optimal placement using LCM. 4932 4933@item -freschedule-modulo-scheduled-loops 4934@opindex fscheduling-in-modulo-scheduled-loops 4935The modulo scheduling comes before the traditional scheduling, if a loop was modulo scheduled 4936we may want to prevent the later scheduling passes from changing its schedule, we use this 4937option to control that. 4938 4939@item -fcaller-saves 4940@opindex fcaller-saves 4941Enable values to be allocated in registers that will be clobbered by 4942function calls, by emitting extra instructions to save and restore the 4943registers around such calls. Such allocation is done only when it 4944seems to result in better code than would otherwise be produced. 4945 4946This option is always enabled by default on certain machines, usually 4947those which have no call-preserved registers to use instead. 4948 4949Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4950 4951@item -ftree-pre 4952Perform Partial Redundancy Elimination (PRE) on trees. This flag is 4953enabled by default at @option{-O2} and @option{-O3}. 4954 4955@item -ftree-fre 4956Perform Full Redundancy Elimination (FRE) on trees. The difference 4957between FRE and PRE is that FRE only considers expressions 4958that are computed on all paths leading to the redundant computation. 4959This analysis faster than PRE, though it exposes fewer redundancies. 4960This flag is enabled by default at @option{-O} and higher. 4961 4962@item -ftree-copy-prop 4963Perform copy propagation on trees. This pass eliminates unnecessary 4964copy operations. This flag is enabled by default at @option{-O} and 4965higher. 4966 4967@item -ftree-store-copy-prop 4968Perform copy propagation of memory loads and stores. This pass 4969eliminates unnecessary copy operations in memory references 4970(structures, global variables, arrays, etc). This flag is enabled by 4971default at @option{-O2} and higher. 4972 4973@item -ftree-salias 4974Perform structural alias analysis on trees. This flag 4975is enabled by default at @option{-O} and higher. 4976 4977@item -fipa-pta 4978Perform interprocedural pointer analysis. 4979 4980@item -ftree-sink 4981Perform forward store motion on trees. This flag is 4982enabled by default at @option{-O} and higher. 4983 4984@item -ftree-ccp 4985Perform sparse conditional constant propagation (CCP) on trees. This 4986pass only operates on local scalar variables and is enabled by default 4987at @option{-O} and higher. 4988 4989@item -ftree-store-ccp 4990Perform sparse conditional constant propagation (CCP) on trees. This 4991pass operates on both local scalar variables and memory stores and 4992loads (global variables, structures, arrays, etc). This flag is 4993enabled by default at @option{-O2} and higher. 4994 4995@item -ftree-dce 4996Perform dead code elimination (DCE) on trees. This flag is enabled by 4997default at @option{-O} and higher. 4998 4999@item -ftree-dominator-opts 5000Perform a variety of simple scalar cleanups (constant/copy 5001propagation, redundancy elimination, range propagation and expression 5002simplification) based on a dominator tree traversal. This also 5003performs jump threading (to reduce jumps to jumps). This flag is 5004enabled by default at @option{-O} and higher. 5005 5006@item -ftree-ch 5007Perform loop header copying on trees. This is beneficial since it increases 5008effectiveness of code motion optimizations. It also saves one jump. This flag 5009is enabled by default at @option{-O} and higher. It is not enabled 5010for @option{-Os}, since it usually increases code size. 5011 5012@item -ftree-loop-optimize 5013Perform loop optimizations on trees. This flag is enabled by default 5014at @option{-O} and higher. 5015 5016@item -ftree-loop-linear 5017Perform linear loop transformations on tree. This flag can improve cache 5018performance and allow further loop optimizations to take place. 5019 5020@item -ftree-loop-im 5021Perform loop invariant motion on trees. This pass moves only invariants that 5022would be hard to handle at RTL level (function calls, operations that expand to 5023nontrivial sequences of insns). With @option{-funswitch-loops} it also moves 5024operands of conditions that are invariant out of the loop, so that we can use 5025just trivial invariantness analysis in loop unswitching. The pass also includes 5026store motion. 5027 5028@item -ftree-loop-ivcanon 5029Create a canonical counter for number of iterations in the loop for that 5030determining number of iterations requires complicated analysis. Later 5031optimizations then may determine the number easily. Useful especially 5032in connection with unrolling. 5033 5034@item -fivopts 5035Perform induction variable optimizations (strength reduction, induction 5036variable merging and induction variable elimination) on trees. 5037 5038@item -ftree-sra 5039Perform scalar replacement of aggregates. This pass replaces structure 5040references with scalars to prevent committing structures to memory too 5041early. This flag is enabled by default at @option{-O} and higher. 5042 5043@item -ftree-copyrename 5044Perform copy renaming on trees. This pass attempts to rename compiler 5045temporaries to other variables at copy locations, usually resulting in 5046variable names which more closely resemble the original variables. This flag 5047is enabled by default at @option{-O} and higher. 5048 5049@item -ftree-ter 5050Perform temporary expression replacement during the SSA->normal phase. Single 5051use/single def temporaries are replaced at their use location with their 5052defining expression. This results in non-GIMPLE code, but gives the expanders 5053much more complex trees to work on resulting in better RTL generation. This is 5054enabled by default at @option{-O} and higher. 5055 5056@item -ftree-lrs 5057Perform live range splitting during the SSA->normal phase. Distinct live 5058ranges of a variable are split into unique variables, allowing for better 5059optimization later. This is enabled by default at @option{-O} and higher. 5060 5061@item -ftree-vectorize 5062Perform loop vectorization on trees. 5063 5064@item -ftree-vect-loop-version 5065@opindex ftree-vect-loop-version 5066Perform loop versioning when doing loop vectorization on trees. When a loop 5067appears to be vectorizable except that data alignment or data dependence cannot 5068be determined at compile time then vectorized and non-vectorized versions of 5069the loop are generated along with runtime checks for alignment or dependence 5070to control which version is executed. This option is enabled by default 5071except at level @option{-Os} where it is disabled. 5072 5073@item -ftree-vrp 5074Perform Value Range Propagation on trees. This is similar to the 5075constant propagation pass, but instead of values, ranges of values are 5076propagated. This allows the optimizers to remove unnecessary range 5077checks like array bound checks and null pointer checks. This is 5078enabled by default at @option{-O2} and higher. Null pointer check 5079elimination is only done if @option{-fdelete-null-pointer-checks} is 5080enabled. 5081 5082@item -ftracer 5083@opindex ftracer 5084Perform tail duplication to enlarge superblock size. This transformation 5085simplifies the control flow of the function allowing other optimizations to do 5086better job. 5087 5088@item -funroll-loops 5089@opindex funroll-loops 5090Unroll loops whose number of iterations can be determined at compile 5091time or upon entry to the loop. @option{-funroll-loops} implies 5092@option{-frerun-cse-after-loop}. This option makes code larger, 5093and may or may not make it run faster. 5094 5095@item -funroll-all-loops 5096@opindex funroll-all-loops 5097Unroll all loops, even if their number of iterations is uncertain when 5098the loop is entered. This usually makes programs run more slowly. 5099@option{-funroll-all-loops} implies the same options as 5100@option{-funroll-loops}, 5101 5102@item -fsplit-ivs-in-unroller 5103@opindex fsplit-ivs-in-unroller 5104Enables expressing of values of induction variables in later iterations 5105of the unrolled loop using the value in the first iteration. This breaks 5106long dependency chains, thus improving efficiency of the scheduling passes. 5107 5108Combination of @option{-fweb} and CSE is often sufficient to obtain the 5109same effect. However in cases the loop body is more complicated than 5110a single basic block, this is not reliable. It also does not work at all 5111on some of the architectures due to restrictions in the CSE pass. 5112 5113This optimization is enabled by default. 5114 5115@item -fvariable-expansion-in-unroller 5116@opindex fvariable-expansion-in-unroller 5117With this option, the compiler will create multiple copies of some 5118local variables when unrolling a loop which can result in superior code. 5119 5120@item -fprefetch-loop-arrays 5121@opindex fprefetch-loop-arrays 5122If supported by the target machine, generate instructions to prefetch 5123memory to improve the performance of loops that access large arrays. 5124 5125This option may generate better or worse code; results are highly 5126dependent on the structure of loops within the source code. 5127 5128Disabled at level @option{-Os}. 5129 5130@item -fno-peephole 5131@itemx -fno-peephole2 5132@opindex fno-peephole 5133@opindex fno-peephole2 5134Disable any machine-specific peephole optimizations. The difference 5135between @option{-fno-peephole} and @option{-fno-peephole2} is in how they 5136are implemented in the compiler; some targets use one, some use the 5137other, a few use both. 5138 5139@option{-fpeephole} is enabled by default. 5140@option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 5141 5142@item -fno-guess-branch-probability 5143@opindex fno-guess-branch-probability 5144Do not guess branch probabilities using heuristics. 5145 5146GCC will use heuristics to guess branch probabilities if they are 5147not provided by profiling feedback (@option{-fprofile-arcs}). These 5148heuristics are based on the control flow graph. If some branch probabilities 5149are specified by @samp{__builtin_expect}, then the heuristics will be 5150used to guess branch probabilities for the rest of the control flow graph, 5151taking the @samp{__builtin_expect} info into account. The interactions 5152between the heuristics and @samp{__builtin_expect} can be complex, and in 5153some cases, it may be useful to disable the heuristics so that the effects 5154of @samp{__builtin_expect} are easier to understand. 5155 5156The default is @option{-fguess-branch-probability} at levels 5157@option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 5158 5159@item -freorder-blocks 5160@opindex freorder-blocks 5161Reorder basic blocks in the compiled function in order to reduce number of 5162taken branches and improve code locality. 5163 5164Enabled at levels @option{-O2}, @option{-O3}. 5165 5166@item -freorder-blocks-and-partition 5167@opindex freorder-blocks-and-partition 5168In addition to reordering basic blocks in the compiled function, in order 5169to reduce number of taken branches, partitions hot and cold basic blocks 5170into separate sections of the assembly and .o files, to improve 5171paging and cache locality performance. 5172 5173This optimization is automatically turned off in the presence of 5174exception handling, for linkonce sections, for functions with a user-defined 5175section attribute and on any architecture that does not support named 5176sections. 5177 5178@item -freorder-functions 5179@opindex freorder-functions 5180Reorder functions in the object file in order to 5181improve code locality. This is implemented by using special 5182subsections @code{.text.hot} for most frequently executed functions and 5183@code{.text.unlikely} for unlikely executed functions. Reordering is done by 5184the linker so object file format must support named sections and linker must 5185place them in a reasonable way. 5186 5187Also profile feedback must be available in to make this option effective. See 5188@option{-fprofile-arcs} for details. 5189 5190Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 5191 5192@item -fstrict-aliasing 5193@opindex fstrict-aliasing 5194Allows the compiler to assume the strictest aliasing rules applicable to 5195the language being compiled. For C (and C++), this activates 5196optimizations based on the type of expressions. In particular, an 5197object of one type is assumed never to reside at the same address as an 5198object of a different type, unless the types are almost the same. For 5199example, an @code{unsigned int} can alias an @code{int}, but not a 5200@code{void*} or a @code{double}. A character type may alias any other 5201type. 5202 5203Pay special attention to code like this: 5204@smallexample 5205union a_union @{ 5206 int i; 5207 double d; 5208@}; 5209 5210int f() @{ 5211 a_union t; 5212 t.d = 3.0; 5213 return t.i; 5214@} 5215@end smallexample 5216The practice of reading from a different union member than the one most 5217recently written to (called ``type-punning'') is common. Even with 5218@option{-fstrict-aliasing}, type-punning is allowed, provided the memory 5219is accessed through the union type. So, the code above will work as 5220expected. However, this code might not: 5221@smallexample 5222int f() @{ 5223 a_union t; 5224 int* ip; 5225 t.d = 3.0; 5226 ip = &t.i; 5227 return *ip; 5228@} 5229@end smallexample 5230 5231Every language that wishes to perform language-specific alias analysis 5232should define a function that computes, given an @code{tree} 5233node, an alias set for the node. Nodes in different alias sets are not 5234allowed to alias. For an example, see the C front-end function 5235@code{c_get_alias_set}. 5236 5237Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 5238 5239@item -fstrict-overflow 5240@opindex fstrict-overflow 5241Allow the compiler to assume strict signed overflow rules, depending 5242on the language being compiled. For C (and C++) this means that 5243overflow when doing arithmetic with signed numbers is undefined, which 5244means that the compiler may assume that it will not happen. This 5245permits various optimizations. For example, the compiler will assume 5246that an expression like @code{i + 10 > i} will always be true for 5247signed @code{i}. This assumption is only valid if signed overflow is 5248undefined, as the expression is false if @code{i + 10} overflows when 5249using twos complement arithmetic. When this option is in effect any 5250attempt to determine whether an operation on signed numbers will 5251overflow must be written carefully to not actually involve overflow. 5252 5253See also the @option{-fwrapv} option. Using @option{-fwrapv} means 5254that signed overflow is fully defined: it wraps. When 5255@option{-fwrapv} is used, there is no difference between 5256@option{-fstrict-overflow} and @option{-fno-strict-overflow}. With 5257@option{-fwrapv} certain types of overflow are permitted. For 5258example, if the compiler gets an overflow when doing arithmetic on 5259constants, the overflowed value can still be used with 5260@option{-fwrapv}, but not otherwise. 5261 5262The @option{-fstrict-overflow} option is enabled at levels 5263@option{-O2}, @option{-O3}, @option{-Os}. 5264 5265@item -falign-functions 5266@itemx -falign-functions=@var{n} 5267@opindex falign-functions 5268Align the start of functions to the next power-of-two greater than 5269@var{n}, skipping up to @var{n} bytes. For instance, 5270@option{-falign-functions=32} aligns functions to the next 32-byte 5271boundary, but @option{-falign-functions=24} would align to the next 527232-byte boundary only if this can be done by skipping 23 bytes or less. 5273 5274@option{-fno-align-functions} and @option{-falign-functions=1} are 5275equivalent and mean that functions will not be aligned. 5276 5277Some assemblers only support this flag when @var{n} is a power of two; 5278in that case, it is rounded up. 5279 5280If @var{n} is not specified or is zero, use a machine-dependent default. 5281 5282Enabled at levels @option{-O2}, @option{-O3}. 5283 5284@item -falign-labels 5285@itemx -falign-labels=@var{n} 5286@opindex falign-labels 5287Align all branch targets to a power-of-two boundary, skipping up to 5288@var{n} bytes like @option{-falign-functions}. This option can easily 5289make code slower, because it must insert dummy operations for when the 5290branch target is reached in the usual flow of the code. 5291 5292@option{-fno-align-labels} and @option{-falign-labels=1} are 5293equivalent and mean that labels will not be aligned. 5294 5295If @option{-falign-loops} or @option{-falign-jumps} are applicable and 5296are greater than this value, then their values are used instead. 5297 5298If @var{n} is not specified or is zero, use a machine-dependent default 5299which is very likely to be @samp{1}, meaning no alignment. 5300 5301Enabled at levels @option{-O2}, @option{-O3}. 5302 5303@item -falign-loops 5304@itemx -falign-loops=@var{n} 5305@opindex falign-loops 5306Align loops to a power-of-two boundary, skipping up to @var{n} bytes 5307like @option{-falign-functions}. The hope is that the loop will be 5308executed many times, which will make up for any execution of the dummy 5309operations. 5310 5311@option{-fno-align-loops} and @option{-falign-loops=1} are 5312equivalent and mean that loops will not be aligned. 5313 5314If @var{n} is not specified or is zero, use a machine-dependent default. 5315 5316Enabled at levels @option{-O2}, @option{-O3}. 5317 5318@item -falign-jumps 5319@itemx -falign-jumps=@var{n} 5320@opindex falign-jumps 5321Align branch targets to a power-of-two boundary, for branch targets 5322where the targets can only be reached by jumping, skipping up to @var{n} 5323bytes like @option{-falign-functions}. In this case, no dummy operations 5324need be executed. 5325 5326@option{-fno-align-jumps} and @option{-falign-jumps=1} are 5327equivalent and mean that loops will not be aligned. 5328 5329If @var{n} is not specified or is zero, use a machine-dependent default. 5330 5331Enabled at levels @option{-O2}, @option{-O3}. 5332 5333@item -funit-at-a-time 5334@opindex funit-at-a-time 5335Parse the whole compilation unit before starting to produce code. 5336This allows some extra optimizations to take place but consumes 5337more memory (in general). There are some compatibility issues 5338with @emph{unit-at-a-time} mode: 5339@itemize @bullet 5340@item 5341enabling @emph{unit-at-a-time} mode may change the order 5342in which functions, variables, and top-level @code{asm} statements 5343are emitted, and will likely break code relying on some particular 5344ordering. The majority of such top-level @code{asm} statements, 5345though, can be replaced by @code{section} attributes. The 5346@option{fno-toplevel-reorder} option may be used to keep the ordering 5347used in the input file, at the cost of some optimizations. 5348 5349@item 5350@emph{unit-at-a-time} mode removes unreferenced static variables 5351and functions. This may result in undefined references 5352when an @code{asm} statement refers directly to variables or functions 5353that are otherwise unused. In that case either the variable/function 5354shall be listed as an operand of the @code{asm} statement operand or, 5355in the case of top-level @code{asm} statements the attribute @code{used} 5356shall be used on the declaration. 5357 5358@item 5359Static functions now can use non-standard passing conventions that 5360may break @code{asm} statements calling functions directly. Again, 5361attribute @code{used} will prevent this behavior. 5362@end itemize 5363 5364As a temporary workaround, @option{-fno-unit-at-a-time} can be used, 5365but this scheme may not be supported by future releases of GCC@. 5366 5367Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 5368 5369@item -fno-toplevel-reorder 5370Do not reorder top-level functions, variables, and @code{asm} 5371statements. Output them in the same order that they appear in the 5372input file. When this option is used, unreferenced static variables 5373will not be removed. This option is intended to support existing code 5374which relies on a particular ordering. For new code, it is better to 5375use attributes. 5376 5377@item -fweb 5378@opindex fweb 5379Constructs webs as commonly used for register allocation purposes and assign 5380each web individual pseudo register. This allows the register allocation pass 5381to operate on pseudos directly, but also strengthens several other optimization 5382passes, such as CSE, loop optimizer and trivial dead code remover. It can, 5383however, make debugging impossible, since variables will no longer stay in a 5384``home register''. 5385 5386Enabled by default with @option{-funroll-loops}. 5387 5388@item -fwhole-program 5389@opindex fwhole-program 5390Assume that the current compilation unit represents whole program being 5391compiled. All public functions and variables with the exception of @code{main} 5392and those merged by attribute @code{externally_visible} become static functions 5393and in a affect gets more aggressively optimized by interprocedural optimizers. 5394While this option is equivalent to proper use of @code{static} keyword for 5395programs consisting of single file, in combination with option 5396@option{--combine} this flag can be used to compile most of smaller scale C 5397programs since the functions and variables become local for the whole combined 5398compilation unit, not for the single source file itself. 5399 5400 5401@item -fno-cprop-registers 5402@opindex fno-cprop-registers 5403After register allocation and post-register allocation instruction splitting, 5404we perform a copy-propagation pass to try to reduce scheduling dependencies 5405and occasionally eliminate the copy. 5406 5407Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 5408 5409@item -fprofile-generate 5410@opindex fprofile-generate 5411 5412Enable options usually used for instrumenting application to produce 5413profile useful for later recompilation with profile feedback based 5414optimization. You must use @option{-fprofile-generate} both when 5415compiling and when linking your program. 5416 5417The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}. 5418 5419@item -fprofile-use 5420@opindex fprofile-use 5421Enable profile feedback directed optimizations, and optimizations 5422generally profitable only with profile feedback available. 5423 5424The following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt}, 5425@code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer} 5426 5427@end table 5428 5429The following options control compiler behavior regarding floating 5430point arithmetic. These options trade off between speed and 5431correctness. All must be specifically enabled. 5432 5433@table @gcctabopt 5434@item -ffloat-store 5435@opindex ffloat-store 5436Do not store floating point variables in registers, and inhibit other 5437options that might change whether a floating point value is taken from a 5438register or memory. 5439 5440@cindex floating point precision 5441This option prevents undesirable excess precision on machines such as 5442the 68000 where the floating registers (of the 68881) keep more 5443precision than a @code{double} is supposed to have. Similarly for the 5444x86 architecture. For most programs, the excess precision does only 5445good, but a few programs rely on the precise definition of IEEE floating 5446point. Use @option{-ffloat-store} for such programs, after modifying 5447them to store all pertinent intermediate computations into variables. 5448 5449@item -ffast-math 5450@opindex ffast-math 5451Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, @* 5452@option{-fno-trapping-math}, @option{-ffinite-math-only}, 5453@option{-fno-rounding-math}, @option{-fno-signaling-nans} 5454and @option{fcx-limited-range}. 5455 5456This option causes the preprocessor macro @code{__FAST_MATH__} to be defined. 5457 5458This option should never be turned on by any @option{-O} option since 5459it can result in incorrect output for programs which depend on 5460an exact implementation of IEEE or ISO rules/specifications for 5461math functions. 5462 5463@item -fno-math-errno 5464@opindex fno-math-errno 5465Do not set ERRNO after calling math functions that are executed 5466with a single instruction, e.g., sqrt. A program that relies on 5467IEEE exceptions for math error handling may want to use this flag 5468for speed while maintaining IEEE arithmetic compatibility. 5469 5470This option should never be turned on by any @option{-O} option since 5471it can result in incorrect output for programs which depend on 5472an exact implementation of IEEE or ISO rules/specifications for 5473math functions. 5474 5475The default is @option{-fmath-errno}. 5476 5477On Darwin and FreeBSD systems, the math library never sets @code{errno}. 5478There is therefore 5479no reason for the compiler to consider the possibility that it might, 5480and @option{-fno-math-errno} is the default. 5481 5482@item -funsafe-math-optimizations 5483@opindex funsafe-math-optimizations 5484Allow optimizations for floating-point arithmetic that (a) assume 5485that arguments and results are valid and (b) may violate IEEE or 5486ANSI standards. When used at link-time, it may include libraries 5487or startup files that change the default FPU control word or other 5488similar optimizations. 5489 5490This option should never be turned on by any @option{-O} option since 5491it can result in incorrect output for programs which depend on 5492an exact implementation of IEEE or ISO rules/specifications for 5493math functions. 5494 5495The default is @option{-fno-unsafe-math-optimizations}. 5496 5497@item -ffinite-math-only 5498@opindex ffinite-math-only 5499Allow optimizations for floating-point arithmetic that assume 5500that arguments and results are not NaNs or +-Infs. 5501 5502This option should never be turned on by any @option{-O} option since 5503it can result in incorrect output for programs which depend on 5504an exact implementation of IEEE or ISO rules/specifications. 5505 5506The default is @option{-fno-finite-math-only}. 5507 5508@item -fno-trapping-math 5509@opindex fno-trapping-math 5510Compile code assuming that floating-point operations cannot generate 5511user-visible traps. These traps include division by zero, overflow, 5512underflow, inexact result and invalid operation. This option implies 5513@option{-fno-signaling-nans}. Setting this option may allow faster 5514code if one relies on ``non-stop'' IEEE arithmetic, for example. 5515 5516This option should never be turned on by any @option{-O} option since 5517it can result in incorrect output for programs which depend on 5518an exact implementation of IEEE or ISO rules/specifications for 5519math functions. 5520 5521The default is @option{-ftrapping-math}. 5522 5523@item -frounding-math 5524@opindex frounding-math 5525Disable transformations and optimizations that assume default floating 5526point rounding behavior. This is round-to-zero for all floating point 5527to integer conversions, and round-to-nearest for all other arithmetic 5528truncations. This option should be specified for programs that change 5529the FP rounding mode dynamically, or that may be executed with a 5530non-default rounding mode. This option disables constant folding of 5531floating point expressions at compile-time (which may be affected by 5532rounding mode) and arithmetic transformations that are unsafe in the 5533presence of sign-dependent rounding modes. 5534 5535The default is @option{-fno-rounding-math}. 5536 5537This option is experimental and does not currently guarantee to 5538disable all GCC optimizations that are affected by rounding mode. 5539Future versions of GCC may provide finer control of this setting 5540using C99's @code{FENV_ACCESS} pragma. This command line option 5541will be used to specify the default state for @code{FENV_ACCESS}. 5542 5543@item -frtl-abstract-sequences 5544@opindex frtl-abstract-sequences 5545It is a size optimization method. This option is to find identical 5546sequences of code, which can be turned into pseudo-procedures and 5547then replace all occurrences with calls to the newly created 5548subroutine. It is kind of an opposite of @option{-finline-functions}. 5549This optimization runs at RTL level. 5550 5551@item -fsignaling-nans 5552@opindex fsignaling-nans 5553Compile code assuming that IEEE signaling NaNs may generate user-visible 5554traps during floating-point operations. Setting this option disables 5555optimizations that may change the number of exceptions visible with 5556signaling NaNs. This option implies @option{-ftrapping-math}. 5557 5558This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to 5559be defined. 5560 5561The default is @option{-fno-signaling-nans}. 5562 5563This option is experimental and does not currently guarantee to 5564disable all GCC optimizations that affect signaling NaN behavior. 5565 5566@item -fsingle-precision-constant 5567@opindex fsingle-precision-constant 5568Treat floating point constant as single precision constant instead of 5569implicitly converting it to double precision constant. 5570 5571@item -fcx-limited-range 5572@itemx -fno-cx-limited-range 5573@opindex fcx-limited-range 5574@opindex fno-cx-limited-range 5575When enabled, this option states that a range reduction step is not 5576needed when performing complex division. The default is 5577@option{-fno-cx-limited-range}, but is enabled by @option{-ffast-math}. 5578 5579This option controls the default setting of the ISO C99 5580@code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to 5581all languages. 5582 5583@end table 5584 5585The following options control optimizations that may improve 5586performance, but are not enabled by any @option{-O} options. This 5587section includes experimental options that may produce broken code. 5588 5589@table @gcctabopt 5590@item -fbranch-probabilities 5591@opindex fbranch-probabilities 5592After running a program compiled with @option{-fprofile-arcs} 5593(@pxref{Debugging Options,, Options for Debugging Your Program or 5594@command{gcc}}), you can compile it a second time using 5595@option{-fbranch-probabilities}, to improve optimizations based on 5596the number of times each branch was taken. When the program 5597compiled with @option{-fprofile-arcs} exits it saves arc execution 5598counts to a file called @file{@var{sourcename}.gcda} for each source 5599file The information in this data file is very dependent on the 5600structure of the generated code, so you must use the same source code 5601and the same optimization options for both compilations. 5602 5603With @option{-fbranch-probabilities}, GCC puts a 5604@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}. 5605These can be used to improve optimization. Currently, they are only 5606used in one place: in @file{reorg.c}, instead of guessing which path a 5607branch is mostly to take, the @samp{REG_BR_PROB} values are used to 5608exactly determine which path is taken more often. 5609 5610@item -fprofile-values 5611@opindex fprofile-values 5612If combined with @option{-fprofile-arcs}, it adds code so that some 5613data about values of expressions in the program is gathered. 5614 5615With @option{-fbranch-probabilities}, it reads back the data gathered 5616from profiling values of expressions and adds @samp{REG_VALUE_PROFILE} 5617notes to instructions for their later usage in optimizations. 5618 5619Enabled with @option{-fprofile-generate} and @option{-fprofile-use}. 5620 5621@item -fvpt 5622@opindex fvpt 5623If combined with @option{-fprofile-arcs}, it instructs the compiler to add 5624a code to gather information about values of expressions. 5625 5626With @option{-fbranch-probabilities}, it reads back the data gathered 5627and actually performs the optimizations based on them. 5628Currently the optimizations include specialization of division operation 5629using the knowledge about the value of the denominator. 5630 5631@item -frename-registers 5632@opindex frename-registers 5633Attempt to avoid false dependencies in scheduled code by making use 5634of registers left over after register allocation. This optimization 5635will most benefit processors with lots of registers. Depending on the 5636debug information format adopted by the target, however, it can 5637make debugging impossible, since variables will no longer stay in 5638a ``home register''. 5639 5640Enabled by default with @option{-funroll-loops}. 5641 5642@item -ftracer 5643@opindex ftracer 5644Perform tail duplication to enlarge superblock size. This transformation 5645simplifies the control flow of the function allowing other optimizations to do 5646better job. 5647 5648Enabled with @option{-fprofile-use}. 5649 5650@item -funroll-loops 5651@opindex funroll-loops 5652Unroll loops whose number of iterations can be determined at compile time or 5653upon entry to the loop. @option{-funroll-loops} implies 5654@option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}. 5655It also turns on complete loop peeling (i.e.@: complete removal of loops with 5656small constant number of iterations). This option makes code larger, and may 5657or may not make it run faster. 5658 5659Enabled with @option{-fprofile-use}. 5660 5661@item -funroll-all-loops 5662@opindex funroll-all-loops 5663Unroll all loops, even if their number of iterations is uncertain when 5664the loop is entered. This usually makes programs run more slowly. 5665@option{-funroll-all-loops} implies the same options as 5666@option{-funroll-loops}. 5667 5668@item -fpeel-loops 5669@opindex fpeel-loops 5670Peels the loops for that there is enough information that they do not 5671roll much (from profile feedback). It also turns on complete loop peeling 5672(i.e.@: complete removal of loops with small constant number of iterations). 5673 5674Enabled with @option{-fprofile-use}. 5675 5676@item -fmove-loop-invariants 5677@opindex fmove-loop-invariants 5678Enables the loop invariant motion pass in the RTL loop optimizer. Enabled 5679at level @option{-O1} 5680 5681@item -funswitch-loops 5682@opindex funswitch-loops 5683Move branches with loop invariant conditions out of the loop, with duplicates 5684of the loop on both branches (modified according to result of the condition). 5685 5686@item -ffunction-sections 5687@itemx -fdata-sections 5688@opindex ffunction-sections 5689@opindex fdata-sections 5690Place each function or data item into its own section in the output 5691file if the target supports arbitrary sections. The name of the 5692function or the name of the data item determines the section's name 5693in the output file. 5694 5695Use these options on systems where the linker can perform optimizations 5696to improve locality of reference in the instruction space. Most systems 5697using the ELF object format and SPARC processors running Solaris 2 have 5698linkers with such optimizations. AIX may have these optimizations in 5699the future. 5700 5701Only use these options when there are significant benefits from doing 5702so. When you specify these options, the assembler and linker will 5703create larger object and executable files and will also be slower. 5704You will not be able to use @code{gprof} on all systems if you 5705specify this option and you may have problems with debugging if 5706you specify both this option and @option{-g}. 5707 5708@item -fbranch-target-load-optimize 5709@opindex fbranch-target-load-optimize 5710Perform branch target register load optimization before prologue / epilogue 5711threading. 5712The use of target registers can typically be exposed only during reload, 5713thus hoisting loads out of loops and doing inter-block scheduling needs 5714a separate optimization pass. 5715 5716@item -fbranch-target-load-optimize2 5717@opindex fbranch-target-load-optimize2 5718Perform branch target register load optimization after prologue / epilogue 5719threading. 5720 5721@item -fbtr-bb-exclusive 5722@opindex fbtr-bb-exclusive 5723When performing branch target register load optimization, don't reuse 5724branch target registers in within any basic block. 5725 5726@item -fstack-protector 5727Emit extra code to check for buffer overflows, such as stack smashing 5728attacks. This is done by adding a guard variable to functions with 5729vulnerable objects. This includes functions that call alloca, and 5730functions with buffers larger than 8 bytes. The guards are initialized 5731when a function is entered and then checked when the function exits. 5732If a guard check fails, an error message is printed and the program exits. 5733 5734@item -fstack-protector-all 5735Like @option{-fstack-protector} except that all functions are protected. 5736 5737@item -fsection-anchors 5738@opindex fsection-anchors 5739Try to reduce the number of symbolic address calculations by using 5740shared ``anchor'' symbols to address nearby objects. This transformation 5741can help to reduce the number of GOT entries and GOT accesses on some 5742targets. 5743 5744For example, the implementation of the following function @code{foo}: 5745 5746@smallexample 5747static int a, b, c; 5748int foo (void) @{ return a + b + c; @} 5749@end smallexample 5750 5751would usually calculate the addresses of all three variables, but if you 5752compile it with @option{-fsection-anchors}, it will access the variables 5753from a common anchor point instead. The effect is similar to the 5754following pseudocode (which isn't valid C): 5755 5756@smallexample 5757int foo (void) 5758@{ 5759 register int *xr = &x; 5760 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x]; 5761@} 5762@end smallexample 5763 5764Not all targets support this option. 5765 5766@item --param @var{name}=@var{value} 5767@opindex param 5768In some places, GCC uses various constants to control the amount of 5769optimization that is done. For example, GCC will not inline functions 5770that contain more that a certain number of instructions. You can 5771control some of these constants on the command-line using the 5772@option{--param} option. 5773 5774The names of specific parameters, and the meaning of the values, are 5775tied to the internals of the compiler, and are subject to change 5776without notice in future releases. 5777 5778In each case, the @var{value} is an integer. The allowable choices for 5779@var{name} are given in the following table: 5780 5781@table @gcctabopt 5782@item salias-max-implicit-fields 5783The maximum number of fields in a variable without direct 5784structure accesses for which structure aliasing will consider trying 5785to track each field. The default is 5 5786 5787@item salias-max-array-elements 5788The maximum number of elements an array can have and its elements 5789still be tracked individually by structure aliasing. The default is 4 5790 5791@item sra-max-structure-size 5792The maximum structure size, in bytes, at which the scalar replacement 5793of aggregates (SRA) optimization will perform block copies. The 5794default value, 0, implies that GCC will select the most appropriate 5795size itself. 5796 5797@item sra-field-structure-ratio 5798The threshold ratio (as a percentage) between instantiated fields and 5799the complete structure size. We say that if the ratio of the number 5800of bytes in instantiated fields to the number of bytes in the complete 5801structure exceeds this parameter, then block copies are not used. The 5802default is 75. 5803 5804@item max-crossjump-edges 5805The maximum number of incoming edges to consider for crossjumping. 5806The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in 5807the number of edges incoming to each block. Increasing values mean 5808more aggressive optimization, making the compile time increase with 5809probably small improvement in executable size. 5810 5811@item min-crossjump-insns 5812The minimum number of instructions which must be matched at the end 5813of two blocks before crossjumping will be performed on them. This 5814value is ignored in the case where all instructions in the block being 5815crossjumped from are matched. The default value is 5. 5816 5817@item max-grow-copy-bb-insns 5818The maximum code size expansion factor when copying basic blocks 5819instead of jumping. The expansion is relative to a jump instruction. 5820The default value is 8. 5821 5822@item max-goto-duplication-insns 5823The maximum number of instructions to duplicate to a block that jumps 5824to a computed goto. To avoid @math{O(N^2)} behavior in a number of 5825passes, GCC factors computed gotos early in the compilation process, 5826and unfactors them as late as possible. Only computed jumps at the 5827end of a basic blocks with no more than max-goto-duplication-insns are 5828unfactored. The default value is 8. 5829 5830@item max-delay-slot-insn-search 5831The maximum number of instructions to consider when looking for an 5832instruction to fill a delay slot. If more than this arbitrary number of 5833instructions is searched, the time savings from filling the delay slot 5834will be minimal so stop searching. Increasing values mean more 5835aggressive optimization, making the compile time increase with probably 5836small improvement in executable run time. 5837 5838@item max-delay-slot-live-search 5839When trying to fill delay slots, the maximum number of instructions to 5840consider when searching for a block with valid live register 5841information. Increasing this arbitrarily chosen value means more 5842aggressive optimization, increasing the compile time. This parameter 5843should be removed when the delay slot code is rewritten to maintain the 5844control-flow graph. 5845 5846@item max-gcse-memory 5847The approximate maximum amount of memory that will be allocated in 5848order to perform the global common subexpression elimination 5849optimization. If more memory than specified is required, the 5850optimization will not be done. 5851 5852@item max-gcse-passes 5853The maximum number of passes of GCSE to run. The default is 1. 5854 5855@item max-pending-list-length 5856The maximum number of pending dependencies scheduling will allow 5857before flushing the current state and starting over. Large functions 5858with few branches or calls can create excessively large lists which 5859needlessly consume memory and resources. 5860 5861@item max-inline-insns-single 5862Several parameters control the tree inliner used in gcc. 5863This number sets the maximum number of instructions (counted in GCC's 5864internal representation) in a single function that the tree inliner 5865will consider for inlining. This only affects functions declared 5866inline and methods implemented in a class declaration (C++). 5867The default value is 450. 5868 5869@item max-inline-insns-auto 5870When you use @option{-finline-functions} (included in @option{-O3}), 5871a lot of functions that would otherwise not be considered for inlining 5872by the compiler will be investigated. To those functions, a different 5873(more restrictive) limit compared to functions declared inline can 5874be applied. 5875The default value is 90. 5876 5877@item large-function-insns 5878The limit specifying really large functions. For functions larger than this 5879limit after inlining inlining is constrained by 5880@option{--param large-function-growth}. This parameter is useful primarily 5881to avoid extreme compilation time caused by non-linear algorithms used by the 5882backend. 5883This parameter is ignored when @option{-funit-at-a-time} is not used. 5884The default value is 2700. 5885 5886@item large-function-growth 5887Specifies maximal growth of large function caused by inlining in percents. 5888This parameter is ignored when @option{-funit-at-a-time} is not used. 5889The default value is 100 which limits large function growth to 2.0 times 5890the original size. 5891 5892@item large-unit-insns 5893The limit specifying large translation unit. Growth caused by inlining of 5894units larger than this limit is limited by @option{--param inline-unit-growth}. 5895For small units this might be too tight (consider unit consisting of function A 5896that is inline and B that just calls A three time. If B is small relative to 5897A, the growth of unit is 300\% and yet such inlining is very sane. For very 5898large units consisting of small inlininable functions however the overall unit 5899growth limit is needed to avoid exponential explosion of code size. Thus for 5900smaller units, the size is increased to @option{--param large-unit-insns} 5901before applying @option{--param inline-unit-growth}. The default is 10000 5902 5903@item inline-unit-growth 5904Specifies maximal overall growth of the compilation unit caused by inlining. 5905This parameter is ignored when @option{-funit-at-a-time} is not used. 5906The default value is 50 which limits unit growth to 1.5 times the original 5907size. 5908 5909@item max-inline-insns-recursive 5910@itemx max-inline-insns-recursive-auto 5911Specifies maximum number of instructions out-of-line copy of self recursive inline 5912function can grow into by performing recursive inlining. 5913 5914For functions declared inline @option{--param max-inline-insns-recursive} is 5915taken into account. For function not declared inline, recursive inlining 5916happens only when @option{-finline-functions} (included in @option{-O3}) is 5917enabled and @option{--param max-inline-insns-recursive-auto} is used. The 5918default value is 450. 5919 5920@item max-inline-recursive-depth 5921@itemx max-inline-recursive-depth-auto 5922Specifies maximum recursion depth used by the recursive inlining. 5923 5924For functions declared inline @option{--param max-inline-recursive-depth} is 5925taken into account. For function not declared inline, recursive inlining 5926happens only when @option{-finline-functions} (included in @option{-O3}) is 5927enabled and @option{--param max-inline-recursive-depth-auto} is used. The 5928default value is 450. 5929 5930@item min-inline-recursive-probability 5931Recursive inlining is profitable only for function having deep recursion 5932in average and can hurt for function having little recursion depth by 5933increasing the prologue size or complexity of function body to other 5934optimizers. 5935 5936When profile feedback is available (see @option{-fprofile-generate}) the actual 5937recursion depth can be guessed from probability that function will recurse via 5938given call expression. This parameter limits inlining only to call expression 5939whose probability exceeds given threshold (in percents). The default value is 594010. 5941 5942@item inline-call-cost 5943Specify cost of call instruction relative to simple arithmetics operations 5944(having cost of 1). Increasing this cost disqualifies inlining of non-leaf 5945functions and at the same time increases size of leaf function that is believed to 5946reduce function size by being inlined. In effect it increases amount of 5947inlining for code having large abstraction penalty (many functions that just 5948pass the arguments to other functions) and decrease inlining for code with low 5949abstraction penalty. The default value is 16. 5950 5951@item max-unrolled-insns 5952The maximum number of instructions that a loop should have if that loop 5953is unrolled, and if the loop is unrolled, it determines how many times 5954the loop code is unrolled. 5955 5956@item max-average-unrolled-insns 5957The maximum number of instructions biased by probabilities of their execution 5958that a loop should have if that loop is unrolled, and if the loop is unrolled, 5959it determines how many times the loop code is unrolled. 5960 5961@item max-unroll-times 5962The maximum number of unrollings of a single loop. 5963 5964@item max-peeled-insns 5965The maximum number of instructions that a loop should have if that loop 5966is peeled, and if the loop is peeled, it determines how many times 5967the loop code is peeled. 5968 5969@item max-peel-times 5970The maximum number of peelings of a single loop. 5971 5972@item max-completely-peeled-insns 5973The maximum number of insns of a completely peeled loop. 5974 5975@item max-completely-peel-times 5976The maximum number of iterations of a loop to be suitable for complete peeling. 5977 5978@item max-unswitch-insns 5979The maximum number of insns of an unswitched loop. 5980 5981@item max-unswitch-level 5982The maximum number of branches unswitched in a single loop. 5983 5984@item lim-expensive 5985The minimum cost of an expensive expression in the loop invariant motion. 5986 5987@item iv-consider-all-candidates-bound 5988Bound on number of candidates for induction variables below that 5989all candidates are considered for each use in induction variable 5990optimizations. Only the most relevant candidates are considered 5991if there are more candidates, to avoid quadratic time complexity. 5992 5993@item iv-max-considered-uses 5994The induction variable optimizations give up on loops that contain more 5995induction variable uses. 5996 5997@item iv-always-prune-cand-set-bound 5998If number of candidates in the set is smaller than this value, 5999we always try to remove unnecessary ivs from the set during its 6000optimization when a new iv is added to the set. 6001 6002@item scev-max-expr-size 6003Bound on size of expressions used in the scalar evolutions analyzer. 6004Large expressions slow the analyzer. 6005 6006@item vect-max-version-checks 6007The maximum number of runtime checks that can be performed when doing 6008loop versioning in the vectorizer. See option ftree-vect-loop-version 6009for more information. 6010 6011@item max-iterations-to-track 6012 6013The maximum number of iterations of a loop the brute force algorithm 6014for analysis of # of iterations of the loop tries to evaluate. 6015 6016@item hot-bb-count-fraction 6017Select fraction of the maximal count of repetitions of basic block in program 6018given basic block needs to have to be considered hot. 6019 6020@item hot-bb-frequency-fraction 6021Select fraction of the maximal frequency of executions of basic block in 6022function given basic block needs to have to be considered hot 6023 6024@item max-predicted-iterations 6025The maximum number of loop iterations we predict statically. This is useful 6026in cases where function contain single loop with known bound and other loop 6027with unknown. We predict the known number of iterations correctly, while 6028the unknown number of iterations average to roughly 10. This means that the 6029loop without bounds would appear artificially cold relative to the other one. 6030 6031@item tracer-dynamic-coverage 6032@itemx tracer-dynamic-coverage-feedback 6033 6034This value is used to limit superblock formation once the given percentage of 6035executed instructions is covered. This limits unnecessary code size 6036expansion. 6037 6038The @option{tracer-dynamic-coverage-feedback} is used only when profile 6039feedback is available. The real profiles (as opposed to statically estimated 6040ones) are much less balanced allowing the threshold to be larger value. 6041 6042@item tracer-max-code-growth 6043Stop tail duplication once code growth has reached given percentage. This is 6044rather hokey argument, as most of the duplicates will be eliminated later in 6045cross jumping, so it may be set to much higher values than is the desired code 6046growth. 6047 6048@item tracer-min-branch-ratio 6049 6050Stop reverse growth when the reverse probability of best edge is less than this 6051threshold (in percent). 6052 6053@item tracer-min-branch-ratio 6054@itemx tracer-min-branch-ratio-feedback 6055 6056Stop forward growth if the best edge do have probability lower than this 6057threshold. 6058 6059Similarly to @option{tracer-dynamic-coverage} two values are present, one for 6060compilation for profile feedback and one for compilation without. The value 6061for compilation with profile feedback needs to be more conservative (higher) in 6062order to make tracer effective. 6063 6064@item max-cse-path-length 6065 6066Maximum number of basic blocks on path that cse considers. The default is 10. 6067 6068@item max-cse-insns 6069The maximum instructions CSE process before flushing. The default is 1000. 6070 6071@item global-var-threshold 6072 6073Counts the number of function calls (@var{n}) and the number of 6074call-clobbered variables (@var{v}). If @var{n}x@var{v} is larger than this limit, a 6075single artificial variable will be created to represent all the 6076call-clobbered variables at function call sites. This artificial 6077variable will then be made to alias every call-clobbered variable. 6078(done as @code{int * size_t} on the host machine; beware overflow). 6079 6080@item max-aliased-vops 6081 6082Maximum number of virtual operands allowed to represent aliases 6083before triggering the alias grouping heuristic. Alias grouping 6084reduces compile times and memory consumption needed for aliasing at 6085the expense of precision loss in alias information. 6086 6087@item ggc-min-expand 6088 6089GCC uses a garbage collector to manage its own memory allocation. This 6090parameter specifies the minimum percentage by which the garbage 6091collector's heap should be allowed to expand between collections. 6092Tuning this may improve compilation speed; it has no effect on code 6093generation. 6094 6095The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when 6096RAM >= 1GB@. If @code{getrlimit} is available, the notion of "RAM" is 6097the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If 6098GCC is not able to calculate RAM on a particular platform, the lower 6099bound of 30% is used. Setting this parameter and 6100@option{ggc-min-heapsize} to zero causes a full collection to occur at 6101every opportunity. This is extremely slow, but can be useful for 6102debugging. 6103 6104@item ggc-min-heapsize 6105 6106Minimum size of the garbage collector's heap before it begins bothering 6107to collect garbage. The first collection occurs after the heap expands 6108by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again, 6109tuning this may improve compilation speed, and has no effect on code 6110generation. 6111 6112The default is the smaller of RAM/8, RLIMIT_RSS, or a limit which 6113tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but 6114with a lower bound of 4096 (four megabytes) and an upper bound of 6115131072 (128 megabytes). If GCC is not able to calculate RAM on a 6116particular platform, the lower bound is used. Setting this parameter 6117very large effectively disables garbage collection. Setting this 6118parameter and @option{ggc-min-expand} to zero causes a full collection 6119to occur at every opportunity. 6120 6121@item max-reload-search-insns 6122The maximum number of instruction reload should look backward for equivalent 6123register. Increasing values mean more aggressive optimization, making the 6124compile time increase with probably slightly better performance. The default 6125value is 100. 6126 6127@item max-cselib-memory-locations 6128The maximum number of memory locations cselib should take into account. 6129Increasing values mean more aggressive optimization, making the compile time 6130increase with probably slightly better performance. The default value is 500. 6131 6132@item max-flow-memory-locations 6133Similar as @option{max-cselib-memory-locations} but for dataflow liveness. 6134The default value is 100. 6135 6136@item reorder-blocks-duplicate 6137@itemx reorder-blocks-duplicate-feedback 6138 6139Used by basic block reordering pass to decide whether to use unconditional 6140branch or duplicate the code on its destination. Code is duplicated when its 6141estimated size is smaller than this value multiplied by the estimated size of 6142unconditional jump in the hot spots of the program. 6143 6144The @option{reorder-block-duplicate-feedback} is used only when profile 6145feedback is available and may be set to higher values than 6146@option{reorder-block-duplicate} since information about the hot spots is more 6147accurate. 6148 6149@item max-sched-ready-insns 6150The maximum number of instructions ready to be issued the scheduler should 6151consider at any given time during the first scheduling pass. Increasing 6152values mean more thorough searches, making the compilation time increase 6153with probably little benefit. The default value is 100. 6154 6155@item max-sched-region-blocks 6156The maximum number of blocks in a region to be considered for 6157interblock scheduling. The default value is 10. 6158 6159@item max-sched-region-insns 6160The maximum number of insns in a region to be considered for 6161interblock scheduling. The default value is 100. 6162 6163@item min-spec-prob 6164The minimum probability (in percents) of reaching a source block 6165for interblock speculative scheduling. The default value is 40. 6166 6167@item max-sched-extend-regions-iters 6168The maximum number of iterations through CFG to extend regions. 61690 - disable region extension, 6170N - do at most N iterations. 6171The default value is 0. 6172 6173@item max-sched-insn-conflict-delay 6174The maximum conflict delay for an insn to be considered for speculative motion. 6175The default value is 3. 6176 6177@item sched-spec-prob-cutoff 6178The minimal probability of speculation success (in percents), so that 6179speculative insn will be scheduled. 6180The default value is 40. 6181 6182@item max-last-value-rtl 6183 6184The maximum size measured as number of RTLs that can be recorded in an expression 6185in combiner for a pseudo register as last known value of that register. The default 6186is 10000. 6187 6188@item integer-share-limit 6189Small integer constants can use a shared data structure, reducing the 6190compiler's memory usage and increasing its speed. This sets the maximum 6191value of a shared integer constant's. The default value is 256. 6192 6193@item min-virtual-mappings 6194Specifies the minimum number of virtual mappings in the incremental 6195SSA updater that should be registered to trigger the virtual mappings 6196heuristic defined by virtual-mappings-ratio. The default value is 6197100. 6198 6199@item virtual-mappings-ratio 6200If the number of virtual mappings is virtual-mappings-ratio bigger 6201than the number of virtual symbols to be updated, then the incremental 6202SSA updater switches to a full update for those symbols. The default 6203ratio is 3. 6204 6205@item ssp-buffer-size 6206The minimum size of buffers (i.e. arrays) that will receive stack smashing 6207protection when @option{-fstack-protection} is used. 6208 6209@item max-jump-thread-duplication-stmts 6210Maximum number of statements allowed in a block that needs to be 6211duplicated when threading jumps. 6212 6213@item max-fields-for-field-sensitive 6214Maximum number of fields in a structure we will treat in 6215a field sensitive manner during pointer analysis. 6216 6217@end table 6218@end table 6219 6220@node Preprocessor Options 6221@section Options Controlling the Preprocessor 6222@cindex preprocessor options 6223@cindex options, preprocessor 6224 6225These options control the C preprocessor, which is run on each C source 6226file before actual compilation. 6227 6228If you use the @option{-E} option, nothing is done except preprocessing. 6229Some of these options make sense only together with @option{-E} because 6230they cause the preprocessor output to be unsuitable for actual 6231compilation. 6232 6233@table @gcctabopt 6234@opindex Wp 6235You can use @option{-Wp,@var{option}} to bypass the compiler driver 6236and pass @var{option} directly through to the preprocessor. If 6237@var{option} contains commas, it is split into multiple options at the 6238commas. However, many options are modified, translated or interpreted 6239by the compiler driver before being passed to the preprocessor, and 6240@option{-Wp} forcibly bypasses this phase. The preprocessor's direct 6241interface is undocumented and subject to change, so whenever possible 6242you should avoid using @option{-Wp} and let the driver handle the 6243options instead. 6244 6245@item -Xpreprocessor @var{option} 6246@opindex preprocessor 6247Pass @var{option} as an option to the preprocessor. You can use this to 6248supply system-specific preprocessor options which GCC does not know how to 6249recognize. 6250 6251If you want to pass an option that takes an argument, you must use 6252@option{-Xpreprocessor} twice, once for the option and once for the argument. 6253@end table 6254 6255@include cppopts.texi 6256 6257@node Assembler Options 6258@section Passing Options to the Assembler 6259 6260@c prevent bad page break with this line 6261You can pass options to the assembler. 6262 6263@table @gcctabopt 6264@item -Wa,@var{option} 6265@opindex Wa 6266Pass @var{option} as an option to the assembler. If @var{option} 6267contains commas, it is split into multiple options at the commas. 6268 6269@item -Xassembler @var{option} 6270@opindex Xassembler 6271Pass @var{option} as an option to the assembler. You can use this to 6272supply system-specific assembler options which GCC does not know how to 6273recognize. 6274 6275If you want to pass an option that takes an argument, you must use 6276@option{-Xassembler} twice, once for the option and once for the argument. 6277 6278@end table 6279 6280@node Link Options 6281@section Options for Linking 6282@cindex link options 6283@cindex options, linking 6284 6285These options come into play when the compiler links object files into 6286an executable output file. They are meaningless if the compiler is 6287not doing a link step. 6288 6289@table @gcctabopt 6290@cindex file names 6291@item @var{object-file-name} 6292A file name that does not end in a special recognized suffix is 6293considered to name an object file or library. (Object files are 6294distinguished from libraries by the linker according to the file 6295contents.) If linking is done, these object files are used as input 6296to the linker. 6297 6298@item -c 6299@itemx -S 6300@itemx -E 6301@opindex c 6302@opindex S 6303@opindex E 6304If any of these options is used, then the linker is not run, and 6305object file names should not be used as arguments. @xref{Overall 6306Options}. 6307 6308@cindex Libraries 6309@item -l@var{library} 6310@itemx -l @var{library} 6311@opindex l 6312Search the library named @var{library} when linking. (The second 6313alternative with the library as a separate argument is only for 6314POSIX compliance and is not recommended.) 6315 6316It makes a difference where in the command you write this option; the 6317linker searches and processes libraries and object files in the order they 6318are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z} 6319after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers 6320to functions in @samp{z}, those functions may not be loaded. 6321 6322The linker searches a standard list of directories for the library, 6323which is actually a file named @file{lib@var{library}.a}. The linker 6324then uses this file as if it had been specified precisely by name. 6325 6326The directories searched include several standard system directories 6327plus any that you specify with @option{-L}. 6328 6329Normally the files found this way are library files---archive files 6330whose members are object files. The linker handles an archive file by 6331scanning through it for members which define symbols that have so far 6332been referenced but not defined. But if the file that is found is an 6333ordinary object file, it is linked in the usual fashion. The only 6334difference between using an @option{-l} option and specifying a file name 6335is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a} 6336and searches several directories. 6337 6338@item -nostartfiles 6339@opindex nostartfiles 6340Do not use the standard system startup files when linking. 6341The standard system libraries are used normally, unless @option{-nostdlib} 6342or @option{-nodefaultlibs} is used. 6343 6344@item -nodefaultlibs 6345@opindex nodefaultlibs 6346Do not use the standard system libraries when linking. 6347Only the libraries you specify will be passed to the linker. 6348The standard startup files are used normally, unless @option{-nostartfiles} 6349is used. The compiler may generate calls to @code{memcmp}, 6350@code{memset}, @code{memcpy} and @code{memmove}. 6351These entries are usually resolved by entries in 6352libc. These entry points should be supplied through some other 6353mechanism when this option is specified. 6354 6355@item -nostdlib 6356@opindex nostdlib 6357Do not use the standard system startup files or libraries when linking. 6358No startup files and only the libraries you specify will be passed to 6359the linker. The compiler may generate calls to @code{memcmp}, @code{memset}, 6360@code{memcpy} and @code{memmove}. 6361These entries are usually resolved by entries in 6362libc. These entry points should be supplied through some other 6363mechanism when this option is specified. 6364 6365@cindex @option{-lgcc}, use with @option{-nostdlib} 6366@cindex @option{-nostdlib} and unresolved references 6367@cindex unresolved references and @option{-nostdlib} 6368@cindex @option{-lgcc}, use with @option{-nodefaultlibs} 6369@cindex @option{-nodefaultlibs} and unresolved references 6370@cindex unresolved references and @option{-nodefaultlibs} 6371One of the standard libraries bypassed by @option{-nostdlib} and 6372@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines 6373that GCC uses to overcome shortcomings of particular machines, or special 6374needs for some languages. 6375(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler 6376Collection (GCC) Internals}, 6377for more discussion of @file{libgcc.a}.) 6378In most cases, you need @file{libgcc.a} even when you want to avoid 6379other standard libraries. In other words, when you specify @option{-nostdlib} 6380or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well. 6381This ensures that you have no unresolved references to internal GCC 6382library subroutines. (For example, @samp{__main}, used to ensure C++ 6383constructors will be called; @pxref{Collect2,,@code{collect2}, gccint, 6384GNU Compiler Collection (GCC) Internals}.) 6385 6386@item -pie 6387@opindex pie 6388Produce a position independent executable on targets which support it. 6389For predictable results, you must also specify the same set of options 6390that were used to generate code (@option{-fpie}, @option{-fPIE}, 6391or model suboptions) when you specify this option. 6392 6393@item -rdynamic 6394@opindex rdynamic 6395Pass the flag @option{-export-dynamic} to the ELF linker, on targets 6396that support it. This instructs the linker to add all symbols, not 6397only used ones, to the dynamic symbol table. This option is needed 6398for some uses of @code{dlopen} or to allow obtaining backtraces 6399from within a program. 6400 6401@item -s 6402@opindex s 6403Remove all symbol table and relocation information from the executable. 6404 6405@item -static 6406@opindex static 6407On systems that support dynamic linking, this prevents linking with the shared 6408libraries. On other systems, this option has no effect. 6409 6410@item -shared 6411@opindex shared 6412Produce a shared object which can then be linked with other objects to 6413form an executable. Not all systems support this option. For predictable 6414results, you must also specify the same set of options that were used to 6415generate code (@option{-fpic}, @option{-fPIC}, or model suboptions) 6416when you specify this option.@footnote{On some systems, @samp{gcc -shared} 6417needs to build supplementary stub code for constructors to work. On 6418multi-libbed systems, @samp{gcc -shared} must select the correct support 6419libraries to link against. Failing to supply the correct flags may lead 6420to subtle defects. Supplying them in cases where they are not necessary 6421is innocuous.} 6422 6423@item -shared-libgcc 6424@itemx -static-libgcc 6425@opindex shared-libgcc 6426@opindex static-libgcc 6427On systems that provide @file{libgcc} as a shared library, these options 6428force the use of either the shared or static version respectively. 6429If no shared version of @file{libgcc} was built when the compiler was 6430configured, these options have no effect. 6431 6432There are several situations in which an application should use the 6433shared @file{libgcc} instead of the static version. The most common 6434of these is when the application wishes to throw and catch exceptions 6435across different shared libraries. In that case, each of the libraries 6436as well as the application itself should use the shared @file{libgcc}. 6437 6438Therefore, the G++ and GCJ drivers automatically add 6439@option{-shared-libgcc} whenever you build a shared library or a main 6440executable, because C++ and Java programs typically use exceptions, so 6441this is the right thing to do. 6442 6443If, instead, you use the GCC driver to create shared libraries, you may 6444find that they will not always be linked with the shared @file{libgcc}. 6445If GCC finds, at its configuration time, that you have a non-GNU linker 6446or a GNU linker that does not support option @option{--eh-frame-hdr}, 6447it will link the shared version of @file{libgcc} into shared libraries 6448by default. Otherwise, it will take advantage of the linker and optimize 6449away the linking with the shared version of @file{libgcc}, linking with 6450the static version of libgcc by default. This allows exceptions to 6451propagate through such shared libraries, without incurring relocation 6452costs at library load time. 6453 6454However, if a library or main executable is supposed to throw or catch 6455exceptions, you must link it using the G++ or GCJ driver, as appropriate 6456for the languages used in the program, or using the option 6457@option{-shared-libgcc}, such that it is linked with the shared 6458@file{libgcc}. 6459 6460@item -symbolic 6461@opindex symbolic 6462Bind references to global symbols when building a shared object. Warn 6463about any unresolved references (unless overridden by the link editor 6464option @samp{-Xlinker -z -Xlinker defs}). Only a few systems support 6465this option. 6466 6467@item -Xlinker @var{option} 6468@opindex Xlinker 6469Pass @var{option} as an option to the linker. You can use this to 6470supply system-specific linker options which GCC does not know how to 6471recognize. 6472 6473If you want to pass an option that takes an argument, you must use 6474@option{-Xlinker} twice, once for the option and once for the argument. 6475For example, to pass @option{-assert definitions}, you must write 6476@samp{-Xlinker -assert -Xlinker definitions}. It does not work to write 6477@option{-Xlinker "-assert definitions"}, because this passes the entire 6478string as a single argument, which is not what the linker expects. 6479 6480@item -Wl,@var{option} 6481@opindex Wl 6482Pass @var{option} as an option to the linker. If @var{option} contains 6483commas, it is split into multiple options at the commas. 6484 6485@item -u @var{symbol} 6486@opindex u 6487Pretend the symbol @var{symbol} is undefined, to force linking of 6488library modules to define it. You can use @option{-u} multiple times with 6489different symbols to force loading of additional library modules. 6490@end table 6491 6492@node Directory Options 6493@section Options for Directory Search 6494@cindex directory options 6495@cindex options, directory search 6496@cindex search path 6497 6498These options specify directories to search for header files, for 6499libraries and for parts of the compiler: 6500 6501@table @gcctabopt 6502@item -I@var{dir} 6503@opindex I 6504Add the directory @var{dir} to the head of the list of directories to be 6505searched for header files. This can be used to override a system header 6506file, substituting your own version, since these directories are 6507searched before the system header file directories. However, you should 6508not use this option to add directories that contain vendor-supplied 6509system header files (use @option{-isystem} for that). If you use more than 6510one @option{-I} option, the directories are scanned in left-to-right 6511order; the standard system directories come after. 6512 6513If a standard system include directory, or a directory specified with 6514@option{-isystem}, is also specified with @option{-I}, the @option{-I} 6515option will be ignored. The directory will still be searched but as a 6516system directory at its normal position in the system include chain. 6517This is to ensure that GCC's procedure to fix buggy system headers and 6518the ordering for the include_next directive are not inadvertently changed. 6519If you really need to change the search order for system directories, 6520use the @option{-nostdinc} and/or @option{-isystem} options. 6521 6522@item -iquote@var{dir} 6523@opindex iquote 6524Add the directory @var{dir} to the head of the list of directories to 6525be searched for header files only for the case of @samp{#include 6526"@var{file}"}; they are not searched for @samp{#include <@var{file}>}, 6527otherwise just like @option{-I}. 6528 6529@item -L@var{dir} 6530@opindex L 6531Add directory @var{dir} to the list of directories to be searched 6532for @option{-l}. 6533 6534@item -B@var{prefix} 6535@opindex B 6536This option specifies where to find the executables, libraries, 6537include files, and data files of the compiler itself. 6538 6539The compiler driver program runs one or more of the subprograms 6540@file{cpp}, @file{cc1}, @file{as} and @file{ld}. It tries 6541@var{prefix} as a prefix for each program it tries to run, both with and 6542without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}). 6543 6544For each subprogram to be run, the compiler driver first tries the 6545@option{-B} prefix, if any. If that name is not found, or if @option{-B} 6546was not specified, the driver tries two standard prefixes, which are 6547@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of 6548those results in a file name that is found, the unmodified program 6549name is searched for using the directories specified in your 6550@env{PATH} environment variable. 6551 6552The compiler will check to see if the path provided by the @option{-B} 6553refers to a directory, and if necessary it will add a directory 6554separator character at the end of the path. 6555 6556@option{-B} prefixes that effectively specify directory names also apply 6557to libraries in the linker, because the compiler translates these 6558options into @option{-L} options for the linker. They also apply to 6559includes files in the preprocessor, because the compiler translates these 6560options into @option{-isystem} options for the preprocessor. In this case, 6561the compiler appends @samp{include} to the prefix. 6562 6563The run-time support file @file{libgcc.a} can also be searched for using 6564the @option{-B} prefix, if needed. If it is not found there, the two 6565standard prefixes above are tried, and that is all. The file is left 6566out of the link if it is not found by those means. 6567 6568Another way to specify a prefix much like the @option{-B} prefix is to use 6569the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment 6570Variables}. 6571 6572As a special kludge, if the path provided by @option{-B} is 6573@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to 65749, then it will be replaced by @file{[dir/]include}. This is to help 6575with boot-strapping the compiler. 6576 6577@item -specs=@var{file} 6578@opindex specs 6579Process @var{file} after the compiler reads in the standard @file{specs} 6580file, in order to override the defaults that the @file{gcc} driver 6581program uses when determining what switches to pass to @file{cc1}, 6582@file{cc1plus}, @file{as}, @file{ld}, etc. More than one 6583@option{-specs=@var{file}} can be specified on the command line, and they 6584are processed in order, from left to right. 6585 6586@item --sysroot=@var{dir} 6587@opindex sysroot 6588Use @var{dir} as the logical root directory for headers and libraries. 6589For example, if the compiler would normally search for headers in 6590@file{/usr/include} and libraries in @file{/usr/lib}, it will instead 6591search @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}. 6592 6593If you use both this option and the @option{-isysroot} option, then 6594the @option{--sysroot} option will apply to libraries, but the 6595@option{-isysroot} option will apply to header files. 6596 6597The GNU linker (beginning with version 2.16) has the necessary support 6598for this option. If your linker does not support this option, the 6599header file aspect of @option{--sysroot} will still work, but the 6600library aspect will not. 6601 6602@item -I- 6603@opindex I- 6604This option has been deprecated. Please use @option{-iquote} instead for 6605@option{-I} directories before the @option{-I-} and remove the @option{-I-}. 6606Any directories you specify with @option{-I} options before the @option{-I-} 6607option are searched only for the case of @samp{#include "@var{file}"}; 6608they are not searched for @samp{#include <@var{file}>}. 6609 6610If additional directories are specified with @option{-I} options after 6611the @option{-I-}, these directories are searched for all @samp{#include} 6612directives. (Ordinarily @emph{all} @option{-I} directories are used 6613this way.) 6614 6615In addition, the @option{-I-} option inhibits the use of the current 6616directory (where the current input file came from) as the first search 6617directory for @samp{#include "@var{file}"}. There is no way to 6618override this effect of @option{-I-}. With @option{-I.} you can specify 6619searching the directory which was current when the compiler was 6620invoked. That is not exactly the same as what the preprocessor does 6621by default, but it is often satisfactory. 6622 6623@option{-I-} does not inhibit the use of the standard system directories 6624for header files. Thus, @option{-I-} and @option{-nostdinc} are 6625independent. 6626@end table 6627 6628@c man end 6629 6630@node Spec Files 6631@section Specifying subprocesses and the switches to pass to them 6632@cindex Spec Files 6633 6634@command{gcc} is a driver program. It performs its job by invoking a 6635sequence of other programs to do the work of compiling, assembling and 6636linking. GCC interprets its command-line parameters and uses these to 6637deduce which programs it should invoke, and which command-line options 6638it ought to place on their command lines. This behavior is controlled 6639by @dfn{spec strings}. In most cases there is one spec string for each 6640program that GCC can invoke, but a few programs have multiple spec 6641strings to control their behavior. The spec strings built into GCC can 6642be overridden by using the @option{-specs=} command-line switch to specify 6643a spec file. 6644 6645@dfn{Spec files} are plaintext files that are used to construct spec 6646strings. They consist of a sequence of directives separated by blank 6647lines. The type of directive is determined by the first non-whitespace 6648character on the line and it can be one of the following: 6649 6650@table @code 6651@item %@var{command} 6652Issues a @var{command} to the spec file processor. The commands that can 6653appear here are: 6654 6655@table @code 6656@item %include <@var{file}> 6657@cindex %include 6658Search for @var{file} and insert its text at the current point in the 6659specs file. 6660 6661@item %include_noerr <@var{file}> 6662@cindex %include_noerr 6663Just like @samp{%include}, but do not generate an error message if the include 6664file cannot be found. 6665 6666@item %rename @var{old_name} @var{new_name} 6667@cindex %rename 6668Rename the spec string @var{old_name} to @var{new_name}. 6669 6670@end table 6671 6672@item *[@var{spec_name}]: 6673This tells the compiler to create, override or delete the named spec 6674string. All lines after this directive up to the next directive or 6675blank line are considered to be the text for the spec string. If this 6676results in an empty string then the spec will be deleted. (Or, if the 6677spec did not exist, then nothing will happened.) Otherwise, if the spec 6678does not currently exist a new spec will be created. If the spec does 6679exist then its contents will be overridden by the text of this 6680directive, unless the first character of that text is the @samp{+} 6681character, in which case the text will be appended to the spec. 6682 6683@item [@var{suffix}]: 6684Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive 6685and up to the next directive or blank line are considered to make up the 6686spec string for the indicated suffix. When the compiler encounters an 6687input file with the named suffix, it will processes the spec string in 6688order to work out how to compile that file. For example: 6689 6690@smallexample 6691.ZZ: 6692z-compile -input %i 6693@end smallexample 6694 6695This says that any input file whose name ends in @samp{.ZZ} should be 6696passed to the program @samp{z-compile}, which should be invoked with the 6697command-line switch @option{-input} and with the result of performing the 6698@samp{%i} substitution. (See below.) 6699 6700As an alternative to providing a spec string, the text that follows a 6701suffix directive can be one of the following: 6702 6703@table @code 6704@item @@@var{language} 6705This says that the suffix is an alias for a known @var{language}. This is 6706similar to using the @option{-x} command-line switch to GCC to specify a 6707language explicitly. For example: 6708 6709@smallexample 6710.ZZ: 6711@@c++ 6712@end smallexample 6713 6714Says that .ZZ files are, in fact, C++ source files. 6715 6716@item #@var{name} 6717This causes an error messages saying: 6718 6719@smallexample 6720@var{name} compiler not installed on this system. 6721@end smallexample 6722@end table 6723 6724GCC already has an extensive list of suffixes built into it. 6725This directive will add an entry to the end of the list of suffixes, but 6726since the list is searched from the end backwards, it is effectively 6727possible to override earlier entries using this technique. 6728 6729@end table 6730 6731GCC has the following spec strings built into it. Spec files can 6732override these strings or create their own. Note that individual 6733targets can also add their own spec strings to this list. 6734 6735@smallexample 6736asm Options to pass to the assembler 6737asm_final Options to pass to the assembler post-processor 6738cpp Options to pass to the C preprocessor 6739cc1 Options to pass to the C compiler 6740cc1plus Options to pass to the C++ compiler 6741endfile Object files to include at the end of the link 6742link Options to pass to the linker 6743lib Libraries to include on the command line to the linker 6744libgcc Decides which GCC support library to pass to the linker 6745linker Sets the name of the linker 6746predefines Defines to be passed to the C preprocessor 6747signed_char Defines to pass to CPP to say whether @code{char} is signed 6748 by default 6749startfile Object files to include at the start of the link 6750@end smallexample 6751 6752Here is a small example of a spec file: 6753 6754@smallexample 6755%rename lib old_lib 6756 6757*lib: 6758--start-group -lgcc -lc -leval1 --end-group %(old_lib) 6759@end smallexample 6760 6761This example renames the spec called @samp{lib} to @samp{old_lib} and 6762then overrides the previous definition of @samp{lib} with a new one. 6763The new definition adds in some extra command-line options before 6764including the text of the old definition. 6765 6766@dfn{Spec strings} are a list of command-line options to be passed to their 6767corresponding program. In addition, the spec strings can contain 6768@samp{%}-prefixed sequences to substitute variable text or to 6769conditionally insert text into the command line. Using these constructs 6770it is possible to generate quite complex command lines. 6771 6772Here is a table of all defined @samp{%}-sequences for spec 6773strings. Note that spaces are not generated automatically around the 6774results of expanding these sequences. Therefore you can concatenate them 6775together or combine them with constant text in a single argument. 6776 6777@table @code 6778@item %% 6779Substitute one @samp{%} into the program name or argument. 6780 6781@item %i 6782Substitute the name of the input file being processed. 6783 6784@item %b 6785Substitute the basename of the input file being processed. 6786This is the substring up to (and not including) the last period 6787and not including the directory. 6788 6789@item %B 6790This is the same as @samp{%b}, but include the file suffix (text after 6791the last period). 6792 6793@item %d 6794Marks the argument containing or following the @samp{%d} as a 6795temporary file name, so that that file will be deleted if GCC exits 6796successfully. Unlike @samp{%g}, this contributes no text to the 6797argument. 6798 6799@item %g@var{suffix} 6800Substitute a file name that has suffix @var{suffix} and is chosen 6801once per compilation, and mark the argument in the same way as 6802@samp{%d}. To reduce exposure to denial-of-service attacks, the file 6803name is now chosen in a way that is hard to predict even when previously 6804chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s} 6805might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches 6806the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is 6807treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g} 6808was simply substituted with a file name chosen once per compilation, 6809without regard to any appended suffix (which was therefore treated 6810just like ordinary text), making such attacks more likely to succeed. 6811 6812@item %u@var{suffix} 6813Like @samp{%g}, but generates a new temporary file name even if 6814@samp{%u@var{suffix}} was already seen. 6815 6816@item %U@var{suffix} 6817Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a 6818new one if there is no such last file name. In the absence of any 6819@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share 6820the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s} 6821would involve the generation of two distinct file names, one 6822for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was 6823simply substituted with a file name chosen for the previous @samp{%u}, 6824without regard to any appended suffix. 6825 6826@item %j@var{suffix} 6827Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is 6828writable, and if save-temps is off; otherwise, substitute the name 6829of a temporary file, just like @samp{%u}. This temporary file is not 6830meant for communication between processes, but rather as a junk 6831disposal mechanism. 6832 6833@item %|@var{suffix} 6834@itemx %m@var{suffix} 6835Like @samp{%g}, except if @option{-pipe} is in effect. In that case 6836@samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at 6837all. These are the two most common ways to instruct a program that it 6838should read from standard input or write to standard output. If you 6839need something more elaborate you can use an @samp{%@{pipe:@code{X}@}} 6840construct: see for example @file{f/lang-specs.h}. 6841 6842@item %.@var{SUFFIX} 6843Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args 6844when it is subsequently output with @samp{%*}. @var{SUFFIX} is 6845terminated by the next space or %. 6846 6847@item %w 6848Marks the argument containing or following the @samp{%w} as the 6849designated output file of this compilation. This puts the argument 6850into the sequence of arguments that @samp{%o} will substitute later. 6851 6852@item %o 6853Substitutes the names of all the output files, with spaces 6854automatically placed around them. You should write spaces 6855around the @samp{%o} as well or the results are undefined. 6856@samp{%o} is for use in the specs for running the linker. 6857Input files whose names have no recognized suffix are not compiled 6858at all, but they are included among the output files, so they will 6859be linked. 6860 6861@item %O 6862Substitutes the suffix for object files. Note that this is 6863handled specially when it immediately follows @samp{%g, %u, or %U}, 6864because of the need for those to form complete file names. The 6865handling is such that @samp{%O} is treated exactly as if it had already 6866been substituted, except that @samp{%g, %u, and %U} do not currently 6867support additional @var{suffix} characters following @samp{%O} as they would 6868following, for example, @samp{.o}. 6869 6870@item %p 6871Substitutes the standard macro predefinitions for the 6872current target machine. Use this when running @code{cpp}. 6873 6874@item %P 6875Like @samp{%p}, but puts @samp{__} before and after the name of each 6876predefined macro, except for macros that start with @samp{__} or with 6877@samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO 6878C@. 6879 6880@item %I 6881Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}), 6882@option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}), 6883@option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options) 6884and @option{-imultilib} as necessary. 6885 6886@item %s 6887Current argument is the name of a library or startup file of some sort. 6888Search for that file in a standard list of directories and substitute 6889the full name found. 6890 6891@item %e@var{str} 6892Print @var{str} as an error message. @var{str} is terminated by a newline. 6893Use this when inconsistent options are detected. 6894 6895@item %(@var{name}) 6896Substitute the contents of spec string @var{name} at this point. 6897 6898@item %[@var{name}] 6899Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments. 6900 6901@item %x@{@var{option}@} 6902Accumulate an option for @samp{%X}. 6903 6904@item %X 6905Output the accumulated linker options specified by @option{-Wl} or a @samp{%x} 6906spec string. 6907 6908@item %Y 6909Output the accumulated assembler options specified by @option{-Wa}. 6910 6911@item %Z 6912Output the accumulated preprocessor options specified by @option{-Wp}. 6913 6914@item %a 6915Process the @code{asm} spec. This is used to compute the 6916switches to be passed to the assembler. 6917 6918@item %A 6919Process the @code{asm_final} spec. This is a spec string for 6920passing switches to an assembler post-processor, if such a program is 6921needed. 6922 6923@item %l 6924Process the @code{link} spec. This is the spec for computing the 6925command line passed to the linker. Typically it will make use of the 6926@samp{%L %G %S %D and %E} sequences. 6927 6928@item %D 6929Dump out a @option{-L} option for each directory that GCC believes might 6930contain startup files. If the target supports multilibs then the 6931current multilib directory will be prepended to each of these paths. 6932 6933@item %L 6934Process the @code{lib} spec. This is a spec string for deciding which 6935libraries should be included on the command line to the linker. 6936 6937@item %G 6938Process the @code{libgcc} spec. This is a spec string for deciding 6939which GCC support library should be included on the command line to the linker. 6940 6941@item %S 6942Process the @code{startfile} spec. This is a spec for deciding which 6943object files should be the first ones passed to the linker. Typically 6944this might be a file named @file{crt0.o}. 6945 6946@item %E 6947Process the @code{endfile} spec. This is a spec string that specifies 6948the last object files that will be passed to the linker. 6949 6950@item %C 6951Process the @code{cpp} spec. This is used to construct the arguments 6952to be passed to the C preprocessor. 6953 6954@item %1 6955Process the @code{cc1} spec. This is used to construct the options to be 6956passed to the actual C compiler (@samp{cc1}). 6957 6958@item %2 6959Process the @code{cc1plus} spec. This is used to construct the options to be 6960passed to the actual C++ compiler (@samp{cc1plus}). 6961 6962@item %* 6963Substitute the variable part of a matched option. See below. 6964Note that each comma in the substituted string is replaced by 6965a single space. 6966 6967@item %<@code{S} 6968Remove all occurrences of @code{-S} from the command line. Note---this 6969command is position dependent. @samp{%} commands in the spec string 6970before this one will see @code{-S}, @samp{%} commands in the spec string 6971after this one will not. 6972 6973@item %:@var{function}(@var{args}) 6974Call the named function @var{function}, passing it @var{args}. 6975@var{args} is first processed as a nested spec string, then split 6976into an argument vector in the usual fashion. The function returns 6977a string which is processed as if it had appeared literally as part 6978of the current spec. 6979 6980The following built-in spec functions are provided: 6981 6982@table @code 6983@item @code{if-exists} 6984The @code{if-exists} spec function takes one argument, an absolute 6985pathname to a file. If the file exists, @code{if-exists} returns the 6986pathname. Here is a small example of its usage: 6987 6988@smallexample 6989*startfile: 6990crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s 6991@end smallexample 6992 6993@item @code{if-exists-else} 6994The @code{if-exists-else} spec function is similar to the @code{if-exists} 6995spec function, except that it takes two arguments. The first argument is 6996an absolute pathname to a file. If the file exists, @code{if-exists-else} 6997returns the pathname. If it does not exist, it returns the second argument. 6998This way, @code{if-exists-else} can be used to select one file or another, 6999based on the existence of the first. Here is a small example of its usage: 7000 7001@smallexample 7002*startfile: 7003crt0%O%s %:if-exists(crti%O%s) \ 7004%:if-exists-else(crtbeginT%O%s crtbegin%O%s) 7005@end smallexample 7006 7007@item @code{replace-outfile} 7008The @code{replace-outfile} spec function takes two arguments. It looks for the 7009first argument in the outfiles array and replaces it with the second argument. Here 7010is a small example of its usage: 7011 7012@smallexample 7013%@{static|static-libgcc|static-libstdc++:%:replace-outfile(-lstdc++ \ 7014libstdc++.a%s)@} 7015 7016@end smallexample 7017 7018@end table 7019 7020@item %@{@code{S}@} 7021Substitutes the @code{-S} switch, if that switch was given to GCC@. 7022If that switch was not specified, this substitutes nothing. Note that 7023the leading dash is omitted when specifying this option, and it is 7024automatically inserted if the substitution is performed. Thus the spec 7025string @samp{%@{foo@}} would match the command-line option @option{-foo} 7026and would output the command line option @option{-foo}. 7027 7028@item %W@{@code{S}@} 7029Like %@{@code{S}@} but mark last argument supplied within as a file to be 7030deleted on failure. 7031 7032@item %@{@code{S}*@} 7033Substitutes all the switches specified to GCC whose names start 7034with @code{-S}, but which also take an argument. This is used for 7035switches like @option{-o}, @option{-D}, @option{-I}, etc. 7036GCC considers @option{-o foo} as being 7037one switch whose names starts with @samp{o}. %@{o*@} would substitute this 7038text, including the space. Thus two arguments would be generated. 7039 7040@item %@{@code{S}*&@code{T}*@} 7041Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options 7042(the order of @code{S} and @code{T} in the spec is not significant). 7043There can be any number of ampersand-separated variables; for each the 7044wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}. 7045 7046@item %@{@code{S}:@code{X}@} 7047Substitutes @code{X}, if the @samp{-S} switch was given to GCC@. 7048 7049@item %@{!@code{S}:@code{X}@} 7050Substitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@. 7051 7052@item %@{@code{S}*:@code{X}@} 7053Substitutes @code{X} if one or more switches whose names start with 7054@code{-S} are specified to GCC@. Normally @code{X} is substituted only 7055once, no matter how many such switches appeared. However, if @code{%*} 7056appears somewhere in @code{X}, then @code{X} will be substituted once 7057for each matching switch, with the @code{%*} replaced by the part of 7058that switch that matched the @code{*}. 7059 7060@item %@{.@code{S}:@code{X}@} 7061Substitutes @code{X}, if processing a file with suffix @code{S}. 7062 7063@item %@{!.@code{S}:@code{X}@} 7064Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}. 7065 7066@item %@{@code{S}|@code{P}:@code{X}@} 7067Substitutes @code{X} if either @code{-S} or @code{-P} was given to GCC@. 7068This may be combined with @samp{!}, @samp{.}, and @code{*} sequences as well, 7069although they have a stronger binding than the @samp{|}. If @code{%*} 7070appears in @code{X}, all of the alternatives must be starred, and only 7071the first matching alternative is substituted. 7072 7073For example, a spec string like this: 7074 7075@smallexample 7076%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@} 7077@end smallexample 7078 7079will output the following command-line options from the following input 7080command-line options: 7081 7082@smallexample 7083fred.c -foo -baz 7084jim.d -bar -boggle 7085-d fred.c -foo -baz -boggle 7086-d jim.d -bar -baz -boggle 7087@end smallexample 7088 7089@item %@{S:X; T:Y; :D@} 7090 7091If @code{S} was given to GCC, substitutes @code{X}; else if @code{T} was 7092given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can 7093be as many clauses as you need. This may be combined with @code{.}, 7094@code{!}, @code{|}, and @code{*} as needed. 7095 7096 7097@end table 7098 7099The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar 7100construct may contain other nested @samp{%} constructs or spaces, or 7101even newlines. They are processed as usual, as described above. 7102Trailing white space in @code{X} is ignored. White space may also 7103appear anywhere on the left side of the colon in these constructs, 7104except between @code{.} or @code{*} and the corresponding word. 7105 7106The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are 7107handled specifically in these constructs. If another value of 7108@option{-O} or the negated form of a @option{-f}, @option{-m}, or 7109@option{-W} switch is found later in the command line, the earlier 7110switch value is ignored, except with @{@code{S}*@} where @code{S} is 7111just one letter, which passes all matching options. 7112 7113The character @samp{|} at the beginning of the predicate text is used to 7114indicate that a command should be piped to the following command, but 7115only if @option{-pipe} is specified. 7116 7117It is built into GCC which switches take arguments and which do not. 7118(You might think it would be useful to generalize this to allow each 7119compiler's spec to say which switches take arguments. But this cannot 7120be done in a consistent fashion. GCC cannot even decide which input 7121files have been specified without knowing which switches take arguments, 7122and it must know which input files to compile in order to tell which 7123compilers to run). 7124 7125GCC also knows implicitly that arguments starting in @option{-l} are to be 7126treated as compiler output files, and passed to the linker in their 7127proper position among the other output files. 7128 7129@c man begin OPTIONS 7130 7131@node Target Options 7132@section Specifying Target Machine and Compiler Version 7133@cindex target options 7134@cindex cross compiling 7135@cindex specifying machine version 7136@cindex specifying compiler version and target machine 7137@cindex compiler version, specifying 7138@cindex target machine, specifying 7139 7140The usual way to run GCC is to run the executable called @file{gcc}, or 7141@file{<machine>-gcc} when cross-compiling, or 7142@file{<machine>-gcc-<version>} to run a version other than the one that 7143was installed last. Sometimes this is inconvenient, so GCC provides 7144options that will switch to another cross-compiler or version. 7145 7146@table @gcctabopt 7147@item -b @var{machine} 7148@opindex b 7149The argument @var{machine} specifies the target machine for compilation. 7150 7151The value to use for @var{machine} is the same as was specified as the 7152machine type when configuring GCC as a cross-compiler. For 7153example, if a cross-compiler was configured with @samp{configure 7154arm-elf}, meaning to compile for an arm processor with elf binaries, 7155then you would specify @option{-b arm-elf} to run that cross compiler. 7156Because there are other options beginning with @option{-b}, the 7157configuration must contain a hyphen. 7158 7159@item -V @var{version} 7160@opindex V 7161The argument @var{version} specifies which version of GCC to run. 7162This is useful when multiple versions are installed. For example, 7163@var{version} might be @samp{4.0}, meaning to run GCC version 4.0. 7164@end table 7165 7166The @option{-V} and @option{-b} options work by running the 7167@file{<machine>-gcc-<version>} executable, so there's no real reason to 7168use them if you can just run that directly. 7169 7170@node Submodel Options 7171@section Hardware Models and Configurations 7172@cindex submodel options 7173@cindex specifying hardware config 7174@cindex hardware models and configurations, specifying 7175@cindex machine dependent options 7176 7177Earlier we discussed the standard option @option{-b} which chooses among 7178different installed compilers for completely different target 7179machines, such as VAX vs.@: 68000 vs.@: 80386. 7180 7181In addition, each of these target machine types can have its own 7182special options, starting with @samp{-m}, to choose among various 7183hardware models or configurations---for example, 68010 vs 68020, 7184floating coprocessor or none. A single installed version of the 7185compiler can compile for any model or configuration, according to the 7186options specified. 7187 7188Some configurations of the compiler also support additional special 7189options, usually for compatibility with other compilers on the same 7190platform. 7191 7192@c This list is ordered alphanumerically by subsection name. 7193@c It should be the same order and spelling as these options are listed 7194@c in Machine Dependent Options 7195 7196@menu 7197* ARC Options:: 7198* ARM Options:: 7199* AVR Options:: 7200* Blackfin Options:: 7201* CRIS Options:: 7202* CRX Options:: 7203* Darwin Options:: 7204* DEC Alpha Options:: 7205* DEC Alpha/VMS Options:: 7206* FRV Options:: 7207* GNU/Linux Options:: 7208* H8/300 Options:: 7209* HPPA Options:: 7210* i386 and x86-64 Options:: 7211* IA-64 Options:: 7212* M32C Options:: 7213* M32R/D Options:: 7214* M680x0 Options:: 7215* M68hc1x Options:: 7216* MCore Options:: 7217* MIPS Options:: 7218* MMIX Options:: 7219* MN10300 Options:: 7220* MT Options:: 7221* PDP-11 Options:: 7222* PowerPC Options:: 7223* RS/6000 and PowerPC Options:: 7224* S/390 and zSeries Options:: 7225* Score Options:: 7226* SH Options:: 7227* SPARC Options:: 7228* System V Options:: 7229* TMS320C3x/C4x Options:: 7230* V850 Options:: 7231* VAX Options:: 7232* x86-64 Options:: 7233* Xstormy16 Options:: 7234* Xtensa Options:: 7235* zSeries Options:: 7236@end menu 7237 7238@node ARC Options 7239@subsection ARC Options 7240@cindex ARC Options 7241 7242These options are defined for ARC implementations: 7243 7244@table @gcctabopt 7245@item -EL 7246@opindex EL 7247Compile code for little endian mode. This is the default. 7248 7249@item -EB 7250@opindex EB 7251Compile code for big endian mode. 7252 7253@item -mmangle-cpu 7254@opindex mmangle-cpu 7255Prepend the name of the cpu to all public symbol names. 7256In multiple-processor systems, there are many ARC variants with different 7257instruction and register set characteristics. This flag prevents code 7258compiled for one cpu to be linked with code compiled for another. 7259No facility exists for handling variants that are ``almost identical''. 7260This is an all or nothing option. 7261 7262@item -mcpu=@var{cpu} 7263@opindex mcpu 7264Compile code for ARC variant @var{cpu}. 7265Which variants are supported depend on the configuration. 7266All variants support @option{-mcpu=base}, this is the default. 7267 7268@item -mtext=@var{text-section} 7269@itemx -mdata=@var{data-section} 7270@itemx -mrodata=@var{readonly-data-section} 7271@opindex mtext 7272@opindex mdata 7273@opindex mrodata 7274Put functions, data, and readonly data in @var{text-section}, 7275@var{data-section}, and @var{readonly-data-section} respectively 7276by default. This can be overridden with the @code{section} attribute. 7277@xref{Variable Attributes}. 7278 7279@end table 7280 7281@node ARM Options 7282@subsection ARM Options 7283@cindex ARM options 7284 7285These @samp{-m} options are defined for Advanced RISC Machines (ARM) 7286architectures: 7287 7288@table @gcctabopt 7289@item -mabi=@var{name} 7290@opindex mabi 7291Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu}, 7292@samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}. 7293 7294@item -mapcs-frame 7295@opindex mapcs-frame 7296Generate a stack frame that is compliant with the ARM Procedure Call 7297Standard for all functions, even if this is not strictly necessary for 7298correct execution of the code. Specifying @option{-fomit-frame-pointer} 7299with this option will cause the stack frames not to be generated for 7300leaf functions. The default is @option{-mno-apcs-frame}. 7301 7302@item -mapcs 7303@opindex mapcs 7304This is a synonym for @option{-mapcs-frame}. 7305 7306@ignore 7307@c not currently implemented 7308@item -mapcs-stack-check 7309@opindex mapcs-stack-check 7310Generate code to check the amount of stack space available upon entry to 7311every function (that actually uses some stack space). If there is 7312insufficient space available then either the function 7313@samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be 7314called, depending upon the amount of stack space required. The run time 7315system is required to provide these functions. The default is 7316@option{-mno-apcs-stack-check}, since this produces smaller code. 7317 7318@c not currently implemented 7319@item -mapcs-float 7320@opindex mapcs-float 7321Pass floating point arguments using the float point registers. This is 7322one of the variants of the APCS@. This option is recommended if the 7323target hardware has a floating point unit or if a lot of floating point 7324arithmetic is going to be performed by the code. The default is 7325@option{-mno-apcs-float}, since integer only code is slightly increased in 7326size if @option{-mapcs-float} is used. 7327 7328@c not currently implemented 7329@item -mapcs-reentrant 7330@opindex mapcs-reentrant 7331Generate reentrant, position independent code. The default is 7332@option{-mno-apcs-reentrant}. 7333@end ignore 7334 7335@item -mthumb-interwork 7336@opindex mthumb-interwork 7337Generate code which supports calling between the ARM and Thumb 7338instruction sets. Without this option the two instruction sets cannot 7339be reliably used inside one program. The default is 7340@option{-mno-thumb-interwork}, since slightly larger code is generated 7341when @option{-mthumb-interwork} is specified. 7342 7343@item -mno-sched-prolog 7344@opindex mno-sched-prolog 7345Prevent the reordering of instructions in the function prolog, or the 7346merging of those instruction with the instructions in the function's 7347body. This means that all functions will start with a recognizable set 7348of instructions (or in fact one of a choice from a small set of 7349different function prologues), and this information can be used to 7350locate the start if functions inside an executable piece of code. The 7351default is @option{-msched-prolog}. 7352 7353@item -mhard-float 7354@opindex mhard-float 7355Generate output containing floating point instructions. This is the 7356default. 7357 7358@item -msoft-float 7359@opindex msoft-float 7360Generate output containing library calls for floating point. 7361@strong{Warning:} the requisite libraries are not available for all ARM 7362targets. Normally the facilities of the machine's usual C compiler are 7363used, but this cannot be done directly in cross-compilation. You must make 7364your own arrangements to provide suitable library functions for 7365cross-compilation. 7366 7367@option{-msoft-float} changes the calling convention in the output file; 7368therefore, it is only useful if you compile @emph{all} of a program with 7369this option. In particular, you need to compile @file{libgcc.a}, the 7370library that comes with GCC, with @option{-msoft-float} in order for 7371this to work. 7372 7373@item -mfloat-abi=@var{name} 7374@opindex mfloat-abi 7375Specifies which ABI to use for floating point values. Permissible values 7376are: @samp{soft}, @samp{softfp} and @samp{hard}. 7377 7378@samp{soft} and @samp{hard} are equivalent to @option{-msoft-float} 7379and @option{-mhard-float} respectively. @samp{softfp} allows the generation 7380of floating point instructions, but still uses the soft-float calling 7381conventions. 7382 7383@item -mlittle-endian 7384@opindex mlittle-endian 7385Generate code for a processor running in little-endian mode. This is 7386the default for all standard configurations. 7387 7388@item -mbig-endian 7389@opindex mbig-endian 7390Generate code for a processor running in big-endian mode; the default is 7391to compile code for a little-endian processor. 7392 7393@item -mwords-little-endian 7394@opindex mwords-little-endian 7395This option only applies when generating code for big-endian processors. 7396Generate code for a little-endian word order but a big-endian byte 7397order. That is, a byte order of the form @samp{32107654}. Note: this 7398option should only be used if you require compatibility with code for 7399big-endian ARM processors generated by versions of the compiler prior to 74002.8. 7401 7402@item -mcpu=@var{name} 7403@opindex mcpu 7404This specifies the name of the target ARM processor. GCC uses this name 7405to determine what kind of instructions it can emit when generating 7406assembly code. Permissible names are: @samp{arm2}, @samp{arm250}, 7407@samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610}, 7408@samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm}, 7409@samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700}, 7410@samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100}, 7411@samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s}, 7412@samp{arm8}, @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100}, 7413@samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920}, 7414@samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s}, 7415@samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi}, 7416@samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s}, 7417@samp{arm10e}, @samp{arm1020e}, @samp{arm1022e}, 7418@samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp}, 7419@samp{arm1176jz-s}, @samp{arm1176jzf-s}, @samp{xscale}, @samp{iwmmxt}, 7420@samp{ep9312}. 7421 7422@itemx -mtune=@var{name} 7423@opindex mtune 7424This option is very similar to the @option{-mcpu=} option, except that 7425instead of specifying the actual target processor type, and hence 7426restricting which instructions can be used, it specifies that GCC should 7427tune the performance of the code as if the target were of the type 7428specified in this option, but still choosing the instructions that it 7429will generate based on the cpu specified by a @option{-mcpu=} option. 7430For some ARM implementations better performance can be obtained by using 7431this option. 7432 7433@item -march=@var{name} 7434@opindex march 7435This specifies the name of the target ARM architecture. GCC uses this 7436name to determine what kind of instructions it can emit when generating 7437assembly code. This option can be used in conjunction with or instead 7438of the @option{-mcpu=} option. Permissible names are: @samp{armv2}, 7439@samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t}, 7440@samp{armv5}, @samp{armv5t}, @samp{armv5te}, @samp{armv6}, @samp{armv6j}, 7441@samp{iwmmxt}, @samp{ep9312}. 7442 7443@item -mfpu=@var{name} 7444@itemx -mfpe=@var{number} 7445@itemx -mfp=@var{number} 7446@opindex mfpu 7447@opindex mfpe 7448@opindex mfp 7449This specifies what floating point hardware (or hardware emulation) is 7450available on the target. Permissible names are: @samp{fpa}, @samp{fpe2}, 7451@samp{fpe3}, @samp{maverick}, @samp{vfp}. @option{-mfp} and @option{-mfpe} 7452are synonyms for @option{-mfpu}=@samp{fpe}@var{number}, for compatibility 7453with older versions of GCC@. 7454 7455If @option{-msoft-float} is specified this specifies the format of 7456floating point values. 7457 7458@item -mstructure-size-boundary=@var{n} 7459@opindex mstructure-size-boundary 7460The size of all structures and unions will be rounded up to a multiple 7461of the number of bits set by this option. Permissible values are 8, 32 7462and 64. The default value varies for different toolchains. For the COFF 7463targeted toolchain the default value is 8. A value of 64 is only allowed 7464if the underlying ABI supports it. 7465 7466Specifying the larger number can produce faster, more efficient code, but 7467can also increase the size of the program. Different values are potentially 7468incompatible. Code compiled with one value cannot necessarily expect to 7469work with code or libraries compiled with another value, if they exchange 7470information using structures or unions. 7471 7472@item -mabort-on-noreturn 7473@opindex mabort-on-noreturn 7474Generate a call to the function @code{abort} at the end of a 7475@code{noreturn} function. It will be executed if the function tries to 7476return. 7477 7478@item -mlong-calls 7479@itemx -mno-long-calls 7480@opindex mlong-calls 7481@opindex mno-long-calls 7482Tells the compiler to perform function calls by first loading the 7483address of the function into a register and then performing a subroutine 7484call on this register. This switch is needed if the target function 7485will lie outside of the 64 megabyte addressing range of the offset based 7486version of subroutine call instruction. 7487 7488Even if this switch is enabled, not all function calls will be turned 7489into long calls. The heuristic is that static functions, functions 7490which have the @samp{short-call} attribute, functions that are inside 7491the scope of a @samp{#pragma no_long_calls} directive and functions whose 7492definitions have already been compiled within the current compilation 7493unit, will not be turned into long calls. The exception to this rule is 7494that weak function definitions, functions with the @samp{long-call} 7495attribute or the @samp{section} attribute, and functions that are within 7496the scope of a @samp{#pragma long_calls} directive, will always be 7497turned into long calls. 7498 7499This feature is not enabled by default. Specifying 7500@option{-mno-long-calls} will restore the default behavior, as will 7501placing the function calls within the scope of a @samp{#pragma 7502long_calls_off} directive. Note these switches have no effect on how 7503the compiler generates code to handle function calls via function 7504pointers. 7505 7506@item -mnop-fun-dllimport 7507@opindex mnop-fun-dllimport 7508Disable support for the @code{dllimport} attribute. 7509 7510@item -msingle-pic-base 7511@opindex msingle-pic-base 7512Treat the register used for PIC addressing as read-only, rather than 7513loading it in the prologue for each function. The run-time system is 7514responsible for initializing this register with an appropriate value 7515before execution begins. 7516 7517@item -mpic-register=@var{reg} 7518@opindex mpic-register 7519Specify the register to be used for PIC addressing. The default is R10 7520unless stack-checking is enabled, when R9 is used. 7521 7522@item -mcirrus-fix-invalid-insns 7523@opindex mcirrus-fix-invalid-insns 7524@opindex mno-cirrus-fix-invalid-insns 7525Insert NOPs into the instruction stream to in order to work around 7526problems with invalid Maverick instruction combinations. This option 7527is only valid if the @option{-mcpu=ep9312} option has been used to 7528enable generation of instructions for the Cirrus Maverick floating 7529point co-processor. This option is not enabled by default, since the 7530problem is only present in older Maverick implementations. The default 7531can be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns} 7532switch. 7533 7534@item -mpoke-function-name 7535@opindex mpoke-function-name 7536Write the name of each function into the text section, directly 7537preceding the function prologue. The generated code is similar to this: 7538 7539@smallexample 7540 t0 7541 .ascii "arm_poke_function_name", 0 7542 .align 7543 t1 7544 .word 0xff000000 + (t1 - t0) 7545 arm_poke_function_name 7546 mov ip, sp 7547 stmfd sp!, @{fp, ip, lr, pc@} 7548 sub fp, ip, #4 7549@end smallexample 7550 7551When performing a stack backtrace, code can inspect the value of 7552@code{pc} stored at @code{fp + 0}. If the trace function then looks at 7553location @code{pc - 12} and the top 8 bits are set, then we know that 7554there is a function name embedded immediately preceding this location 7555and has length @code{((pc[-3]) & 0xff000000)}. 7556 7557@item -mthumb 7558@opindex mthumb 7559Generate code for the 16-bit Thumb instruction set. The default is to 7560use the 32-bit ARM instruction set. 7561 7562@item -mtpcs-frame 7563@opindex mtpcs-frame 7564Generate a stack frame that is compliant with the Thumb Procedure Call 7565Standard for all non-leaf functions. (A leaf function is one that does 7566not call any other functions.) The default is @option{-mno-tpcs-frame}. 7567 7568@item -mtpcs-leaf-frame 7569@opindex mtpcs-leaf-frame 7570Generate a stack frame that is compliant with the Thumb Procedure Call 7571Standard for all leaf functions. (A leaf function is one that does 7572not call any other functions.) The default is @option{-mno-apcs-leaf-frame}. 7573 7574@item -mcallee-super-interworking 7575@opindex mcallee-super-interworking 7576Gives all externally visible functions in the file being compiled an ARM 7577instruction set header which switches to Thumb mode before executing the 7578rest of the function. This allows these functions to be called from 7579non-interworking code. 7580 7581@item -mcaller-super-interworking 7582@opindex mcaller-super-interworking 7583Allows calls via function pointers (including virtual functions) to 7584execute correctly regardless of whether the target code has been 7585compiled for interworking or not. There is a small overhead in the cost 7586of executing a function pointer if this option is enabled. 7587 7588@item -mtp=@var{name} 7589@opindex mtp 7590Specify the access model for the thread local storage pointer. The valid 7591models are @option{soft}, which generates calls to @code{__aeabi_read_tp}, 7592@option{cp15}, which fetches the thread pointer from @code{cp15} directly 7593(supported in the arm6k architecture), and @option{auto}, which uses the 7594best available method for the selected processor. The default setting is 7595@option{auto}. 7596 7597@end table 7598 7599@node AVR Options 7600@subsection AVR Options 7601@cindex AVR Options 7602 7603These options are defined for AVR implementations: 7604 7605@table @gcctabopt 7606@item -mmcu=@var{mcu} 7607@opindex mmcu 7608Specify ATMEL AVR instruction set or MCU type. 7609 7610Instruction set avr1 is for the minimal AVR core, not supported by the C 7611compiler, only for assembler programs (MCU types: at90s1200, attiny10, 7612attiny11, attiny12, attiny15, attiny28). 7613 7614Instruction set avr2 (default) is for the classic AVR core with up to 76158K program memory space (MCU types: at90s2313, at90s2323, attiny22, 7616at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515, 7617at90c8534, at90s8535). 7618 7619Instruction set avr3 is for the classic AVR core with up to 128K program 7620memory space (MCU types: atmega103, atmega603, at43usb320, at76c711). 7621 7622Instruction set avr4 is for the enhanced AVR core with up to 8K program 7623memory space (MCU types: atmega8, atmega83, atmega85). 7624 7625Instruction set avr5 is for the enhanced AVR core with up to 128K program 7626memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323, 7627atmega64, atmega128, at43usb355, at94k). 7628 7629@item -msize 7630@opindex msize 7631Output instruction sizes to the asm file. 7632 7633@item -minit-stack=@var{N} 7634@opindex minit-stack 7635Specify the initial stack address, which may be a symbol or numeric value, 7636@samp{__stack} is the default. 7637 7638@item -mno-interrupts 7639@opindex mno-interrupts 7640Generated code is not compatible with hardware interrupts. 7641Code size will be smaller. 7642 7643@item -mcall-prologues 7644@opindex mcall-prologues 7645Functions prologues/epilogues expanded as call to appropriate 7646subroutines. Code size will be smaller. 7647 7648@item -mno-tablejump 7649@opindex mno-tablejump 7650Do not generate tablejump insns which sometimes increase code size. 7651 7652@item -mtiny-stack 7653@opindex mtiny-stack 7654Change only the low 8 bits of the stack pointer. 7655 7656@item -mint8 7657@opindex mint8 7658Assume int to be 8 bit integer. This affects the sizes of all types: A 7659char will be 1 byte, an int will be 1 byte, an long will be 2 bytes 7660and long long will be 4 bytes. Please note that this option does not 7661comply to the C standards, but it will provide you with smaller code 7662size. 7663@end table 7664 7665@node Blackfin Options 7666@subsection Blackfin Options 7667@cindex Blackfin Options 7668 7669@table @gcctabopt 7670@item -momit-leaf-frame-pointer 7671@opindex momit-leaf-frame-pointer 7672Don't keep the frame pointer in a register for leaf functions. This 7673avoids the instructions to save, set up and restore frame pointers and 7674makes an extra register available in leaf functions. The option 7675@option{-fomit-frame-pointer} removes the frame pointer for all functions 7676which might make debugging harder. 7677 7678@item -mspecld-anomaly 7679@opindex mspecld-anomaly 7680When enabled, the compiler will ensure that the generated code does not 7681contain speculative loads after jump instructions. This option is enabled 7682by default. 7683 7684@item -mno-specld-anomaly 7685@opindex mno-specld-anomaly 7686Don't generate extra code to prevent speculative loads from occurring. 7687 7688@item -mcsync-anomaly 7689@opindex mcsync-anomaly 7690When enabled, the compiler will ensure that the generated code does not 7691contain CSYNC or SSYNC instructions too soon after conditional branches. 7692This option is enabled by default. 7693 7694@item -mno-csync-anomaly 7695@opindex mno-csync-anomaly 7696Don't generate extra code to prevent CSYNC or SSYNC instructions from 7697occurring too soon after a conditional branch. 7698 7699@item -mlow-64k 7700@opindex mlow-64k 7701When enabled, the compiler is free to take advantage of the knowledge that 7702the entire program fits into the low 64k of memory. 7703 7704@item -mno-low-64k 7705@opindex mno-low-64k 7706Assume that the program is arbitrarily large. This is the default. 7707 7708@item -mid-shared-library 7709@opindex mid-shared-library 7710Generate code that supports shared libraries via the library ID method. 7711This allows for execute in place and shared libraries in an environment 7712without virtual memory management. This option implies @option{-fPIC}. 7713 7714@item -mno-id-shared-library 7715@opindex mno-id-shared-library 7716Generate code that doesn't assume ID based shared libraries are being used. 7717This is the default. 7718 7719@item -mshared-library-id=n 7720@opindex mshared-library-id 7721Specified the identification number of the ID based shared library being 7722compiled. Specifying a value of 0 will generate more compact code, specifying 7723other values will force the allocation of that number to the current 7724library but is no more space or time efficient than omitting this option. 7725 7726@item -mlong-calls 7727@itemx -mno-long-calls 7728@opindex mlong-calls 7729@opindex mno-long-calls 7730Tells the compiler to perform function calls by first loading the 7731address of the function into a register and then performing a subroutine 7732call on this register. This switch is needed if the target function 7733will lie outside of the 24 bit addressing range of the offset based 7734version of subroutine call instruction. 7735 7736This feature is not enabled by default. Specifying 7737@option{-mno-long-calls} will restore the default behavior. Note these 7738switches have no effect on how the compiler generates code to handle 7739function calls via function pointers. 7740@end table 7741 7742@node CRIS Options 7743@subsection CRIS Options 7744@cindex CRIS Options 7745 7746These options are defined specifically for the CRIS ports. 7747 7748@table @gcctabopt 7749@item -march=@var{architecture-type} 7750@itemx -mcpu=@var{architecture-type} 7751@opindex march 7752@opindex mcpu 7753Generate code for the specified architecture. The choices for 7754@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for 7755respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@. 7756Default is @samp{v0} except for cris-axis-linux-gnu, where the default is 7757@samp{v10}. 7758 7759@item -mtune=@var{architecture-type} 7760@opindex mtune 7761Tune to @var{architecture-type} everything applicable about the generated 7762code, except for the ABI and the set of available instructions. The 7763choices for @var{architecture-type} are the same as for 7764@option{-march=@var{architecture-type}}. 7765 7766@item -mmax-stack-frame=@var{n} 7767@opindex mmax-stack-frame 7768Warn when the stack frame of a function exceeds @var{n} bytes. 7769 7770@item -melinux-stacksize=@var{n} 7771@opindex melinux-stacksize 7772Only available with the @samp{cris-axis-aout} target. Arranges for 7773indications in the program to the kernel loader that the stack of the 7774program should be set to @var{n} bytes. 7775 7776@item -metrax4 7777@itemx -metrax100 7778@opindex metrax4 7779@opindex metrax100 7780The options @option{-metrax4} and @option{-metrax100} are synonyms for 7781@option{-march=v3} and @option{-march=v8} respectively. 7782 7783@item -mmul-bug-workaround 7784@itemx -mno-mul-bug-workaround 7785@opindex mmul-bug-workaround 7786@opindex mno-mul-bug-workaround 7787Work around a bug in the @code{muls} and @code{mulu} instructions for CPU 7788models where it applies. This option is active by default. 7789 7790@item -mpdebug 7791@opindex mpdebug 7792Enable CRIS-specific verbose debug-related information in the assembly 7793code. This option also has the effect to turn off the @samp{#NO_APP} 7794formatted-code indicator to the assembler at the beginning of the 7795assembly file. 7796 7797@item -mcc-init 7798@opindex mcc-init 7799Do not use condition-code results from previous instruction; always emit 7800compare and test instructions before use of condition codes. 7801 7802@item -mno-side-effects 7803@opindex mno-side-effects 7804Do not emit instructions with side-effects in addressing modes other than 7805post-increment. 7806 7807@item -mstack-align 7808@itemx -mno-stack-align 7809@itemx -mdata-align 7810@itemx -mno-data-align 7811@itemx -mconst-align 7812@itemx -mno-const-align 7813@opindex mstack-align 7814@opindex mno-stack-align 7815@opindex mdata-align 7816@opindex mno-data-align 7817@opindex mconst-align 7818@opindex mno-const-align 7819These options (no-options) arranges (eliminate arrangements) for the 7820stack-frame, individual data and constants to be aligned for the maximum 7821single data access size for the chosen CPU model. The default is to 7822arrange for 32-bit alignment. ABI details such as structure layout are 7823not affected by these options. 7824 7825@item -m32-bit 7826@itemx -m16-bit 7827@itemx -m8-bit 7828@opindex m32-bit 7829@opindex m16-bit 7830@opindex m8-bit 7831Similar to the stack- data- and const-align options above, these options 7832arrange for stack-frame, writable data and constants to all be 32-bit, 783316-bit or 8-bit aligned. The default is 32-bit alignment. 7834 7835@item -mno-prologue-epilogue 7836@itemx -mprologue-epilogue 7837@opindex mno-prologue-epilogue 7838@opindex mprologue-epilogue 7839With @option{-mno-prologue-epilogue}, the normal function prologue and 7840epilogue that sets up the stack-frame are omitted and no return 7841instructions or return sequences are generated in the code. Use this 7842option only together with visual inspection of the compiled code: no 7843warnings or errors are generated when call-saved registers must be saved, 7844or storage for local variable needs to be allocated. 7845 7846@item -mno-gotplt 7847@itemx -mgotplt 7848@opindex mno-gotplt 7849@opindex mgotplt 7850With @option{-fpic} and @option{-fPIC}, don't generate (do generate) 7851instruction sequences that load addresses for functions from the PLT part 7852of the GOT rather than (traditional on other architectures) calls to the 7853PLT@. The default is @option{-mgotplt}. 7854 7855@item -maout 7856@opindex maout 7857Legacy no-op option only recognized with the cris-axis-aout target. 7858 7859@item -melf 7860@opindex melf 7861Legacy no-op option only recognized with the cris-axis-elf and 7862cris-axis-linux-gnu targets. 7863 7864@item -melinux 7865@opindex melinux 7866Only recognized with the cris-axis-aout target, where it selects a 7867GNU/linux-like multilib, include files and instruction set for 7868@option{-march=v8}. 7869 7870@item -mlinux 7871@opindex mlinux 7872Legacy no-op option only recognized with the cris-axis-linux-gnu target. 7873 7874@item -sim 7875@opindex sim 7876This option, recognized for the cris-axis-aout and cris-axis-elf arranges 7877to link with input-output functions from a simulator library. Code, 7878initialized data and zero-initialized data are allocated consecutively. 7879 7880@item -sim2 7881@opindex sim2 7882Like @option{-sim}, but pass linker options to locate initialized data at 78830x40000000 and zero-initialized data at 0x80000000. 7884@end table 7885 7886@node CRX Options 7887@subsection CRX Options 7888@cindex CRX Options 7889 7890These options are defined specifically for the CRX ports. 7891 7892@table @gcctabopt 7893 7894@item -mmac 7895@opindex mmac 7896Enable the use of multiply-accumulate instructions. Disabled by default. 7897 7898@item -mpush-args 7899@opindex mpush-args 7900Push instructions will be used to pass outgoing arguments when functions 7901are called. Enabled by default. 7902@end table 7903 7904@node Darwin Options 7905@subsection Darwin Options 7906@cindex Darwin options 7907 7908These options are defined for all architectures running the Darwin operating 7909system. 7910 7911FSF GCC on Darwin does not create ``fat'' object files; it will create 7912an object file for the single architecture that it was built to 7913target. Apple's GCC on Darwin does create ``fat'' files if multiple 7914@option{-arch} options are used; it does so by running the compiler or 7915linker multiple times and joining the results together with 7916@file{lipo}. 7917 7918The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or 7919@samp{i686}) is determined by the flags that specify the ISA 7920that GCC is targetting, like @option{-mcpu} or @option{-march}. The 7921@option{-force_cpusubtype_ALL} option can be used to override this. 7922 7923The Darwin tools vary in their behavior when presented with an ISA 7924mismatch. The assembler, @file{as}, will only permit instructions to 7925be used that are valid for the subtype of the file it is generating, 7926so you cannot put 64-bit instructions in an @samp{ppc750} object file. 7927The linker for shared libraries, @file{/usr/bin/libtool}, will fail 7928and print an error if asked to create a shared library with a less 7929restrictive subtype than its input files (for instance, trying to put 7930a @samp{ppc970} object file in a @samp{ppc7400} library). The linker 7931for executables, @file{ld}, will quietly give the executable the most 7932restrictive subtype of any of its input files. 7933 7934@table @gcctabopt 7935@item -F@var{dir} 7936@opindex F 7937Add the framework directory @var{dir} to the head of the list of 7938directories to be searched for header files. These directories are 7939interleaved with those specified by @option{-I} options and are 7940scanned in a left-to-right order. 7941 7942A framework directory is a directory with frameworks in it. A 7943framework is a directory with a @samp{"Headers"} and/or 7944@samp{"PrivateHeaders"} directory contained directly in it that ends 7945in @samp{".framework"}. The name of a framework is the name of this 7946directory excluding the @samp{".framework"}. Headers associated with 7947the framework are found in one of those two directories, with 7948@samp{"Headers"} being searched first. A subframework is a framework 7949directory that is in a framework's @samp{"Frameworks"} directory. 7950Includes of subframework headers can only appear in a header of a 7951framework that contains the subframework, or in a sibling subframework 7952header. Two subframeworks are siblings if they occur in the same 7953framework. A subframework should not have the same name as a 7954framework, a warning will be issued if this is violated. Currently a 7955subframework cannot have subframeworks, in the future, the mechanism 7956may be extended to support this. The standard frameworks can be found 7957in @samp{"/System/Library/Frameworks"} and 7958@samp{"/Library/Frameworks"}. An example include looks like 7959@code{#include <Framework/header.h>}, where @samp{Framework} denotes 7960the name of the framework and header.h is found in the 7961@samp{"PrivateHeaders"} or @samp{"Headers"} directory. 7962 7963@item -gused 7964@opindex gused 7965Emit debugging information for symbols that are used. For STABS 7966debugging format, this enables @option{-feliminate-unused-debug-symbols}. 7967This is by default ON@. 7968 7969@item -gfull 7970@opindex gfull 7971Emit debugging information for all symbols and types. 7972 7973@item -mmacosx-version-min=@var{version} 7974The earliest version of MacOS X that this executable will run on 7975is @var{version}. Typical values of @var{version} include @code{10.1}, 7976@code{10.2}, and @code{10.3.9}. 7977 7978The default for this option is to make choices that seem to be most 7979useful. 7980 7981@item -mkernel 7982@opindex mkernel 7983Enable kernel development mode. The @option{-mkernel} option sets 7984@option{-static}, @option{-fno-common}, @option{-fno-cxa-atexit}, 7985@option{-fno-exceptions}, @option{-fno-non-call-exceptions}, 7986@option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where 7987applicable. This mode also sets @option{-mno-altivec}, 7988@option{-msoft-float}, @option{-fno-builtin} and 7989@option{-mlong-branch} for PowerPC targets. 7990 7991@item -mone-byte-bool 7992@opindex mone-byte-bool 7993Override the defaults for @samp{bool} so that @samp{sizeof(bool)==1}. 7994By default @samp{sizeof(bool)} is @samp{4} when compiling for 7995Darwin/PowerPC and @samp{1} when compiling for Darwin/x86, so this 7996option has no effect on x86. 7997 7998@strong{Warning:} The @option{-mone-byte-bool} switch causes GCC 7999to generate code that is not binary compatible with code generated 8000without that switch. Using this switch may require recompiling all 8001other modules in a program, including system libraries. Use this 8002switch to conform to a non-default data model. 8003 8004@item -mfix-and-continue 8005@itemx -ffix-and-continue 8006@itemx -findirect-data 8007@opindex mfix-and-continue 8008@opindex ffix-and-continue 8009@opindex findirect-data 8010Generate code suitable for fast turn around development. Needed to 8011enable gdb to dynamically load @code{.o} files into already running 8012programs. @option{-findirect-data} and @option{-ffix-and-continue} 8013are provided for backwards compatibility. 8014 8015@item -all_load 8016@opindex all_load 8017Loads all members of static archive libraries. 8018See man ld(1) for more information. 8019 8020@item -arch_errors_fatal 8021@opindex arch_errors_fatal 8022Cause the errors having to do with files that have the wrong architecture 8023to be fatal. 8024 8025@item -bind_at_load 8026@opindex bind_at_load 8027Causes the output file to be marked such that the dynamic linker will 8028bind all undefined references when the file is loaded or launched. 8029 8030@item -bundle 8031@opindex bundle 8032Produce a Mach-o bundle format file. 8033See man ld(1) for more information. 8034 8035@item -bundle_loader @var{executable} 8036@opindex bundle_loader 8037This option specifies the @var{executable} that will be loading the build 8038output file being linked. See man ld(1) for more information. 8039 8040@item -dynamiclib 8041@opindex dynamiclib 8042When passed this option, GCC will produce a dynamic library instead of 8043an executable when linking, using the Darwin @file{libtool} command. 8044 8045@item -force_cpusubtype_ALL 8046@opindex force_cpusubtype_ALL 8047This causes GCC's output file to have the @var{ALL} subtype, instead of 8048one controlled by the @option{-mcpu} or @option{-march} option. 8049 8050@item -allowable_client @var{client_name} 8051@itemx -client_name 8052@itemx -compatibility_version 8053@itemx -current_version 8054@itemx -dead_strip 8055@itemx -dependency-file 8056@itemx -dylib_file 8057@itemx -dylinker_install_name 8058@itemx -dynamic 8059@itemx -exported_symbols_list 8060@itemx -filelist 8061@itemx -flat_namespace 8062@itemx -force_flat_namespace 8063@itemx -headerpad_max_install_names 8064@itemx -image_base 8065@itemx -init 8066@itemx -install_name 8067@itemx -keep_private_externs 8068@itemx -multi_module 8069@itemx -multiply_defined 8070@itemx -multiply_defined_unused 8071@itemx -noall_load 8072@itemx -no_dead_strip_inits_and_terms 8073@itemx -nofixprebinding 8074@itemx -nomultidefs 8075@itemx -noprebind 8076@itemx -noseglinkedit 8077@itemx -pagezero_size 8078@itemx -prebind 8079@itemx -prebind_all_twolevel_modules 8080@itemx -private_bundle 8081@itemx -read_only_relocs 8082@itemx -sectalign 8083@itemx -sectobjectsymbols 8084@itemx -whyload 8085@itemx -seg1addr 8086@itemx -sectcreate 8087@itemx -sectobjectsymbols 8088@itemx -sectorder 8089@itemx -segaddr 8090@itemx -segs_read_only_addr 8091@itemx -segs_read_write_addr 8092@itemx -seg_addr_table 8093@itemx -seg_addr_table_filename 8094@itemx -seglinkedit 8095@itemx -segprot 8096@itemx -segs_read_only_addr 8097@itemx -segs_read_write_addr 8098@itemx -single_module 8099@itemx -static 8100@itemx -sub_library 8101@itemx -sub_umbrella 8102@itemx -twolevel_namespace 8103@itemx -umbrella 8104@itemx -undefined 8105@itemx -unexported_symbols_list 8106@itemx -weak_reference_mismatches 8107@itemx -whatsloaded 8108 8109@opindex allowable_client 8110@opindex client_name 8111@opindex compatibility_version 8112@opindex current_version 8113@opindex dead_strip 8114@opindex dependency-file 8115@opindex dylib_file 8116@opindex dylinker_install_name 8117@opindex dynamic 8118@opindex exported_symbols_list 8119@opindex filelist 8120@opindex flat_namespace 8121@opindex force_flat_namespace 8122@opindex headerpad_max_install_names 8123@opindex image_base 8124@opindex init 8125@opindex install_name 8126@opindex keep_private_externs 8127@opindex multi_module 8128@opindex multiply_defined 8129@opindex multiply_defined_unused 8130@opindex noall_load 8131@opindex no_dead_strip_inits_and_terms 8132@opindex nofixprebinding 8133@opindex nomultidefs 8134@opindex noprebind 8135@opindex noseglinkedit 8136@opindex pagezero_size 8137@opindex prebind 8138@opindex prebind_all_twolevel_modules 8139@opindex private_bundle 8140@opindex read_only_relocs 8141@opindex sectalign 8142@opindex sectobjectsymbols 8143@opindex whyload 8144@opindex seg1addr 8145@opindex sectcreate 8146@opindex sectobjectsymbols 8147@opindex sectorder 8148@opindex segaddr 8149@opindex segs_read_only_addr 8150@opindex segs_read_write_addr 8151@opindex seg_addr_table 8152@opindex seg_addr_table_filename 8153@opindex seglinkedit 8154@opindex segprot 8155@opindex segs_read_only_addr 8156@opindex segs_read_write_addr 8157@opindex single_module 8158@opindex static 8159@opindex sub_library 8160@opindex sub_umbrella 8161@opindex twolevel_namespace 8162@opindex umbrella 8163@opindex undefined 8164@opindex unexported_symbols_list 8165@opindex weak_reference_mismatches 8166@opindex whatsloaded 8167 8168These options are passed to the Darwin linker. The Darwin linker man page 8169describes them in detail. 8170@end table 8171 8172@node DEC Alpha Options 8173@subsection DEC Alpha Options 8174 8175These @samp{-m} options are defined for the DEC Alpha implementations: 8176 8177@table @gcctabopt 8178@item -mno-soft-float 8179@itemx -msoft-float 8180@opindex mno-soft-float 8181@opindex msoft-float 8182Use (do not use) the hardware floating-point instructions for 8183floating-point operations. When @option{-msoft-float} is specified, 8184functions in @file{libgcc.a} will be used to perform floating-point 8185operations. Unless they are replaced by routines that emulate the 8186floating-point operations, or compiled in such a way as to call such 8187emulations routines, these routines will issue floating-point 8188operations. If you are compiling for an Alpha without floating-point 8189operations, you must ensure that the library is built so as not to call 8190them. 8191 8192Note that Alpha implementations without floating-point operations are 8193required to have floating-point registers. 8194 8195@item -mfp-reg 8196@itemx -mno-fp-regs 8197@opindex mfp-reg 8198@opindex mno-fp-regs 8199Generate code that uses (does not use) the floating-point register set. 8200@option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point 8201register set is not used, floating point operands are passed in integer 8202registers as if they were integers and floating-point results are passed 8203in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence, 8204so any function with a floating-point argument or return value called by code 8205compiled with @option{-mno-fp-regs} must also be compiled with that 8206option. 8207 8208A typical use of this option is building a kernel that does not use, 8209and hence need not save and restore, any floating-point registers. 8210 8211@item -mieee 8212@opindex mieee 8213The Alpha architecture implements floating-point hardware optimized for 8214maximum performance. It is mostly compliant with the IEEE floating 8215point standard. However, for full compliance, software assistance is 8216required. This option generates code fully IEEE compliant code 8217@emph{except} that the @var{inexact-flag} is not maintained (see below). 8218If this option is turned on, the preprocessor macro @code{_IEEE_FP} is 8219defined during compilation. The resulting code is less efficient but is 8220able to correctly support denormalized numbers and exceptional IEEE 8221values such as not-a-number and plus/minus infinity. Other Alpha 8222compilers call this option @option{-ieee_with_no_inexact}. 8223 8224@item -mieee-with-inexact 8225@opindex mieee-with-inexact 8226This is like @option{-mieee} except the generated code also maintains 8227the IEEE @var{inexact-flag}. Turning on this option causes the 8228generated code to implement fully-compliant IEEE math. In addition to 8229@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor 8230macro. On some Alpha implementations the resulting code may execute 8231significantly slower than the code generated by default. Since there is 8232very little code that depends on the @var{inexact-flag}, you should 8233normally not specify this option. Other Alpha compilers call this 8234option @option{-ieee_with_inexact}. 8235 8236@item -mfp-trap-mode=@var{trap-mode} 8237@opindex mfp-trap-mode 8238This option controls what floating-point related traps are enabled. 8239Other Alpha compilers call this option @option{-fptm @var{trap-mode}}. 8240The trap mode can be set to one of four values: 8241 8242@table @samp 8243@item n 8244This is the default (normal) setting. The only traps that are enabled 8245are the ones that cannot be disabled in software (e.g., division by zero 8246trap). 8247 8248@item u 8249In addition to the traps enabled by @samp{n}, underflow traps are enabled 8250as well. 8251 8252@item su 8253Like @samp{u}, but the instructions are marked to be safe for software 8254completion (see Alpha architecture manual for details). 8255 8256@item sui 8257Like @samp{su}, but inexact traps are enabled as well. 8258@end table 8259 8260@item -mfp-rounding-mode=@var{rounding-mode} 8261@opindex mfp-rounding-mode 8262Selects the IEEE rounding mode. Other Alpha compilers call this option 8263@option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one 8264of: 8265 8266@table @samp 8267@item n 8268Normal IEEE rounding mode. Floating point numbers are rounded towards 8269the nearest machine number or towards the even machine number in case 8270of a tie. 8271 8272@item m 8273Round towards minus infinity. 8274 8275@item c 8276Chopped rounding mode. Floating point numbers are rounded towards zero. 8277 8278@item d 8279Dynamic rounding mode. A field in the floating point control register 8280(@var{fpcr}, see Alpha architecture reference manual) controls the 8281rounding mode in effect. The C library initializes this register for 8282rounding towards plus infinity. Thus, unless your program modifies the 8283@var{fpcr}, @samp{d} corresponds to round towards plus infinity. 8284@end table 8285 8286@item -mtrap-precision=@var{trap-precision} 8287@opindex mtrap-precision 8288In the Alpha architecture, floating point traps are imprecise. This 8289means without software assistance it is impossible to recover from a 8290floating trap and program execution normally needs to be terminated. 8291GCC can generate code that can assist operating system trap handlers 8292in determining the exact location that caused a floating point trap. 8293Depending on the requirements of an application, different levels of 8294precisions can be selected: 8295 8296@table @samp 8297@item p 8298Program precision. This option is the default and means a trap handler 8299can only identify which program caused a floating point exception. 8300 8301@item f 8302Function precision. The trap handler can determine the function that 8303caused a floating point exception. 8304 8305@item i 8306Instruction precision. The trap handler can determine the exact 8307instruction that caused a floating point exception. 8308@end table 8309 8310Other Alpha compilers provide the equivalent options called 8311@option{-scope_safe} and @option{-resumption_safe}. 8312 8313@item -mieee-conformant 8314@opindex mieee-conformant 8315This option marks the generated code as IEEE conformant. You must not 8316use this option unless you also specify @option{-mtrap-precision=i} and either 8317@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect 8318is to emit the line @samp{.eflag 48} in the function prologue of the 8319generated assembly file. Under DEC Unix, this has the effect that 8320IEEE-conformant math library routines will be linked in. 8321 8322@item -mbuild-constants 8323@opindex mbuild-constants 8324Normally GCC examines a 32- or 64-bit integer constant to 8325see if it can construct it from smaller constants in two or three 8326instructions. If it cannot, it will output the constant as a literal and 8327generate code to load it from the data segment at runtime. 8328 8329Use this option to require GCC to construct @emph{all} integer constants 8330using code, even if it takes more instructions (the maximum is six). 8331 8332You would typically use this option to build a shared library dynamic 8333loader. Itself a shared library, it must relocate itself in memory 8334before it can find the variables and constants in its own data segment. 8335 8336@item -malpha-as 8337@itemx -mgas 8338@opindex malpha-as 8339@opindex mgas 8340Select whether to generate code to be assembled by the vendor-supplied 8341assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}. 8342 8343@item -mbwx 8344@itemx -mno-bwx 8345@itemx -mcix 8346@itemx -mno-cix 8347@itemx -mfix 8348@itemx -mno-fix 8349@itemx -mmax 8350@itemx -mno-max 8351@opindex mbwx 8352@opindex mno-bwx 8353@opindex mcix 8354@opindex mno-cix 8355@opindex mfix 8356@opindex mno-fix 8357@opindex mmax 8358@opindex mno-max 8359Indicate whether GCC should generate code to use the optional BWX, 8360CIX, FIX and MAX instruction sets. The default is to use the instruction 8361sets supported by the CPU type specified via @option{-mcpu=} option or that 8362of the CPU on which GCC was built if none was specified. 8363 8364@item -mfloat-vax 8365@itemx -mfloat-ieee 8366@opindex mfloat-vax 8367@opindex mfloat-ieee 8368Generate code that uses (does not use) VAX F and G floating point 8369arithmetic instead of IEEE single and double precision. 8370 8371@item -mexplicit-relocs 8372@itemx -mno-explicit-relocs 8373@opindex mexplicit-relocs 8374@opindex mno-explicit-relocs 8375Older Alpha assemblers provided no way to generate symbol relocations 8376except via assembler macros. Use of these macros does not allow 8377optimal instruction scheduling. GNU binutils as of version 2.12 8378supports a new syntax that allows the compiler to explicitly mark 8379which relocations should apply to which instructions. This option 8380is mostly useful for debugging, as GCC detects the capabilities of 8381the assembler when it is built and sets the default accordingly. 8382 8383@item -msmall-data 8384@itemx -mlarge-data 8385@opindex msmall-data 8386@opindex mlarge-data 8387When @option{-mexplicit-relocs} is in effect, static data is 8388accessed via @dfn{gp-relative} relocations. When @option{-msmall-data} 8389is used, objects 8 bytes long or smaller are placed in a @dfn{small data area} 8390(the @code{.sdata} and @code{.sbss} sections) and are accessed via 839116-bit relocations off of the @code{$gp} register. This limits the 8392size of the small data area to 64KB, but allows the variables to be 8393directly accessed via a single instruction. 8394 8395The default is @option{-mlarge-data}. With this option the data area 8396is limited to just below 2GB@. Programs that require more than 2GB of 8397data must use @code{malloc} or @code{mmap} to allocate the data in the 8398heap instead of in the program's data segment. 8399 8400When generating code for shared libraries, @option{-fpic} implies 8401@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}. 8402 8403@item -msmall-text 8404@itemx -mlarge-text 8405@opindex msmall-text 8406@opindex mlarge-text 8407When @option{-msmall-text} is used, the compiler assumes that the 8408code of the entire program (or shared library) fits in 4MB, and is 8409thus reachable with a branch instruction. When @option{-msmall-data} 8410is used, the compiler can assume that all local symbols share the 8411same @code{$gp} value, and thus reduce the number of instructions 8412required for a function call from 4 to 1. 8413 8414The default is @option{-mlarge-text}. 8415 8416@item -mcpu=@var{cpu_type} 8417@opindex mcpu 8418Set the instruction set and instruction scheduling parameters for 8419machine type @var{cpu_type}. You can specify either the @samp{EV} 8420style name or the corresponding chip number. GCC supports scheduling 8421parameters for the EV4, EV5 and EV6 family of processors and will 8422choose the default values for the instruction set from the processor 8423you specify. If you do not specify a processor type, GCC will default 8424to the processor on which the compiler was built. 8425 8426Supported values for @var{cpu_type} are 8427 8428@table @samp 8429@item ev4 8430@itemx ev45 8431@itemx 21064 8432Schedules as an EV4 and has no instruction set extensions. 8433 8434@item ev5 8435@itemx 21164 8436Schedules as an EV5 and has no instruction set extensions. 8437 8438@item ev56 8439@itemx 21164a 8440Schedules as an EV5 and supports the BWX extension. 8441 8442@item pca56 8443@itemx 21164pc 8444@itemx 21164PC 8445Schedules as an EV5 and supports the BWX and MAX extensions. 8446 8447@item ev6 8448@itemx 21264 8449Schedules as an EV6 and supports the BWX, FIX, and MAX extensions. 8450 8451@item ev67 8452@itemx 21264a 8453Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions. 8454@end table 8455 8456@item -mtune=@var{cpu_type} 8457@opindex mtune 8458Set only the instruction scheduling parameters for machine type 8459@var{cpu_type}. The instruction set is not changed. 8460 8461@item -mmemory-latency=@var{time} 8462@opindex mmemory-latency 8463Sets the latency the scheduler should assume for typical memory 8464references as seen by the application. This number is highly 8465dependent on the memory access patterns used by the application 8466and the size of the external cache on the machine. 8467 8468Valid options for @var{time} are 8469 8470@table @samp 8471@item @var{number} 8472A decimal number representing clock cycles. 8473 8474@item L1 8475@itemx L2 8476@itemx L3 8477@itemx main 8478The compiler contains estimates of the number of clock cycles for 8479``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches 8480(also called Dcache, Scache, and Bcache), as well as to main memory. 8481Note that L3 is only valid for EV5. 8482 8483@end table 8484@end table 8485 8486@node DEC Alpha/VMS Options 8487@subsection DEC Alpha/VMS Options 8488 8489These @samp{-m} options are defined for the DEC Alpha/VMS implementations: 8490 8491@table @gcctabopt 8492@item -mvms-return-codes 8493@opindex mvms-return-codes 8494Return VMS condition codes from main. The default is to return POSIX 8495style condition (e.g.@ error) codes. 8496@end table 8497 8498@node FRV Options 8499@subsection FRV Options 8500@cindex FRV Options 8501 8502@table @gcctabopt 8503@item -mgpr-32 8504@opindex mgpr-32 8505 8506Only use the first 32 general purpose registers. 8507 8508@item -mgpr-64 8509@opindex mgpr-64 8510 8511Use all 64 general purpose registers. 8512 8513@item -mfpr-32 8514@opindex mfpr-32 8515 8516Use only the first 32 floating point registers. 8517 8518@item -mfpr-64 8519@opindex mfpr-64 8520 8521Use all 64 floating point registers 8522 8523@item -mhard-float 8524@opindex mhard-float 8525 8526Use hardware instructions for floating point operations. 8527 8528@item -msoft-float 8529@opindex msoft-float 8530 8531Use library routines for floating point operations. 8532 8533@item -malloc-cc 8534@opindex malloc-cc 8535 8536Dynamically allocate condition code registers. 8537 8538@item -mfixed-cc 8539@opindex mfixed-cc 8540 8541Do not try to dynamically allocate condition code registers, only 8542use @code{icc0} and @code{fcc0}. 8543 8544@item -mdword 8545@opindex mdword 8546 8547Change ABI to use double word insns. 8548 8549@item -mno-dword 8550@opindex mno-dword 8551 8552Do not use double word instructions. 8553 8554@item -mdouble 8555@opindex mdouble 8556 8557Use floating point double instructions. 8558 8559@item -mno-double 8560@opindex mno-double 8561 8562Do not use floating point double instructions. 8563 8564@item -mmedia 8565@opindex mmedia 8566 8567Use media instructions. 8568 8569@item -mno-media 8570@opindex mno-media 8571 8572Do not use media instructions. 8573 8574@item -mmuladd 8575@opindex mmuladd 8576 8577Use multiply and add/subtract instructions. 8578 8579@item -mno-muladd 8580@opindex mno-muladd 8581 8582Do not use multiply and add/subtract instructions. 8583 8584@item -mfdpic 8585@opindex mfdpic 8586 8587Select the FDPIC ABI, that uses function descriptors to represent 8588pointers to functions. Without any PIC/PIE-related options, it 8589implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it 8590assumes GOT entries and small data are within a 12-bit range from the 8591GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets 8592are computed with 32 bits. 8593 8594@item -minline-plt 8595@opindex minline-plt 8596 8597Enable inlining of PLT entries in function calls to functions that are 8598not known to bind locally. It has no effect without @option{-mfdpic}. 8599It's enabled by default if optimizing for speed and compiling for 8600shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an 8601optimization option such as @option{-O3} or above is present in the 8602command line. 8603 8604@item -mTLS 8605@opindex TLS 8606 8607Assume a large TLS segment when generating thread-local code. 8608 8609@item -mtls 8610@opindex tls 8611 8612Do not assume a large TLS segment when generating thread-local code. 8613 8614@item -mgprel-ro 8615@opindex mgprel-ro 8616 8617Enable the use of @code{GPREL} relocations in the FDPIC ABI for data 8618that is known to be in read-only sections. It's enabled by default, 8619except for @option{-fpic} or @option{-fpie}: even though it may help 8620make the global offset table smaller, it trades 1 instruction for 4. 8621With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4, 8622one of which may be shared by multiple symbols, and it avoids the need 8623for a GOT entry for the referenced symbol, so it's more likely to be a 8624win. If it is not, @option{-mno-gprel-ro} can be used to disable it. 8625 8626@item -multilib-library-pic 8627@opindex multilib-library-pic 8628 8629Link with the (library, not FD) pic libraries. It's implied by 8630@option{-mlibrary-pic}, as well as by @option{-fPIC} and 8631@option{-fpic} without @option{-mfdpic}. You should never have to use 8632it explicitly. 8633 8634@item -mlinked-fp 8635@opindex mlinked-fp 8636 8637Follow the EABI requirement of always creating a frame pointer whenever 8638a stack frame is allocated. This option is enabled by default and can 8639be disabled with @option{-mno-linked-fp}. 8640 8641@item -mlong-calls 8642@opindex mlong-calls 8643 8644Use indirect addressing to call functions outside the current 8645compilation unit. This allows the functions to be placed anywhere 8646within the 32-bit address space. 8647 8648@item -malign-labels 8649@opindex malign-labels 8650 8651Try to align labels to an 8-byte boundary by inserting nops into the 8652previous packet. This option only has an effect when VLIW packing 8653is enabled. It doesn't create new packets; it merely adds nops to 8654existing ones. 8655 8656@item -mlibrary-pic 8657@opindex mlibrary-pic 8658 8659Generate position-independent EABI code. 8660 8661@item -macc-4 8662@opindex macc-4 8663 8664Use only the first four media accumulator registers. 8665 8666@item -macc-8 8667@opindex macc-8 8668 8669Use all eight media accumulator registers. 8670 8671@item -mpack 8672@opindex mpack 8673 8674Pack VLIW instructions. 8675 8676@item -mno-pack 8677@opindex mno-pack 8678 8679Do not pack VLIW instructions. 8680 8681@item -mno-eflags 8682@opindex mno-eflags 8683 8684Do not mark ABI switches in e_flags. 8685 8686@item -mcond-move 8687@opindex mcond-move 8688 8689Enable the use of conditional-move instructions (default). 8690 8691This switch is mainly for debugging the compiler and will likely be removed 8692in a future version. 8693 8694@item -mno-cond-move 8695@opindex mno-cond-move 8696 8697Disable the use of conditional-move instructions. 8698 8699This switch is mainly for debugging the compiler and will likely be removed 8700in a future version. 8701 8702@item -mscc 8703@opindex mscc 8704 8705Enable the use of conditional set instructions (default). 8706 8707This switch is mainly for debugging the compiler and will likely be removed 8708in a future version. 8709 8710@item -mno-scc 8711@opindex mno-scc 8712 8713Disable the use of conditional set instructions. 8714 8715This switch is mainly for debugging the compiler and will likely be removed 8716in a future version. 8717 8718@item -mcond-exec 8719@opindex mcond-exec 8720 8721Enable the use of conditional execution (default). 8722 8723This switch is mainly for debugging the compiler and will likely be removed 8724in a future version. 8725 8726@item -mno-cond-exec 8727@opindex mno-cond-exec 8728 8729Disable the use of conditional execution. 8730 8731This switch is mainly for debugging the compiler and will likely be removed 8732in a future version. 8733 8734@item -mvliw-branch 8735@opindex mvliw-branch 8736 8737Run a pass to pack branches into VLIW instructions (default). 8738 8739This switch is mainly for debugging the compiler and will likely be removed 8740in a future version. 8741 8742@item -mno-vliw-branch 8743@opindex mno-vliw-branch 8744 8745Do not run a pass to pack branches into VLIW instructions. 8746 8747This switch is mainly for debugging the compiler and will likely be removed 8748in a future version. 8749 8750@item -mmulti-cond-exec 8751@opindex mmulti-cond-exec 8752 8753Enable optimization of @code{&&} and @code{||} in conditional execution 8754(default). 8755 8756This switch is mainly for debugging the compiler and will likely be removed 8757in a future version. 8758 8759@item -mno-multi-cond-exec 8760@opindex mno-multi-cond-exec 8761 8762Disable optimization of @code{&&} and @code{||} in conditional execution. 8763 8764This switch is mainly for debugging the compiler and will likely be removed 8765in a future version. 8766 8767@item -mnested-cond-exec 8768@opindex mnested-cond-exec 8769 8770Enable nested conditional execution optimizations (default). 8771 8772This switch is mainly for debugging the compiler and will likely be removed 8773in a future version. 8774 8775@item -mno-nested-cond-exec 8776@opindex mno-nested-cond-exec 8777 8778Disable nested conditional execution optimizations. 8779 8780This switch is mainly for debugging the compiler and will likely be removed 8781in a future version. 8782 8783@item -moptimize-membar 8784@opindex moptimize-membar 8785 8786This switch removes redundant @code{membar} instructions from the 8787compiler generated code. It is enabled by default. 8788 8789@item -mno-optimize-membar 8790@opindex mno-optimize-membar 8791 8792This switch disables the automatic removal of redundant @code{membar} 8793instructions from the generated code. 8794 8795@item -mtomcat-stats 8796@opindex mtomcat-stats 8797 8798Cause gas to print out tomcat statistics. 8799 8800@item -mcpu=@var{cpu} 8801@opindex mcpu 8802 8803Select the processor type for which to generate code. Possible values are 8804@samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450}, 8805@samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}. 8806 8807@end table 8808 8809@node GNU/Linux Options 8810@subsection GNU/Linux Options 8811 8812These @samp{-m} options are defined for GNU/Linux targets: 8813 8814@table @gcctabopt 8815@item -mglibc 8816@opindex mglibc 8817Use the GNU C library instead of uClibc. This is the default except 8818on @samp{*-*-linux-*uclibc*} targets. 8819 8820@item -muclibc 8821@opindex muclibc 8822Use uClibc instead of the GNU C library. This is the default on 8823@samp{*-*-linux-*uclibc*} targets. 8824@end table 8825 8826@node H8/300 Options 8827@subsection H8/300 Options 8828 8829These @samp{-m} options are defined for the H8/300 implementations: 8830 8831@table @gcctabopt 8832@item -mrelax 8833@opindex mrelax 8834Shorten some address references at link time, when possible; uses the 8835linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300, 8836ld, Using ld}, for a fuller description. 8837 8838@item -mh 8839@opindex mh 8840Generate code for the H8/300H@. 8841 8842@item -ms 8843@opindex ms 8844Generate code for the H8S@. 8845 8846@item -mn 8847@opindex mn 8848Generate code for the H8S and H8/300H in the normal mode. This switch 8849must be used either with @option{-mh} or @option{-ms}. 8850 8851@item -ms2600 8852@opindex ms2600 8853Generate code for the H8S/2600. This switch must be used with @option{-ms}. 8854 8855@item -mint32 8856@opindex mint32 8857Make @code{int} data 32 bits by default. 8858 8859@item -malign-300 8860@opindex malign-300 8861On the H8/300H and H8S, use the same alignment rules as for the H8/300. 8862The default for the H8/300H and H8S is to align longs and floats on 4 8863byte boundaries. 8864@option{-malign-300} causes them to be aligned on 2 byte boundaries. 8865This option has no effect on the H8/300. 8866@end table 8867 8868@node HPPA Options 8869@subsection HPPA Options 8870@cindex HPPA Options 8871 8872These @samp{-m} options are defined for the HPPA family of computers: 8873 8874@table @gcctabopt 8875@item -march=@var{architecture-type} 8876@opindex march 8877Generate code for the specified architecture. The choices for 8878@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA 88791.1, and @samp{2.0} for PA 2.0 processors. Refer to 8880@file{/usr/lib/sched.models} on an HP-UX system to determine the proper 8881architecture option for your machine. Code compiled for lower numbered 8882architectures will run on higher numbered architectures, but not the 8883other way around. 8884 8885@item -mpa-risc-1-0 8886@itemx -mpa-risc-1-1 8887@itemx -mpa-risc-2-0 8888@opindex mpa-risc-1-0 8889@opindex mpa-risc-1-1 8890@opindex mpa-risc-2-0 8891Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively. 8892 8893@item -mbig-switch 8894@opindex mbig-switch 8895Generate code suitable for big switch tables. Use this option only if 8896the assembler/linker complain about out of range branches within a switch 8897table. 8898 8899@item -mjump-in-delay 8900@opindex mjump-in-delay 8901Fill delay slots of function calls with unconditional jump instructions 8902by modifying the return pointer for the function call to be the target 8903of the conditional jump. 8904 8905@item -mdisable-fpregs 8906@opindex mdisable-fpregs 8907Prevent floating point registers from being used in any manner. This is 8908necessary for compiling kernels which perform lazy context switching of 8909floating point registers. If you use this option and attempt to perform 8910floating point operations, the compiler will abort. 8911 8912@item -mdisable-indexing 8913@opindex mdisable-indexing 8914Prevent the compiler from using indexing address modes. This avoids some 8915rather obscure problems when compiling MIG generated code under MACH@. 8916 8917@item -mno-space-regs 8918@opindex mno-space-regs 8919Generate code that assumes the target has no space registers. This allows 8920GCC to generate faster indirect calls and use unscaled index address modes. 8921 8922Such code is suitable for level 0 PA systems and kernels. 8923 8924@item -mfast-indirect-calls 8925@opindex mfast-indirect-calls 8926Generate code that assumes calls never cross space boundaries. This 8927allows GCC to emit code which performs faster indirect calls. 8928 8929This option will not work in the presence of shared libraries or nested 8930functions. 8931 8932@item -mfixed-range=@var{register-range} 8933@opindex mfixed-range 8934Generate code treating the given register range as fixed registers. 8935A fixed register is one that the register allocator can not use. This is 8936useful when compiling kernel code. A register range is specified as 8937two registers separated by a dash. Multiple register ranges can be 8938specified separated by a comma. 8939 8940@item -mlong-load-store 8941@opindex mlong-load-store 8942Generate 3-instruction load and store sequences as sometimes required by 8943the HP-UX 10 linker. This is equivalent to the @samp{+k} option to 8944the HP compilers. 8945 8946@item -mportable-runtime 8947@opindex mportable-runtime 8948Use the portable calling conventions proposed by HP for ELF systems. 8949 8950@item -mgas 8951@opindex mgas 8952Enable the use of assembler directives only GAS understands. 8953 8954@item -mschedule=@var{cpu-type} 8955@opindex mschedule 8956Schedule code according to the constraints for the machine type 8957@var{cpu-type}. The choices for @var{cpu-type} are @samp{700} 8958@samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer 8959to @file{/usr/lib/sched.models} on an HP-UX system to determine the 8960proper scheduling option for your machine. The default scheduling is 8961@samp{8000}. 8962 8963@item -mlinker-opt 8964@opindex mlinker-opt 8965Enable the optimization pass in the HP-UX linker. Note this makes symbolic 8966debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9 8967linkers in which they give bogus error messages when linking some programs. 8968 8969@item -msoft-float 8970@opindex msoft-float 8971Generate output containing library calls for floating point. 8972@strong{Warning:} the requisite libraries are not available for all HPPA 8973targets. Normally the facilities of the machine's usual C compiler are 8974used, but this cannot be done directly in cross-compilation. You must make 8975your own arrangements to provide suitable library functions for 8976cross-compilation. The embedded target @samp{hppa1.1-*-pro} 8977does provide software floating point support. 8978 8979@option{-msoft-float} changes the calling convention in the output file; 8980therefore, it is only useful if you compile @emph{all} of a program with 8981this option. In particular, you need to compile @file{libgcc.a}, the 8982library that comes with GCC, with @option{-msoft-float} in order for 8983this to work. 8984 8985@item -msio 8986@opindex msio 8987Generate the predefine, @code{_SIO}, for server IO@. The default is 8988@option{-mwsio}. This generates the predefines, @code{__hp9000s700}, 8989@code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These 8990options are available under HP-UX and HI-UX@. 8991 8992@item -mgnu-ld 8993@opindex gnu-ld 8994Use GNU ld specific options. This passes @option{-shared} to ld when 8995building a shared library. It is the default when GCC is configured, 8996explicitly or implicitly, with the GNU linker. This option does not 8997have any affect on which ld is called, it only changes what parameters 8998are passed to that ld. The ld that is called is determined by the 8999@option{--with-ld} configure option, GCC's program search path, and 9000finally by the user's @env{PATH}. The linker used by GCC can be printed 9001using @samp{which `gcc -print-prog-name=ld`}. This option is only available 9002on the 64 bit HP-UX GCC, i.e. configured with @samp{hppa*64*-*-hpux*}. 9003 9004@item -mhp-ld 9005@opindex hp-ld 9006Use HP ld specific options. This passes @option{-b} to ld when building 9007a shared library and passes @option{+Accept TypeMismatch} to ld on all 9008links. It is the default when GCC is configured, explicitly or 9009implicitly, with the HP linker. This option does not have any affect on 9010which ld is called, it only changes what parameters are passed to that 9011ld. The ld that is called is determined by the @option{--with-ld} 9012configure option, GCC's program search path, and finally by the user's 9013@env{PATH}. The linker used by GCC can be printed using @samp{which 9014`gcc -print-prog-name=ld`}. This option is only available on the 64 bit 9015HP-UX GCC, i.e. configured with @samp{hppa*64*-*-hpux*}. 9016 9017@item -mlong-calls 9018@opindex mno-long-calls 9019Generate code that uses long call sequences. This ensures that a call 9020is always able to reach linker generated stubs. The default is to generate 9021long calls only when the distance from the call site to the beginning 9022of the function or translation unit, as the case may be, exceeds a 9023predefined limit set by the branch type being used. The limits for 9024normal calls are 7,600,000 and 240,000 bytes, respectively for the 9025PA 2.0 and PA 1.X architectures. Sibcalls are always limited at 9026240,000 bytes. 9027 9028Distances are measured from the beginning of functions when using the 9029@option{-ffunction-sections} option, or when using the @option{-mgas} 9030and @option{-mno-portable-runtime} options together under HP-UX with 9031the SOM linker. 9032 9033It is normally not desirable to use this option as it will degrade 9034performance. However, it may be useful in large applications, 9035particularly when partial linking is used to build the application. 9036 9037The types of long calls used depends on the capabilities of the 9038assembler and linker, and the type of code being generated. The 9039impact on systems that support long absolute calls, and long pic 9040symbol-difference or pc-relative calls should be relatively small. 9041However, an indirect call is used on 32-bit ELF systems in pic code 9042and it is quite long. 9043 9044@item -munix=@var{unix-std} 9045@opindex march 9046Generate compiler predefines and select a startfile for the specified 9047UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95} 9048and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95} 9049is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX 905011.11 and later. The default values are @samp{93} for HP-UX 10.00, 9051@samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11 9052and later. 9053 9054@option{-munix=93} provides the same predefines as GCC 3.3 and 3.4. 9055@option{-munix=95} provides additional predefines for @code{XOPEN_UNIX} 9056and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}. 9057@option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX}, 9058@code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and 9059@code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}. 9060 9061It is @emph{important} to note that this option changes the interfaces 9062for various library routines. It also affects the operational behavior 9063of the C library. Thus, @emph{extreme} care is needed in using this 9064option. 9065 9066Library code that is intended to operate with more than one UNIX 9067standard must test, set and restore the variable @var{__xpg4_extended_mask} 9068as appropriate. Most GNU software doesn't provide this capability. 9069 9070@item -nolibdld 9071@opindex nolibdld 9072Suppress the generation of link options to search libdld.sl when the 9073@option{-static} option is specified on HP-UX 10 and later. 9074 9075@item -static 9076@opindex static 9077The HP-UX implementation of setlocale in libc has a dependency on 9078libdld.sl. There isn't an archive version of libdld.sl. Thus, 9079when the @option{-static} option is specified, special link options 9080are needed to resolve this dependency. 9081 9082On HP-UX 10 and later, the GCC driver adds the necessary options to 9083link with libdld.sl when the @option{-static} option is specified. 9084This causes the resulting binary to be dynamic. On the 64-bit port, 9085the linkers generate dynamic binaries by default in any case. The 9086@option{-nolibdld} option can be used to prevent the GCC driver from 9087adding these link options. 9088 9089@item -threads 9090@opindex threads 9091Add support for multithreading with the @dfn{dce thread} library 9092under HP-UX@. This option sets flags for both the preprocessor and 9093linker. 9094@end table 9095 9096@node i386 and x86-64 Options 9097@subsection Intel 386 and AMD x86-64 Options 9098@cindex i386 Options 9099@cindex x86-64 Options 9100@cindex Intel 386 Options 9101@cindex AMD x86-64 Options 9102 9103These @samp{-m} options are defined for the i386 and x86-64 family of 9104computers: 9105 9106@table @gcctabopt 9107@item -mtune=@var{cpu-type} 9108@opindex mtune 9109Tune to @var{cpu-type} everything applicable about the generated code, except 9110for the ABI and the set of available instructions. The choices for 9111@var{cpu-type} are: 9112@table @emph 9113@item generic 9114Produce code optimized for the most common IA32/AMD64/EM64T processors. 9115If you know the CPU on which your code will run, then you should use 9116the corresponding @option{-mtune} option instead of 9117@option{-mtune=generic}. But, if you do not know exactly what CPU users 9118of your application will have, then you should use this option. 9119 9120As new processors are deployed in the marketplace, the behavior of this 9121option will change. Therefore, if you upgrade to a newer version of 9122GCC, the code generated option will change to reflect the processors 9123that were most common when that version of GCC was released. 9124 9125There is no @option{-march=generic} option because @option{-march} 9126indicates the instruction set the compiler can use, and there is no 9127generic instruction set applicable to all processors. In contrast, 9128@option{-mtune} indicates the processor (or, in this case, collection of 9129processors) for which the code is optimized. 9130@item native 9131This selects the CPU to tune for at compilation time by determining 9132the processor type of the compiling machine. Using @option{-mtune=native} 9133will produce code optimized for the local machine under the constraints 9134of the selected instruction set. Using @option{-march=native} will 9135enable all instruction subsets supported by the local machine (hence 9136the result might not run on different machines). 9137@item i386 9138Original Intel's i386 CPU@. 9139@item i486 9140Intel's i486 CPU@. (No scheduling is implemented for this chip.) 9141@item i586, pentium 9142Intel Pentium CPU with no MMX support. 9143@item pentium-mmx 9144Intel PentiumMMX CPU based on Pentium core with MMX instruction set support. 9145@item pentiumpro 9146Intel PentiumPro CPU@. 9147@item i686 9148Same as @code{generic}, but when used as @code{march} option, PentiumPro 9149instruction set will be used, so the code will run on all i686 family chips. 9150@item pentium2 9151Intel Pentium2 CPU based on PentiumPro core with MMX instruction set support. 9152@item pentium3, pentium3m 9153Intel Pentium3 CPU based on PentiumPro core with MMX and SSE instruction set 9154support. 9155@item pentium-m 9156Low power version of Intel Pentium3 CPU with MMX, SSE and SSE2 instruction set 9157support. Used by Centrino notebooks. 9158@item pentium4, pentium4m 9159Intel Pentium4 CPU with MMX, SSE and SSE2 instruction set support. 9160@item prescott 9161Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction 9162set support. 9163@item nocona 9164Improved version of Intel Pentium4 CPU with 64-bit extensions, MMX, SSE, 9165SSE2 and SSE3 instruction set support. 9166@item core2 9167Intel Core2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3 9168instruction set support. 9169@item k6 9170AMD K6 CPU with MMX instruction set support. 9171@item k6-2, k6-3 9172Improved versions of AMD K6 CPU with MMX and 3dNOW! instruction set support. 9173@item athlon, athlon-tbird 9174AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and SSE prefetch instructions 9175support. 9176@item athlon-4, athlon-xp, athlon-mp 9177Improved AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and full SSE 9178instruction set support. 9179@item k8, opteron, athlon64, athlon-fx 9180AMD K8 core based CPUs with x86-64 instruction set support. (This supersets 9181MMX, SSE, SSE2, 3dNOW!, enhanced 3dNOW! and 64-bit instruction set extensions.) 9182@item k8-sse3, opteron-sse3, athlon64-sse3 9183Improved versions of k8, opteron and athlon64 with SSE3 instruction set support. 9184@item amdfam10, barcelona 9185AMD Family 10h core based CPUs with x86-64 instruction set support. (This 9186supersets MMX, SSE, SSE2, SSE3, SSE4A, 3dNOW!, enhanced 3dNOW!, ABM and 64-bit 9187instruction set extensions.) 9188@item winchip-c6 9189IDT Winchip C6 CPU, dealt in same way as i486 with additional MMX instruction 9190set support. 9191@item winchip2 9192IDT Winchip2 CPU, dealt in same way as i486 with additional MMX and 3dNOW! 9193instruction set support. 9194@item c3 9195Via C3 CPU with MMX and 3dNOW! instruction set support. (No scheduling is 9196implemented for this chip.) 9197@item c3-2 9198Via C3-2 CPU with MMX and SSE instruction set support. (No scheduling is 9199implemented for this chip.) 9200@item geode 9201Embedded AMD CPU with MMX and 3dNOW! instruction set support. 9202@end table 9203 9204While picking a specific @var{cpu-type} will schedule things appropriately 9205for that particular chip, the compiler will not generate any code that 9206does not run on the i386 without the @option{-march=@var{cpu-type}} option 9207being used. 9208 9209@item -march=@var{cpu-type} 9210@opindex march 9211Generate instructions for the machine type @var{cpu-type}. The choices 9212for @var{cpu-type} are the same as for @option{-mtune}. Moreover, 9213specifying @option{-march=@var{cpu-type}} implies @option{-mtune=@var{cpu-type}}. 9214 9215@item -mcpu=@var{cpu-type} 9216@opindex mcpu 9217A deprecated synonym for @option{-mtune}. 9218 9219@item -m386 9220@itemx -m486 9221@itemx -mpentium 9222@itemx -mpentiumpro 9223@opindex m386 9224@opindex m486 9225@opindex mpentium 9226@opindex mpentiumpro 9227These options are synonyms for @option{-mtune=i386}, @option{-mtune=i486}, 9228@option{-mtune=pentium}, and @option{-mtune=pentiumpro} respectively. 9229These synonyms are deprecated. 9230 9231@item -mfpmath=@var{unit} 9232@opindex march 9233Generate floating point arithmetics for selected unit @var{unit}. The choices 9234for @var{unit} are: 9235 9236@table @samp 9237@item 387 9238Use the standard 387 floating point coprocessor present majority of chips and 9239emulated otherwise. Code compiled with this option will run almost everywhere. 9240The temporary results are computed in 80bit precision instead of precision 9241specified by the type resulting in slightly different results compared to most 9242of other chips. See @option{-ffloat-store} for more detailed description. 9243 9244This is the default choice for i386 compiler. 9245 9246@item sse 9247Use scalar floating point instructions present in the SSE instruction set. 9248This instruction set is supported by Pentium3 and newer chips, in the AMD line 9249by Athlon-4, Athlon-xp and Athlon-mp chips. The earlier version of SSE 9250instruction set supports only single precision arithmetics, thus the double and 9251extended precision arithmetics is still done using 387. Later version, present 9252only in Pentium4 and the future AMD x86-64 chips supports double precision 9253arithmetics too. 9254 9255For the i386 compiler, you need to use @option{-march=@var{cpu-type}}, @option{-msse} 9256or @option{-msse2} switches to enable SSE extensions and make this option 9257effective. For the x86-64 compiler, these extensions are enabled by default. 9258 9259The resulting code should be considerably faster in the majority of cases and avoid 9260the numerical instability problems of 387 code, but may break some existing 9261code that expects temporaries to be 80bit. 9262 9263This is the default choice for the x86-64 compiler. 9264 9265@item sse,387 9266Attempt to utilize both instruction sets at once. This effectively double the 9267amount of available registers and on chips with separate execution units for 9268387 and SSE the execution resources too. Use this option with care, as it is 9269still experimental, because the GCC register allocator does not model separate 9270functional units well resulting in instable performance. 9271@end table 9272 9273@item -masm=@var{dialect} 9274@opindex masm=@var{dialect} 9275Output asm instructions using selected @var{dialect}. Supported 9276choices are @samp{intel} or @samp{att} (the default one). Darwin does 9277not support @samp{intel}. 9278 9279@item -mieee-fp 9280@itemx -mno-ieee-fp 9281@opindex mieee-fp 9282@opindex mno-ieee-fp 9283Control whether or not the compiler uses IEEE floating point 9284comparisons. These handle correctly the case where the result of a 9285comparison is unordered. 9286 9287@item -msoft-float 9288@opindex msoft-float 9289Generate output containing library calls for floating point. 9290@strong{Warning:} the requisite libraries are not part of GCC@. 9291Normally the facilities of the machine's usual C compiler are used, but 9292this can't be done directly in cross-compilation. You must make your 9293own arrangements to provide suitable library functions for 9294cross-compilation. 9295 9296On machines where a function returns floating point results in the 80387 9297register stack, some floating point opcodes may be emitted even if 9298@option{-msoft-float} is used. 9299 9300@item -mno-fp-ret-in-387 9301@opindex mno-fp-ret-in-387 9302Do not use the FPU registers for return values of functions. 9303 9304The usual calling convention has functions return values of types 9305@code{float} and @code{double} in an FPU register, even if there 9306is no FPU@. The idea is that the operating system should emulate 9307an FPU@. 9308 9309The option @option{-mno-fp-ret-in-387} causes such values to be returned 9310in ordinary CPU registers instead. 9311 9312@item -mno-fancy-math-387 9313@opindex mno-fancy-math-387 9314Some 387 emulators do not support the @code{sin}, @code{cos} and 9315@code{sqrt} instructions for the 387. Specify this option to avoid 9316generating those instructions. This option is the default on 9317OpenBSD and NetBSD@. This option is overridden when @option{-march} 9318indicates that the target cpu will always have an FPU and so the 9319instruction will not need emulation. As of revision 2.6.1, these 9320instructions are not generated unless you also use the 9321@option{-funsafe-math-optimizations} switch. 9322 9323@item -malign-double 9324@itemx -mno-align-double 9325@opindex malign-double 9326@opindex mno-align-double 9327Control whether GCC aligns @code{double}, @code{long double}, and 9328@code{long long} variables on a two word boundary or a one word 9329boundary. Aligning @code{double} variables on a two word boundary will 9330produce code that runs somewhat faster on a @samp{Pentium} at the 9331expense of more memory. 9332 9333On x86-64, @option{-malign-double} is enabled by default. 9334 9335@strong{Warning:} if you use the @option{-malign-double} switch, 9336structures containing the above types will be aligned differently than 9337the published application binary interface specifications for the 386 9338and will not be binary compatible with structures in code compiled 9339without that switch. 9340 9341@item -m96bit-long-double 9342@itemx -m128bit-long-double 9343@opindex m96bit-long-double 9344@opindex m128bit-long-double 9345These switches control the size of @code{long double} type. The i386 9346application binary interface specifies the size to be 96 bits, 9347so @option{-m96bit-long-double} is the default in 32 bit mode. 9348 9349Modern architectures (Pentium and newer) would prefer @code{long double} 9350to be aligned to an 8 or 16 byte boundary. In arrays or structures 9351conforming to the ABI, this would not be possible. So specifying a 9352@option{-m128bit-long-double} will align @code{long double} 9353to a 16 byte boundary by padding the @code{long double} with an additional 935432 bit zero. 9355 9356In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as 9357its ABI specifies that @code{long double} is to be aligned on 16 byte boundary. 9358 9359Notice that neither of these options enable any extra precision over the x87 9360standard of 80 bits for a @code{long double}. 9361 9362@strong{Warning:} if you override the default value for your target ABI, the 9363structures and arrays containing @code{long double} variables will change 9364their size as well as function calling convention for function taking 9365@code{long double} will be modified. Hence they will not be binary 9366compatible with arrays or structures in code compiled without that switch. 9367 9368@item -mmlarge-data-threshold=@var{number} 9369@opindex mlarge-data-threshold=@var{number} 9370When @option{-mcmodel=medium} is specified, the data greater than 9371@var{threshold} are placed in large data section. This value must be the 9372same across all object linked into the binary and defaults to 65535. 9373 9374@item -msvr3-shlib 9375@itemx -mno-svr3-shlib 9376@opindex msvr3-shlib 9377@opindex mno-svr3-shlib 9378Control whether GCC places uninitialized local variables into the 9379@code{bss} or @code{data} segments. @option{-msvr3-shlib} places them 9380into @code{bss}. These options are meaningful only on System V Release 3. 9381 9382@item -mrtd 9383@opindex mrtd 9384Use a different function-calling convention, in which functions that 9385take a fixed number of arguments return with the @code{ret} @var{num} 9386instruction, which pops their arguments while returning. This saves one 9387instruction in the caller since there is no need to pop the arguments 9388there. 9389 9390You can specify that an individual function is called with this calling 9391sequence with the function attribute @samp{stdcall}. You can also 9392override the @option{-mrtd} option by using the function attribute 9393@samp{cdecl}. @xref{Function Attributes}. 9394 9395@strong{Warning:} this calling convention is incompatible with the one 9396normally used on Unix, so you cannot use it if you need to call 9397libraries compiled with the Unix compiler. 9398 9399Also, you must provide function prototypes for all functions that 9400take variable numbers of arguments (including @code{printf}); 9401otherwise incorrect code will be generated for calls to those 9402functions. 9403 9404In addition, seriously incorrect code will result if you call a 9405function with too many arguments. (Normally, extra arguments are 9406harmlessly ignored.) 9407 9408@item -mregparm=@var{num} 9409@opindex mregparm 9410Control how many registers are used to pass integer arguments. By 9411default, no registers are used to pass arguments, and at most 3 9412registers can be used. You can control this behavior for a specific 9413function by using the function attribute @samp{regparm}. 9414@xref{Function Attributes}. 9415 9416@strong{Warning:} if you use this switch, and 9417@var{num} is nonzero, then you must build all modules with the same 9418value, including any libraries. This includes the system libraries and 9419startup modules. 9420 9421@item -msseregparm 9422@opindex msseregparm 9423Use SSE register passing conventions for float and double arguments 9424and return values. You can control this behavior for a specific 9425function by using the function attribute @samp{sseregparm}. 9426@xref{Function Attributes}. 9427 9428@strong{Warning:} if you use this switch then you must build all 9429modules with the same value, including any libraries. This includes 9430the system libraries and startup modules. 9431 9432@item -mstackrealign 9433@opindex mstackrealign 9434Realign the stack at entry. On the Intel x86, the 9435@option{-mstackrealign} option will generate an alternate prologue and 9436epilogue that realigns the runtime stack. This supports mixing legacy 9437codes that keep a 4-byte aligned stack with modern codes that keep a 943816-byte stack for SSE compatibility. The alternate prologue and 9439epilogue are slower and bigger than the regular ones, and the 9440alternate prologue requires an extra scratch register; this lowers the 9441number of registers available if used in conjunction with the 9442@code{regparm} attribute. The @option{-mstackrealign} option is 9443incompatible with the nested function prologue; this is considered a 9444hard error. See also the attribute @code{force_align_arg_pointer}, 9445applicable to individual functions. 9446 9447@item -mpreferred-stack-boundary=@var{num} 9448@opindex mpreferred-stack-boundary 9449Attempt to keep the stack boundary aligned to a 2 raised to @var{num} 9450byte boundary. If @option{-mpreferred-stack-boundary} is not specified, 9451the default is 4 (16 bytes or 128 bits). 9452 9453On Pentium and PentiumPro, @code{double} and @code{long double} values 9454should be aligned to an 8 byte boundary (see @option{-malign-double}) or 9455suffer significant run time performance penalties. On Pentium III, the 9456Streaming SIMD Extension (SSE) data type @code{__m128} may not work 9457properly if it is not 16 byte aligned. 9458 9459To ensure proper alignment of this values on the stack, the stack boundary 9460must be as aligned as that required by any value stored on the stack. 9461Further, every function must be generated such that it keeps the stack 9462aligned. Thus calling a function compiled with a higher preferred 9463stack boundary from a function compiled with a lower preferred stack 9464boundary will most likely misalign the stack. It is recommended that 9465libraries that use callbacks always use the default setting. 9466 9467This extra alignment does consume extra stack space, and generally 9468increases code size. Code that is sensitive to stack space usage, such 9469as embedded systems and operating system kernels, may want to reduce the 9470preferred alignment to @option{-mpreferred-stack-boundary=2}. 9471 9472@item -mmmx 9473@itemx -mno-mmx 9474@item -msse 9475@itemx -mno-sse 9476@item -msse2 9477@itemx -mno-sse2 9478@item -msse3 9479@itemx -mno-sse3 9480@item -mssse3 9481@itemx -mno-ssse3 9482@item -msse4a 9483@item -mno-sse4a 9484@item -m3dnow 9485@itemx -mno-3dnow 9486@item -mpopcnt 9487@itemx -mno-popcnt 9488@item -mabm 9489@itemx -mno-abm 9490@item -maes 9491@itemx -mno-aes 9492@opindex mmmx 9493@opindex mno-mmx 9494@opindex msse 9495@opindex mno-sse 9496@opindex m3dnow 9497@opindex mno-3dnow 9498These switches enable or disable the use of instructions in the MMX, 9499SSE, SSE2, SSE3, SSSE3, SSE4A, ABM, AES or 3DNow! extended 9500instruction sets. These extensions are also available as built-in 9501functions: see @ref{X86 Built-in Functions}, for details of the functions 9502enabled and disabled by these switches. 9503 9504To have SSE/SSE2 instructions generated automatically from floating-point 9505code (as opposed to 387 instructions), see @option{-mfpmath=sse}. 9506 9507These options will enable GCC to use these extended instructions in 9508generated code, even without @option{-mfpmath=sse}. Applications which 9509perform runtime CPU detection must compile separate files for each 9510supported architecture, using the appropriate flags. In particular, 9511the file containing the CPU detection code should be compiled without 9512these options. 9513 9514@item -mpush-args 9515@itemx -mno-push-args 9516@opindex mpush-args 9517@opindex mno-push-args 9518Use PUSH operations to store outgoing parameters. This method is shorter 9519and usually equally fast as method using SUB/MOV operations and is enabled 9520by default. In some cases disabling it may improve performance because of 9521improved scheduling and reduced dependencies. 9522 9523@item -maccumulate-outgoing-args 9524@opindex maccumulate-outgoing-args 9525If enabled, the maximum amount of space required for outgoing arguments will be 9526computed in the function prologue. This is faster on most modern CPUs 9527because of reduced dependencies, improved scheduling and reduced stack usage 9528when preferred stack boundary is not equal to 2. The drawback is a notable 9529increase in code size. This switch implies @option{-mno-push-args}. 9530 9531@item -mthreads 9532@opindex mthreads 9533Support thread-safe exception handling on @samp{Mingw32}. Code that relies 9534on thread-safe exception handling must compile and link all code with the 9535@option{-mthreads} option. When compiling, @option{-mthreads} defines 9536@option{-D_MT}; when linking, it links in a special thread helper library 9537@option{-lmingwthrd} which cleans up per thread exception handling data. 9538 9539@item -mno-align-stringops 9540@opindex mno-align-stringops 9541Do not align destination of inlined string operations. This switch reduces 9542code size and improves performance in case the destination is already aligned, 9543but GCC doesn't know about it. 9544 9545@item -minline-all-stringops 9546@opindex minline-all-stringops 9547By default GCC inlines string operations only when destination is known to be 9548aligned at least to 4 byte boundary. This enables more inlining, increase code 9549size, but may improve performance of code that depends on fast memcpy, strlen 9550and memset for short lengths. 9551 9552@item -momit-leaf-frame-pointer 9553@opindex momit-leaf-frame-pointer 9554Don't keep the frame pointer in a register for leaf functions. This 9555avoids the instructions to save, set up and restore frame pointers and 9556makes an extra register available in leaf functions. The option 9557@option{-fomit-frame-pointer} removes the frame pointer for all functions 9558which might make debugging harder. 9559 9560@item -mtls-direct-seg-refs 9561@itemx -mno-tls-direct-seg-refs 9562@opindex mtls-direct-seg-refs 9563Controls whether TLS variables may be accessed with offsets from the 9564TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit), 9565or whether the thread base pointer must be added. Whether or not this 9566is legal depends on the operating system, and whether it maps the 9567segment to cover the entire TLS area. 9568 9569For systems that use GNU libc, the default is on. 9570@end table 9571 9572These @samp{-m} switches are supported in addition to the above 9573on AMD x86-64 processors in 64-bit environments. 9574 9575@table @gcctabopt 9576@item -m32 9577@itemx -m64 9578@opindex m32 9579@opindex m64 9580Generate code for a 32-bit or 64-bit environment. 9581The 32-bit environment sets int, long and pointer to 32 bits and 9582generates code that runs on any i386 system. 9583The 64-bit environment sets int to 32 bits and long and pointer 9584to 64 bits and generates code for AMD's x86-64 architecture. For 9585darwin only the -m64 option turns off the @option{-fno-pic} and 9586@option{-mdynamic-no-pic} options. 9587 9588@item -mno-red-zone 9589@opindex no-red-zone 9590Do not use a so called red zone for x86-64 code. The red zone is mandated 9591by the x86-64 ABI, it is a 128-byte area beyond the location of the 9592stack pointer that will not be modified by signal or interrupt handlers 9593and therefore can be used for temporary data without adjusting the stack 9594pointer. The flag @option{-mno-red-zone} disables this red zone. 9595 9596@item -mcmodel=small 9597@opindex mcmodel=small 9598Generate code for the small code model: the program and its symbols must 9599be linked in the lower 2 GB of the address space. Pointers are 64 bits. 9600Programs can be statically or dynamically linked. This is the default 9601code model. 9602 9603@item -mcmodel=kernel 9604@opindex mcmodel=kernel 9605Generate code for the kernel code model. The kernel runs in the 9606negative 2 GB of the address space. 9607This model has to be used for Linux kernel code. 9608 9609@item -mcmodel=medium 9610@opindex mcmodel=medium 9611Generate code for the medium model: The program is linked in the lower 2 9612GB of the address space but symbols can be located anywhere in the 9613address space. Programs can be statically or dynamically linked, but 9614building of shared libraries are not supported with the medium model. 9615 9616@item -mcmodel=large 9617@opindex mcmodel=large 9618Generate code for the large model: This model makes no assumptions 9619about addresses and sizes of sections. Currently GCC does not implement 9620this model. 9621@end table 9622 9623@node IA-64 Options 9624@subsection IA-64 Options 9625@cindex IA-64 Options 9626 9627These are the @samp{-m} options defined for the Intel IA-64 architecture. 9628 9629@table @gcctabopt 9630@item -mbig-endian 9631@opindex mbig-endian 9632Generate code for a big endian target. This is the default for HP-UX@. 9633 9634@item -mlittle-endian 9635@opindex mlittle-endian 9636Generate code for a little endian target. This is the default for AIX5 9637and GNU/Linux. 9638 9639@item -mgnu-as 9640@itemx -mno-gnu-as 9641@opindex mgnu-as 9642@opindex mno-gnu-as 9643Generate (or don't) code for the GNU assembler. This is the default. 9644@c Also, this is the default if the configure option @option{--with-gnu-as} 9645@c is used. 9646 9647@item -mgnu-ld 9648@itemx -mno-gnu-ld 9649@opindex mgnu-ld 9650@opindex mno-gnu-ld 9651Generate (or don't) code for the GNU linker. This is the default. 9652@c Also, this is the default if the configure option @option{--with-gnu-ld} 9653@c is used. 9654 9655@item -mno-pic 9656@opindex mno-pic 9657Generate code that does not use a global pointer register. The result 9658is not position independent code, and violates the IA-64 ABI@. 9659 9660@item -mvolatile-asm-stop 9661@itemx -mno-volatile-asm-stop 9662@opindex mvolatile-asm-stop 9663@opindex mno-volatile-asm-stop 9664Generate (or don't) a stop bit immediately before and after volatile asm 9665statements. 9666 9667@item -mregister-names 9668@itemx -mno-register-names 9669@opindex mregister-names 9670@opindex mno-register-names 9671Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for 9672the stacked registers. This may make assembler output more readable. 9673 9674@item -mno-sdata 9675@itemx -msdata 9676@opindex mno-sdata 9677@opindex msdata 9678Disable (or enable) optimizations that use the small data section. This may 9679be useful for working around optimizer bugs. 9680 9681@item -mconstant-gp 9682@opindex mconstant-gp 9683Generate code that uses a single constant global pointer value. This is 9684useful when compiling kernel code. 9685 9686@item -mauto-pic 9687@opindex mauto-pic 9688Generate code that is self-relocatable. This implies @option{-mconstant-gp}. 9689This is useful when compiling firmware code. 9690 9691@item -minline-float-divide-min-latency 9692@opindex minline-float-divide-min-latency 9693Generate code for inline divides of floating point values 9694using the minimum latency algorithm. 9695 9696@item -minline-float-divide-max-throughput 9697@opindex minline-float-divide-max-throughput 9698Generate code for inline divides of floating point values 9699using the maximum throughput algorithm. 9700 9701@item -minline-int-divide-min-latency 9702@opindex minline-int-divide-min-latency 9703Generate code for inline divides of integer values 9704using the minimum latency algorithm. 9705 9706@item -minline-int-divide-max-throughput 9707@opindex minline-int-divide-max-throughput 9708Generate code for inline divides of integer values 9709using the maximum throughput algorithm. 9710 9711@item -minline-sqrt-min-latency 9712@opindex minline-sqrt-min-latency 9713Generate code for inline square roots 9714using the minimum latency algorithm. 9715 9716@item -minline-sqrt-max-throughput 9717@opindex minline-sqrt-max-throughput 9718Generate code for inline square roots 9719using the maximum throughput algorithm. 9720 9721@item -mno-dwarf2-asm 9722@itemx -mdwarf2-asm 9723@opindex mno-dwarf2-asm 9724@opindex mdwarf2-asm 9725Don't (or do) generate assembler code for the DWARF2 line number debugging 9726info. This may be useful when not using the GNU assembler. 9727 9728@item -mearly-stop-bits 9729@itemx -mno-early-stop-bits 9730@opindex mearly-stop-bits 9731@opindex mno-early-stop-bits 9732Allow stop bits to be placed earlier than immediately preceding the 9733instruction that triggered the stop bit. This can improve instruction 9734scheduling, but does not always do so. 9735 9736@item -mfixed-range=@var{register-range} 9737@opindex mfixed-range 9738Generate code treating the given register range as fixed registers. 9739A fixed register is one that the register allocator can not use. This is 9740useful when compiling kernel code. A register range is specified as 9741two registers separated by a dash. Multiple register ranges can be 9742specified separated by a comma. 9743 9744@item -mtls-size=@var{tls-size} 9745@opindex mtls-size 9746Specify bit size of immediate TLS offsets. Valid values are 14, 22, and 974764. 9748 9749@item -mtune=@var{cpu-type} 9750@opindex mtune 9751Tune the instruction scheduling for a particular CPU, Valid values are 9752itanium, itanium1, merced, itanium2, and mckinley. 9753 9754@item -mt 9755@itemx -pthread 9756@opindex mt 9757@opindex pthread 9758Add support for multithreading using the POSIX threads library. This 9759option sets flags for both the preprocessor and linker. It does 9760not affect the thread safety of object code produced by the compiler or 9761that of libraries supplied with it. These are HP-UX specific flags. 9762 9763@item -milp32 9764@itemx -mlp64 9765@opindex milp32 9766@opindex mlp64 9767Generate code for a 32-bit or 64-bit environment. 9768The 32-bit environment sets int, long and pointer to 32 bits. 9769The 64-bit environment sets int to 32 bits and long and pointer 9770to 64 bits. These are HP-UX specific flags. 9771 9772@item -mno-sched-br-data-spec 9773@itemx -msched-br-data-spec 9774@opindex mno-sched-br-data-spec 9775@opindex msched-br-data-spec 9776(Dis/En)able data speculative scheduling before reload. 9777This will result in generation of the ld.a instructions and 9778the corresponding check instructions (ld.c / chk.a). 9779The default is 'disable'. 9780 9781@item -msched-ar-data-spec 9782@itemx -mno-sched-ar-data-spec 9783@opindex msched-ar-data-spec 9784@opindex mno-sched-ar-data-spec 9785(En/Dis)able data speculative scheduling after reload. 9786This will result in generation of the ld.a instructions and 9787the corresponding check instructions (ld.c / chk.a). 9788The default is 'enable'. 9789 9790@item -mno-sched-control-spec 9791@itemx -msched-control-spec 9792@opindex mno-sched-control-spec 9793@opindex msched-control-spec 9794(Dis/En)able control speculative scheduling. This feature is 9795available only during region scheduling (i.e. before reload). 9796This will result in generation of the ld.s instructions and 9797the corresponding check instructions chk.s . 9798The default is 'disable'. 9799 9800@item -msched-br-in-data-spec 9801@itemx -mno-sched-br-in-data-spec 9802@opindex msched-br-in-data-spec 9803@opindex mno-sched-br-in-data-spec 9804(En/Dis)able speculative scheduling of the instructions that 9805are dependent on the data speculative loads before reload. 9806This is effective only with @option{-msched-br-data-spec} enabled. 9807The default is 'enable'. 9808 9809@item -msched-ar-in-data-spec 9810@itemx -mno-sched-ar-in-data-spec 9811@opindex msched-ar-in-data-spec 9812@opindex mno-sched-ar-in-data-spec 9813(En/Dis)able speculative scheduling of the instructions that 9814are dependent on the data speculative loads after reload. 9815This is effective only with @option{-msched-ar-data-spec} enabled. 9816The default is 'enable'. 9817 9818@item -msched-in-control-spec 9819@itemx -mno-sched-in-control-spec 9820@opindex msched-in-control-spec 9821@opindex mno-sched-in-control-spec 9822(En/Dis)able speculative scheduling of the instructions that 9823are dependent on the control speculative loads. 9824This is effective only with @option{-msched-control-spec} enabled. 9825The default is 'enable'. 9826 9827@item -msched-ldc 9828@itemx -mno-sched-ldc 9829@opindex msched-ldc 9830@opindex mno-sched-ldc 9831(En/Dis)able use of simple data speculation checks ld.c . 9832If disabled, only chk.a instructions will be emitted to check 9833data speculative loads. 9834The default is 'enable'. 9835 9836@item -mno-sched-control-ldc 9837@itemx -msched-control-ldc 9838@opindex mno-sched-control-ldc 9839@opindex msched-control-ldc 9840(Dis/En)able use of ld.c instructions to check control speculative loads. 9841If enabled, in case of control speculative load with no speculatively 9842scheduled dependent instructions this load will be emitted as ld.sa and 9843ld.c will be used to check it. 9844The default is 'disable'. 9845 9846@item -mno-sched-spec-verbose 9847@itemx -msched-spec-verbose 9848@opindex mno-sched-spec-verbose 9849@opindex msched-spec-verbose 9850(Dis/En)able printing of the information about speculative motions. 9851 9852@item -mno-sched-prefer-non-data-spec-insns 9853@itemx -msched-prefer-non-data-spec-insns 9854@opindex mno-sched-prefer-non-data-spec-insns 9855@opindex msched-prefer-non-data-spec-insns 9856If enabled, data speculative instructions will be chosen for schedule 9857only if there are no other choices at the moment. This will make 9858the use of the data speculation much more conservative. 9859The default is 'disable'. 9860 9861@item -mno-sched-prefer-non-control-spec-insns 9862@itemx -msched-prefer-non-control-spec-insns 9863@opindex mno-sched-prefer-non-control-spec-insns 9864@opindex msched-prefer-non-control-spec-insns 9865If enabled, control speculative instructions will be chosen for schedule 9866only if there are no other choices at the moment. This will make 9867the use of the control speculation much more conservative. 9868The default is 'disable'. 9869 9870@item -mno-sched-count-spec-in-critical-path 9871@itemx -msched-count-spec-in-critical-path 9872@opindex mno-sched-count-spec-in-critical-path 9873@opindex msched-count-spec-in-critical-path 9874If enabled, speculative dependencies will be considered during 9875computation of the instructions priorities. This will make the use of the 9876speculation a bit more conservative. 9877The default is 'disable'. 9878 9879@end table 9880 9881@node M32C Options 9882@subsection M32C Options 9883@cindex M32C options 9884 9885@table @gcctabopt 9886@item -mcpu=@var{name} 9887@opindex mcpu= 9888Select the CPU for which code is generated. @var{name} may be one of 9889@samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to 9890/60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for 9891the M32C/80 series. 9892 9893@item -msim 9894@opindex msim 9895Specifies that the program will be run on the simulator. This causes 9896an alternate runtime library to be linked in which supports, for 9897example, file I/O. You must not use this option when generating 9898programs that will run on real hardware; you must provide your own 9899runtime library for whatever I/O functions are needed. 9900 9901@item -memregs=@var{number} 9902@opindex memregs= 9903Specifies the number of memory-based pseudo-registers GCC will use 9904during code generation. These pseudo-registers will be used like real 9905registers, so there is a tradeoff between GCC's ability to fit the 9906code into available registers, and the performance penalty of using 9907memory instead of registers. Note that all modules in a program must 9908be compiled with the same value for this option. Because of that, you 9909must not use this option with the default runtime libraries gcc 9910builds. 9911 9912@end table 9913 9914@node M32R/D Options 9915@subsection M32R/D Options 9916@cindex M32R/D options 9917 9918These @option{-m} options are defined for Renesas M32R/D architectures: 9919 9920@table @gcctabopt 9921@item -m32r2 9922@opindex m32r2 9923Generate code for the M32R/2@. 9924 9925@item -m32rx 9926@opindex m32rx 9927Generate code for the M32R/X@. 9928 9929@item -m32r 9930@opindex m32r 9931Generate code for the M32R@. This is the default. 9932 9933@item -mmodel=small 9934@opindex mmodel=small 9935Assume all objects live in the lower 16MB of memory (so that their addresses 9936can be loaded with the @code{ld24} instruction), and assume all subroutines 9937are reachable with the @code{bl} instruction. 9938This is the default. 9939 9940The addressability of a particular object can be set with the 9941@code{model} attribute. 9942 9943@item -mmodel=medium 9944@opindex mmodel=medium 9945Assume objects may be anywhere in the 32-bit address space (the compiler 9946will generate @code{seth/add3} instructions to load their addresses), and 9947assume all subroutines are reachable with the @code{bl} instruction. 9948 9949@item -mmodel=large 9950@opindex mmodel=large 9951Assume objects may be anywhere in the 32-bit address space (the compiler 9952will generate @code{seth/add3} instructions to load their addresses), and 9953assume subroutines may not be reachable with the @code{bl} instruction 9954(the compiler will generate the much slower @code{seth/add3/jl} 9955instruction sequence). 9956 9957@item -msdata=none 9958@opindex msdata=none 9959Disable use of the small data area. Variables will be put into 9960one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the 9961@code{section} attribute has been specified). 9962This is the default. 9963 9964The small data area consists of sections @samp{.sdata} and @samp{.sbss}. 9965Objects may be explicitly put in the small data area with the 9966@code{section} attribute using one of these sections. 9967 9968@item -msdata=sdata 9969@opindex msdata=sdata 9970Put small global and static data in the small data area, but do not 9971generate special code to reference them. 9972 9973@item -msdata=use 9974@opindex msdata=use 9975Put small global and static data in the small data area, and generate 9976special instructions to reference them. 9977 9978@item -G @var{num} 9979@opindex G 9980@cindex smaller data references 9981Put global and static objects less than or equal to @var{num} bytes 9982into the small data or bss sections instead of the normal data or bss 9983sections. The default value of @var{num} is 8. 9984The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use} 9985for this option to have any effect. 9986 9987All modules should be compiled with the same @option{-G @var{num}} value. 9988Compiling with different values of @var{num} may or may not work; if it 9989doesn't the linker will give an error message---incorrect code will not be 9990generated. 9991 9992@item -mdebug 9993@opindex mdebug 9994Makes the M32R specific code in the compiler display some statistics 9995that might help in debugging programs. 9996 9997@item -malign-loops 9998@opindex malign-loops 9999Align all loops to a 32-byte boundary. 10000 10001@item -mno-align-loops 10002@opindex mno-align-loops 10003Do not enforce a 32-byte alignment for loops. This is the default. 10004 10005@item -missue-rate=@var{number} 10006@opindex missue-rate=@var{number} 10007Issue @var{number} instructions per cycle. @var{number} can only be 1 10008or 2. 10009 10010@item -mbranch-cost=@var{number} 10011@opindex mbranch-cost=@var{number} 10012@var{number} can only be 1 or 2. If it is 1 then branches will be 10013preferred over conditional code, if it is 2, then the opposite will 10014apply. 10015 10016@item -mflush-trap=@var{number} 10017@opindex mflush-trap=@var{number} 10018Specifies the trap number to use to flush the cache. The default is 1001912. Valid numbers are between 0 and 15 inclusive. 10020 10021@item -mno-flush-trap 10022@opindex mno-flush-trap 10023Specifies that the cache cannot be flushed by using a trap. 10024 10025@item -mflush-func=@var{name} 10026@opindex mflush-func=@var{name} 10027Specifies the name of the operating system function to call to flush 10028the cache. The default is @emph{_flush_cache}, but a function call 10029will only be used if a trap is not available. 10030 10031@item -mno-flush-func 10032@opindex mno-flush-func 10033Indicates that there is no OS function for flushing the cache. 10034 10035@end table 10036 10037@node M680x0 Options 10038@subsection M680x0 Options 10039@cindex M680x0 options 10040 10041These are the @samp{-m} options defined for the 68000 series. The default 10042values for these options depends on which style of 68000 was selected when 10043the compiler was configured; the defaults for the most common choices are 10044given below. 10045 10046@table @gcctabopt 10047@item -m68000 10048@itemx -mc68000 10049@opindex m68000 10050@opindex mc68000 10051Generate output for a 68000. This is the default 10052when the compiler is configured for 68000-based systems. 10053 10054Use this option for microcontrollers with a 68000 or EC000 core, 10055including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356. 10056 10057@item -m68020 10058@itemx -mc68020 10059@opindex m68020 10060@opindex mc68020 10061Generate output for a 68020. This is the default 10062when the compiler is configured for 68020-based systems. 10063 10064@item -m68881 10065@opindex m68881 10066Generate output containing 68881 instructions for floating point. 10067This is the default for most 68020 systems unless @option{--nfp} was 10068specified when the compiler was configured. 10069 10070@item -m68030 10071@opindex m68030 10072Generate output for a 68030. This is the default when the compiler is 10073configured for 68030-based systems. 10074 10075@item -m68040 10076@opindex m68040 10077Generate output for a 68040. This is the default when the compiler is 10078configured for 68040-based systems. 10079 10080This option inhibits the use of 68881/68882 instructions that have to be 10081emulated by software on the 68040. Use this option if your 68040 does not 10082have code to emulate those instructions. 10083 10084@item -m68060 10085@opindex m68060 10086Generate output for a 68060. This is the default when the compiler is 10087configured for 68060-based systems. 10088 10089This option inhibits the use of 68020 and 68881/68882 instructions that 10090have to be emulated by software on the 68060. Use this option if your 68060 10091does not have code to emulate those instructions. 10092 10093@item -mcpu32 10094@opindex mcpu32 10095Generate output for a CPU32. This is the default 10096when the compiler is configured for CPU32-based systems. 10097 10098Use this option for microcontrollers with a 10099CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334, 1010068336, 68340, 68341, 68349 and 68360. 10101 10102@item -m5200 10103@opindex m5200 10104Generate output for a 520X ``coldfire'' family cpu. This is the default 10105when the compiler is configured for 520X-based systems. 10106 10107Use this option for microcontroller with a 5200 core, including 10108the MCF5202, MCF5203, MCF5204 and MCF5202. 10109 10110@item -mcfv4e 10111@opindex mcfv4e 10112Generate output for a ColdFire V4e family cpu (e.g.@: 547x/548x). 10113This includes use of hardware floating point instructions. 10114 10115@item -m68020-40 10116@opindex m68020-40 10117Generate output for a 68040, without using any of the new instructions. 10118This results in code which can run relatively efficiently on either a 1011968020/68881 or a 68030 or a 68040. The generated code does use the 1012068881 instructions that are emulated on the 68040. 10121 10122@item -m68020-60 10123@opindex m68020-60 10124Generate output for a 68060, without using any of the new instructions. 10125This results in code which can run relatively efficiently on either a 1012668020/68881 or a 68030 or a 68040. The generated code does use the 1012768881 instructions that are emulated on the 68060. 10128 10129@item -msoft-float 10130@opindex msoft-float 10131Generate output containing library calls for floating point. 10132@strong{Warning:} the requisite libraries are not available for all m68k 10133targets. Normally the facilities of the machine's usual C compiler are 10134used, but this can't be done directly in cross-compilation. You must 10135make your own arrangements to provide suitable library functions for 10136cross-compilation. The embedded targets @samp{m68k-*-aout} and 10137@samp{m68k-*-coff} do provide software floating point support. 10138 10139@item -mshort 10140@opindex mshort 10141Consider type @code{int} to be 16 bits wide, like @code{short int}. 10142Additionally, parameters passed on the stack are also aligned to a 1014316-bit boundary even on targets whose API mandates promotion to 32-bit. 10144 10145@item -mnobitfield 10146@opindex mnobitfield 10147Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32} 10148and @option{-m5200} options imply @w{@option{-mnobitfield}}. 10149 10150@item -mbitfield 10151@opindex mbitfield 10152Do use the bit-field instructions. The @option{-m68020} option implies 10153@option{-mbitfield}. This is the default if you use a configuration 10154designed for a 68020. 10155 10156@item -mrtd 10157@opindex mrtd 10158Use a different function-calling convention, in which functions 10159that take a fixed number of arguments return with the @code{rtd} 10160instruction, which pops their arguments while returning. This 10161saves one instruction in the caller since there is no need to pop 10162the arguments there. 10163 10164This calling convention is incompatible with the one normally 10165used on Unix, so you cannot use it if you need to call libraries 10166compiled with the Unix compiler. 10167 10168Also, you must provide function prototypes for all functions that 10169take variable numbers of arguments (including @code{printf}); 10170otherwise incorrect code will be generated for calls to those 10171functions. 10172 10173In addition, seriously incorrect code will result if you call a 10174function with too many arguments. (Normally, extra arguments are 10175harmlessly ignored.) 10176 10177The @code{rtd} instruction is supported by the 68010, 68020, 68030, 1017868040, 68060 and CPU32 processors, but not by the 68000 or 5200. 10179 10180@item -malign-int 10181@itemx -mno-align-int 10182@opindex malign-int 10183@opindex mno-align-int 10184Control whether GCC aligns @code{int}, @code{long}, @code{long long}, 10185@code{float}, @code{double}, and @code{long double} variables on a 32-bit 10186boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}). 10187Aligning variables on 32-bit boundaries produces code that runs somewhat 10188faster on processors with 32-bit busses at the expense of more memory. 10189 10190@strong{Warning:} if you use the @option{-malign-int} switch, GCC will 10191align structures containing the above types differently than 10192most published application binary interface specifications for the m68k. 10193 10194@item -mpcrel 10195@opindex mpcrel 10196Use the pc-relative addressing mode of the 68000 directly, instead of 10197using a global offset table. At present, this option implies @option{-fpic}, 10198allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is 10199not presently supported with @option{-mpcrel}, though this could be supported for 1020068020 and higher processors. 10201 10202@item -mno-strict-align 10203@itemx -mstrict-align 10204@opindex mno-strict-align 10205@opindex mstrict-align 10206Do not (do) assume that unaligned memory references will be handled by 10207the system. 10208 10209@item -msep-data 10210Generate code that allows the data segment to be located in a different 10211area of memory from the text segment. This allows for execute in place in 10212an environment without virtual memory management. This option implies 10213@option{-fPIC}. 10214 10215@item -mno-sep-data 10216Generate code that assumes that the data segment follows the text segment. 10217This is the default. 10218 10219@item -mid-shared-library 10220Generate code that supports shared libraries via the library ID method. 10221This allows for execute in place and shared libraries in an environment 10222without virtual memory management. This option implies @option{-fPIC}. 10223 10224@item -mno-id-shared-library 10225Generate code that doesn't assume ID based shared libraries are being used. 10226This is the default. 10227 10228@item -mshared-library-id=n 10229Specified the identification number of the ID based shared library being 10230compiled. Specifying a value of 0 will generate more compact code, specifying 10231other values will force the allocation of that number to the current 10232library but is no more space or time efficient than omitting this option. 10233 10234@end table 10235 10236@node M68hc1x Options 10237@subsection M68hc1x Options 10238@cindex M68hc1x options 10239 10240These are the @samp{-m} options defined for the 68hc11 and 68hc12 10241microcontrollers. The default values for these options depends on 10242which style of microcontroller was selected when the compiler was configured; 10243the defaults for the most common choices are given below. 10244 10245@table @gcctabopt 10246@item -m6811 10247@itemx -m68hc11 10248@opindex m6811 10249@opindex m68hc11 10250Generate output for a 68HC11. This is the default 10251when the compiler is configured for 68HC11-based systems. 10252 10253@item -m6812 10254@itemx -m68hc12 10255@opindex m6812 10256@opindex m68hc12 10257Generate output for a 68HC12. This is the default 10258when the compiler is configured for 68HC12-based systems. 10259 10260@item -m68S12 10261@itemx -m68hcs12 10262@opindex m68S12 10263@opindex m68hcs12 10264Generate output for a 68HCS12. 10265 10266@item -mauto-incdec 10267@opindex mauto-incdec 10268Enable the use of 68HC12 pre and post auto-increment and auto-decrement 10269addressing modes. 10270 10271@item -minmax 10272@itemx -nominmax 10273@opindex minmax 10274@opindex mnominmax 10275Enable the use of 68HC12 min and max instructions. 10276 10277@item -mlong-calls 10278@itemx -mno-long-calls 10279@opindex mlong-calls 10280@opindex mno-long-calls 10281Treat all calls as being far away (near). If calls are assumed to be 10282far away, the compiler will use the @code{call} instruction to 10283call a function and the @code{rtc} instruction for returning. 10284 10285@item -mshort 10286@opindex mshort 10287Consider type @code{int} to be 16 bits wide, like @code{short int}. 10288 10289@item -msoft-reg-count=@var{count} 10290@opindex msoft-reg-count 10291Specify the number of pseudo-soft registers which are used for the 10292code generation. The maximum number is 32. Using more pseudo-soft 10293register may or may not result in better code depending on the program. 10294The default is 4 for 68HC11 and 2 for 68HC12. 10295 10296@end table 10297 10298@node MCore Options 10299@subsection MCore Options 10300@cindex MCore options 10301 10302These are the @samp{-m} options defined for the Motorola M*Core 10303processors. 10304 10305@table @gcctabopt 10306 10307@item -mhardlit 10308@itemx -mno-hardlit 10309@opindex mhardlit 10310@opindex mno-hardlit 10311Inline constants into the code stream if it can be done in two 10312instructions or less. 10313 10314@item -mdiv 10315@itemx -mno-div 10316@opindex mdiv 10317@opindex mno-div 10318Use the divide instruction. (Enabled by default). 10319 10320@item -mrelax-immediate 10321@itemx -mno-relax-immediate 10322@opindex mrelax-immediate 10323@opindex mno-relax-immediate 10324Allow arbitrary sized immediates in bit operations. 10325 10326@item -mwide-bitfields 10327@itemx -mno-wide-bitfields 10328@opindex mwide-bitfields 10329@opindex mno-wide-bitfields 10330Always treat bit-fields as int-sized. 10331 10332@item -m4byte-functions 10333@itemx -mno-4byte-functions 10334@opindex m4byte-functions 10335@opindex mno-4byte-functions 10336Force all functions to be aligned to a four byte boundary. 10337 10338@item -mcallgraph-data 10339@itemx -mno-callgraph-data 10340@opindex mcallgraph-data 10341@opindex mno-callgraph-data 10342Emit callgraph information. 10343 10344@item -mslow-bytes 10345@itemx -mno-slow-bytes 10346@opindex mslow-bytes 10347@opindex mno-slow-bytes 10348Prefer word access when reading byte quantities. 10349 10350@item -mlittle-endian 10351@itemx -mbig-endian 10352@opindex mlittle-endian 10353@opindex mbig-endian 10354Generate code for a little endian target. 10355 10356@item -m210 10357@itemx -m340 10358@opindex m210 10359@opindex m340 10360Generate code for the 210 processor. 10361@end table 10362 10363@node MIPS Options 10364@subsection MIPS Options 10365@cindex MIPS options 10366 10367@table @gcctabopt 10368 10369@item -EB 10370@opindex EB 10371Generate big-endian code. 10372 10373@item -EL 10374@opindex EL 10375Generate little-endian code. This is the default for @samp{mips*el-*-*} 10376configurations. 10377 10378@item -march=@var{arch} 10379@opindex march 10380Generate code that will run on @var{arch}, which can be the name of a 10381generic MIPS ISA, or the name of a particular processor. 10382The ISA names are: 10383@samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4}, 10384@samp{mips32}, @samp{mips32r2}, and @samp{mips64}. 10385The processor names are: 10386@samp{4kc}, @samp{4km}, @samp{4kp}, 10387@samp{5kc}, @samp{5kf}, 10388@samp{20kc}, 10389@samp{24k}, @samp{24kc}, @samp{24kf}, @samp{24kx}, 10390@samp{m4k}, 10391@samp{orion}, 10392@samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400}, 10393@samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000}, 10394@samp{rm7000}, @samp{rm9000}, 10395@samp{sb1}, 10396@samp{sr71000}, 10397@samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300}, 10398@samp{vr5000}, @samp{vr5400} and @samp{vr5500}. 10399The special value @samp{from-abi} selects the 10400most compatible architecture for the selected ABI (that is, 10401@samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@. 10402 10403In processor names, a final @samp{000} can be abbreviated as @samp{k} 10404(for example, @samp{-march=r2k}). Prefixes are optional, and 10405@samp{vr} may be written @samp{r}. 10406 10407GCC defines two macros based on the value of this option. The first 10408is @samp{_MIPS_ARCH}, which gives the name of target architecture, as 10409a string. The second has the form @samp{_MIPS_ARCH_@var{foo}}, 10410where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@. 10411For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH} 10412to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}. 10413 10414Note that the @samp{_MIPS_ARCH} macro uses the processor names given 10415above. In other words, it will have the full prefix and will not 10416abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi}, 10417the macro names the resolved architecture (either @samp{"mips1"} or 10418@samp{"mips3"}). It names the default architecture when no 10419@option{-march} option is given. 10420 10421@item -mtune=@var{arch} 10422@opindex mtune 10423Optimize for @var{arch}. Among other things, this option controls 10424the way instructions are scheduled, and the perceived cost of arithmetic 10425operations. The list of @var{arch} values is the same as for 10426@option{-march}. 10427 10428When this option is not used, GCC will optimize for the processor 10429specified by @option{-march}. By using @option{-march} and 10430@option{-mtune} together, it is possible to generate code that will 10431run on a family of processors, but optimize the code for one 10432particular member of that family. 10433 10434@samp{-mtune} defines the macros @samp{_MIPS_TUNE} and 10435@samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the 10436@samp{-march} ones described above. 10437 10438@item -mips1 10439@opindex mips1 10440Equivalent to @samp{-march=mips1}. 10441 10442@item -mips2 10443@opindex mips2 10444Equivalent to @samp{-march=mips2}. 10445 10446@item -mips3 10447@opindex mips3 10448Equivalent to @samp{-march=mips3}. 10449 10450@item -mips4 10451@opindex mips4 10452Equivalent to @samp{-march=mips4}. 10453 10454@item -mips32 10455@opindex mips32 10456Equivalent to @samp{-march=mips32}. 10457 10458@item -mips32r2 10459@opindex mips32r2 10460Equivalent to @samp{-march=mips32r2}. 10461 10462@item -mips64 10463@opindex mips64 10464Equivalent to @samp{-march=mips64}. 10465 10466@item -mips16 10467@itemx -mno-mips16 10468@opindex mips16 10469@opindex mno-mips16 10470Generate (do not generate) MIPS16 code. If GCC is targetting a 10471MIPS32 or MIPS64 architecture, it will make use of the MIPS16e ASE@. 10472 10473@item -mabi=32 10474@itemx -mabi=o64 10475@itemx -mabi=n32 10476@itemx -mabi=64 10477@itemx -mabi=eabi 10478@opindex mabi=32 10479@opindex mabi=o64 10480@opindex mabi=n32 10481@opindex mabi=64 10482@opindex mabi=eabi 10483Generate code for the given ABI@. 10484 10485Note that the EABI has a 32-bit and a 64-bit variant. GCC normally 10486generates 64-bit code when you select a 64-bit architecture, but you 10487can use @option{-mgp32} to get 32-bit code instead. 10488 10489For information about the O64 ABI, see 10490@w{@uref{http://gcc.gnu.org/projects/mipso64-abi.html}}. 10491 10492@item -mabicalls 10493@itemx -mno-abicalls 10494@opindex mabicalls 10495@opindex mno-abicalls 10496Generate (do not generate) code that is suitable for SVR4-style 10497dynamic objects. @option{-mabicalls} is the default for SVR4-based 10498systems. 10499 10500@item -mshared 10501@itemx -mno-shared 10502Generate (do not generate) code that is fully position-independent, 10503and that can therefore be linked into shared libraries. This option 10504only affects @option{-mabicalls}. 10505 10506All @option{-mabicalls} code has traditionally been position-independent, 10507regardless of options like @option{-fPIC} and @option{-fpic}. However, 10508as an extension, the GNU toolchain allows executables to use absolute 10509accesses for locally-binding symbols. It can also use shorter GP 10510initialization sequences and generate direct calls to locally-defined 10511functions. This mode is selected by @option{-mno-shared}. 10512 10513@option{-mno-shared} depends on binutils 2.16 or higher and generates 10514objects that can only be linked by the GNU linker. However, the option 10515does not affect the ABI of the final executable; it only affects the ABI 10516of relocatable objects. Using @option{-mno-shared} will generally make 10517executables both smaller and quicker. 10518 10519@option{-mshared} is the default. 10520 10521@item -mxgot 10522@itemx -mno-xgot 10523@opindex mxgot 10524@opindex mno-xgot 10525Lift (do not lift) the usual restrictions on the size of the global 10526offset table. 10527 10528GCC normally uses a single instruction to load values from the GOT@. 10529While this is relatively efficient, it will only work if the GOT 10530is smaller than about 64k. Anything larger will cause the linker 10531to report an error such as: 10532 10533@cindex relocation truncated to fit (MIPS) 10534@smallexample 10535relocation truncated to fit: R_MIPS_GOT16 foobar 10536@end smallexample 10537 10538If this happens, you should recompile your code with @option{-mxgot}. 10539It should then work with very large GOTs, although it will also be 10540less efficient, since it will take three instructions to fetch the 10541value of a global symbol. 10542 10543Note that some linkers can create multiple GOTs. If you have such a 10544linker, you should only need to use @option{-mxgot} when a single object 10545file accesses more than 64k's worth of GOT entries. Very few do. 10546 10547These options have no effect unless GCC is generating position 10548independent code. 10549 10550@item -mgp32 10551@opindex mgp32 10552Assume that general-purpose registers are 32 bits wide. 10553 10554@item -mgp64 10555@opindex mgp64 10556Assume that general-purpose registers are 64 bits wide. 10557 10558@item -mfp32 10559@opindex mfp32 10560Assume that floating-point registers are 32 bits wide. 10561 10562@item -mfp64 10563@opindex mfp64 10564Assume that floating-point registers are 64 bits wide. 10565 10566@item -mhard-float 10567@opindex mhard-float 10568Use floating-point coprocessor instructions. 10569 10570@item -msoft-float 10571@opindex msoft-float 10572Do not use floating-point coprocessor instructions. Implement 10573floating-point calculations using library calls instead. 10574 10575@item -msingle-float 10576@opindex msingle-float 10577Assume that the floating-point coprocessor only supports single-precision 10578operations. 10579 10580@itemx -mdouble-float 10581@opindex mdouble-float 10582Assume that the floating-point coprocessor supports double-precision 10583operations. This is the default. 10584 10585@itemx -mdsp 10586@itemx -mno-dsp 10587@opindex mdsp 10588@opindex mno-dsp 10589Use (do not use) the MIPS DSP ASE. @xref{MIPS DSP Built-in Functions}. 10590 10591@itemx -mpaired-single 10592@itemx -mno-paired-single 10593@opindex mpaired-single 10594@opindex mno-paired-single 10595Use (do not use) paired-single floating-point instructions. 10596@xref{MIPS Paired-Single Support}. This option can only be used 10597when generating 64-bit code and requires hardware floating-point 10598support to be enabled. 10599 10600@itemx -mips3d 10601@itemx -mno-mips3d 10602@opindex mips3d 10603@opindex mno-mips3d 10604Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}. 10605The option @option{-mips3d} implies @option{-mpaired-single}. 10606 10607@item -mlong64 10608@opindex mlong64 10609Force @code{long} types to be 64 bits wide. See @option{-mlong32} for 10610an explanation of the default and the way that the pointer size is 10611determined. 10612 10613@item -mlong32 10614@opindex mlong32 10615Force @code{long}, @code{int}, and pointer types to be 32 bits wide. 10616 10617The default size of @code{int}s, @code{long}s and pointers depends on 10618the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI 10619uses 64-bit @code{long}s, as does the 64-bit EABI; the others use 1062032-bit @code{long}s. Pointers are the same size as @code{long}s, 10621or the same size as integer registers, whichever is smaller. 10622 10623@item -msym32 10624@itemx -mno-sym32 10625@opindex msym32 10626@opindex mno-sym32 10627Assume (do not assume) that all symbols have 32-bit values, regardless 10628of the selected ABI@. This option is useful in combination with 10629@option{-mabi=64} and @option{-mno-abicalls} because it allows GCC 10630to generate shorter and faster references to symbolic addresses. 10631 10632@item -G @var{num} 10633@opindex G 10634@cindex smaller data references (MIPS) 10635@cindex gp-relative references (MIPS) 10636Put global and static items less than or equal to @var{num} bytes into 10637the small data or bss section instead of the normal data or bss section. 10638This allows the data to be accessed using a single instruction. 10639 10640All modules should be compiled with the same @option{-G @var{num}} 10641value. 10642 10643@item -membedded-data 10644@itemx -mno-embedded-data 10645@opindex membedded-data 10646@opindex mno-embedded-data 10647Allocate variables to the read-only data section first if possible, then 10648next in the small data section if possible, otherwise in data. This gives 10649slightly slower code than the default, but reduces the amount of RAM required 10650when executing, and thus may be preferred for some embedded systems. 10651 10652@item -muninit-const-in-rodata 10653@itemx -mno-uninit-const-in-rodata 10654@opindex muninit-const-in-rodata 10655@opindex mno-uninit-const-in-rodata 10656Put uninitialized @code{const} variables in the read-only data section. 10657This option is only meaningful in conjunction with @option{-membedded-data}. 10658 10659@item -msplit-addresses 10660@itemx -mno-split-addresses 10661@opindex msplit-addresses 10662@opindex mno-split-addresses 10663Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler 10664relocation operators. This option has been superseded by 10665@option{-mexplicit-relocs} but is retained for backwards compatibility. 10666 10667@item -mexplicit-relocs 10668@itemx -mno-explicit-relocs 10669@opindex mexplicit-relocs 10670@opindex mno-explicit-relocs 10671Use (do not use) assembler relocation operators when dealing with symbolic 10672addresses. The alternative, selected by @option{-mno-explicit-relocs}, 10673is to use assembler macros instead. 10674 10675@option{-mexplicit-relocs} is the default if GCC was configured 10676to use an assembler that supports relocation operators. 10677 10678@item -mcheck-zero-division 10679@itemx -mno-check-zero-division 10680@opindex mcheck-zero-division 10681@opindex mno-check-zero-division 10682Trap (do not trap) on integer division by zero. The default is 10683@option{-mcheck-zero-division}. 10684 10685@item -mdivide-traps 10686@itemx -mdivide-breaks 10687@opindex mdivide-traps 10688@opindex mdivide-breaks 10689MIPS systems check for division by zero by generating either a 10690conditional trap or a break instruction. Using traps results in 10691smaller code, but is only supported on MIPS II and later. Also, some 10692versions of the Linux kernel have a bug that prevents trap from 10693generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to 10694allow conditional traps on architectures that support them and 10695@option{-mdivide-breaks} to force the use of breaks. 10696 10697The default is usually @option{-mdivide-traps}, but this can be 10698overridden at configure time using @option{--with-divide=breaks}. 10699Divide-by-zero checks can be completely disabled using 10700@option{-mno-check-zero-division}. 10701 10702@item -mmemcpy 10703@itemx -mno-memcpy 10704@opindex mmemcpy 10705@opindex mno-memcpy 10706Force (do not force) the use of @code{memcpy()} for non-trivial block 10707moves. The default is @option{-mno-memcpy}, which allows GCC to inline 10708most constant-sized copies. 10709 10710@item -mlong-calls 10711@itemx -mno-long-calls 10712@opindex mlong-calls 10713@opindex mno-long-calls 10714Disable (do not disable) use of the @code{jal} instruction. Calling 10715functions using @code{jal} is more efficient but requires the caller 10716and callee to be in the same 256 megabyte segment. 10717 10718This option has no effect on abicalls code. The default is 10719@option{-mno-long-calls}. 10720 10721@item -mmad 10722@itemx -mno-mad 10723@opindex mmad 10724@opindex mno-mad 10725Enable (disable) use of the @code{mad}, @code{madu} and @code{mul} 10726instructions, as provided by the R4650 ISA@. 10727 10728@item -mfused-madd 10729@itemx -mno-fused-madd 10730@opindex mfused-madd 10731@opindex mno-fused-madd 10732Enable (disable) use of the floating point multiply-accumulate 10733instructions, when they are available. The default is 10734@option{-mfused-madd}. 10735 10736When multiply-accumulate instructions are used, the intermediate 10737product is calculated to infinite precision and is not subject to 10738the FCSR Flush to Zero bit. This may be undesirable in some 10739circumstances. 10740 10741@item -nocpp 10742@opindex nocpp 10743Tell the MIPS assembler to not run its preprocessor over user 10744assembler files (with a @samp{.s} suffix) when assembling them. 10745 10746@item -mfix-r4000 10747@itemx -mno-fix-r4000 10748@opindex mfix-r4000 10749@opindex mno-fix-r4000 10750Work around certain R4000 CPU errata: 10751@itemize @minus 10752@item 10753A double-word or a variable shift may give an incorrect result if executed 10754immediately after starting an integer division. 10755@item 10756A double-word or a variable shift may give an incorrect result if executed 10757while an integer multiplication is in progress. 10758@item 10759An integer division may give an incorrect result if started in a delay slot 10760of a taken branch or a jump. 10761@end itemize 10762 10763@item -mfix-r4400 10764@itemx -mno-fix-r4400 10765@opindex mfix-r4400 10766@opindex mno-fix-r4400 10767Work around certain R4400 CPU errata: 10768@itemize @minus 10769@item 10770A double-word or a variable shift may give an incorrect result if executed 10771immediately after starting an integer division. 10772@end itemize 10773 10774@item -mfix-vr4120 10775@itemx -mno-fix-vr4120 10776@opindex mfix-vr4120 10777Work around certain VR4120 errata: 10778@itemize @minus 10779@item 10780@code{dmultu} does not always produce the correct result. 10781@item 10782@code{div} and @code{ddiv} do not always produce the correct result if one 10783of the operands is negative. 10784@end itemize 10785The workarounds for the division errata rely on special functions in 10786@file{libgcc.a}. At present, these functions are only provided by 10787the @code{mips64vr*-elf} configurations. 10788 10789Other VR4120 errata require a nop to be inserted between certain pairs of 10790instructions. These errata are handled by the assembler, not by GCC itself. 10791 10792@item -mfix-vr4130 10793@opindex mfix-vr4130 10794Work around the VR4130 @code{mflo}/@code{mfhi} errata. The 10795workarounds are implemented by the assembler rather than by GCC, 10796although GCC will avoid using @code{mflo} and @code{mfhi} if the 10797VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi} 10798instructions are available instead. 10799 10800@item -mfix-sb1 10801@itemx -mno-fix-sb1 10802@opindex mfix-sb1 10803Work around certain SB-1 CPU core errata. 10804(This flag currently works around the SB-1 revision 2 10805``F1'' and ``F2'' floating point errata.) 10806 10807@item -mflush-func=@var{func} 10808@itemx -mno-flush-func 10809@opindex mflush-func 10810Specifies the function to call to flush the I and D caches, or to not 10811call any such function. If called, the function must take the same 10812arguments as the common @code{_flush_func()}, that is, the address of the 10813memory range for which the cache is being flushed, the size of the 10814memory range, and the number 3 (to flush both caches). The default 10815depends on the target GCC was configured for, but commonly is either 10816@samp{_flush_func} or @samp{__cpu_flush}. 10817 10818@item -mbranch-likely 10819@itemx -mno-branch-likely 10820@opindex mbranch-likely 10821@opindex mno-branch-likely 10822Enable or disable use of Branch Likely instructions, regardless of the 10823default for the selected architecture. By default, Branch Likely 10824instructions may be generated if they are supported by the selected 10825architecture. An exception is for the MIPS32 and MIPS64 architectures 10826and processors which implement those architectures; for those, Branch 10827Likely instructions will not be generated by default because the MIPS32 10828and MIPS64 architectures specifically deprecate their use. 10829 10830@item -mfp-exceptions 10831@itemx -mno-fp-exceptions 10832@opindex mfp-exceptions 10833Specifies whether FP exceptions are enabled. This affects how we schedule 10834FP instructions for some processors. The default is that FP exceptions are 10835enabled. 10836 10837For instance, on the SB-1, if FP exceptions are disabled, and we are emitting 1083864-bit code, then we can use both FP pipes. Otherwise, we can only use one 10839FP pipe. 10840 10841@item -mvr4130-align 10842@itemx -mno-vr4130-align 10843@opindex mvr4130-align 10844The VR4130 pipeline is two-way superscalar, but can only issue two 10845instructions together if the first one is 8-byte aligned. When this 10846option is enabled, GCC will align pairs of instructions that it 10847thinks should execute in parallel. 10848 10849This option only has an effect when optimizing for the VR4130. 10850It normally makes code faster, but at the expense of making it bigger. 10851It is enabled by default at optimization level @option{-O3}. 10852@end table 10853 10854@node MMIX Options 10855@subsection MMIX Options 10856@cindex MMIX Options 10857 10858These options are defined for the MMIX: 10859 10860@table @gcctabopt 10861@item -mlibfuncs 10862@itemx -mno-libfuncs 10863@opindex mlibfuncs 10864@opindex mno-libfuncs 10865Specify that intrinsic library functions are being compiled, passing all 10866values in registers, no matter the size. 10867 10868@item -mepsilon 10869@itemx -mno-epsilon 10870@opindex mepsilon 10871@opindex mno-epsilon 10872Generate floating-point comparison instructions that compare with respect 10873to the @code{rE} epsilon register. 10874 10875@item -mabi=mmixware 10876@itemx -mabi=gnu 10877@opindex mabi-mmixware 10878@opindex mabi=gnu 10879Generate code that passes function parameters and return values that (in 10880the called function) are seen as registers @code{$0} and up, as opposed to 10881the GNU ABI which uses global registers @code{$231} and up. 10882 10883@item -mzero-extend 10884@itemx -mno-zero-extend 10885@opindex mzero-extend 10886@opindex mno-zero-extend 10887When reading data from memory in sizes shorter than 64 bits, use (do not 10888use) zero-extending load instructions by default, rather than 10889sign-extending ones. 10890 10891@item -mknuthdiv 10892@itemx -mno-knuthdiv 10893@opindex mknuthdiv 10894@opindex mno-knuthdiv 10895Make the result of a division yielding a remainder have the same sign as 10896the divisor. With the default, @option{-mno-knuthdiv}, the sign of the 10897remainder follows the sign of the dividend. Both methods are 10898arithmetically valid, the latter being almost exclusively used. 10899 10900@item -mtoplevel-symbols 10901@itemx -mno-toplevel-symbols 10902@opindex mtoplevel-symbols 10903@opindex mno-toplevel-symbols 10904Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly 10905code can be used with the @code{PREFIX} assembly directive. 10906 10907@item -melf 10908@opindex melf 10909Generate an executable in the ELF format, rather than the default 10910@samp{mmo} format used by the @command{mmix} simulator. 10911 10912@item -mbranch-predict 10913@itemx -mno-branch-predict 10914@opindex mbranch-predict 10915@opindex mno-branch-predict 10916Use (do not use) the probable-branch instructions, when static branch 10917prediction indicates a probable branch. 10918 10919@item -mbase-addresses 10920@itemx -mno-base-addresses 10921@opindex mbase-addresses 10922@opindex mno-base-addresses 10923Generate (do not generate) code that uses @emph{base addresses}. Using a 10924base address automatically generates a request (handled by the assembler 10925and the linker) for a constant to be set up in a global register. The 10926register is used for one or more base address requests within the range 0 10927to 255 from the value held in the register. The generally leads to short 10928and fast code, but the number of different data items that can be 10929addressed is limited. This means that a program that uses lots of static 10930data may require @option{-mno-base-addresses}. 10931 10932@item -msingle-exit 10933@itemx -mno-single-exit 10934@opindex msingle-exit 10935@opindex mno-single-exit 10936Force (do not force) generated code to have a single exit point in each 10937function. 10938@end table 10939 10940@node MN10300 Options 10941@subsection MN10300 Options 10942@cindex MN10300 options 10943 10944These @option{-m} options are defined for Matsushita MN10300 architectures: 10945 10946@table @gcctabopt 10947@item -mmult-bug 10948@opindex mmult-bug 10949Generate code to avoid bugs in the multiply instructions for the MN10300 10950processors. This is the default. 10951 10952@item -mno-mult-bug 10953@opindex mno-mult-bug 10954Do not generate code to avoid bugs in the multiply instructions for the 10955MN10300 processors. 10956 10957@item -mam33 10958@opindex mam33 10959Generate code which uses features specific to the AM33 processor. 10960 10961@item -mno-am33 10962@opindex mno-am33 10963Do not generate code which uses features specific to the AM33 processor. This 10964is the default. 10965 10966@item -mreturn-pointer-on-d0 10967@opindex mreturn-pointer-on-d0 10968When generating a function which returns a pointer, return the pointer 10969in both @code{a0} and @code{d0}. Otherwise, the pointer is returned 10970only in a0, and attempts to call such functions without a prototype 10971would result in errors. Note that this option is on by default; use 10972@option{-mno-return-pointer-on-d0} to disable it. 10973 10974@item -mno-crt0 10975@opindex mno-crt0 10976Do not link in the C run-time initialization object file. 10977 10978@item -mrelax 10979@opindex mrelax 10980Indicate to the linker that it should perform a relaxation optimization pass 10981to shorten branches, calls and absolute memory addresses. This option only 10982has an effect when used on the command line for the final link step. 10983 10984This option makes symbolic debugging impossible. 10985@end table 10986 10987@node MT Options 10988@subsection MT Options 10989@cindex MT options 10990 10991These @option{-m} options are defined for Morpho MT architectures: 10992 10993@table @gcctabopt 10994 10995@item -march=@var{cpu-type} 10996@opindex march 10997Generate code that will run on @var{cpu-type}, which is the name of a system 10998representing a certain processor type. Possible values for 10999@var{cpu-type} are @samp{ms1-64-001}, @samp{ms1-16-002}, 11000@samp{ms1-16-003} and @samp{ms2}. 11001 11002When this option is not used, the default is @option{-march=ms1-16-002}. 11003 11004@item -mbacc 11005@opindex mbacc 11006Use byte loads and stores when generating code. 11007 11008@item -mno-bacc 11009@opindex mno-bacc 11010Do not use byte loads and stores when generating code. 11011 11012@item -msim 11013@opindex msim 11014Use simulator runtime 11015 11016@item -mno-crt0 11017@opindex mno-crt0 11018Do not link in the C run-time initialization object file 11019@file{crti.o}. Other run-time initialization and termination files 11020such as @file{startup.o} and @file{exit.o} are still included on the 11021linker command line. 11022 11023@end table 11024 11025@node PDP-11 Options 11026@subsection PDP-11 Options 11027@cindex PDP-11 Options 11028 11029These options are defined for the PDP-11: 11030 11031@table @gcctabopt 11032@item -mfpu 11033@opindex mfpu 11034Use hardware FPP floating point. This is the default. (FIS floating 11035point on the PDP-11/40 is not supported.) 11036 11037@item -msoft-float 11038@opindex msoft-float 11039Do not use hardware floating point. 11040 11041@item -mac0 11042@opindex mac0 11043Return floating-point results in ac0 (fr0 in Unix assembler syntax). 11044 11045@item -mno-ac0 11046@opindex mno-ac0 11047Return floating-point results in memory. This is the default. 11048 11049@item -m40 11050@opindex m40 11051Generate code for a PDP-11/40. 11052 11053@item -m45 11054@opindex m45 11055Generate code for a PDP-11/45. This is the default. 11056 11057@item -m10 11058@opindex m10 11059Generate code for a PDP-11/10. 11060 11061@item -mbcopy-builtin 11062@opindex bcopy-builtin 11063Use inline @code{movmemhi} patterns for copying memory. This is the 11064default. 11065 11066@item -mbcopy 11067@opindex mbcopy 11068Do not use inline @code{movmemhi} patterns for copying memory. 11069 11070@item -mint16 11071@itemx -mno-int32 11072@opindex mint16 11073@opindex mno-int32 11074Use 16-bit @code{int}. This is the default. 11075 11076@item -mint32 11077@itemx -mno-int16 11078@opindex mint32 11079@opindex mno-int16 11080Use 32-bit @code{int}. 11081 11082@item -mfloat64 11083@itemx -mno-float32 11084@opindex mfloat64 11085@opindex mno-float32 11086Use 64-bit @code{float}. This is the default. 11087 11088@item -mfloat32 11089@itemx -mno-float64 11090@opindex mfloat32 11091@opindex mno-float64 11092Use 32-bit @code{float}. 11093 11094@item -mabshi 11095@opindex mabshi 11096Use @code{abshi2} pattern. This is the default. 11097 11098@item -mno-abshi 11099@opindex mno-abshi 11100Do not use @code{abshi2} pattern. 11101 11102@item -mbranch-expensive 11103@opindex mbranch-expensive 11104Pretend that branches are expensive. This is for experimenting with 11105code generation only. 11106 11107@item -mbranch-cheap 11108@opindex mbranch-cheap 11109Do not pretend that branches are expensive. This is the default. 11110 11111@item -msplit 11112@opindex msplit 11113Generate code for a system with split I&D@. 11114 11115@item -mno-split 11116@opindex mno-split 11117Generate code for a system without split I&D@. This is the default. 11118 11119@item -munix-asm 11120@opindex munix-asm 11121Use Unix assembler syntax. This is the default when configured for 11122@samp{pdp11-*-bsd}. 11123 11124@item -mdec-asm 11125@opindex mdec-asm 11126Use DEC assembler syntax. This is the default when configured for any 11127PDP-11 target other than @samp{pdp11-*-bsd}. 11128@end table 11129 11130@node PowerPC Options 11131@subsection PowerPC Options 11132@cindex PowerPC options 11133 11134These are listed under @xref{RS/6000 and PowerPC Options}. 11135 11136@node RS/6000 and PowerPC Options 11137@subsection IBM RS/6000 and PowerPC Options 11138@cindex RS/6000 and PowerPC Options 11139@cindex IBM RS/6000 and PowerPC Options 11140 11141These @samp{-m} options are defined for the IBM RS/6000 and PowerPC: 11142@table @gcctabopt 11143@item -mpower 11144@itemx -mno-power 11145@itemx -mpower2 11146@itemx -mno-power2 11147@itemx -mpowerpc 11148@itemx -mno-powerpc 11149@itemx -mpowerpc-gpopt 11150@itemx -mno-powerpc-gpopt 11151@itemx -mpowerpc-gfxopt 11152@itemx -mno-powerpc-gfxopt 11153@itemx -mpowerpc64 11154@itemx -mno-powerpc64 11155@itemx -mmfcrf 11156@itemx -mno-mfcrf 11157@itemx -mpopcntb 11158@itemx -mno-popcntb 11159@itemx -mfprnd 11160@itemx -mno-fprnd 11161@opindex mpower 11162@opindex mno-power 11163@opindex mpower2 11164@opindex mno-power2 11165@opindex mpowerpc 11166@opindex mno-powerpc 11167@opindex mpowerpc-gpopt 11168@opindex mno-powerpc-gpopt 11169@opindex mpowerpc-gfxopt 11170@opindex mno-powerpc-gfxopt 11171@opindex mpowerpc64 11172@opindex mno-powerpc64 11173@opindex mmfcrf 11174@opindex mno-mfcrf 11175@opindex mpopcntb 11176@opindex mno-popcntb 11177@opindex mfprnd 11178@opindex mno-fprnd 11179GCC supports two related instruction set architectures for the 11180RS/6000 and PowerPC@. The @dfn{POWER} instruction set are those 11181instructions supported by the @samp{rios} chip set used in the original 11182RS/6000 systems and the @dfn{PowerPC} instruction set is the 11183architecture of the Freescale MPC5xx, MPC6xx, MPC8xx microprocessors, and 11184the IBM 4xx, 6xx, and follow-on microprocessors. 11185 11186Neither architecture is a subset of the other. However there is a 11187large common subset of instructions supported by both. An MQ 11188register is included in processors supporting the POWER architecture. 11189 11190You use these options to specify which instructions are available on the 11191processor you are using. The default value of these options is 11192determined when configuring GCC@. Specifying the 11193@option{-mcpu=@var{cpu_type}} overrides the specification of these 11194options. We recommend you use the @option{-mcpu=@var{cpu_type}} option 11195rather than the options listed above. 11196 11197The @option{-mpower} option allows GCC to generate instructions that 11198are found only in the POWER architecture and to use the MQ register. 11199Specifying @option{-mpower2} implies @option{-power} and also allows GCC 11200to generate instructions that are present in the POWER2 architecture but 11201not the original POWER architecture. 11202 11203The @option{-mpowerpc} option allows GCC to generate instructions that 11204are found only in the 32-bit subset of the PowerPC architecture. 11205Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows 11206GCC to use the optional PowerPC architecture instructions in the 11207General Purpose group, including floating-point square root. Specifying 11208@option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to 11209use the optional PowerPC architecture instructions in the Graphics 11210group, including floating-point select. 11211 11212The @option{-mmfcrf} option allows GCC to generate the move from 11213condition register field instruction implemented on the POWER4 11214processor and other processors that support the PowerPC V2.01 11215architecture. 11216The @option{-mpopcntb} option allows GCC to generate the popcount and 11217double precision FP reciprocal estimate instruction implemented on the 11218POWER5 processor and other processors that support the PowerPC V2.02 11219architecture. 11220The @option{-mfprnd} option allows GCC to generate the FP round to 11221integer instructions implemented on the POWER5+ processor and other 11222processors that support the PowerPC V2.03 architecture. 11223 11224The @option{-mpowerpc64} option allows GCC to generate the additional 1122564-bit instructions that are found in the full PowerPC64 architecture 11226and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to 11227@option{-mno-powerpc64}. 11228 11229If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC 11230will use only the instructions in the common subset of both 11231architectures plus some special AIX common-mode calls, and will not use 11232the MQ register. Specifying both @option{-mpower} and @option{-mpowerpc} 11233permits GCC to use any instruction from either architecture and to 11234allow use of the MQ register; specify this for the Motorola MPC601. 11235 11236@item -mnew-mnemonics 11237@itemx -mold-mnemonics 11238@opindex mnew-mnemonics 11239@opindex mold-mnemonics 11240Select which mnemonics to use in the generated assembler code. With 11241@option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for 11242the PowerPC architecture. With @option{-mold-mnemonics} it uses the 11243assembler mnemonics defined for the POWER architecture. Instructions 11244defined in only one architecture have only one mnemonic; GCC uses that 11245mnemonic irrespective of which of these options is specified. 11246 11247GCC defaults to the mnemonics appropriate for the architecture in 11248use. Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the 11249value of these option. Unless you are building a cross-compiler, you 11250should normally not specify either @option{-mnew-mnemonics} or 11251@option{-mold-mnemonics}, but should instead accept the default. 11252 11253@item -mcpu=@var{cpu_type} 11254@opindex mcpu 11255Set architecture type, register usage, choice of mnemonics, and 11256instruction scheduling parameters for machine type @var{cpu_type}. 11257Supported values for @var{cpu_type} are @samp{401}, @samp{403}, 11258@samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{505}, 11259@samp{601}, @samp{602}, @samp{603}, @samp{603e}, @samp{604}, 11260@samp{604e}, @samp{620}, @samp{630}, @samp{740}, @samp{7400}, 11261@samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823}, 11262@samp{860}, @samp{970}, @samp{8540}, @samp{ec603e}, @samp{G3}, 11263@samp{G4}, @samp{G5}, @samp{power}, @samp{power2}, @samp{power3}, 11264@samp{power4}, @samp{power5}, @samp{power5+}, @samp{power6}, 11265@samp{common}, @samp{powerpc}, @samp{powerpc64}, 11266@samp{rios}, @samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64}. 11267 11268@option{-mcpu=common} selects a completely generic processor. Code 11269generated under this option will run on any POWER or PowerPC processor. 11270GCC will use only the instructions in the common subset of both 11271architectures, and will not use the MQ register. GCC assumes a generic 11272processor model for scheduling purposes. 11273 11274@option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and 11275@option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit 11276PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine 11277types, with an appropriate, generic processor model assumed for 11278scheduling purposes. 11279 11280The other options specify a specific processor. Code generated under 11281those options will run best on that processor, and may not run at all on 11282others. 11283 11284The @option{-mcpu} options automatically enable or disable the 11285following options: @option{-maltivec}, @option{-mfprnd}, 11286@option{-mhard-float}, @option{-mmfcrf}, @option{-mmultiple}, 11287@option{-mnew-mnemonics}, @option{-mpopcntb}, @option{-mpower}, 11288@option{-mpower2}, @option{-mpowerpc64}, @option{-mpowerpc-gpopt}, 11289@option{-mpowerpc-gfxopt}, @option{-mstring}, @option{-mmulhw}, @option{-mdlmzb}. 11290The particular options 11291set for any particular CPU will vary between compiler versions, 11292depending on what setting seems to produce optimal code for that CPU; 11293it doesn't necessarily reflect the actual hardware's capabilities. If 11294you wish to set an individual option to a particular value, you may 11295specify it after the @option{-mcpu} option, like @samp{-mcpu=970 11296-mno-altivec}. 11297 11298On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are 11299not enabled or disabled by the @option{-mcpu} option at present because 11300AIX does not have full support for these options. You may still 11301enable or disable them individually if you're sure it'll work in your 11302environment. 11303 11304@item -mtune=@var{cpu_type} 11305@opindex mtune 11306Set the instruction scheduling parameters for machine type 11307@var{cpu_type}, but do not set the architecture type, register usage, or 11308choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would. The same 11309values for @var{cpu_type} are used for @option{-mtune} as for 11310@option{-mcpu}. If both are specified, the code generated will use the 11311architecture, registers, and mnemonics set by @option{-mcpu}, but the 11312scheduling parameters set by @option{-mtune}. 11313 11314@item -mswdiv 11315@itemx -mno-swdiv 11316@opindex mswdiv 11317@opindex mno-swdiv 11318Generate code to compute division as reciprocal estimate and iterative 11319refinement, creating opportunities for increased throughput. This 11320feature requires: optional PowerPC Graphics instruction set for single 11321precision and FRE instruction for double precision, assuming divides 11322cannot generate user-visible traps, and the domain values not include 11323Infinities, denormals or zero denominator. 11324 11325@item -maltivec 11326@itemx -mno-altivec 11327@opindex maltivec 11328@opindex mno-altivec 11329Generate code that uses (does not use) AltiVec instructions, and also 11330enable the use of built-in functions that allow more direct access to 11331the AltiVec instruction set. You may also need to set 11332@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI 11333enhancements. 11334 11335@item -mvrsave 11336@item -mno-vrsave 11337@opindex mvrsave 11338@opindex mno-vrsave 11339Generate VRSAVE instructions when generating AltiVec code. 11340 11341@item -msecure-plt 11342@opindex msecure-plt 11343Generate code that allows ld and ld.so to build executables and shared 11344libraries with non-exec .plt and .got sections. This is a PowerPC 1134532-bit SYSV ABI option. 11346 11347@item -mbss-plt 11348@opindex mbss-plt 11349Generate code that uses a BSS .plt section that ld.so fills in, and 11350requires .plt and .got sections that are both writable and executable. 11351This is a PowerPC 32-bit SYSV ABI option. 11352 11353@item -misel 11354@itemx -mno-isel 11355@opindex misel 11356@opindex mno-isel 11357This switch enables or disables the generation of ISEL instructions. 11358 11359@item -misel=@var{yes/no} 11360This switch has been deprecated. Use @option{-misel} and 11361@option{-mno-isel} instead. 11362 11363@item -mspe 11364@itemx -mno-spe 11365@opindex mspe 11366@opindex mno-spe 11367This switch enables or disables the generation of SPE simd 11368instructions. 11369 11370@item -mspe=@var{yes/no} 11371This option has been deprecated. Use @option{-mspe} and 11372@option{-mno-spe} instead. 11373 11374@item -mfloat-gprs=@var{yes/single/double/no} 11375@itemx -mfloat-gprs 11376@opindex mfloat-gprs 11377This switch enables or disables the generation of floating point 11378operations on the general purpose registers for architectures that 11379support it. 11380 11381The argument @var{yes} or @var{single} enables the use of 11382single-precision floating point operations. 11383 11384The argument @var{double} enables the use of single and 11385double-precision floating point operations. 11386 11387The argument @var{no} disables floating point operations on the 11388general purpose registers. 11389 11390This option is currently only available on the MPC854x. 11391 11392@item -m32 11393@itemx -m64 11394@opindex m32 11395@opindex m64 11396Generate code for 32-bit or 64-bit environments of Darwin and SVR4 11397targets (including GNU/Linux). The 32-bit environment sets int, long 11398and pointer to 32 bits and generates code that runs on any PowerPC 11399variant. The 64-bit environment sets int to 32 bits and long and 11400pointer to 64 bits, and generates code for PowerPC64, as for 11401@option{-mpowerpc64}. 11402 11403@item -mfull-toc 11404@itemx -mno-fp-in-toc 11405@itemx -mno-sum-in-toc 11406@itemx -mminimal-toc 11407@opindex mfull-toc 11408@opindex mno-fp-in-toc 11409@opindex mno-sum-in-toc 11410@opindex mminimal-toc 11411Modify generation of the TOC (Table Of Contents), which is created for 11412every executable file. The @option{-mfull-toc} option is selected by 11413default. In that case, GCC will allocate at least one TOC entry for 11414each unique non-automatic variable reference in your program. GCC 11415will also place floating-point constants in the TOC@. However, only 1141616,384 entries are available in the TOC@. 11417 11418If you receive a linker error message that saying you have overflowed 11419the available TOC space, you can reduce the amount of TOC space used 11420with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options. 11421@option{-mno-fp-in-toc} prevents GCC from putting floating-point 11422constants in the TOC and @option{-mno-sum-in-toc} forces GCC to 11423generate code to calculate the sum of an address and a constant at 11424run-time instead of putting that sum into the TOC@. You may specify one 11425or both of these options. Each causes GCC to produce very slightly 11426slower and larger code at the expense of conserving TOC space. 11427 11428If you still run out of space in the TOC even when you specify both of 11429these options, specify @option{-mminimal-toc} instead. This option causes 11430GCC to make only one TOC entry for every file. When you specify this 11431option, GCC will produce code that is slower and larger but which 11432uses extremely little TOC space. You may wish to use this option 11433only on files that contain less frequently executed code. 11434 11435@item -maix64 11436@itemx -maix32 11437@opindex maix64 11438@opindex maix32 11439Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit 11440@code{long} type, and the infrastructure needed to support them. 11441Specifying @option{-maix64} implies @option{-mpowerpc64} and 11442@option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and 11443implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}. 11444 11445@item -mxl-compat 11446@itemx -mno-xl-compat 11447@opindex mxl-compat 11448@opindex mno-xl-compat 11449Produce code that conforms more closely to IBM XL compiler semantics 11450when using AIX-compatible ABI. Pass floating-point arguments to 11451prototyped functions beyond the register save area (RSA) on the stack 11452in addition to argument FPRs. Do not assume that most significant 11453double in 128-bit long double value is properly rounded when comparing 11454values and converting to double. Use XL symbol names for long double 11455support routines. 11456 11457The AIX calling convention was extended but not initially documented to 11458handle an obscure K&R C case of calling a function that takes the 11459address of its arguments with fewer arguments than declared. IBM XL 11460compilers access floating point arguments which do not fit in the 11461RSA from the stack when a subroutine is compiled without 11462optimization. Because always storing floating-point arguments on the 11463stack is inefficient and rarely needed, this option is not enabled by 11464default and only is necessary when calling subroutines compiled by IBM 11465XL compilers without optimization. 11466 11467@item -mpe 11468@opindex mpe 11469Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an 11470application written to use message passing with special startup code to 11471enable the application to run. The system must have PE installed in the 11472standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file 11473must be overridden with the @option{-specs=} option to specify the 11474appropriate directory location. The Parallel Environment does not 11475support threads, so the @option{-mpe} option and the @option{-pthread} 11476option are incompatible. 11477 11478@item -malign-natural 11479@itemx -malign-power 11480@opindex malign-natural 11481@opindex malign-power 11482On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option 11483@option{-malign-natural} overrides the ABI-defined alignment of larger 11484types, such as floating-point doubles, on their natural size-based boundary. 11485The option @option{-malign-power} instructs GCC to follow the ABI-specified 11486alignment rules. GCC defaults to the standard alignment defined in the ABI@. 11487 11488On 64-bit Darwin, natural alignment is the default, and @option{-malign-power} 11489is not supported. 11490 11491@item -msoft-float 11492@itemx -mhard-float 11493@opindex msoft-float 11494@opindex mhard-float 11495Generate code that does not use (uses) the floating-point register set. 11496Software floating point emulation is provided if you use the 11497@option{-msoft-float} option, and pass the option to GCC when linking. 11498 11499@item -mmultiple 11500@itemx -mno-multiple 11501@opindex mmultiple 11502@opindex mno-multiple 11503Generate code that uses (does not use) the load multiple word 11504instructions and the store multiple word instructions. These 11505instructions are generated by default on POWER systems, and not 11506generated on PowerPC systems. Do not use @option{-mmultiple} on little 11507endian PowerPC systems, since those instructions do not work when the 11508processor is in little endian mode. The exceptions are PPC740 and 11509PPC750 which permit the instructions usage in little endian mode. 11510 11511@item -mstring 11512@itemx -mno-string 11513@opindex mstring 11514@opindex mno-string 11515Generate code that uses (does not use) the load string instructions 11516and the store string word instructions to save multiple registers and 11517do small block moves. These instructions are generated by default on 11518POWER systems, and not generated on PowerPC systems. Do not use 11519@option{-mstring} on little endian PowerPC systems, since those 11520instructions do not work when the processor is in little endian mode. 11521The exceptions are PPC740 and PPC750 which permit the instructions 11522usage in little endian mode. 11523 11524@item -mupdate 11525@itemx -mno-update 11526@opindex mupdate 11527@opindex mno-update 11528Generate code that uses (does not use) the load or store instructions 11529that update the base register to the address of the calculated memory 11530location. These instructions are generated by default. If you use 11531@option{-mno-update}, there is a small window between the time that the 11532stack pointer is updated and the address of the previous frame is 11533stored, which means code that walks the stack frame across interrupts or 11534signals may get corrupted data. 11535 11536@item -mfused-madd 11537@itemx -mno-fused-madd 11538@opindex mfused-madd 11539@opindex mno-fused-madd 11540Generate code that uses (does not use) the floating point multiply and 11541accumulate instructions. These instructions are generated by default if 11542hardware floating is used. 11543 11544@item -mmulhw 11545@itemx -mno-mulhw 11546@opindex mmulhw 11547@opindex mno-mulhw 11548Generate code that uses (does not use) the half-word multiply and 11549multiply-accumulate instructions on the IBM 405 and 440 processors. 11550These instructions are generated by default when targetting those 11551processors. 11552 11553@item -mdlmzb 11554@itemx -mno-dlmzb 11555@opindex mdlmzb 11556@opindex mno-dlmzb 11557Generate code that uses (does not use) the string-search @samp{dlmzb} 11558instruction on the IBM 405 and 440 processors. This instruction is 11559generated by default when targetting those processors. 11560 11561@item -mno-bit-align 11562@itemx -mbit-align 11563@opindex mno-bit-align 11564@opindex mbit-align 11565On System V.4 and embedded PowerPC systems do not (do) force structures 11566and unions that contain bit-fields to be aligned to the base type of the 11567bit-field. 11568 11569For example, by default a structure containing nothing but 8 11570@code{unsigned} bit-fields of length 1 would be aligned to a 4 byte 11571boundary and have a size of 4 bytes. By using @option{-mno-bit-align}, 11572the structure would be aligned to a 1 byte boundary and be one byte in 11573size. 11574 11575@item -mno-strict-align 11576@itemx -mstrict-align 11577@opindex mno-strict-align 11578@opindex mstrict-align 11579On System V.4 and embedded PowerPC systems do not (do) assume that 11580unaligned memory references will be handled by the system. 11581 11582@item -mrelocatable 11583@itemx -mno-relocatable 11584@opindex mrelocatable 11585@opindex mno-relocatable 11586On embedded PowerPC systems generate code that allows (does not allow) 11587the program to be relocated to a different address at runtime. If you 11588use @option{-mrelocatable} on any module, all objects linked together must 11589be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}. 11590 11591@item -mrelocatable-lib 11592@itemx -mno-relocatable-lib 11593@opindex mrelocatable-lib 11594@opindex mno-relocatable-lib 11595On embedded PowerPC systems generate code that allows (does not allow) 11596the program to be relocated to a different address at runtime. Modules 11597compiled with @option{-mrelocatable-lib} can be linked with either modules 11598compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or 11599with modules compiled with the @option{-mrelocatable} options. 11600 11601@item -mno-toc 11602@itemx -mtoc 11603@opindex mno-toc 11604@opindex mtoc 11605On System V.4 and embedded PowerPC systems do not (do) assume that 11606register 2 contains a pointer to a global area pointing to the addresses 11607used in the program. 11608 11609@item -mlittle 11610@itemx -mlittle-endian 11611@opindex mlittle 11612@opindex mlittle-endian 11613On System V.4 and embedded PowerPC systems compile code for the 11614processor in little endian mode. The @option{-mlittle-endian} option is 11615the same as @option{-mlittle}. 11616 11617@item -mbig 11618@itemx -mbig-endian 11619@opindex mbig 11620@opindex mbig-endian 11621On System V.4 and embedded PowerPC systems compile code for the 11622processor in big endian mode. The @option{-mbig-endian} option is 11623the same as @option{-mbig}. 11624 11625@item -mdynamic-no-pic 11626@opindex mdynamic-no-pic 11627On Darwin and Mac OS X systems, compile code so that it is not 11628relocatable, but that its external references are relocatable. The 11629resulting code is suitable for applications, but not shared 11630libraries. 11631 11632@item -mprioritize-restricted-insns=@var{priority} 11633@opindex mprioritize-restricted-insns 11634This option controls the priority that is assigned to 11635dispatch-slot restricted instructions during the second scheduling 11636pass. The argument @var{priority} takes the value @var{0/1/2} to assign 11637@var{no/highest/second-highest} priority to dispatch slot restricted 11638instructions. 11639 11640@item -msched-costly-dep=@var{dependence_type} 11641@opindex msched-costly-dep 11642This option controls which dependences are considered costly 11643by the target during instruction scheduling. The argument 11644@var{dependence_type} takes one of the following values: 11645@var{no}: no dependence is costly, 11646@var{all}: all dependences are costly, 11647@var{true_store_to_load}: a true dependence from store to load is costly, 11648@var{store_to_load}: any dependence from store to load is costly, 11649@var{number}: any dependence which latency >= @var{number} is costly. 11650 11651@item -minsert-sched-nops=@var{scheme} 11652@opindex minsert-sched-nops 11653This option controls which nop insertion scheme will be used during 11654the second scheduling pass. The argument @var{scheme} takes one of the 11655following values: 11656@var{no}: Don't insert nops. 11657@var{pad}: Pad with nops any dispatch group which has vacant issue slots, 11658according to the scheduler's grouping. 11659@var{regroup_exact}: Insert nops to force costly dependent insns into 11660separate groups. Insert exactly as many nops as needed to force an insn 11661to a new group, according to the estimated processor grouping. 11662@var{number}: Insert nops to force costly dependent insns into 11663separate groups. Insert @var{number} nops to force an insn to a new group. 11664 11665@item -mcall-sysv 11666@opindex mcall-sysv 11667On System V.4 and embedded PowerPC systems compile code using calling 11668conventions that adheres to the March 1995 draft of the System V 11669Application Binary Interface, PowerPC processor supplement. This is the 11670default unless you configured GCC using @samp{powerpc-*-eabiaix}. 11671 11672@item -mcall-sysv-eabi 11673@opindex mcall-sysv-eabi 11674Specify both @option{-mcall-sysv} and @option{-meabi} options. 11675 11676@item -mcall-sysv-noeabi 11677@opindex mcall-sysv-noeabi 11678Specify both @option{-mcall-sysv} and @option{-mno-eabi} options. 11679 11680@item -mcall-solaris 11681@opindex mcall-solaris 11682On System V.4 and embedded PowerPC systems compile code for the Solaris 11683operating system. 11684 11685@item -mcall-linux 11686@opindex mcall-linux 11687On System V.4 and embedded PowerPC systems compile code for the 11688Linux-based GNU system. 11689 11690@item -mcall-gnu 11691@opindex mcall-gnu 11692On System V.4 and embedded PowerPC systems compile code for the 11693Hurd-based GNU system. 11694 11695@item -mcall-netbsd 11696@opindex mcall-netbsd 11697On System V.4 and embedded PowerPC systems compile code for the 11698NetBSD operating system. 11699 11700@item -maix-struct-return 11701@opindex maix-struct-return 11702Return all structures in memory (as specified by the AIX ABI)@. 11703 11704@item -msvr4-struct-return 11705@opindex msvr4-struct-return 11706Return structures smaller than 8 bytes in registers (as specified by the 11707SVR4 ABI)@. 11708 11709@item -mabi=@var{abi-type} 11710@opindex mabi 11711Extend the current ABI with a particular extension, or remove such extension. 11712Valid values are @var{altivec}, @var{no-altivec}, @var{spe}, 11713@var{no-spe}, @var{ibmlongdouble}, @var{ieeelongdouble}@. 11714 11715@item -mabi=spe 11716@opindex mabi=spe 11717Extend the current ABI with SPE ABI extensions. This does not change 11718the default ABI, instead it adds the SPE ABI extensions to the current 11719ABI@. 11720 11721@item -mabi=no-spe 11722@opindex mabi=no-spe 11723Disable Booke SPE ABI extensions for the current ABI@. 11724 11725@item -mabi=ibmlongdouble 11726@opindex mabi=ibmlongdouble 11727Change the current ABI to use IBM extended precision long double. 11728This is a PowerPC 32-bit SYSV ABI option. 11729 11730@item -mabi=ieeelongdouble 11731@opindex mabi=ieeelongdouble 11732Change the current ABI to use IEEE extended precision long double. 11733This is a PowerPC 32-bit Linux ABI option. 11734 11735@item -mprototype 11736@itemx -mno-prototype 11737@opindex mprototype 11738@opindex mno-prototype 11739On System V.4 and embedded PowerPC systems assume that all calls to 11740variable argument functions are properly prototyped. Otherwise, the 11741compiler must insert an instruction before every non prototyped call to 11742set or clear bit 6 of the condition code register (@var{CR}) to 11743indicate whether floating point values were passed in the floating point 11744registers in case the function takes a variable arguments. With 11745@option{-mprototype}, only calls to prototyped variable argument functions 11746will set or clear the bit. 11747 11748@item -msim 11749@opindex msim 11750On embedded PowerPC systems, assume that the startup module is called 11751@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and 11752@file{libc.a}. This is the default for @samp{powerpc-*-eabisim}. 11753configurations. 11754 11755@item -mmvme 11756@opindex mmvme 11757On embedded PowerPC systems, assume that the startup module is called 11758@file{crt0.o} and the standard C libraries are @file{libmvme.a} and 11759@file{libc.a}. 11760 11761@item -mads 11762@opindex mads 11763On embedded PowerPC systems, assume that the startup module is called 11764@file{crt0.o} and the standard C libraries are @file{libads.a} and 11765@file{libc.a}. 11766 11767@item -myellowknife 11768@opindex myellowknife 11769On embedded PowerPC systems, assume that the startup module is called 11770@file{crt0.o} and the standard C libraries are @file{libyk.a} and 11771@file{libc.a}. 11772 11773@item -mvxworks 11774@opindex mvxworks 11775On System V.4 and embedded PowerPC systems, specify that you are 11776compiling for a VxWorks system. 11777 11778@item -mwindiss 11779@opindex mwindiss 11780Specify that you are compiling for the WindISS simulation environment. 11781 11782@item -memb 11783@opindex memb 11784On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags 11785header to indicate that @samp{eabi} extended relocations are used. 11786 11787@item -meabi 11788@itemx -mno-eabi 11789@opindex meabi 11790@opindex mno-eabi 11791On System V.4 and embedded PowerPC systems do (do not) adhere to the 11792Embedded Applications Binary Interface (eabi) which is a set of 11793modifications to the System V.4 specifications. Selecting @option{-meabi} 11794means that the stack is aligned to an 8 byte boundary, a function 11795@code{__eabi} is called to from @code{main} to set up the eabi 11796environment, and the @option{-msdata} option can use both @code{r2} and 11797@code{r13} to point to two separate small data areas. Selecting 11798@option{-mno-eabi} means that the stack is aligned to a 16 byte boundary, 11799do not call an initialization function from @code{main}, and the 11800@option{-msdata} option will only use @code{r13} to point to a single 11801small data area. The @option{-meabi} option is on by default if you 11802configured GCC using one of the @samp{powerpc*-*-eabi*} options. 11803 11804@item -msdata=eabi 11805@opindex msdata=eabi 11806On System V.4 and embedded PowerPC systems, put small initialized 11807@code{const} global and static data in the @samp{.sdata2} section, which 11808is pointed to by register @code{r2}. Put small initialized 11809non-@code{const} global and static data in the @samp{.sdata} section, 11810which is pointed to by register @code{r13}. Put small uninitialized 11811global and static data in the @samp{.sbss} section, which is adjacent to 11812the @samp{.sdata} section. The @option{-msdata=eabi} option is 11813incompatible with the @option{-mrelocatable} option. The 11814@option{-msdata=eabi} option also sets the @option{-memb} option. 11815 11816@item -msdata=sysv 11817@opindex msdata=sysv 11818On System V.4 and embedded PowerPC systems, put small global and static 11819data in the @samp{.sdata} section, which is pointed to by register 11820@code{r13}. Put small uninitialized global and static data in the 11821@samp{.sbss} section, which is adjacent to the @samp{.sdata} section. 11822The @option{-msdata=sysv} option is incompatible with the 11823@option{-mrelocatable} option. 11824 11825@item -msdata=default 11826@itemx -msdata 11827@opindex msdata=default 11828@opindex msdata 11829On System V.4 and embedded PowerPC systems, if @option{-meabi} is used, 11830compile code the same as @option{-msdata=eabi}, otherwise compile code the 11831same as @option{-msdata=sysv}. 11832 11833@item -msdata-data 11834@opindex msdata-data 11835On System V.4 and embedded PowerPC systems, put small global 11836data in the @samp{.sdata} section. Put small uninitialized global 11837data in the @samp{.sbss} section. Do not use register @code{r13} 11838to address small data however. This is the default behavior unless 11839other @option{-msdata} options are used. 11840 11841@item -msdata=none 11842@itemx -mno-sdata 11843@opindex msdata=none 11844@opindex mno-sdata 11845On embedded PowerPC systems, put all initialized global and static data 11846in the @samp{.data} section, and all uninitialized data in the 11847@samp{.bss} section. 11848 11849@item -G @var{num} 11850@opindex G 11851@cindex smaller data references (PowerPC) 11852@cindex .sdata/.sdata2 references (PowerPC) 11853On embedded PowerPC systems, put global and static items less than or 11854equal to @var{num} bytes into the small data or bss sections instead of 11855the normal data or bss section. By default, @var{num} is 8. The 11856@option{-G @var{num}} switch is also passed to the linker. 11857All modules should be compiled with the same @option{-G @var{num}} value. 11858 11859@item -mregnames 11860@itemx -mno-regnames 11861@opindex mregnames 11862@opindex mno-regnames 11863On System V.4 and embedded PowerPC systems do (do not) emit register 11864names in the assembly language output using symbolic forms. 11865 11866@item -mlongcall 11867@itemx -mno-longcall 11868@opindex mlongcall 11869@opindex mno-longcall 11870By default assume that all calls are far away so that a longer more 11871expensive calling sequence is required. This is required for calls 11872further than 32 megabytes (33,554,432 bytes) from the current location. 11873A short call will be generated if the compiler knows 11874the call cannot be that far away. This setting can be overridden by 11875the @code{shortcall} function attribute, or by @code{#pragma 11876longcall(0)}. 11877 11878Some linkers are capable of detecting out-of-range calls and generating 11879glue code on the fly. On these systems, long calls are unnecessary and 11880generate slower code. As of this writing, the AIX linker can do this, 11881as can the GNU linker for PowerPC/64. It is planned to add this feature 11882to the GNU linker for 32-bit PowerPC systems as well. 11883 11884On Darwin/PPC systems, @code{#pragma longcall} will generate ``jbsr 11885callee, L42'', plus a ``branch island'' (glue code). The two target 11886addresses represent the callee and the ``branch island''. The 11887Darwin/PPC linker will prefer the first address and generate a ``bl 11888callee'' if the PPC ``bl'' instruction will reach the callee directly; 11889otherwise, the linker will generate ``bl L42'' to call the ``branch 11890island''. The ``branch island'' is appended to the body of the 11891calling function; it computes the full 32-bit address of the callee 11892and jumps to it. 11893 11894On Mach-O (Darwin) systems, this option directs the compiler emit to 11895the glue for every direct call, and the Darwin linker decides whether 11896to use or discard it. 11897 11898In the future, we may cause GCC to ignore all longcall specifications 11899when the linker is known to generate glue. 11900 11901@item -pthread 11902@opindex pthread 11903Adds support for multithreading with the @dfn{pthreads} library. 11904This option sets flags for both the preprocessor and linker. 11905 11906@end table 11907 11908@node S/390 and zSeries Options 11909@subsection S/390 and zSeries Options 11910@cindex S/390 and zSeries Options 11911 11912These are the @samp{-m} options defined for the S/390 and zSeries architecture. 11913 11914@table @gcctabopt 11915@item -mhard-float 11916@itemx -msoft-float 11917@opindex mhard-float 11918@opindex msoft-float 11919Use (do not use) the hardware floating-point instructions and registers 11920for floating-point operations. When @option{-msoft-float} is specified, 11921functions in @file{libgcc.a} will be used to perform floating-point 11922operations. When @option{-mhard-float} is specified, the compiler 11923generates IEEE floating-point instructions. This is the default. 11924 11925@item -mlong-double-64 11926@itemx -mlong-double-128 11927@opindex mlong-double-64 11928@opindex mlong-double-128 11929These switches control the size of @code{long double} type. A size 11930of 64bit makes the @code{long double} type equivalent to the @code{double} 11931type. This is the default. 11932 11933@item -mbackchain 11934@itemx -mno-backchain 11935@opindex mbackchain 11936@opindex mno-backchain 11937Store (do not store) the address of the caller's frame as backchain pointer 11938into the callee's stack frame. 11939A backchain may be needed to allow debugging using tools that do not understand 11940DWARF-2 call frame information. 11941When @option{-mno-packed-stack} is in effect, the backchain pointer is stored 11942at the bottom of the stack frame; when @option{-mpacked-stack} is in effect, 11943the backchain is placed into the topmost word of the 96/160 byte register 11944save area. 11945 11946In general, code compiled with @option{-mbackchain} is call-compatible with 11947code compiled with @option{-mmo-backchain}; however, use of the backchain 11948for debugging purposes usually requires that the whole binary is built with 11949@option{-mbackchain}. Note that the combination of @option{-mbackchain}, 11950@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order 11951to build a linux kernel use @option{-msoft-float}. 11952 11953The default is to not maintain the backchain. 11954 11955@item -mpacked-stack 11956@item -mno-packed-stack 11957@opindex mpacked-stack 11958@opindex mno-packed-stack 11959Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is 11960specified, the compiler uses the all fields of the 96/160 byte register save 11961area only for their default purpose; unused fields still take up stack space. 11962When @option{-mpacked-stack} is specified, register save slots are densely 11963packed at the top of the register save area; unused space is reused for other 11964purposes, allowing for more efficient use of the available stack space. 11965However, when @option{-mbackchain} is also in effect, the topmost word of 11966the save area is always used to store the backchain, and the return address 11967register is always saved two words below the backchain. 11968 11969As long as the stack frame backchain is not used, code generated with 11970@option{-mpacked-stack} is call-compatible with code generated with 11971@option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for 11972S/390 or zSeries generated code that uses the stack frame backchain at run 11973time, not just for debugging purposes. Such code is not call-compatible 11974with code compiled with @option{-mpacked-stack}. Also, note that the 11975combination of @option{-mbackchain}, 11976@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order 11977to build a linux kernel use @option{-msoft-float}. 11978 11979The default is to not use the packed stack layout. 11980 11981@item -msmall-exec 11982@itemx -mno-small-exec 11983@opindex msmall-exec 11984@opindex mno-small-exec 11985Generate (or do not generate) code using the @code{bras} instruction 11986to do subroutine calls. 11987This only works reliably if the total executable size does not 11988exceed 64k. The default is to use the @code{basr} instruction instead, 11989which does not have this limitation. 11990 11991@item -m64 11992@itemx -m31 11993@opindex m64 11994@opindex m31 11995When @option{-m31} is specified, generate code compliant to the 11996GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate 11997code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in 11998particular to generate 64-bit instructions. For the @samp{s390} 11999targets, the default is @option{-m31}, while the @samp{s390x} 12000targets default to @option{-m64}. 12001 12002@item -mzarch 12003@itemx -mesa 12004@opindex mzarch 12005@opindex mesa 12006When @option{-mzarch} is specified, generate code using the 12007instructions available on z/Architecture. 12008When @option{-mesa} is specified, generate code using the 12009instructions available on ESA/390. Note that @option{-mesa} is 12010not possible with @option{-m64}. 12011When generating code compliant to the GNU/Linux for S/390 ABI, 12012the default is @option{-mesa}. When generating code compliant 12013to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}. 12014 12015@item -mmvcle 12016@itemx -mno-mvcle 12017@opindex mmvcle 12018@opindex mno-mvcle 12019Generate (or do not generate) code using the @code{mvcle} instruction 12020to perform block moves. When @option{-mno-mvcle} is specified, 12021use a @code{mvc} loop instead. This is the default unless optimizing for 12022size. 12023 12024@item -mdebug 12025@itemx -mno-debug 12026@opindex mdebug 12027@opindex mno-debug 12028Print (or do not print) additional debug information when compiling. 12029The default is to not print debug information. 12030 12031@item -march=@var{cpu-type} 12032@opindex march 12033Generate code that will run on @var{cpu-type}, which is the name of a system 12034representing a certain processor type. Possible values for 12035@var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, and @samp{z990}. 12036When generating code using the instructions available on z/Architecture, 12037the default is @option{-march=z900}. Otherwise, the default is 12038@option{-march=g5}. 12039 12040@item -mtune=@var{cpu-type} 12041@opindex mtune 12042Tune to @var{cpu-type} everything applicable about the generated code, 12043except for the ABI and the set of available instructions. 12044The list of @var{cpu-type} values is the same as for @option{-march}. 12045The default is the value used for @option{-march}. 12046 12047@item -mtpf-trace 12048@itemx -mno-tpf-trace 12049@opindex mtpf-trace 12050@opindex mno-tpf-trace 12051Generate code that adds (does not add) in TPF OS specific branches to trace 12052routines in the operating system. This option is off by default, even 12053when compiling for the TPF OS@. 12054 12055@item -mfused-madd 12056@itemx -mno-fused-madd 12057@opindex mfused-madd 12058@opindex mno-fused-madd 12059Generate code that uses (does not use) the floating point multiply and 12060accumulate instructions. These instructions are generated by default if 12061hardware floating point is used. 12062 12063@item -mwarn-framesize=@var{framesize} 12064@opindex mwarn-framesize 12065Emit a warning if the current function exceeds the given frame size. Because 12066this is a compile time check it doesn't need to be a real problem when the program 12067runs. It is intended to identify functions which most probably cause 12068a stack overflow. It is useful to be used in an environment with limited stack 12069size e.g.@: the linux kernel. 12070 12071@item -mwarn-dynamicstack 12072@opindex mwarn-dynamicstack 12073Emit a warning if the function calls alloca or uses dynamically 12074sized arrays. This is generally a bad idea with a limited stack size. 12075 12076@item -mstack-guard=@var{stack-guard} 12077@item -mstack-size=@var{stack-size} 12078@opindex mstack-guard 12079@opindex mstack-size 12080These arguments always have to be used in conjunction. If they are present the s390 12081back end emits additional instructions in the function prologue which trigger a trap 12082if the stack size is @var{stack-guard} bytes above the @var{stack-size} 12083(remember that the stack on s390 grows downward). These options are intended to 12084be used to help debugging stack overflow problems. The additionally emitted code 12085causes only little overhead and hence can also be used in production like systems 12086without greater performance degradation. The given values have to be exact 12087powers of 2 and @var{stack-size} has to be greater than @var{stack-guard} without 12088exceeding 64k. 12089In order to be efficient the extra code makes the assumption that the stack starts 12090at an address aligned to the value given by @var{stack-size}. 12091@end table 12092 12093@node Score Options 12094@subsection Score Options 12095@cindex Score Options 12096 12097These options are defined for Score implementations: 12098 12099@table @gcctabopt 12100@item -meb 12101@opindex meb 12102Compile code for big endian mode. This is the default. 12103 12104@item -mel 12105@opindex mel 12106Compile code for little endian mode. 12107 12108@item -mnhwloop 12109@opindex mnhwloop 12110Disable generate bcnz instruction. 12111 12112@item -muls 12113@opindex muls 12114Enable generate unaligned load and store instruction. 12115 12116@item -mmac 12117@opindex mmac 12118Enable the use of multiply-accumulate instructions. Disabled by default. 12119 12120@item -mscore5 12121@opindex mscore5 12122Specify the SCORE5 as the target architecture. 12123 12124@item -mscore5u 12125@opindex mscore5u 12126Specify the SCORE5U of the target architecture. 12127 12128@item -mscore7 12129@opindex mscore7 12130Specify the SCORE7 as the target architecture. This is the default. 12131 12132@item -mscore7d 12133@opindex mscore7d 12134Specify the SCORE7D as the target architecture. 12135@end table 12136 12137@node SH Options 12138@subsection SH Options 12139 12140These @samp{-m} options are defined for the SH implementations: 12141 12142@table @gcctabopt 12143@item -m1 12144@opindex m1 12145Generate code for the SH1. 12146 12147@item -m2 12148@opindex m2 12149Generate code for the SH2. 12150 12151@item -m2e 12152Generate code for the SH2e. 12153 12154@item -m3 12155@opindex m3 12156Generate code for the SH3. 12157 12158@item -m3e 12159@opindex m3e 12160Generate code for the SH3e. 12161 12162@item -m4-nofpu 12163@opindex m4-nofpu 12164Generate code for the SH4 without a floating-point unit. 12165 12166@item -m4-single-only 12167@opindex m4-single-only 12168Generate code for the SH4 with a floating-point unit that only 12169supports single-precision arithmetic. 12170 12171@item -m4-single 12172@opindex m4-single 12173Generate code for the SH4 assuming the floating-point unit is in 12174single-precision mode by default. 12175 12176@item -m4 12177@opindex m4 12178Generate code for the SH4. 12179 12180@item -m4a-nofpu 12181@opindex m4a-nofpu 12182Generate code for the SH4al-dsp, or for a SH4a in such a way that the 12183floating-point unit is not used. 12184 12185@item -m4a-single-only 12186@opindex m4a-single-only 12187Generate code for the SH4a, in such a way that no double-precision 12188floating point operations are used. 12189 12190@item -m4a-single 12191@opindex m4a-single 12192Generate code for the SH4a assuming the floating-point unit is in 12193single-precision mode by default. 12194 12195@item -m4a 12196@opindex m4a 12197Generate code for the SH4a. 12198 12199@item -m4al 12200@opindex m4al 12201Same as @option{-m4a-nofpu}, except that it implicitly passes 12202@option{-dsp} to the assembler. GCC doesn't generate any DSP 12203instructions at the moment. 12204 12205@item -mb 12206@opindex mb 12207Compile code for the processor in big endian mode. 12208 12209@item -ml 12210@opindex ml 12211Compile code for the processor in little endian mode. 12212 12213@item -mdalign 12214@opindex mdalign 12215Align doubles at 64-bit boundaries. Note that this changes the calling 12216conventions, and thus some functions from the standard C library will 12217not work unless you recompile it first with @option{-mdalign}. 12218 12219@item -mrelax 12220@opindex mrelax 12221Shorten some address references at link time, when possible; uses the 12222linker option @option{-relax}. 12223 12224@item -mbigtable 12225@opindex mbigtable 12226Use 32-bit offsets in @code{switch} tables. The default is to use 1222716-bit offsets. 12228 12229@item -mfmovd 12230@opindex mfmovd 12231Enable the use of the instruction @code{fmovd}. 12232 12233@item -mhitachi 12234@opindex mhitachi 12235Comply with the calling conventions defined by Renesas. 12236 12237@item -mrenesas 12238@opindex mhitachi 12239Comply with the calling conventions defined by Renesas. 12240 12241@item -mno-renesas 12242@opindex mhitachi 12243Comply with the calling conventions defined for GCC before the Renesas 12244conventions were available. This option is the default for all 12245targets of the SH toolchain except for @samp{sh-symbianelf}. 12246 12247@item -mnomacsave 12248@opindex mnomacsave 12249Mark the @code{MAC} register as call-clobbered, even if 12250@option{-mhitachi} is given. 12251 12252@item -mieee 12253@opindex mieee 12254Increase IEEE-compliance of floating-point code. 12255At the moment, this is equivalent to @option{-fno-finite-math-only}. 12256When generating 16 bit SH opcodes, getting IEEE-conforming results for 12257comparisons of NANs / infinities incurs extra overhead in every 12258floating point comparison, therefore the default is set to 12259@option{-ffinite-math-only}. 12260 12261@item -misize 12262@opindex misize 12263Dump instruction size and location in the assembly code. 12264 12265@item -mpadstruct 12266@opindex mpadstruct 12267This option is deprecated. It pads structures to multiple of 4 bytes, 12268which is incompatible with the SH ABI@. 12269 12270@item -mspace 12271@opindex mspace 12272Optimize for space instead of speed. Implied by @option{-Os}. 12273 12274@item -mprefergot 12275@opindex mprefergot 12276When generating position-independent code, emit function calls using 12277the Global Offset Table instead of the Procedure Linkage Table. 12278 12279@item -musermode 12280@opindex musermode 12281Generate a library function call to invalidate instruction cache 12282entries, after fixing up a trampoline. This library function call 12283doesn't assume it can write to the whole memory address space. This 12284is the default when the target is @code{sh-*-linux*}. 12285 12286@item -multcost=@var{number} 12287@opindex multcost=@var{number} 12288Set the cost to assume for a multiply insn. 12289 12290@item -mdiv=@var{strategy} 12291@opindex mdiv=@var{strategy} 12292Set the division strategy to use for SHmedia code. @var{strategy} must be 12293one of: call, call2, fp, inv, inv:minlat, inv20u, inv20l, inv:call, 12294inv:call2, inv:fp . 12295"fp" performs the operation in floating point. This has a very high latency, 12296but needs only a few instructions, so it might be a good choice if 12297your code has enough easily exploitable ILP to allow the compiler to 12298schedule the floating point instructions together with other instructions. 12299Division by zero causes a floating point exception. 12300"inv" uses integer operations to calculate the inverse of the divisor, 12301and then multiplies the dividend with the inverse. This strategy allows 12302cse and hoisting of the inverse calculation. Division by zero calculates 12303an unspecified result, but does not trap. 12304"inv:minlat" is a variant of "inv" where if no cse / hoisting opportunities 12305have been found, or if the entire operation has been hoisted to the same 12306place, the last stages of the inverse calculation are intertwined with the 12307final multiply to reduce the overall latency, at the expense of using a few 12308more instructions, and thus offering fewer scheduling opportunities with 12309other code. 12310"call" calls a library function that usually implements the inv:minlat 12311strategy. 12312This gives high code density for m5-*media-nofpu compilations. 12313"call2" uses a different entry point of the same library function, where it 12314assumes that a pointer to a lookup table has already been set up, which 12315exposes the pointer load to cse / code hoisting optimizations. 12316"inv:call", "inv:call2" and "inv:fp" all use the "inv" algorithm for initial 12317code generation, but if the code stays unoptimized, revert to the "call", 12318"call2", or "fp" strategies, respectively. Note that the 12319potentially-trapping side effect of division by zero is carried by a 12320separate instruction, so it is possible that all the integer instructions 12321are hoisted out, but the marker for the side effect stays where it is. 12322A recombination to fp operations or a call is not possible in that case. 12323"inv20u" and "inv20l" are variants of the "inv:minlat" strategy. In the case 12324that the inverse calculation was nor separated from the multiply, they speed 12325up division where the dividend fits into 20 bits (plus sign where applicable), 12326by inserting a test to skip a number of operations in this case; this test 12327slows down the case of larger dividends. inv20u assumes the case of a such 12328a small dividend to be unlikely, and inv20l assumes it to be likely. 12329 12330@item -mdivsi3_libfunc=@var{name} 12331@opindex mdivsi3_libfunc=@var{name} 12332Set the name of the library function used for 32 bit signed division to 12333@var{name}. This only affect the name used in the call and inv:call 12334division strategies, and the compiler will still expect the same 12335sets of input/output/clobbered registers as if this option was not present. 12336 12337@item -madjust-unroll 12338@opindex madjust-unroll 12339Throttle unrolling to avoid thrashing target registers. 12340This option only has an effect if the gcc code base supports the 12341TARGET_ADJUST_UNROLL_MAX target hook. 12342 12343@item -mindexed-addressing 12344@opindex mindexed-addressing 12345Enable the use of the indexed addressing mode for SHmedia32/SHcompact. 12346This is only safe if the hardware and/or OS implement 32 bit wrap-around 12347semantics for the indexed addressing mode. The architecture allows the 12348implementation of processors with 64 bit MMU, which the OS could use to 12349get 32 bit addressing, but since no current hardware implementation supports 12350this or any other way to make the indexed addressing mode safe to use in 12351the 32 bit ABI, the default is -mno-indexed-addressing. 12352 12353@item -mgettrcost=@var{number} 12354@opindex mgettrcost=@var{number} 12355Set the cost assumed for the gettr instruction to @var{number}. 12356The default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise. 12357 12358@item -mpt-fixed 12359@opindex mpt-fixed 12360Assume pt* instructions won't trap. This will generally generate better 12361scheduled code, but is unsafe on current hardware. The current architecture 12362definition says that ptabs and ptrel trap when the target anded with 3 is 3. 12363This has the unintentional effect of making it unsafe to schedule ptabs / 12364ptrel before a branch, or hoist it out of a loop. For example, 12365__do_global_ctors, a part of libgcc that runs constructors at program 12366startup, calls functions in a list which is delimited by -1. With the 12367-mpt-fixed option, the ptabs will be done before testing against -1. 12368That means that all the constructors will be run a bit quicker, but when 12369the loop comes to the end of the list, the program crashes because ptabs 12370loads -1 into a target register. Since this option is unsafe for any 12371hardware implementing the current architecture specification, the default 12372is -mno-pt-fixed. Unless the user specifies a specific cost with 12373@option{-mgettrcost}, -mno-pt-fixed also implies @option{-mgettrcost=100}; 12374this deters register allocation using target registers for storing 12375ordinary integers. 12376 12377@item -minvalid-symbols 12378@opindex minvalid-symbols 12379Assume symbols might be invalid. Ordinary function symbols generated by 12380the compiler will always be valid to load with movi/shori/ptabs or 12381movi/shori/ptrel, but with assembler and/or linker tricks it is possible 12382to generate symbols that will cause ptabs / ptrel to trap. 12383This option is only meaningful when @option{-mno-pt-fixed} is in effect. 12384It will then prevent cross-basic-block cse, hoisting and most scheduling 12385of symbol loads. The default is @option{-mno-invalid-symbols}. 12386@end table 12387 12388@node SPARC Options 12389@subsection SPARC Options 12390@cindex SPARC options 12391 12392These @samp{-m} options are supported on the SPARC: 12393 12394@table @gcctabopt 12395@item -mno-app-regs 12396@itemx -mapp-regs 12397@opindex mno-app-regs 12398@opindex mapp-regs 12399Specify @option{-mapp-regs} to generate output using the global registers 124002 through 4, which the SPARC SVR4 ABI reserves for applications. This 12401is the default. 12402 12403To be fully SVR4 ABI compliant at the cost of some performance loss, 12404specify @option{-mno-app-regs}. You should compile libraries and system 12405software with this option. 12406 12407@item -mfpu 12408@itemx -mhard-float 12409@opindex mfpu 12410@opindex mhard-float 12411Generate output containing floating point instructions. This is the 12412default. 12413 12414@item -mno-fpu 12415@itemx -msoft-float 12416@opindex mno-fpu 12417@opindex msoft-float 12418Generate output containing library calls for floating point. 12419@strong{Warning:} the requisite libraries are not available for all SPARC 12420targets. Normally the facilities of the machine's usual C compiler are 12421used, but this cannot be done directly in cross-compilation. You must make 12422your own arrangements to provide suitable library functions for 12423cross-compilation. The embedded targets @samp{sparc-*-aout} and 12424@samp{sparclite-*-*} do provide software floating point support. 12425 12426@option{-msoft-float} changes the calling convention in the output file; 12427therefore, it is only useful if you compile @emph{all} of a program with 12428this option. In particular, you need to compile @file{libgcc.a}, the 12429library that comes with GCC, with @option{-msoft-float} in order for 12430this to work. 12431 12432@item -mhard-quad-float 12433@opindex mhard-quad-float 12434Generate output containing quad-word (long double) floating point 12435instructions. 12436 12437@item -msoft-quad-float 12438@opindex msoft-quad-float 12439Generate output containing library calls for quad-word (long double) 12440floating point instructions. The functions called are those specified 12441in the SPARC ABI@. This is the default. 12442 12443As of this writing, there are no SPARC implementations that have hardware 12444support for the quad-word floating point instructions. They all invoke 12445a trap handler for one of these instructions, and then the trap handler 12446emulates the effect of the instruction. Because of the trap handler overhead, 12447this is much slower than calling the ABI library routines. Thus the 12448@option{-msoft-quad-float} option is the default. 12449 12450@item -mno-unaligned-doubles 12451@itemx -munaligned-doubles 12452@opindex mno-unaligned-doubles 12453@opindex munaligned-doubles 12454Assume that doubles have 8 byte alignment. This is the default. 12455 12456With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte 12457alignment only if they are contained in another type, or if they have an 12458absolute address. Otherwise, it assumes they have 4 byte alignment. 12459Specifying this option avoids some rare compatibility problems with code 12460generated by other compilers. It is not the default because it results 12461in a performance loss, especially for floating point code. 12462 12463@item -mno-faster-structs 12464@itemx -mfaster-structs 12465@opindex mno-faster-structs 12466@opindex mfaster-structs 12467With @option{-mfaster-structs}, the compiler assumes that structures 12468should have 8 byte alignment. This enables the use of pairs of 12469@code{ldd} and @code{std} instructions for copies in structure 12470assignment, in place of twice as many @code{ld} and @code{st} pairs. 12471However, the use of this changed alignment directly violates the SPARC 12472ABI@. Thus, it's intended only for use on targets where the developer 12473acknowledges that their resulting code will not be directly in line with 12474the rules of the ABI@. 12475 12476@item -mimpure-text 12477@opindex mimpure-text 12478@option{-mimpure-text}, used in addition to @option{-shared}, tells 12479the compiler to not pass @option{-z text} to the linker when linking a 12480shared object. Using this option, you can link position-dependent 12481code into a shared object. 12482 12483@option{-mimpure-text} suppresses the ``relocations remain against 12484allocatable but non-writable sections'' linker error message. 12485However, the necessary relocations will trigger copy-on-write, and the 12486shared object is not actually shared across processes. Instead of 12487using @option{-mimpure-text}, you should compile all source code with 12488@option{-fpic} or @option{-fPIC}. 12489 12490This option is only available on SunOS and Solaris. 12491 12492@item -mcpu=@var{cpu_type} 12493@opindex mcpu 12494Set the instruction set, register set, and instruction scheduling parameters 12495for machine type @var{cpu_type}. Supported values for @var{cpu_type} are 12496@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite}, 12497@samp{f930}, @samp{f934}, @samp{hypersparc}, @samp{sparclite86x}, 12498@samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc}, 12499@samp{ultrasparc3}, and @samp{niagara}. 12500 12501Default instruction scheduling parameters are used for values that select 12502an architecture and not an implementation. These are @samp{v7}, @samp{v8}, 12503@samp{sparclite}, @samp{sparclet}, @samp{v9}. 12504 12505Here is a list of each supported architecture and their supported 12506implementations. 12507 12508@smallexample 12509 v7: cypress 12510 v8: supersparc, hypersparc 12511 sparclite: f930, f934, sparclite86x 12512 sparclet: tsc701 12513 v9: ultrasparc, ultrasparc3, niagara 12514@end smallexample 12515 12516By default (unless configured otherwise), GCC generates code for the V7 12517variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler 12518additionally optimizes it for the Cypress CY7C602 chip, as used in the 12519SPARCStation/SPARCServer 3xx series. This is also appropriate for the older 12520SPARCStation 1, 2, IPX etc. 12521 12522With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC 12523architecture. The only difference from V7 code is that the compiler emits 12524the integer multiply and integer divide instructions which exist in SPARC-V8 12525but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally 12526optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and 125272000 series. 12528 12529With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of 12530the SPARC architecture. This adds the integer multiply, integer divide step 12531and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7. 12532With @option{-mcpu=f930}, the compiler additionally optimizes it for the 12533Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With 12534@option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu 12535MB86934 chip, which is the more recent SPARClite with FPU@. 12536 12537With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of 12538the SPARC architecture. This adds the integer multiply, multiply/accumulate, 12539integer divide step and scan (@code{ffs}) instructions which exist in SPARClet 12540but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally 12541optimizes it for the TEMIC SPARClet chip. 12542 12543With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC 12544architecture. This adds 64-bit integer and floating-point move instructions, 125453 additional floating-point condition code registers and conditional move 12546instructions. With @option{-mcpu=ultrasparc}, the compiler additionally 12547optimizes it for the Sun UltraSPARC I/II/IIi chips. With 12548@option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the 12549Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With 12550@option{-mcpu=niagara}, the compiler additionally optimizes it for 12551Sun UltraSPARC T1 chips. 12552 12553@item -mtune=@var{cpu_type} 12554@opindex mtune 12555Set the instruction scheduling parameters for machine type 12556@var{cpu_type}, but do not set the instruction set or register set that the 12557option @option{-mcpu=@var{cpu_type}} would. 12558 12559The same values for @option{-mcpu=@var{cpu_type}} can be used for 12560@option{-mtune=@var{cpu_type}}, but the only useful values are those 12561that select a particular cpu implementation. Those are @samp{cypress}, 12562@samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934}, 12563@samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc}, 12564@samp{ultrasparc3}, and @samp{niagara}. 12565 12566@item -mv8plus 12567@itemx -mno-v8plus 12568@opindex mv8plus 12569@opindex mno-v8plus 12570With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The 12571difference from the V8 ABI is that the global and out registers are 12572considered 64-bit wide. This is enabled by default on Solaris in 32-bit 12573mode for all SPARC-V9 processors. 12574 12575@item -mvis 12576@itemx -mno-vis 12577@opindex mvis 12578@opindex mno-vis 12579With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC 12580Visual Instruction Set extensions. The default is @option{-mno-vis}. 12581@end table 12582 12583These @samp{-m} options are supported in addition to the above 12584on SPARC-V9 processors in 64-bit environments: 12585 12586@table @gcctabopt 12587@item -mlittle-endian 12588@opindex mlittle-endian 12589Generate code for a processor running in little-endian mode. It is only 12590available for a few configurations and most notably not on Solaris and Linux. 12591 12592@item -m32 12593@itemx -m64 12594@opindex m32 12595@opindex m64 12596Generate code for a 32-bit or 64-bit environment. 12597The 32-bit environment sets int, long and pointer to 32 bits. 12598The 64-bit environment sets int to 32 bits and long and pointer 12599to 64 bits. 12600 12601@item -mcmodel=medlow 12602@opindex mcmodel=medlow 12603Generate code for the Medium/Low code model: 64-bit addresses, programs 12604must be linked in the low 32 bits of memory. Programs can be statically 12605or dynamically linked. 12606 12607@item -mcmodel=medmid 12608@opindex mcmodel=medmid 12609Generate code for the Medium/Middle code model: 64-bit addresses, programs 12610must be linked in the low 44 bits of memory, the text and data segments must 12611be less than 2GB in size and the data segment must be located within 2GB of 12612the text segment. 12613 12614@item -mcmodel=medany 12615@opindex mcmodel=medany 12616Generate code for the Medium/Anywhere code model: 64-bit addresses, programs 12617may be linked anywhere in memory, the text and data segments must be less 12618than 2GB in size and the data segment must be located within 2GB of the 12619text segment. 12620 12621@item -mcmodel=embmedany 12622@opindex mcmodel=embmedany 12623Generate code for the Medium/Anywhere code model for embedded systems: 1262464-bit addresses, the text and data segments must be less than 2GB in 12625size, both starting anywhere in memory (determined at link time). The 12626global register %g4 points to the base of the data segment. Programs 12627are statically linked and PIC is not supported. 12628 12629@item -mstack-bias 12630@itemx -mno-stack-bias 12631@opindex mstack-bias 12632@opindex mno-stack-bias 12633With @option{-mstack-bias}, GCC assumes that the stack pointer, and 12634frame pointer if present, are offset by @minus{}2047 which must be added back 12635when making stack frame references. This is the default in 64-bit mode. 12636Otherwise, assume no such offset is present. 12637@end table 12638 12639These switches are supported in addition to the above on Solaris: 12640 12641@table @gcctabopt 12642@item -threads 12643@opindex threads 12644Add support for multithreading using the Solaris threads library. This 12645option sets flags for both the preprocessor and linker. This option does 12646not affect the thread safety of object code produced by the compiler or 12647that of libraries supplied with it. 12648 12649@item -pthreads 12650@opindex pthreads 12651Add support for multithreading using the POSIX threads library. This 12652option sets flags for both the preprocessor and linker. This option does 12653not affect the thread safety of object code produced by the compiler or 12654that of libraries supplied with it. 12655 12656@item -pthread 12657@opindex pthread 12658This is a synonym for @option{-pthreads}. 12659@end table 12660 12661@node System V Options 12662@subsection Options for System V 12663 12664These additional options are available on System V Release 4 for 12665compatibility with other compilers on those systems: 12666 12667@table @gcctabopt 12668@item -G 12669@opindex G 12670Create a shared object. 12671It is recommended that @option{-symbolic} or @option{-shared} be used instead. 12672 12673@item -Qy 12674@opindex Qy 12675Identify the versions of each tool used by the compiler, in a 12676@code{.ident} assembler directive in the output. 12677 12678@item -Qn 12679@opindex Qn 12680Refrain from adding @code{.ident} directives to the output file (this is 12681the default). 12682 12683@item -YP,@var{dirs} 12684@opindex YP 12685Search the directories @var{dirs}, and no others, for libraries 12686specified with @option{-l}. 12687 12688@item -Ym,@var{dir} 12689@opindex Ym 12690Look in the directory @var{dir} to find the M4 preprocessor. 12691The assembler uses this option. 12692@c This is supposed to go with a -Yd for predefined M4 macro files, but 12693@c the generic assembler that comes with Solaris takes just -Ym. 12694@end table 12695 12696@node TMS320C3x/C4x Options 12697@subsection TMS320C3x/C4x Options 12698@cindex TMS320C3x/C4x Options 12699 12700These @samp{-m} options are defined for TMS320C3x/C4x implementations: 12701 12702@table @gcctabopt 12703 12704@item -mcpu=@var{cpu_type} 12705@opindex mcpu 12706Set the instruction set, register set, and instruction scheduling 12707parameters for machine type @var{cpu_type}. Supported values for 12708@var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and 12709@samp{c44}. The default is @samp{c40} to generate code for the 12710TMS320C40. 12711 12712@item -mbig-memory 12713@itemx -mbig 12714@itemx -msmall-memory 12715@itemx -msmall 12716@opindex mbig-memory 12717@opindex mbig 12718@opindex msmall-memory 12719@opindex msmall 12720Generates code for the big or small memory model. The small memory 12721model assumed that all data fits into one 64K word page. At run-time 12722the data page (DP) register must be set to point to the 64K page 12723containing the .bss and .data program sections. The big memory model is 12724the default and requires reloading of the DP register for every direct 12725memory access. 12726 12727@item -mbk 12728@itemx -mno-bk 12729@opindex mbk 12730@opindex mno-bk 12731Allow (disallow) allocation of general integer operands into the block 12732count register BK@. 12733 12734@item -mdb 12735@itemx -mno-db 12736@opindex mdb 12737@opindex mno-db 12738Enable (disable) generation of code using decrement and branch, 12739DBcond(D), instructions. This is enabled by default for the C4x. To be 12740on the safe side, this is disabled for the C3x, since the maximum 12741iteration count on the C3x is @math{2^{23} + 1} (but who iterates loops more than 12742@math{2^{23}} times on the C3x?). Note that GCC will try to reverse a loop so 12743that it can utilize the decrement and branch instruction, but will give 12744up if there is more than one memory reference in the loop. Thus a loop 12745where the loop counter is decremented can generate slightly more 12746efficient code, in cases where the RPTB instruction cannot be utilized. 12747 12748@item -mdp-isr-reload 12749@itemx -mparanoid 12750@opindex mdp-isr-reload 12751@opindex mparanoid 12752Force the DP register to be saved on entry to an interrupt service 12753routine (ISR), reloaded to point to the data section, and restored on 12754exit from the ISR@. This should not be required unless someone has 12755violated the small memory model by modifying the DP register, say within 12756an object library. 12757 12758@item -mmpyi 12759@itemx -mno-mpyi 12760@opindex mmpyi 12761@opindex mno-mpyi 12762For the C3x use the 24-bit MPYI instruction for integer multiplies 12763instead of a library call to guarantee 32-bit results. Note that if one 12764of the operands is a constant, then the multiplication will be performed 12765using shifts and adds. If the @option{-mmpyi} option is not specified for the C3x, 12766then squaring operations are performed inline instead of a library call. 12767 12768@item -mfast-fix 12769@itemx -mno-fast-fix 12770@opindex mfast-fix 12771@opindex mno-fast-fix 12772The C3x/C4x FIX instruction to convert a floating point value to an 12773integer value chooses the nearest integer less than or equal to the 12774floating point value rather than to the nearest integer. Thus if the 12775floating point number is negative, the result will be incorrectly 12776truncated an additional code is necessary to detect and correct this 12777case. This option can be used to disable generation of the additional 12778code required to correct the result. 12779 12780@item -mrptb 12781@itemx -mno-rptb 12782@opindex mrptb 12783@opindex mno-rptb 12784Enable (disable) generation of repeat block sequences using the RPTB 12785instruction for zero overhead looping. The RPTB construct is only used 12786for innermost loops that do not call functions or jump across the loop 12787boundaries. There is no advantage having nested RPTB loops due to the 12788overhead required to save and restore the RC, RS, and RE registers. 12789This is enabled by default with @option{-O2}. 12790 12791@item -mrpts=@var{count} 12792@itemx -mno-rpts 12793@opindex mrpts 12794@opindex mno-rpts 12795Enable (disable) the use of the single instruction repeat instruction 12796RPTS@. If a repeat block contains a single instruction, and the loop 12797count can be guaranteed to be less than the value @var{count}, GCC will 12798emit a RPTS instruction instead of a RPTB@. If no value is specified, 12799then a RPTS will be emitted even if the loop count cannot be determined 12800at compile time. Note that the repeated instruction following RPTS does 12801not have to be reloaded from memory each iteration, thus freeing up the 12802CPU buses for operands. However, since interrupts are blocked by this 12803instruction, it is disabled by default. 12804 12805@item -mloop-unsigned 12806@itemx -mno-loop-unsigned 12807@opindex mloop-unsigned 12808@opindex mno-loop-unsigned 12809The maximum iteration count when using RPTS and RPTB (and DB on the C40) 12810is @math{2^{31} + 1} since these instructions test if the iteration count is 12811negative to terminate the loop. If the iteration count is unsigned 12812there is a possibility than the @math{2^{31} + 1} maximum iteration count may be 12813exceeded. This switch allows an unsigned iteration count. 12814 12815@item -mti 12816@opindex mti 12817Try to emit an assembler syntax that the TI assembler (asm30) is happy 12818with. This also enforces compatibility with the API employed by the TI 12819C3x C compiler. For example, long doubles are passed as structures 12820rather than in floating point registers. 12821 12822@item -mregparm 12823@itemx -mmemparm 12824@opindex mregparm 12825@opindex mmemparm 12826Generate code that uses registers (stack) for passing arguments to functions. 12827By default, arguments are passed in registers where possible rather 12828than by pushing arguments on to the stack. 12829 12830@item -mparallel-insns 12831@itemx -mno-parallel-insns 12832@opindex mparallel-insns 12833@opindex mno-parallel-insns 12834Allow the generation of parallel instructions. This is enabled by 12835default with @option{-O2}. 12836 12837@item -mparallel-mpy 12838@itemx -mno-parallel-mpy 12839@opindex mparallel-mpy 12840@opindex mno-parallel-mpy 12841Allow the generation of MPY||ADD and MPY||SUB parallel instructions, 12842provided @option{-mparallel-insns} is also specified. These instructions have 12843tight register constraints which can pessimize the code generation 12844of large functions. 12845 12846@end table 12847 12848@node V850 Options 12849@subsection V850 Options 12850@cindex V850 Options 12851 12852These @samp{-m} options are defined for V850 implementations: 12853 12854@table @gcctabopt 12855@item -mlong-calls 12856@itemx -mno-long-calls 12857@opindex mlong-calls 12858@opindex mno-long-calls 12859Treat all calls as being far away (near). If calls are assumed to be 12860far away, the compiler will always load the functions address up into a 12861register, and call indirect through the pointer. 12862 12863@item -mno-ep 12864@itemx -mep 12865@opindex mno-ep 12866@opindex mep 12867Do not optimize (do optimize) basic blocks that use the same index 12868pointer 4 or more times to copy pointer into the @code{ep} register, and 12869use the shorter @code{sld} and @code{sst} instructions. The @option{-mep} 12870option is on by default if you optimize. 12871 12872@item -mno-prolog-function 12873@itemx -mprolog-function 12874@opindex mno-prolog-function 12875@opindex mprolog-function 12876Do not use (do use) external functions to save and restore registers 12877at the prologue and epilogue of a function. The external functions 12878are slower, but use less code space if more than one function saves 12879the same number of registers. The @option{-mprolog-function} option 12880is on by default if you optimize. 12881 12882@item -mspace 12883@opindex mspace 12884Try to make the code as small as possible. At present, this just turns 12885on the @option{-mep} and @option{-mprolog-function} options. 12886 12887@item -mtda=@var{n} 12888@opindex mtda 12889Put static or global variables whose size is @var{n} bytes or less into 12890the tiny data area that register @code{ep} points to. The tiny data 12891area can hold up to 256 bytes in total (128 bytes for byte references). 12892 12893@item -msda=@var{n} 12894@opindex msda 12895Put static or global variables whose size is @var{n} bytes or less into 12896the small data area that register @code{gp} points to. The small data 12897area can hold up to 64 kilobytes. 12898 12899@item -mzda=@var{n} 12900@opindex mzda 12901Put static or global variables whose size is @var{n} bytes or less into 12902the first 32 kilobytes of memory. 12903 12904@item -mv850 12905@opindex mv850 12906Specify that the target processor is the V850. 12907 12908@item -mbig-switch 12909@opindex mbig-switch 12910Generate code suitable for big switch tables. Use this option only if 12911the assembler/linker complain about out of range branches within a switch 12912table. 12913 12914@item -mapp-regs 12915@opindex mapp-regs 12916This option will cause r2 and r5 to be used in the code generated by 12917the compiler. This setting is the default. 12918 12919@item -mno-app-regs 12920@opindex mno-app-regs 12921This option will cause r2 and r5 to be treated as fixed registers. 12922 12923@item -mv850e1 12924@opindex mv850e1 12925Specify that the target processor is the V850E1. The preprocessor 12926constants @samp{__v850e1__} and @samp{__v850e__} will be defined if 12927this option is used. 12928 12929@item -mv850e 12930@opindex mv850e 12931Specify that the target processor is the V850E@. The preprocessor 12932constant @samp{__v850e__} will be defined if this option is used. 12933 12934If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1} 12935are defined then a default target processor will be chosen and the 12936relevant @samp{__v850*__} preprocessor constant will be defined. 12937 12938The preprocessor constants @samp{__v850} and @samp{__v851__} are always 12939defined, regardless of which processor variant is the target. 12940 12941@item -mdisable-callt 12942@opindex mdisable-callt 12943This option will suppress generation of the CALLT instruction for the 12944v850e and v850e1 flavors of the v850 architecture. The default is 12945@option{-mno-disable-callt} which allows the CALLT instruction to be used. 12946 12947@end table 12948 12949@node VAX Options 12950@subsection VAX Options 12951@cindex VAX options 12952 12953These @samp{-m} options are defined for the VAX: 12954 12955@table @gcctabopt 12956@item -munix 12957@opindex munix 12958Do not output certain jump instructions (@code{aobleq} and so on) 12959that the Unix assembler for the VAX cannot handle across long 12960ranges. 12961 12962@item -mgnu 12963@opindex mgnu 12964Do output those jump instructions, on the assumption that you 12965will assemble with the GNU assembler. 12966 12967@item -mg 12968@opindex mg 12969Output code for g-format floating point numbers instead of d-format. 12970@end table 12971 12972@node x86-64 Options 12973@subsection x86-64 Options 12974@cindex x86-64 options 12975 12976These are listed under @xref{i386 and x86-64 Options}. 12977 12978@node Xstormy16 Options 12979@subsection Xstormy16 Options 12980@cindex Xstormy16 Options 12981 12982These options are defined for Xstormy16: 12983 12984@table @gcctabopt 12985@item -msim 12986@opindex msim 12987Choose startup files and linker script suitable for the simulator. 12988@end table 12989 12990@node Xtensa Options 12991@subsection Xtensa Options 12992@cindex Xtensa Options 12993 12994These options are supported for Xtensa targets: 12995 12996@table @gcctabopt 12997@item -mconst16 12998@itemx -mno-const16 12999@opindex mconst16 13000@opindex mno-const16 13001Enable or disable use of @code{CONST16} instructions for loading 13002constant values. The @code{CONST16} instruction is currently not a 13003standard option from Tensilica. When enabled, @code{CONST16} 13004instructions are always used in place of the standard @code{L32R} 13005instructions. The use of @code{CONST16} is enabled by default only if 13006the @code{L32R} instruction is not available. 13007 13008@item -mfused-madd 13009@itemx -mno-fused-madd 13010@opindex mfused-madd 13011@opindex mno-fused-madd 13012Enable or disable use of fused multiply/add and multiply/subtract 13013instructions in the floating-point option. This has no effect if the 13014floating-point option is not also enabled. Disabling fused multiply/add 13015and multiply/subtract instructions forces the compiler to use separate 13016instructions for the multiply and add/subtract operations. This may be 13017desirable in some cases where strict IEEE 754-compliant results are 13018required: the fused multiply add/subtract instructions do not round the 13019intermediate result, thereby producing results with @emph{more} bits of 13020precision than specified by the IEEE standard. Disabling fused multiply 13021add/subtract instructions also ensures that the program output is not 13022sensitive to the compiler's ability to combine multiply and add/subtract 13023operations. 13024 13025@item -mtext-section-literals 13026@itemx -mno-text-section-literals 13027@opindex mtext-section-literals 13028@opindex mno-text-section-literals 13029Control the treatment of literal pools. The default is 13030@option{-mno-text-section-literals}, which places literals in a separate 13031section in the output file. This allows the literal pool to be placed 13032in a data RAM/ROM, and it also allows the linker to combine literal 13033pools from separate object files to remove redundant literals and 13034improve code size. With @option{-mtext-section-literals}, the literals 13035are interspersed in the text section in order to keep them as close as 13036possible to their references. This may be necessary for large assembly 13037files. 13038 13039@item -mtarget-align 13040@itemx -mno-target-align 13041@opindex mtarget-align 13042@opindex mno-target-align 13043When this option is enabled, GCC instructs the assembler to 13044automatically align instructions to reduce branch penalties at the 13045expense of some code density. The assembler attempts to widen density 13046instructions to align branch targets and the instructions following call 13047instructions. If there are not enough preceding safe density 13048instructions to align a target, no widening will be performed. The 13049default is @option{-mtarget-align}. These options do not affect the 13050treatment of auto-aligned instructions like @code{LOOP}, which the 13051assembler will always align, either by widening density instructions or 13052by inserting no-op instructions. 13053 13054@item -mlongcalls 13055@itemx -mno-longcalls 13056@opindex mlongcalls 13057@opindex mno-longcalls 13058When this option is enabled, GCC instructs the assembler to translate 13059direct calls to indirect calls unless it can determine that the target 13060of a direct call is in the range allowed by the call instruction. This 13061translation typically occurs for calls to functions in other source 13062files. Specifically, the assembler translates a direct @code{CALL} 13063instruction into an @code{L32R} followed by a @code{CALLX} instruction. 13064The default is @option{-mno-longcalls}. This option should be used in 13065programs where the call target can potentially be out of range. This 13066option is implemented in the assembler, not the compiler, so the 13067assembly code generated by GCC will still show direct call 13068instructions---look at the disassembled object code to see the actual 13069instructions. Note that the assembler will use an indirect call for 13070every cross-file call, not just those that really will be out of range. 13071@end table 13072 13073@node zSeries Options 13074@subsection zSeries Options 13075@cindex zSeries options 13076 13077These are listed under @xref{S/390 and zSeries Options}. 13078 13079@node Code Gen Options 13080@section Options for Code Generation Conventions 13081@cindex code generation conventions 13082@cindex options, code generation 13083@cindex run-time options 13084 13085These machine-independent options control the interface conventions 13086used in code generation. 13087 13088Most of them have both positive and negative forms; the negative form 13089of @option{-ffoo} would be @option{-fno-foo}. In the table below, only 13090one of the forms is listed---the one which is not the default. You 13091can figure out the other form by either removing @samp{no-} or adding 13092it. 13093 13094@table @gcctabopt 13095@item -fbounds-check 13096@opindex fbounds-check 13097For front-ends that support it, generate additional code to check that 13098indices used to access arrays are within the declared range. This is 13099currently only supported by the Java and Fortran front-ends, where 13100this option defaults to true and false respectively. 13101 13102@item -ftrapv 13103@opindex ftrapv 13104This option generates traps for signed overflow on addition, subtraction, 13105multiplication operations. 13106 13107@item -fwrapv 13108@opindex fwrapv 13109This option instructs the compiler to assume that signed arithmetic 13110overflow of addition, subtraction and multiplication wraps around 13111using twos-complement representation. This flag enables some optimizations 13112and disables others. This option is enabled by default for the Java 13113front-end, as required by the Java language specification. 13114 13115@item -fexceptions 13116@opindex fexceptions 13117Enable exception handling. Generates extra code needed to propagate 13118exceptions. For some targets, this implies GCC will generate frame 13119unwind information for all functions, which can produce significant data 13120size overhead, although it does not affect execution. If you do not 13121specify this option, GCC will enable it by default for languages like 13122C++ which normally require exception handling, and disable it for 13123languages like C that do not normally require it. However, you may need 13124to enable this option when compiling C code that needs to interoperate 13125properly with exception handlers written in C++. You may also wish to 13126disable this option if you are compiling older C++ programs that don't 13127use exception handling. 13128 13129@item -fnon-call-exceptions 13130@opindex fnon-call-exceptions 13131Generate code that allows trapping instructions to throw exceptions. 13132Note that this requires platform-specific runtime support that does 13133not exist everywhere. Moreover, it only allows @emph{trapping} 13134instructions to throw exceptions, i.e.@: memory references or floating 13135point instructions. It does not allow exceptions to be thrown from 13136arbitrary signal handlers such as @code{SIGALRM}. 13137 13138@item -funwind-tables 13139@opindex funwind-tables 13140Similar to @option{-fexceptions}, except that it will just generate any needed 13141static data, but will not affect the generated code in any other way. 13142You will normally not enable this option; instead, a language processor 13143that needs this handling would enable it on your behalf. 13144 13145@item -fasynchronous-unwind-tables 13146@opindex fasynchronous-unwind-tables 13147Generate unwind table in dwarf2 format, if supported by target machine. The 13148table is exact at each instruction boundary, so it can be used for stack 13149unwinding from asynchronous events (such as debugger or garbage collector). 13150 13151@item -fpcc-struct-return 13152@opindex fpcc-struct-return 13153Return ``short'' @code{struct} and @code{union} values in memory like 13154longer ones, rather than in registers. This convention is less 13155efficient, but it has the advantage of allowing intercallability between 13156GCC-compiled files and files compiled with other compilers, particularly 13157the Portable C Compiler (pcc). 13158 13159The precise convention for returning structures in memory depends 13160on the target configuration macros. 13161 13162Short structures and unions are those whose size and alignment match 13163that of some integer type. 13164 13165@strong{Warning:} code compiled with the @option{-fpcc-struct-return} 13166switch is not binary compatible with code compiled with the 13167@option{-freg-struct-return} switch. 13168Use it to conform to a non-default application binary interface. 13169 13170@item -freg-struct-return 13171@opindex freg-struct-return 13172Return @code{struct} and @code{union} values in registers when possible. 13173This is more efficient for small structures than 13174@option{-fpcc-struct-return}. 13175 13176If you specify neither @option{-fpcc-struct-return} nor 13177@option{-freg-struct-return}, GCC defaults to whichever convention is 13178standard for the target. If there is no standard convention, GCC 13179defaults to @option{-fpcc-struct-return}, except on targets where GCC is 13180the principal compiler. In those cases, we can choose the standard, and 13181we chose the more efficient register return alternative. 13182 13183@strong{Warning:} code compiled with the @option{-freg-struct-return} 13184switch is not binary compatible with code compiled with the 13185@option{-fpcc-struct-return} switch. 13186Use it to conform to a non-default application binary interface. 13187 13188@item -fshort-enums 13189@opindex fshort-enums 13190Allocate to an @code{enum} type only as many bytes as it needs for the 13191declared range of possible values. Specifically, the @code{enum} type 13192will be equivalent to the smallest integer type which has enough room. 13193 13194@strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate 13195code that is not binary compatible with code generated without that switch. 13196Use it to conform to a non-default application binary interface. 13197 13198@item -fshort-double 13199@opindex fshort-double 13200Use the same size for @code{double} as for @code{float}. 13201 13202@strong{Warning:} the @option{-fshort-double} switch causes GCC to generate 13203code that is not binary compatible with code generated without that switch. 13204Use it to conform to a non-default application binary interface. 13205 13206@item -fshort-wchar 13207@opindex fshort-wchar 13208Override the underlying type for @samp{wchar_t} to be @samp{short 13209unsigned int} instead of the default for the target. This option is 13210useful for building programs to run under WINE@. 13211 13212@strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate 13213code that is not binary compatible with code generated without that switch. 13214Use it to conform to a non-default application binary interface. 13215 13216@item -fno-common 13217@opindex fno-common 13218In C, allocate even uninitialized global variables in the data section of the 13219object file, rather than generating them as common blocks. This has the 13220effect that if the same variable is declared (without @code{extern}) in 13221two different compilations, you will get an error when you link them. 13222The only reason this might be useful is if you wish to verify that the 13223program will work on other systems which always work this way. 13224 13225@item -fno-ident 13226@opindex fno-ident 13227Ignore the @samp{#ident} directive. 13228 13229@item -finhibit-size-directive 13230@opindex finhibit-size-directive 13231Don't output a @code{.size} assembler directive, or anything else that 13232would cause trouble if the function is split in the middle, and the 13233two halves are placed at locations far apart in memory. This option is 13234used when compiling @file{crtstuff.c}; you should not need to use it 13235for anything else. 13236 13237@item -fverbose-asm 13238@opindex fverbose-asm 13239Put extra commentary information in the generated assembly code to 13240make it more readable. This option is generally only of use to those 13241who actually need to read the generated assembly code (perhaps while 13242debugging the compiler itself). 13243 13244@option{-fno-verbose-asm}, the default, causes the 13245extra information to be omitted and is useful when comparing two assembler 13246files. 13247 13248@item -fpic 13249@opindex fpic 13250@cindex global offset table 13251@cindex PIC 13252Generate position-independent code (PIC) suitable for use in a shared 13253library, if supported for the target machine. Such code accesses all 13254constant addresses through a global offset table (GOT)@. The dynamic 13255loader resolves the GOT entries when the program starts (the dynamic 13256loader is not part of GCC; it is part of the operating system). If 13257the GOT size for the linked executable exceeds a machine-specific 13258maximum size, you get an error message from the linker indicating that 13259@option{-fpic} does not work; in that case, recompile with @option{-fPIC} 13260instead. (These maximums are 8k on the SPARC and 32k 13261on the m68k and RS/6000. The 386 has no such limit.) 13262 13263Position-independent code requires special support, and therefore works 13264only on certain machines. For the 386, GCC supports PIC for System V 13265but not for the Sun 386i. Code generated for the IBM RS/6000 is always 13266position-independent. 13267 13268When this flag is set, the macros @code{__pic__} and @code{__PIC__} 13269are defined to 1. 13270 13271@item -fPIC 13272@opindex fPIC 13273If supported for the target machine, emit position-independent code, 13274suitable for dynamic linking and avoiding any limit on the size of the 13275global offset table. This option makes a difference on the m68k, 13276PowerPC and SPARC@. 13277 13278Position-independent code requires special support, and therefore works 13279only on certain machines. 13280 13281When this flag is set, the macros @code{__pic__} and @code{__PIC__} 13282are defined to 2. 13283 13284@item -fpie 13285@itemx -fPIE 13286@opindex fpie 13287@opindex fPIE 13288These options are similar to @option{-fpic} and @option{-fPIC}, but 13289generated position independent code can be only linked into executables. 13290Usually these options are used when @option{-pie} GCC option will be 13291used during linking. 13292 13293@item -fno-jump-tables 13294@opindex fno-jump-tables 13295Do not use jump tables for switch statements even where it would be 13296more efficient than other code generation strategies. This option is 13297of use in conjunction with @option{-fpic} or @option{-fPIC} for 13298building code which forms part of a dynamic linker and cannot 13299reference the address of a jump table. On some targets, jump tables 13300do not require a GOT and this option is not needed. 13301 13302@item -ffixed-@var{reg} 13303@opindex ffixed 13304Treat the register named @var{reg} as a fixed register; generated code 13305should never refer to it (except perhaps as a stack pointer, frame 13306pointer or in some other fixed role). 13307 13308@var{reg} must be the name of a register. The register names accepted 13309are machine-specific and are defined in the @code{REGISTER_NAMES} 13310macro in the machine description macro file. 13311 13312This flag does not have a negative form, because it specifies a 13313three-way choice. 13314 13315@item -fcall-used-@var{reg} 13316@opindex fcall-used 13317Treat the register named @var{reg} as an allocable register that is 13318clobbered by function calls. It may be allocated for temporaries or 13319variables that do not live across a call. Functions compiled this way 13320will not save and restore the register @var{reg}. 13321 13322It is an error to used this flag with the frame pointer or stack pointer. 13323Use of this flag for other registers that have fixed pervasive roles in 13324the machine's execution model will produce disastrous results. 13325 13326This flag does not have a negative form, because it specifies a 13327three-way choice. 13328 13329@item -fcall-saved-@var{reg} 13330@opindex fcall-saved 13331Treat the register named @var{reg} as an allocable register saved by 13332functions. It may be allocated even for temporaries or variables that 13333live across a call. Functions compiled this way will save and restore 13334the register @var{reg} if they use it. 13335 13336It is an error to used this flag with the frame pointer or stack pointer. 13337Use of this flag for other registers that have fixed pervasive roles in 13338the machine's execution model will produce disastrous results. 13339 13340A different sort of disaster will result from the use of this flag for 13341a register in which function values may be returned. 13342 13343This flag does not have a negative form, because it specifies a 13344three-way choice. 13345 13346@item -fpack-struct[=@var{n}] 13347@opindex fpack-struct 13348Without a value specified, pack all structure members together without 13349holes. When a value is specified (which must be a small power of two), pack 13350structure members according to this value, representing the maximum 13351alignment (that is, objects with default alignment requirements larger than 13352this will be output potentially unaligned at the next fitting location. 13353 13354@strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate 13355code that is not binary compatible with code generated without that switch. 13356Additionally, it makes the code suboptimal. 13357Use it to conform to a non-default application binary interface. 13358 13359@item -finstrument-functions 13360@opindex finstrument-functions 13361Generate instrumentation calls for entry and exit to functions. Just 13362after function entry and just before function exit, the following 13363profiling functions will be called with the address of the current 13364function and its call site. (On some platforms, 13365@code{__builtin_return_address} does not work beyond the current 13366function, so the call site information may not be available to the 13367profiling functions otherwise.) 13368 13369@smallexample 13370void __cyg_profile_func_enter (void *this_fn, 13371 void *call_site); 13372void __cyg_profile_func_exit (void *this_fn, 13373 void *call_site); 13374@end smallexample 13375 13376The first argument is the address of the start of the current function, 13377which may be looked up exactly in the symbol table. 13378 13379This instrumentation is also done for functions expanded inline in other 13380functions. The profiling calls will indicate where, conceptually, the 13381inline function is entered and exited. This means that addressable 13382versions of such functions must be available. If all your uses of a 13383function are expanded inline, this may mean an additional expansion of 13384code size. If you use @samp{extern inline} in your C code, an 13385addressable version of such functions must be provided. (This is 13386normally the case anyways, but if you get lucky and the optimizer always 13387expands the functions inline, you might have gotten away without 13388providing static copies.) 13389 13390A function may be given the attribute @code{no_instrument_function}, in 13391which case this instrumentation will not be done. This can be used, for 13392example, for the profiling functions listed above, high-priority 13393interrupt routines, and any functions from which the profiling functions 13394cannot safely be called (perhaps signal handlers, if the profiling 13395routines generate output or allocate memory). 13396 13397@item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} 13398@opindex finstrument-functions-exclude-file-list 13399 13400Set the list of functions that are excluded from instrumentation (see 13401the description of @code{-finstrument-functions}). If the file that 13402contains a function definition matches with one of @var{file}, then 13403that function is not instrumented. The match is done on substrings: 13404if the @var{file} parameter is a substring of the file name, it is 13405considered to be a match. 13406 13407For example, 13408@code{-finstrument-functions-exclude-file-list=/bits/stl,include/sys} 13409will exclude any inline function defined in files whose pathnames 13410contain @code{/bits/stl} or @code{include/sys}. 13411 13412If, for some reason, you want to include letter @code{','} in one of 13413@var{sym}, write @code{'\,'}. For example, 13414@code{-finstrument-functions-exclude-file-list='\,\,tmp'} 13415(note the single quote surrounding the option). 13416 13417@item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} 13418@opindex finstrument-functions-exclude-function-list 13419 13420This is similar to @code{-finstrument-functions-exclude-file-list}, 13421but this option sets the list of function names to be excluded from 13422instrumentation. The function name to be matched is its user-visible 13423name, such as @code{vector<int> blah(const vector<int> &)}, not the 13424internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The 13425match is done on substrings: if the @var{sym} parameter is a substring 13426of the function name, it is considered to be a match. 13427 13428@item -fstack-check 13429@opindex fstack-check 13430Generate code to verify that you do not go beyond the boundary of the 13431stack. You should specify this flag if you are running in an 13432environment with multiple threads, but only rarely need to specify it in 13433a single-threaded environment since stack overflow is automatically 13434detected on nearly all systems if there is only one stack. 13435 13436Note that this switch does not actually cause checking to be done; the 13437operating system must do that. The switch causes generation of code 13438to ensure that the operating system sees the stack being extended. 13439 13440@item -fstack-limit-register=@var{reg} 13441@itemx -fstack-limit-symbol=@var{sym} 13442@itemx -fno-stack-limit 13443@opindex fstack-limit-register 13444@opindex fstack-limit-symbol 13445@opindex fno-stack-limit 13446Generate code to ensure that the stack does not grow beyond a certain value, 13447either the value of a register or the address of a symbol. If the stack 13448would grow beyond the value, a signal is raised. For most targets, 13449the signal is raised before the stack overruns the boundary, so 13450it is possible to catch the signal without taking special precautions. 13451 13452For instance, if the stack starts at absolute address @samp{0x80000000} 13453and grows downwards, you can use the flags 13454@option{-fstack-limit-symbol=__stack_limit} and 13455@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit 13456of 128KB@. Note that this may only work with the GNU linker. 13457 13458@cindex aliasing of parameters 13459@cindex parameters, aliased 13460@item -fargument-alias 13461@itemx -fargument-noalias 13462@itemx -fargument-noalias-global 13463@itemx -fargument-noalias-anything 13464@opindex fargument-alias 13465@opindex fargument-noalias 13466@opindex fargument-noalias-global 13467@opindex fargument-noalias-anything 13468Specify the possible relationships among parameters and between 13469parameters and global data. 13470 13471@option{-fargument-alias} specifies that arguments (parameters) may 13472alias each other and may alias global storage.@* 13473@option{-fargument-noalias} specifies that arguments do not alias 13474each other, but may alias global storage.@* 13475@option{-fargument-noalias-global} specifies that arguments do not 13476alias each other and do not alias global storage. 13477@option{-fargument-noalias-anything} specifies that arguments do not 13478alias any other storage. 13479 13480Each language will automatically use whatever option is required by 13481the language standard. You should not need to use these options yourself. 13482 13483@item -fleading-underscore 13484@opindex fleading-underscore 13485This option and its counterpart, @option{-fno-leading-underscore}, forcibly 13486change the way C symbols are represented in the object file. One use 13487is to help link with legacy assembly code. 13488 13489@strong{Warning:} the @option{-fleading-underscore} switch causes GCC to 13490generate code that is not binary compatible with code generated without that 13491switch. Use it to conform to a non-default application binary interface. 13492Not all targets provide complete support for this switch. 13493 13494@item -ftls-model=@var{model} 13495Alter the thread-local storage model to be used (@pxref{Thread-Local}). 13496The @var{model} argument should be one of @code{global-dynamic}, 13497@code{local-dynamic}, @code{initial-exec} or @code{local-exec}. 13498 13499The default without @option{-fpic} is @code{initial-exec}; with 13500@option{-fpic} the default is @code{global-dynamic}. 13501 13502@item -fvisibility=@var{default|internal|hidden|protected} 13503@opindex fvisibility 13504Set the default ELF image symbol visibility to the specified option---all 13505symbols will be marked with this unless overridden within the code. 13506Using this feature can very substantially improve linking and 13507load times of shared object libraries, produce more optimized 13508code, provide near-perfect API export and prevent symbol clashes. 13509It is @strong{strongly} recommended that you use this in any shared objects 13510you distribute. 13511 13512Despite the nomenclature, @code{default} always means public ie; 13513available to be linked against from outside the shared object. 13514@code{protected} and @code{internal} are pretty useless in real-world 13515usage so the only other commonly used option will be @code{hidden}. 13516The default if @option{-fvisibility} isn't specified is 13517@code{default}, i.e., make every 13518symbol public---this causes the same behavior as previous versions of 13519GCC@. 13520 13521A good explanation of the benefits offered by ensuring ELF 13522symbols have the correct visibility is given by ``How To Write 13523Shared Libraries'' by Ulrich Drepper (which can be found at 13524@w{@uref{http://people.redhat.com/~drepper/}})---however a superior 13525solution made possible by this option to marking things hidden when 13526the default is public is to make the default hidden and mark things 13527public. This is the norm with DLL's on Windows and with @option{-fvisibility=hidden} 13528and @code{__attribute__ ((visibility("default")))} instead of 13529@code{__declspec(dllexport)} you get almost identical semantics with 13530identical syntax. This is a great boon to those working with 13531cross-platform projects. 13532 13533For those adding visibility support to existing code, you may find 13534@samp{#pragma GCC visibility} of use. This works by you enclosing 13535the declarations you wish to set visibility for with (for example) 13536@samp{#pragma GCC visibility push(hidden)} and 13537@samp{#pragma GCC visibility pop}. 13538Bear in mind that symbol visibility should be viewed @strong{as 13539part of the API interface contract} and thus all new code should 13540always specify visibility when it is not the default ie; declarations 13541only for use within the local DSO should @strong{always} be marked explicitly 13542as hidden as so to avoid PLT indirection overheads---making this 13543abundantly clear also aids readability and self-documentation of the code. 13544Note that due to ISO C++ specification requirements, operator new and 13545operator delete must always be of default visibility. 13546 13547Be aware that headers from outside your project, in particular system 13548headers and headers from any other library you use, may not be 13549expecting to be compiled with visibility other than the default. You 13550may need to explicitly say @samp{#pragma GCC visibility push(default)} 13551before including any such headers. 13552 13553@samp{extern} declarations are not affected by @samp{-fvisibility}, so 13554a lot of code can be recompiled with @samp{-fvisibility=hidden} with 13555no modifications. However, this means that calls to @samp{extern} 13556functions with no explicit visibility will use the PLT, so it is more 13557effective to use @samp{__attribute ((visibility))} and/or 13558@samp{#pragma GCC visibility} to tell the compiler which @samp{extern} 13559declarations should be treated as hidden. 13560 13561Note that @samp{-fvisibility} does affect C++ vague linkage 13562entities. This means that, for instance, an exception class that will 13563be thrown between DSOs must be explicitly marked with default 13564visibility so that the @samp{type_info} nodes will be unified between 13565the DSOs. 13566 13567An overview of these techniques, their benefits and how to use them 13568is at @w{@uref{http://gcc.gnu.org/wiki/Visibility}}. 13569 13570@end table 13571 13572@c man end 13573 13574@node Environment Variables 13575@section Environment Variables Affecting GCC 13576@cindex environment variables 13577 13578@c man begin ENVIRONMENT 13579This section describes several environment variables that affect how GCC 13580operates. Some of them work by specifying directories or prefixes to use 13581when searching for various kinds of files. Some are used to specify other 13582aspects of the compilation environment. 13583 13584Note that you can also specify places to search using options such as 13585@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These 13586take precedence over places specified using environment variables, which 13587in turn take precedence over those specified by the configuration of GCC@. 13588@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint, 13589GNU Compiler Collection (GCC) Internals}. 13590 13591@table @env 13592@item LANG 13593@itemx LC_CTYPE 13594@c @itemx LC_COLLATE 13595@itemx LC_MESSAGES 13596@c @itemx LC_MONETARY 13597@c @itemx LC_NUMERIC 13598@c @itemx LC_TIME 13599@itemx LC_ALL 13600@findex LANG 13601@findex LC_CTYPE 13602@c @findex LC_COLLATE 13603@findex LC_MESSAGES 13604@c @findex LC_MONETARY 13605@c @findex LC_NUMERIC 13606@c @findex LC_TIME 13607@findex LC_ALL 13608@cindex locale 13609These environment variables control the way that GCC uses 13610localization information that allow GCC to work with different 13611national conventions. GCC inspects the locale categories 13612@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do 13613so. These locale categories can be set to any value supported by your 13614installation. A typical value is @samp{en_GB.UTF-8} for English in the United 13615Kingdom encoded in UTF-8. 13616 13617The @env{LC_CTYPE} environment variable specifies character 13618classification. GCC uses it to determine the character boundaries in 13619a string; this is needed for some multibyte encodings that contain quote 13620and escape characters that would otherwise be interpreted as a string 13621end or escape. 13622 13623The @env{LC_MESSAGES} environment variable specifies the language to 13624use in diagnostic messages. 13625 13626If the @env{LC_ALL} environment variable is set, it overrides the value 13627of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE} 13628and @env{LC_MESSAGES} default to the value of the @env{LANG} 13629environment variable. If none of these variables are set, GCC 13630defaults to traditional C English behavior. 13631 13632@item TMPDIR 13633@findex TMPDIR 13634If @env{TMPDIR} is set, it specifies the directory to use for temporary 13635files. GCC uses temporary files to hold the output of one stage of 13636compilation which is to be used as input to the next stage: for example, 13637the output of the preprocessor, which is the input to the compiler 13638proper. 13639 13640@item GCC_EXEC_PREFIX 13641@findex GCC_EXEC_PREFIX 13642If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the 13643names of the subprograms executed by the compiler. No slash is added 13644when this prefix is combined with the name of a subprogram, but you can 13645specify a prefix that ends with a slash if you wish. 13646 13647If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out 13648an appropriate prefix to use based on the pathname it was invoked with. 13649 13650If GCC cannot find the subprogram using the specified prefix, it 13651tries looking in the usual places for the subprogram. 13652 13653The default value of @env{GCC_EXEC_PREFIX} is 13654@file{@var{prefix}/lib/gcc/} where @var{prefix} is the value 13655of @code{prefix} when you ran the @file{configure} script. 13656 13657Other prefixes specified with @option{-B} take precedence over this prefix. 13658 13659This prefix is also used for finding files such as @file{crt0.o} that are 13660used for linking. 13661 13662In addition, the prefix is used in an unusual way in finding the 13663directories to search for header files. For each of the standard 13664directories whose name normally begins with @samp{/usr/local/lib/gcc} 13665(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries 13666replacing that beginning with the specified prefix to produce an 13667alternate directory name. Thus, with @option{-Bfoo/}, GCC will search 13668@file{foo/bar} where it would normally search @file{/usr/local/lib/bar}. 13669These alternate directories are searched first; the standard directories 13670come next. 13671 13672@item COMPILER_PATH 13673@findex COMPILER_PATH 13674The value of @env{COMPILER_PATH} is a colon-separated list of 13675directories, much like @env{PATH}. GCC tries the directories thus 13676specified when searching for subprograms, if it can't find the 13677subprograms using @env{GCC_EXEC_PREFIX}. 13678 13679@item LIBRARY_PATH 13680@findex LIBRARY_PATH 13681The value of @env{LIBRARY_PATH} is a colon-separated list of 13682directories, much like @env{PATH}. When configured as a native compiler, 13683GCC tries the directories thus specified when searching for special 13684linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking 13685using GCC also uses these directories when searching for ordinary 13686libraries for the @option{-l} option (but directories specified with 13687@option{-L} come first). 13688 13689@item LANG 13690@findex LANG 13691@cindex locale definition 13692This variable is used to pass locale information to the compiler. One way in 13693which this information is used is to determine the character set to be used 13694when character literals, string literals and comments are parsed in C and C++. 13695When the compiler is configured to allow multibyte characters, 13696the following values for @env{LANG} are recognized: 13697 13698@table @samp 13699@item C-JIS 13700Recognize JIS characters. 13701@item C-SJIS 13702Recognize SJIS characters. 13703@item C-EUCJP 13704Recognize EUCJP characters. 13705@end table 13706 13707If @env{LANG} is not defined, or if it has some other value, then the 13708compiler will use mblen and mbtowc as defined by the default locale to 13709recognize and translate multibyte characters. 13710@end table 13711 13712@noindent 13713Some additional environments variables affect the behavior of the 13714preprocessor. 13715 13716@include cppenv.texi 13717 13718@c man end 13719 13720@node Precompiled Headers 13721@section Using Precompiled Headers 13722@cindex precompiled headers 13723@cindex speed of compilation 13724 13725Often large projects have many header files that are included in every 13726source file. The time the compiler takes to process these header files 13727over and over again can account for nearly all of the time required to 13728build the project. To make builds faster, GCC allows users to 13729`precompile' a header file; then, if builds can use the precompiled 13730header file they will be much faster. 13731 13732To create a precompiled header file, simply compile it as you would any 13733other file, if necessary using the @option{-x} option to make the driver 13734treat it as a C or C++ header file. You will probably want to use a 13735tool like @command{make} to keep the precompiled header up-to-date when 13736the headers it contains change. 13737 13738A precompiled header file will be searched for when @code{#include} is 13739seen in the compilation. As it searches for the included file 13740(@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the 13741compiler looks for a precompiled header in each directory just before it 13742looks for the include file in that directory. The name searched for is 13743the name specified in the @code{#include} with @samp{.gch} appended. If 13744the precompiled header file can't be used, it is ignored. 13745 13746For instance, if you have @code{#include "all.h"}, and you have 13747@file{all.h.gch} in the same directory as @file{all.h}, then the 13748precompiled header file will be used if possible, and the original 13749header will be used otherwise. 13750 13751Alternatively, you might decide to put the precompiled header file in a 13752directory and use @option{-I} to ensure that directory is searched 13753before (or instead of) the directory containing the original header. 13754Then, if you want to check that the precompiled header file is always 13755used, you can put a file of the same name as the original header in this 13756directory containing an @code{#error} command. 13757 13758This also works with @option{-include}. So yet another way to use 13759precompiled headers, good for projects not designed with precompiled 13760header files in mind, is to simply take most of the header files used by 13761a project, include them from another header file, precompile that header 13762file, and @option{-include} the precompiled header. If the header files 13763have guards against multiple inclusion, they will be skipped because 13764they've already been included (in the precompiled header). 13765 13766If you need to precompile the same header file for different 13767languages, targets, or compiler options, you can instead make a 13768@emph{directory} named like @file{all.h.gch}, and put each precompiled 13769header in the directory, perhaps using @option{-o}. It doesn't matter 13770what you call the files in the directory, every precompiled header in 13771the directory will be considered. The first precompiled header 13772encountered in the directory that is valid for this compilation will 13773be used; they're searched in no particular order. 13774 13775There are many other possibilities, limited only by your imagination, 13776good sense, and the constraints of your build system. 13777 13778A precompiled header file can be used only when these conditions apply: 13779 13780@itemize 13781@item 13782Only one precompiled header can be used in a particular compilation. 13783 13784@item 13785A precompiled header can't be used once the first C token is seen. You 13786can have preprocessor directives before a precompiled header; you can 13787even include a precompiled header from inside another header, so long as 13788there are no C tokens before the @code{#include}. 13789 13790@item 13791The precompiled header file must be produced for the same language as 13792the current compilation. You can't use a C precompiled header for a C++ 13793compilation. 13794 13795@item 13796The precompiled header file must have been produced by the same compiler 13797binary as the current compilation is using. 13798 13799@item 13800Any macros defined before the precompiled header is included must 13801either be defined in the same way as when the precompiled header was 13802generated, or must not affect the precompiled header, which usually 13803means that they don't appear in the precompiled header at all. 13804 13805The @option{-D} option is one way to define a macro before a 13806precompiled header is included; using a @code{#define} can also do it. 13807There are also some options that define macros implicitly, like 13808@option{-O} and @option{-Wdeprecated}; the same rule applies to macros 13809defined this way. 13810 13811@item If debugging information is output when using the precompiled 13812header, using @option{-g} or similar, the same kind of debugging information 13813must have been output when building the precompiled header. However, 13814a precompiled header built using @option{-g} can be used in a compilation 13815when no debugging information is being output. 13816 13817@item The same @option{-m} options must generally be used when building 13818and using the precompiled header. @xref{Submodel Options}, 13819for any cases where this rule is relaxed. 13820 13821@item Each of the following options must be the same when building and using 13822the precompiled header: 13823 13824@gccoptlist{-fexceptions -funit-at-a-time} 13825 13826@item 13827Some other command-line options starting with @option{-f}, 13828@option{-p}, or @option{-O} must be defined in the same way as when 13829the precompiled header was generated. At present, it's not clear 13830which options are safe to change and which are not; the safest choice 13831is to use exactly the same options when generating and using the 13832precompiled header. The following are known to be safe: 13833 13834@gccoptlist{-fmessage-length= -fpreprocessed 13835-fsched-interblock -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous 13836-fsched-verbose=<number> -fschedule-insns -fvisibility= 13837-pedantic-errors} 13838 13839@end itemize 13840 13841For all of these except the last, the compiler will automatically 13842ignore the precompiled header if the conditions aren't met. If you 13843find an option combination that doesn't work and doesn't cause the 13844precompiled header to be ignored, please consider filing a bug report, 13845see @ref{Bugs}. 13846 13847If you do use differing options when generating and using the 13848precompiled header, the actual behavior will be a mixture of the 13849behavior for the options. For instance, if you use @option{-g} to 13850generate the precompiled header but not when using it, you may or may 13851not get debugging information for routines in the precompiled header. 13852 13853@node Running Protoize 13854@section Running Protoize 13855 13856The program @code{protoize} is an optional part of GCC@. You can use 13857it to add prototypes to a program, thus converting the program to ISO 13858C in one respect. The companion program @code{unprotoize} does the 13859reverse: it removes argument types from any prototypes that are found. 13860 13861When you run these programs, you must specify a set of source files as 13862command line arguments. The conversion programs start out by compiling 13863these files to see what functions they define. The information gathered 13864about a file @var{foo} is saved in a file named @file{@var{foo}.X}. 13865 13866After scanning comes actual conversion. The specified files are all 13867eligible to be converted; any files they include (whether sources or 13868just headers) are eligible as well. 13869 13870But not all the eligible files are converted. By default, 13871@code{protoize} and @code{unprotoize} convert only source and header 13872files in the current directory. You can specify additional directories 13873whose files should be converted with the @option{-d @var{directory}} 13874option. You can also specify particular files to exclude with the 13875@option{-x @var{file}} option. A file is converted if it is eligible, its 13876directory name matches one of the specified directory names, and its 13877name within the directory has not been excluded. 13878 13879Basic conversion with @code{protoize} consists of rewriting most 13880function definitions and function declarations to specify the types of 13881the arguments. The only ones not rewritten are those for varargs 13882functions. 13883 13884@code{protoize} optionally inserts prototype declarations at the 13885beginning of the source file, to make them available for any calls that 13886precede the function's definition. Or it can insert prototype 13887declarations with block scope in the blocks where undeclared functions 13888are called. 13889 13890Basic conversion with @code{unprotoize} consists of rewriting most 13891function declarations to remove any argument types, and rewriting 13892function definitions to the old-style pre-ISO form. 13893 13894Both conversion programs print a warning for any function declaration or 13895definition that they can't convert. You can suppress these warnings 13896with @option{-q}. 13897 13898The output from @code{protoize} or @code{unprotoize} replaces the 13899original source file. The original file is renamed to a name ending 13900with @samp{.save} (for DOS, the saved filename ends in @samp{.sav} 13901without the original @samp{.c} suffix). If the @samp{.save} (@samp{.sav} 13902for DOS) file already exists, then the source file is simply discarded. 13903 13904@code{protoize} and @code{unprotoize} both depend on GCC itself to 13905scan the program and collect information about the functions it uses. 13906So neither of these programs will work until GCC is installed. 13907 13908Here is a table of the options you can use with @code{protoize} and 13909@code{unprotoize}. Each option works with both programs unless 13910otherwise stated. 13911 13912@table @code 13913@item -B @var{directory} 13914Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the 13915usual directory (normally @file{/usr/local/lib}). This file contains 13916prototype information about standard system functions. This option 13917applies only to @code{protoize}. 13918 13919@item -c @var{compilation-options} 13920Use @var{compilation-options} as the options when running @command{gcc} to 13921produce the @samp{.X} files. The special option @option{-aux-info} is 13922always passed in addition, to tell @command{gcc} to write a @samp{.X} file. 13923 13924Note that the compilation options must be given as a single argument to 13925@code{protoize} or @code{unprotoize}. If you want to specify several 13926@command{gcc} options, you must quote the entire set of compilation options 13927to make them a single word in the shell. 13928 13929There are certain @command{gcc} arguments that you cannot use, because they 13930would produce the wrong kind of output. These include @option{-g}, 13931@option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in 13932the @var{compilation-options}, they are ignored. 13933 13934@item -C 13935Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file 13936systems) instead of @samp{.c}. This is convenient if you are converting 13937a C program to C++. This option applies only to @code{protoize}. 13938 13939@item -g 13940Add explicit global declarations. This means inserting explicit 13941declarations at the beginning of each source file for each function 13942that is called in the file and was not declared. These declarations 13943precede the first function definition that contains a call to an 13944undeclared function. This option applies only to @code{protoize}. 13945 13946@item -i @var{string} 13947Indent old-style parameter declarations with the string @var{string}. 13948This option applies only to @code{protoize}. 13949 13950@code{unprotoize} converts prototyped function definitions to old-style 13951function definitions, where the arguments are declared between the 13952argument list and the initial @samp{@{}. By default, @code{unprotoize} 13953uses five spaces as the indentation. If you want to indent with just 13954one space instead, use @option{-i " "}. 13955 13956@item -k 13957Keep the @samp{.X} files. Normally, they are deleted after conversion 13958is finished. 13959 13960@item -l 13961Add explicit local declarations. @code{protoize} with @option{-l} inserts 13962a prototype declaration for each function in each block which calls the 13963function without any declaration. This option applies only to 13964@code{protoize}. 13965 13966@item -n 13967Make no real changes. This mode just prints information about the conversions 13968that would have been done without @option{-n}. 13969 13970@item -N 13971Make no @samp{.save} files. The original files are simply deleted. 13972Use this option with caution. 13973 13974@item -p @var{program} 13975Use the program @var{program} as the compiler. Normally, the name 13976@file{gcc} is used. 13977 13978@item -q 13979Work quietly. Most warnings are suppressed. 13980 13981@item -v 13982Print the version number, just like @option{-v} for @command{gcc}. 13983@end table 13984 13985If you need special compiler options to compile one of your program's 13986source files, then you should generate that file's @samp{.X} file 13987specially, by running @command{gcc} on that source file with the 13988appropriate options and the option @option{-aux-info}. Then run 13989@code{protoize} on the entire set of files. @code{protoize} will use 13990the existing @samp{.X} file because it is newer than the source file. 13991For example: 13992 13993@smallexample 13994gcc -Dfoo=bar file1.c -aux-info file1.X 13995protoize *.c 13996@end smallexample 13997 13998@noindent 13999You need to include the special files along with the rest in the 14000@code{protoize} command, even though their @samp{.X} files already 14001exist, because otherwise they won't get converted. 14002 14003@xref{Protoize Caveats}, for more information on how to use 14004@code{protoize} successfully. 14005 14006