invoke.texi revision 259268
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 @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} -Wunsafe-loop-optimizations -Wlong-long @gol 218-Wmain -Wmissing-braces -Wmissing-field-initializers @gol 219-Wmissing-format-attribute -Wmissing-include-dirs @gol 220-Wmissing-noreturn @gol 221-Wno-multichar -Wnonnull -Wno-overflow @gol 222-Woverlength-strings -Wpacked -Wpadded @gol 223-Wparentheses -Wpointer-arith -Wno-pointer-to-int-cast @gol 224-Wredundant-decls @gol 225-Wreturn-type -Wsequence-point -Wshadow @gol 226-Wsign-compare -Wstack-protector @gol 227-Wstrict-aliasing -Wstrict-aliasing=2 @gol 228-Wstrict-overflow -Wstrict-overflow=@var{n} @gol 229-Wswitch -Wswitch-default -Wswitch-enum @gol 230-Wsystem-headers -Wtrigraphs -Wundef -Wuninitialized @gol 231-Wunknown-pragmas -Wno-pragmas -Wunreachable-code @gol 232-Wunused -Wunused-function -Wunused-label -Wunused-parameter @gol 233-Wunused-value -Wunused-variable @gol 234-Wvariadic-macros -Wvla @gol 235-Wvolatile-register-var -Wwrite-strings} 236 237@item C-only Warning Options 238@gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol 239-Wmissing-prototypes -Wnested-externs -Wold-style-definition @gol 240-Wstrict-prototypes -Wtraditional @gol 241-Wdeclaration-after-statement -Wpointer-sign} 242 243@item Debugging Options 244@xref{Debugging Options,,Options for Debugging Your Program or GCC}. 245@gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol 246-fdump-noaddr -fdump-unnumbered -fdump-translation-unit@r{[}-@var{n}@r{]} @gol 247-fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol 248-fdump-ipa-all -fdump-ipa-cgraph @gol 249-fdump-tree-all @gol 250-fdump-tree-original@r{[}-@var{n}@r{]} @gol 251-fdump-tree-optimized@r{[}-@var{n}@r{]} @gol 252-fdump-tree-inlined@r{[}-@var{n}@r{]} @gol 253-fdump-tree-cfg -fdump-tree-vcg -fdump-tree-alias @gol 254-fdump-tree-ch @gol 255-fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol 256-fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol 257-fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol 258-fdump-tree-dom@r{[}-@var{n}@r{]} @gol 259-fdump-tree-dse@r{[}-@var{n}@r{]} @gol 260-fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol 261-fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol 262-fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol 263-fdump-tree-nrv -fdump-tree-vect @gol 264-fdump-tree-sink @gol 265-fdump-tree-sra@r{[}-@var{n}@r{]} @gol 266-fdump-tree-salias @gol 267-fdump-tree-fre@r{[}-@var{n}@r{]} @gol 268-fdump-tree-vrp@r{[}-@var{n}@r{]} @gol 269-ftree-vectorizer-verbose=@var{n} @gol 270-fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol 271-feliminate-dwarf2-dups -feliminate-unused-debug-types @gol 272-feliminate-unused-debug-symbols -femit-class-debug-always @gol 273-fmem-report -fprofile-arcs @gol 274-frandom-seed=@var{string} -fsched-verbose=@var{n} @gol 275-ftest-coverage -ftime-report -fvar-tracking @gol 276-g -g@var{level} -gcoff -gdwarf-2 @gol 277-ggdb -gstabs -gstabs+ -gvms -gxcoff -gxcoff+ @gol 278-femit-struct-debug-baseonly -femit-struct-debug-reduced @gol 279-femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol 280-p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol 281-print-multi-directory -print-multi-lib @gol 282-print-prog-name=@var{program} -print-search-dirs -Q @gol 283-save-temps -time} 284 285@item Optimization Options 286@xref{Optimize Options,,Options that Control Optimization}. 287@gccoptlist{-falign-functions=@var{n} -falign-jumps=@var{n} @gol 288-falign-labels=@var{n} -falign-loops=@var{n} @gol 289-fbounds-check -fmudflap -fmudflapth -fmudflapir @gol 290-fbranch-probabilities -fprofile-values -fvpt -fbranch-target-load-optimize @gol 291-fbranch-target-load-optimize2 -fbtr-bb-exclusive @gol 292-fcaller-saves -fcprop-registers -fcse-follow-jumps @gol 293-fcse-skip-blocks -fcx-limited-range -fdata-sections @gol 294-fdelayed-branch -fdelete-null-pointer-checks -fearly-inlining @gol 295-fexpensive-optimizations -ffast-math -ffloat-store @gol 296-fforce-addr -ffunction-sections @gol 297-fgcse -fgcse-lm -fgcse-sm -fgcse-las -fgcse-after-reload @gol 298-fcrossjumping -fif-conversion -fif-conversion2 @gol 299-finline-functions -finline-functions-called-once @gol 300-finline-limit=@var{n} -fkeep-inline-functions @gol 301-fkeep-static-consts -fmerge-constants -fmerge-all-constants @gol 302-fmodulo-sched -fno-branch-count-reg @gol 303-fno-default-inline -fno-defer-pop -fmove-loop-invariants @gol 304-fno-function-cse -fno-guess-branch-probability @gol 305-fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol 306-funsafe-math-optimizations -funsafe-loop-optimizations -ffinite-math-only @gol 307-fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol 308-fomit-frame-pointer -foptimize-register-move @gol 309-foptimize-sibling-calls -fprefetch-loop-arrays @gol 310-fprofile-generate -fprofile-use @gol 311-fregmove -frename-registers @gol 312-freorder-blocks -freorder-blocks-and-partition -freorder-functions @gol 313-frerun-cse-after-loop @gol 314-frounding-math -frtl-abstract-sequences @gol 315-fschedule-insns -fschedule-insns2 @gol 316-fno-sched-interblock -fno-sched-spec -fsched-spec-load @gol 317-fsched-spec-load-dangerous @gol 318-fsched-stalled-insns=@var{n} -fsched-stalled-insns-dep=@var{n} @gol 319-fsched2-use-superblocks @gol 320-fsched2-use-traces -fsee -freschedule-modulo-scheduled-loops @gol 321-fsection-anchors -fsignaling-nans -fsingle-precision-constant @gol 322-fstack-protector -fstack-protector-all @gol 323-fstrict-aliasing -fstrict-overflow -ftracer -fthread-jumps @gol 324-funroll-all-loops -funroll-loops -fpeel-loops @gol 325-fsplit-ivs-in-unroller -funswitch-loops @gol 326-fvariable-expansion-in-unroller @gol 327-ftree-pre -ftree-ccp -ftree-dce -ftree-loop-optimize @gol 328-ftree-loop-linear -ftree-loop-im -ftree-loop-ivcanon -fivopts @gol 329-ftree-dominator-opts -ftree-dse -ftree-copyrename -ftree-sink @gol 330-ftree-ch -ftree-sra -ftree-ter -ftree-lrs -ftree-fre -ftree-vectorize @gol 331-ftree-vect-loop-version -ftree-salias -fipa-pta -fweb @gol 332-ftree-copy-prop -ftree-store-ccp -ftree-store-copy-prop -fwhole-program @gol 333--param @var{name}=@var{value} 334-O -O0 -O1 -O2 -O3 -Os} 335 336@item Preprocessor Options 337@xref{Preprocessor Options,,Options Controlling the Preprocessor}. 338@gccoptlist{-A@var{question}=@var{answer} @gol 339-A-@var{question}@r{[}=@var{answer}@r{]} @gol 340-C -dD -dI -dM -dN @gol 341-D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol 342-idirafter @var{dir} @gol 343-include @var{file} -imacros @var{file} @gol 344-iprefix @var{file} -iwithprefix @var{dir} @gol 345-iwithprefixbefore @var{dir} -isystem @var{dir} @gol 346-imultilib @var{dir} -isysroot @var{dir} @gol 347-M -MM -MF -MG -MP -MQ -MT -nostdinc @gol 348-P -fworking-directory -remap @gol 349-trigraphs -undef -U@var{macro} -Wp,@var{option} @gol 350-Xpreprocessor @var{option}} 351 352@item Assembler Option 353@xref{Assembler Options,,Passing Options to the Assembler}. 354@gccoptlist{-Wa,@var{option} -Xassembler @var{option}} 355 356@item Linker Options 357@xref{Link Options,,Options for Linking}. 358@gccoptlist{@var{object-file-name} -l@var{library} @gol 359-nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol 360-s -static -static-libgcc -shared -shared-libgcc -symbolic @gol 361-Wl,@var{option} -Xlinker @var{option} @gol 362-u @var{symbol}} 363 364@item Directory Options 365@xref{Directory Options,,Options for Directory Search}. 366@gccoptlist{-B@var{prefix} -I@var{dir} -iquote@var{dir} -L@var{dir} 367-specs=@var{file} -I- --sysroot=@var{dir}} 368 369@item Target Options 370@c I wrote this xref this way to avoid overfull hbox. -- rms 371@xref{Target Options}. 372@gccoptlist{-V @var{version} -b @var{machine}} 373 374@item Machine Dependent Options 375@xref{Submodel Options,,Hardware Models and Configurations}. 376@c This list is ordered alphanumerically by subsection name. 377@c Try and put the significant identifier (CPU or system) first, 378@c so users have a clue at guessing where the ones they want will be. 379 380@emph{ARC Options} 381@gccoptlist{-EB -EL @gol 382-mmangle-cpu -mcpu=@var{cpu} -mtext=@var{text-section} @gol 383-mdata=@var{data-section} -mrodata=@var{readonly-data-section}} 384 385@emph{ARM Options} 386@gccoptlist{-mapcs-frame -mno-apcs-frame @gol 387-mabi=@var{name} @gol 388-mapcs-stack-check -mno-apcs-stack-check @gol 389-mapcs-float -mno-apcs-float @gol 390-mapcs-reentrant -mno-apcs-reentrant @gol 391-msched-prolog -mno-sched-prolog @gol 392-mlittle-endian -mbig-endian -mwords-little-endian @gol 393-mfloat-abi=@var{name} -msoft-float -mhard-float -mfpe @gol 394-mthumb-interwork -mno-thumb-interwork @gol 395-mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol 396-mstructure-size-boundary=@var{n} @gol 397-mabort-on-noreturn @gol 398-mlong-calls -mno-long-calls @gol 399-msingle-pic-base -mno-single-pic-base @gol 400-mpic-register=@var{reg} @gol 401-mnop-fun-dllimport @gol 402-mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol 403-mpoke-function-name @gol 404-mthumb -marm @gol 405-mtpcs-frame -mtpcs-leaf-frame @gol 406-mcaller-super-interworking -mcallee-super-interworking @gol 407-mtp=@var{name}} 408 409@emph{AVR Options} 410@gccoptlist{-mmcu=@var{mcu} -msize -minit-stack=@var{n} -mno-interrupts @gol 411-mcall-prologues -mno-tablejump -mtiny-stack -mint8} 412 413@emph{Blackfin Options} 414@gccoptlist{-momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol 415-mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol 416-mlow-64k -mno-low64k -mid-shared-library @gol 417-mno-id-shared-library -mshared-library-id=@var{n} @gol 418-mlong-calls -mno-long-calls} 419 420@emph{CRIS Options} 421@gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol 422-mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol 423-metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol 424-mstack-align -mdata-align -mconst-align @gol 425-m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol 426-melf -maout -melinux -mlinux -sim -sim2 @gol 427-mmul-bug-workaround -mno-mul-bug-workaround} 428 429@emph{CRX Options} 430@gccoptlist{-mmac -mpush-args} 431 432@emph{Darwin Options} 433@gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol 434-arch_only -bind_at_load -bundle -bundle_loader @gol 435-client_name -compatibility_version -current_version @gol 436-dead_strip @gol 437-dependency-file -dylib_file -dylinker_install_name @gol 438-dynamic -dynamiclib -exported_symbols_list @gol 439-filelist -flat_namespace -force_cpusubtype_ALL @gol 440-force_flat_namespace -headerpad_max_install_names @gol 441-image_base -init -install_name -keep_private_externs @gol 442-multi_module -multiply_defined -multiply_defined_unused @gol 443-noall_load -no_dead_strip_inits_and_terms @gol 444-nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol 445-pagezero_size -prebind -prebind_all_twolevel_modules @gol 446-private_bundle -read_only_relocs -sectalign @gol 447-sectobjectsymbols -whyload -seg1addr @gol 448-sectcreate -sectobjectsymbols -sectorder @gol 449-segaddr -segs_read_only_addr -segs_read_write_addr @gol 450-seg_addr_table -seg_addr_table_filename -seglinkedit @gol 451-segprot -segs_read_only_addr -segs_read_write_addr @gol 452-single_module -static -sub_library -sub_umbrella @gol 453-twolevel_namespace -umbrella -undefined @gol 454-unexported_symbols_list -weak_reference_mismatches @gol 455-whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol 456-mkernel -mone-byte-bool} 457 458@emph{DEC Alpha Options} 459@gccoptlist{-mno-fp-regs -msoft-float -malpha-as -mgas @gol 460-mieee -mieee-with-inexact -mieee-conformant @gol 461-mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol 462-mtrap-precision=@var{mode} -mbuild-constants @gol 463-mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol 464-mbwx -mmax -mfix -mcix @gol 465-mfloat-vax -mfloat-ieee @gol 466-mexplicit-relocs -msmall-data -mlarge-data @gol 467-msmall-text -mlarge-text @gol 468-mmemory-latency=@var{time}} 469 470@emph{DEC Alpha/VMS Options} 471@gccoptlist{-mvms-return-codes} 472 473@emph{FRV Options} 474@gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol 475-mhard-float -msoft-float @gol 476-malloc-cc -mfixed-cc -mdword -mno-dword @gol 477-mdouble -mno-double @gol 478-mmedia -mno-media -mmuladd -mno-muladd @gol 479-mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol 480-mlinked-fp -mlong-calls -malign-labels @gol 481-mlibrary-pic -macc-4 -macc-8 @gol 482-mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol 483-moptimize-membar -mno-optimize-membar @gol 484-mscc -mno-scc -mcond-exec -mno-cond-exec @gol 485-mvliw-branch -mno-vliw-branch @gol 486-mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol 487-mno-nested-cond-exec -mtomcat-stats @gol 488-mTLS -mtls @gol 489-mcpu=@var{cpu}} 490 491@emph{GNU/Linux Options} 492@gccoptlist{-muclibc} 493 494@emph{H8/300 Options} 495@gccoptlist{-mrelax -mh -ms -mn -mint32 -malign-300} 496 497@emph{HPPA Options} 498@gccoptlist{-march=@var{architecture-type} @gol 499-mbig-switch -mdisable-fpregs -mdisable-indexing @gol 500-mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol 501-mfixed-range=@var{register-range} @gol 502-mjump-in-delay -mlinker-opt -mlong-calls @gol 503-mlong-load-store -mno-big-switch -mno-disable-fpregs @gol 504-mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol 505-mno-jump-in-delay -mno-long-load-store @gol 506-mno-portable-runtime -mno-soft-float @gol 507-mno-space-regs -msoft-float -mpa-risc-1-0 @gol 508-mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol 509-mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol 510-munix=@var{unix-std} -nolibdld -static -threads} 511 512@emph{i386 and x86-64 Options} 513@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol 514-mfpmath=@var{unit} @gol 515-masm=@var{dialect} -mno-fancy-math-387 @gol 516-mno-fp-ret-in-387 -msoft-float -msvr3-shlib @gol 517-mno-wide-multiply -mrtd -malign-double @gol 518-mpreferred-stack-boundary=@var{num} @gol 519-mmmx -msse -msse2 -msse3 -mssse3 -msse4a -m3dnow -mpopcnt -mabm -maes @gol 520-mthreads -mno-align-stringops -minline-all-stringops @gol 521-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol 522-m96bit-long-double -mregparm=@var{num} -msseregparm @gol 523-mstackrealign @gol 524-momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol 525-mcmodel=@var{code-model} @gol 526-m32 -m64 -mlarge-data-threshold=@var{num}} 527 528@emph{IA-64 Options} 529@gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol 530-mvolatile-asm-stop -mregister-names -mno-sdata @gol 531-mconstant-gp -mauto-pic -minline-float-divide-min-latency @gol 532-minline-float-divide-max-throughput @gol 533-minline-int-divide-min-latency @gol 534-minline-int-divide-max-throughput @gol 535-minline-sqrt-min-latency -minline-sqrt-max-throughput @gol 536-mno-dwarf2-asm -mearly-stop-bits @gol 537-mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol 538-mtune=@var{cpu-type} -mt -pthread -milp32 -mlp64 @gol 539-mno-sched-br-data-spec -msched-ar-data-spec -mno-sched-control-spec @gol 540-msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol 541-msched-ldc -mno-sched-control-ldc -mno-sched-spec-verbose @gol 542-mno-sched-prefer-non-data-spec-insns @gol 543-mno-sched-prefer-non-control-spec-insns @gol 544-mno-sched-count-spec-in-critical-path} 545 546@emph{M32R/D Options} 547@gccoptlist{-m32r2 -m32rx -m32r @gol 548-mdebug @gol 549-malign-loops -mno-align-loops @gol 550-missue-rate=@var{number} @gol 551-mbranch-cost=@var{number} @gol 552-mmodel=@var{code-size-model-type} @gol 553-msdata=@var{sdata-type} @gol 554-mno-flush-func -mflush-func=@var{name} @gol 555-mno-flush-trap -mflush-trap=@var{number} @gol 556-G @var{num}} 557 558@emph{M32C Options} 559@gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}} 560 561@emph{M680x0 Options} 562@gccoptlist{-m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol 563-m68060 -mcpu32 -m5200 -mcfv4e -m68881 -mbitfield @gol 564-mc68000 -mc68020 @gol 565-mnobitfield -mrtd -mshort -msoft-float -mpcrel @gol 566-malign-int -mstrict-align -msep-data -mno-sep-data @gol 567-mshared-library-id=n -mid-shared-library -mno-id-shared-library} 568 569@emph{M68hc1x Options} 570@gccoptlist{-m6811 -m6812 -m68hc11 -m68hc12 -m68hcs12 @gol 571-mauto-incdec -minmax -mlong-calls -mshort @gol 572-msoft-reg-count=@var{count}} 573 574@emph{MCore Options} 575@gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol 576-mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol 577-m4byte-functions -mno-4byte-functions -mcallgraph-data @gol 578-mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol 579-mlittle-endian -mbig-endian -m210 -m340 -mstack-increment} 580 581@emph{MIPS Options} 582@gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol 583-mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips64 @gol 584-mips16 -mno-mips16 -mabi=@var{abi} -mabicalls -mno-abicalls @gol 585-mshared -mno-shared -mxgot -mno-xgot -mgp32 -mgp64 @gol 586-mfp32 -mfp64 -mhard-float -msoft-float @gol 587-msingle-float -mdouble-float -mdsp -mpaired-single -mips3d @gol 588-mlong64 -mlong32 -msym32 -mno-sym32 @gol 589-G@var{num} -membedded-data -mno-embedded-data @gol 590-muninit-const-in-rodata -mno-uninit-const-in-rodata @gol 591-msplit-addresses -mno-split-addresses @gol 592-mexplicit-relocs -mno-explicit-relocs @gol 593-mcheck-zero-division -mno-check-zero-division @gol 594-mdivide-traps -mdivide-breaks @gol 595-mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol 596-mmad -mno-mad -mfused-madd -mno-fused-madd -nocpp @gol 597-mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol 598-mfix-vr4120 -mno-fix-vr4120 -mfix-vr4130 @gol 599-mfix-sb1 -mno-fix-sb1 @gol 600-mflush-func=@var{func} -mno-flush-func @gol 601-mbranch-likely -mno-branch-likely @gol 602-mfp-exceptions -mno-fp-exceptions @gol 603-mvr4130-align -mno-vr4130-align} 604 605@emph{MMIX Options} 606@gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol 607-mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol 608-melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol 609-mno-base-addresses -msingle-exit -mno-single-exit} 610 611@emph{MN10300 Options} 612@gccoptlist{-mmult-bug -mno-mult-bug @gol 613-mam33 -mno-am33 @gol 614-mam33-2 -mno-am33-2 @gol 615-mreturn-pointer-on-d0 @gol 616-mno-crt0 -mrelax} 617 618@emph{MT Options} 619@gccoptlist{-mno-crt0 -mbacc -msim @gol 620-march=@var{cpu-type} } 621 622@emph{PDP-11 Options} 623@gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol 624-mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol 625-mint16 -mno-int32 -mfloat32 -mno-float64 @gol 626-mfloat64 -mno-float32 -mabshi -mno-abshi @gol 627-mbranch-expensive -mbranch-cheap @gol 628-msplit -mno-split -munix-asm -mdec-asm} 629 630@emph{PowerPC Options} 631See RS/6000 and PowerPC Options. 632 633@emph{RS/6000 and PowerPC Options} 634@gccoptlist{-mcpu=@var{cpu-type} @gol 635-mtune=@var{cpu-type} @gol 636-mpower -mno-power -mpower2 -mno-power2 @gol 637-mpowerpc -mpowerpc64 -mno-powerpc @gol 638-maltivec -mno-altivec @gol 639-mpowerpc-gpopt -mno-powerpc-gpopt @gol 640-mpowerpc-gfxopt -mno-powerpc-gfxopt @gol 641-mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mfprnd -mno-fprnd @gol 642-mnew-mnemonics -mold-mnemonics @gol 643-mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol 644-m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol 645-malign-power -malign-natural @gol 646-msoft-float -mhard-float -mmultiple -mno-multiple @gol 647-mstring -mno-string -mupdate -mno-update @gol 648-mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol 649-mstrict-align -mno-strict-align -mrelocatable @gol 650-mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol 651-mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol 652-mdynamic-no-pic -maltivec -mswdiv @gol 653-mprioritize-restricted-insns=@var{priority} @gol 654-msched-costly-dep=@var{dependence_type} @gol 655-minsert-sched-nops=@var{scheme} @gol 656-mcall-sysv -mcall-netbsd @gol 657-maix-struct-return -msvr4-struct-return @gol 658-mabi=@var{abi-type} -msecure-plt -mbss-plt @gol 659-misel -mno-isel @gol 660-misel=yes -misel=no @gol 661-mspe -mno-spe @gol 662-mspe=yes -mspe=no @gol 663-mvrsave -mno-vrsave @gol 664-mmulhw -mno-mulhw @gol 665-mdlmzb -mno-dlmzb @gol 666-mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol 667-mprototype -mno-prototype @gol 668-msim -mmvme -mads -myellowknife -memb -msdata @gol 669-msdata=@var{opt} -mvxworks -mwindiss -G @var{num} -pthread} 670 671@emph{S/390 and zSeries Options} 672@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol 673-mhard-float -msoft-float -mlong-double-64 -mlong-double-128 @gol 674-mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol 675-msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol 676-m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol 677-mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol 678-mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard} 679 680@emph{Score Options} 681@gccoptlist{-meb -mel @gol 682-mnhwloop @gol 683-muls @gol 684-mmac @gol 685-mscore5 -mscore5u -mscore7 -mscore7d} 686 687@emph{SH Options} 688@gccoptlist{-m1 -m2 -m2e -m3 -m3e @gol 689-m4-nofpu -m4-single-only -m4-single -m4 @gol 690-m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol 691-m5-64media -m5-64media-nofpu @gol 692-m5-32media -m5-32media-nofpu @gol 693-m5-compact -m5-compact-nofpu @gol 694-mb -ml -mdalign -mrelax @gol 695-mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol 696-mieee -misize -mpadstruct -mspace @gol 697-mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol 698-mdivsi3_libfunc=@var{name} @gol 699-madjust-unroll -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol 700 -minvalid-symbols} 701 702@emph{SPARC Options} 703@gccoptlist{-mcpu=@var{cpu-type} @gol 704-mtune=@var{cpu-type} @gol 705-mcmodel=@var{code-model} @gol 706-m32 -m64 -mapp-regs -mno-app-regs @gol 707-mfaster-structs -mno-faster-structs @gol 708-mfpu -mno-fpu -mhard-float -msoft-float @gol 709-mhard-quad-float -msoft-quad-float @gol 710-mimpure-text -mno-impure-text -mlittle-endian @gol 711-mstack-bias -mno-stack-bias @gol 712-munaligned-doubles -mno-unaligned-doubles @gol 713-mv8plus -mno-v8plus -mvis -mno-vis 714-threads -pthreads -pthread} 715 716@emph{System V Options} 717@gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}} 718 719@emph{TMS320C3x/C4x Options} 720@gccoptlist{-mcpu=@var{cpu} -mbig -msmall -mregparm -mmemparm @gol 721-mfast-fix -mmpyi -mbk -mti -mdp-isr-reload @gol 722-mrpts=@var{count} -mrptb -mdb -mloop-unsigned @gol 723-mparallel-insns -mparallel-mpy -mpreserve-float} 724 725@emph{V850 Options} 726@gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol 727-mprolog-function -mno-prolog-function -mspace @gol 728-mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol 729-mapp-regs -mno-app-regs @gol 730-mdisable-callt -mno-disable-callt @gol 731-mv850e1 @gol 732-mv850e @gol 733-mv850 -mbig-switch} 734 735@emph{VAX Options} 736@gccoptlist{-mg -mgnu -munix} 737 738@emph{x86-64 Options} 739See i386 and x86-64 Options. 740 741@emph{Xstormy16 Options} 742@gccoptlist{-msim} 743 744@emph{Xtensa Options} 745@gccoptlist{-mconst16 -mno-const16 @gol 746-mfused-madd -mno-fused-madd @gol 747-mtext-section-literals -mno-text-section-literals @gol 748-mtarget-align -mno-target-align @gol 749-mlongcalls -mno-longcalls} 750 751@emph{zSeries Options} 752See S/390 and zSeries Options. 753 754@item Code Generation Options 755@xref{Code Gen Options,,Options for Code Generation Conventions}. 756@gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol 757-ffixed-@var{reg} -fexceptions @gol 758-fnon-call-exceptions -funwind-tables @gol 759-fasynchronous-unwind-tables @gol 760-finhibit-size-directive -finstrument-functions @gol 761-fno-common -fno-ident @gol 762-fpcc-struct-return -fpic -fPIC -fpie -fPIE @gol 763-fno-jump-tables @gol 764-freg-struct-return -fshort-enums @gol 765-fshort-double -fshort-wchar @gol 766-fverbose-asm -fpack-struct[=@var{n}] -fstack-check @gol 767-fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol 768-fargument-alias -fargument-noalias @gol 769-fargument-noalias-global -fargument-noalias-anything 770-fleading-underscore -ftls-model=@var{model} @gol 771-ftrapv -fwrapv -fbounds-check @gol 772-fvisibility} 773@end table 774 775@menu 776* Overall Options:: Controlling the kind of output: 777 an executable, object files, assembler files, 778 or preprocessed source. 779* C Dialect Options:: Controlling the variant of C language compiled. 780* C++ Dialect Options:: Variations on C++. 781* Language Independent Options:: Controlling how diagnostics should be 782 formatted. 783* Warning Options:: How picky should the compiler be? 784* Debugging Options:: Symbol tables, measurements, and debugging dumps. 785* Optimize Options:: How much optimization? 786* Preprocessor Options:: Controlling header files and macro definitions. 787 Also, getting dependency information for Make. 788* Assembler Options:: Passing options to the assembler. 789* Link Options:: Specifying libraries and so on. 790* Directory Options:: Where to find header files and libraries. 791 Where to find the compiler executable files. 792* Spec Files:: How to pass switches to sub-processes. 793* Target Options:: Running a cross-compiler, or an old version of GCC. 794@end menu 795 796@node Overall Options 797@section Options Controlling the Kind of Output 798 799Compilation can involve up to four stages: preprocessing, compilation 800proper, assembly and linking, always in that order. GCC is capable of 801preprocessing and compiling several files either into several 802assembler input files, or into one assembler input file; then each 803assembler input file produces an object file, and linking combines all 804the object files (those newly compiled, and those specified as input) 805into an executable file. 806 807@cindex file name suffix 808For any given input file, the file name suffix determines what kind of 809compilation is done: 810 811@table @gcctabopt 812@item @var{file}.c 813C source code which must be preprocessed. 814 815@item @var{file}.i 816C source code which should not be preprocessed. 817 818@item @var{file}.ii 819C++ source code which should not be preprocessed. 820 821@item @var{file}.h 822C, or C++ header file to be turned into a precompiled header. 823 824@item @var{file}.cc 825@itemx @var{file}.cp 826@itemx @var{file}.cxx 827@itemx @var{file}.cpp 828@itemx @var{file}.CPP 829@itemx @var{file}.c++ 830@itemx @var{file}.C 831C++ source code which must be preprocessed. Note that in @samp{.cxx}, 832the last two letters must both be literally @samp{x}. Likewise, 833@samp{.C} refers to a literal capital C@. 834 835@item @var{file}.hh 836@itemx @var{file}.H 837C++ header file to be turned into a precompiled header. 838 839@item @var{file}.f 840@itemx @var{file}.for 841@itemx @var{file}.FOR 842Fixed form Fortran source code which should not be preprocessed. 843 844@item @var{file}.F 845@itemx @var{file}.fpp 846@itemx @var{file}.FPP 847Fixed form Fortran source code which must be preprocessed (with the traditional 848preprocessor). 849 850@item @var{file}.f90 851@itemx @var{file}.f95 852Free form Fortran source code which should not be preprocessed. 853 854@item @var{file}.F90 855@itemx @var{file}.F95 856Free form Fortran source code which must be preprocessed (with the 857traditional preprocessor). 858 859@c FIXME: Descriptions of Java file types. 860@c @var{file}.java 861@c @var{file}.class 862@c @var{file}.zip 863@c @var{file}.jar 864 865@item @var{file}.ads 866Ada source code file which contains a library unit declaration (a 867declaration of a package, subprogram, or generic, or a generic 868instantiation), or a library unit renaming declaration (a package, 869generic, or subprogram renaming declaration). Such files are also 870called @dfn{specs}. 871 872@itemx @var{file}.adb 873Ada source code file containing a library unit body (a subprogram or 874package body). Such files are also called @dfn{bodies}. 875 876@c GCC also knows about some suffixes for languages not yet included: 877@c Pascal: 878@c @var{file}.p 879@c @var{file}.pas 880@c Ratfor: 881@c @var{file}.r 882 883@item @var{file}.s 884Assembler code. 885 886@item @var{file}.S 887Assembler code which must be preprocessed. 888 889@item @var{other} 890An object file to be fed straight into linking. 891Any file name with no recognized suffix is treated this way. 892@end table 893 894@opindex x 895You can specify the input language explicitly with the @option{-x} option: 896 897@table @gcctabopt 898@item -x @var{language} 899Specify explicitly the @var{language} for the following input files 900(rather than letting the compiler choose a default based on the file 901name suffix). This option applies to all following input files until 902the next @option{-x} option. Possible values for @var{language} are: 903@smallexample 904c c-header c-cpp-output 905c++ c++-header c++-cpp-output 906assembler assembler-with-cpp 907ada 908f95 f95-cpp-input 909java 910treelang 911@end smallexample 912 913@item -x none 914Turn off any specification of a language, so that subsequent files are 915handled according to their file name suffixes (as they are if @option{-x} 916has not been used at all). 917 918@item -pass-exit-codes 919@opindex pass-exit-codes 920Normally the @command{gcc} program will exit with the code of 1 if any 921phase of the compiler returns a non-success return code. If you specify 922@option{-pass-exit-codes}, the @command{gcc} program will instead return with 923numerically highest error produced by any phase that returned an error 924indication. The C, C++, and Fortran frontends return 4, if an internal 925compiler error is encountered. 926@end table 927 928If you only want some of the stages of compilation, you can use 929@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and 930one of the options @option{-c}, @option{-S}, or @option{-E} to say where 931@command{gcc} is to stop. Note that some combinations (for example, 932@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all. 933 934@table @gcctabopt 935@item -c 936@opindex c 937Compile or assemble the source files, but do not link. The linking 938stage simply is not done. The ultimate output is in the form of an 939object file for each source file. 940 941By default, the object file name for a source file is made by replacing 942the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}. 943 944Unrecognized input files, not requiring compilation or assembly, are 945ignored. 946 947@item -S 948@opindex S 949Stop after the stage of compilation proper; do not assemble. The output 950is in the form of an assembler code file for each non-assembler input 951file specified. 952 953By default, the assembler file name for a source file is made by 954replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}. 955 956Input files that don't require compilation are ignored. 957 958@item -E 959@opindex E 960Stop after the preprocessing stage; do not run the compiler proper. The 961output is in the form of preprocessed source code, which is sent to the 962standard output. 963 964Input files which don't require preprocessing are ignored. 965 966@cindex output file option 967@item -o @var{file} 968@opindex o 969Place output in file @var{file}. This applies regardless to whatever 970sort of output is being produced, whether it be an executable file, 971an object file, an assembler file or preprocessed C code. 972 973If @option{-o} is not specified, the default is to put an executable 974file in @file{a.out}, the object file for 975@file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its 976assembler file in @file{@var{source}.s}, a precompiled header file in 977@file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on 978standard output. 979 980@item -v 981@opindex v 982Print (on standard error output) the commands executed to run the stages 983of compilation. Also print the version number of the compiler driver 984program and of the preprocessor and the compiler proper. 985 986@item -### 987@opindex ### 988Like @option{-v} except the commands are not executed and all command 989arguments are quoted. This is useful for shell scripts to capture the 990driver-generated command lines. 991 992@item -pipe 993@opindex pipe 994Use pipes rather than temporary files for communication between the 995various stages of compilation. This fails to work on some systems where 996the assembler is unable to read from a pipe; but the GNU assembler has 997no trouble. 998 999@item -combine 1000@opindex combine 1001If you are compiling multiple source files, this option tells the driver 1002to pass all the source files to the compiler at once (for those 1003languages for which the compiler can handle this). This will allow 1004intermodule analysis (IMA) to be performed by the compiler. Currently the only 1005language for which this is supported is C@. If you pass source files for 1006multiple languages to the driver, using this option, the driver will invoke 1007the compiler(s) that support IMA once each, passing each compiler all the 1008source files appropriate for it. For those languages that do not support 1009IMA this option will be ignored, and the compiler will be invoked once for 1010each source file in that language. If you use this option in conjunction 1011with @option{-save-temps}, the compiler will generate multiple 1012pre-processed files 1013(one for each source file), but only one (combined) @file{.o} or 1014@file{.s} file. 1015 1016@item --help 1017@opindex help 1018Print (on the standard output) a description of the command line options 1019understood by @command{gcc}. If the @option{-v} option is also specified 1020then @option{--help} will also be passed on to the various processes 1021invoked by @command{gcc}, so that they can display the command line options 1022they accept. If the @option{-Wextra} option is also specified then command 1023line options which have no documentation associated with them will also 1024be displayed. 1025 1026@item --target-help 1027@opindex target-help 1028Print (on the standard output) a description of target specific command 1029line options for each tool. 1030 1031@item --version 1032@opindex version 1033Display the version number and copyrights of the invoked GCC@. 1034 1035@include @value{srcdir}/../libiberty/at-file.texi 1036@end table 1037 1038@node Invoking G++ 1039@section Compiling C++ Programs 1040 1041@cindex suffixes for C++ source 1042@cindex C++ source file suffixes 1043C++ source files conventionally use one of the suffixes @samp{.C}, 1044@samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or 1045@samp{.cxx}; C++ header files often use @samp{.hh} or @samp{.H}; and 1046preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes 1047files with these names and compiles them as C++ programs even if you 1048call the compiler the same way as for compiling C programs (usually 1049with the name @command{gcc}). 1050 1051@findex g++ 1052@findex c++ 1053However, the use of @command{gcc} does not add the C++ library. 1054@command{g++} is a program that calls GCC and treats @samp{.c}, 1055@samp{.h} and @samp{.i} files as C++ source files instead of C source 1056files unless @option{-x} is used, and automatically specifies linking 1057against the C++ library. This program is also useful when 1058precompiling a C header file with a @samp{.h} extension for use in C++ 1059compilations. On many systems, @command{g++} is also installed with 1060the name @command{c++}. 1061 1062@cindex invoking @command{g++} 1063When you compile C++ programs, you may specify many of the same 1064command-line options that you use for compiling programs in any 1065language; or command-line options meaningful for C and related 1066languages; or options that are meaningful only for C++ programs. 1067@xref{C Dialect Options,,Options Controlling C Dialect}, for 1068explanations of options for languages related to C@. 1069@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for 1070explanations of options that are meaningful only for C++ programs. 1071 1072@node C Dialect Options 1073@section Options Controlling C Dialect 1074@cindex dialect options 1075@cindex language dialect options 1076@cindex options, dialect 1077 1078The following options control the dialect of C (or languages derived 1079from C, such as C++) that the compiler accepts: 1080 1081@table @gcctabopt 1082@cindex ANSI support 1083@cindex ISO support 1084@item -ansi 1085@opindex ansi 1086In C mode, support all ISO C90 programs. In C++ mode, 1087remove GNU extensions that conflict with ISO C++. 1088 1089This turns off certain features of GCC that are incompatible with ISO 1090C90 (when compiling C code), or of standard C++ (when compiling C++ code), 1091such as the @code{asm} and @code{typeof} keywords, and 1092predefined macros such as @code{unix} and @code{vax} that identify the 1093type of system you are using. It also enables the undesirable and 1094rarely used ISO trigraph feature. For the C compiler, 1095it disables recognition of C++ style @samp{//} comments as well as 1096the @code{inline} keyword. 1097 1098The alternate keywords @code{__asm__}, @code{__extension__}, 1099@code{__inline__} and @code{__typeof__} continue to work despite 1100@option{-ansi}. You would not want to use them in an ISO C program, of 1101course, but it is useful to put them in header files that might be included 1102in compilations done with @option{-ansi}. Alternate predefined macros 1103such as @code{__unix__} and @code{__vax__} are also available, with or 1104without @option{-ansi}. 1105 1106The @option{-ansi} option does not cause non-ISO programs to be 1107rejected gratuitously. For that, @option{-pedantic} is required in 1108addition to @option{-ansi}. @xref{Warning Options}. 1109 1110The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi} 1111option is used. Some header files may notice this macro and refrain 1112from declaring certain functions or defining certain macros that the 1113ISO standard doesn't call for; this is to avoid interfering with any 1114programs that might use these names for other things. 1115 1116Functions which would normally be built in but do not have semantics 1117defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in 1118functions with @option{-ansi} is used. @xref{Other Builtins,,Other 1119built-in functions provided by GCC}, for details of the functions 1120affected. 1121 1122@item -std= 1123@opindex std 1124Determine the language standard. This option is currently only 1125supported when compiling C or C++. A value for this option must be 1126provided; possible values are 1127 1128@table @samp 1129@item c89 1130@itemx iso9899:1990 1131ISO C90 (same as @option{-ansi}). 1132 1133@item iso9899:199409 1134ISO C90 as modified in amendment 1. 1135 1136@item c99 1137@itemx c9x 1138@itemx iso9899:1999 1139@itemx iso9899:199x 1140ISO C99. Note that this standard is not yet fully supported; see 1141@w{@uref{http://gcc.gnu.org/gcc-4.2/c99status.html}} for more information. The 1142names @samp{c9x} and @samp{iso9899:199x} are deprecated. 1143 1144@item gnu89 1145Default, ISO C90 plus GNU extensions (including some C99 features). 1146 1147@item gnu99 1148@itemx gnu9x 1149ISO C99 plus GNU extensions. When ISO C99 is fully implemented in GCC, 1150this will become the default. The name @samp{gnu9x} is deprecated. 1151 1152@item c++98 1153The 1998 ISO C++ standard plus amendments. 1154 1155@item gnu++98 1156The same as @option{-std=c++98} plus GNU extensions. This is the 1157default for C++ code. 1158@end table 1159 1160Even when this option is not specified, you can still use some of the 1161features of newer standards in so far as they do not conflict with 1162previous C standards. For example, you may use @code{__restrict__} even 1163when @option{-std=c99} is not specified. 1164 1165The @option{-std} options specifying some version of ISO C have the same 1166effects as @option{-ansi}, except that features that were not in ISO C90 1167but are in the specified version (for example, @samp{//} comments and 1168the @code{inline} keyword in ISO C99) are not disabled. 1169 1170@xref{Standards,,Language Standards Supported by GCC}, for details of 1171these standard versions. 1172 1173@item -fgnu89-inline 1174@opindex fgnu89-inline 1175The option @option{-fgnu89-inline} tells GCC to use the traditional 1176GNU semantics for @code{inline} functions when in C99 mode. 1177@xref{Inline,,An Inline Function is As Fast As a Macro}. Using this 1178option is roughly equivalent to adding the @code{gnu_inline} function 1179attribute to all inline functions (@pxref{Function Attributes}). 1180 1181This option is accepted by GCC versions 4.1.3 and up. In GCC versions 1182prior to 4.3, C99 inline semantics are not supported, and thus this 1183option is effectively assumed to be present regardless of whether or not 1184it is specified; the only effect of specifying it explicitly is to 1185disable warnings about using inline functions in C99 mode. Likewise, 1186the option @option{-fno-gnu89-inline} is not supported in versions of 1187GCC before 4.3. It will be supported only in C99 or gnu99 mode, not in 1188C89 or gnu89 mode. 1189 1190The preprocesor macros @code{__GNUC_GNU_INLINE__} and 1191@code{__GNUC_STDC_INLINE__} may be used to check which semantics are 1192in effect for @code{inline} functions. @xref{Common Predefined 1193Macros,,,cpp,The C Preprocessor}. 1194 1195@item -aux-info @var{filename} 1196@opindex aux-info 1197Output to the given filename prototyped declarations for all functions 1198declared and/or defined in a translation unit, including those in header 1199files. This option is silently ignored in any language other than C@. 1200 1201Besides declarations, the file indicates, in comments, the origin of 1202each declaration (source file and line), whether the declaration was 1203implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or 1204@samp{O} for old, respectively, in the first character after the line 1205number and the colon), and whether it came from a declaration or a 1206definition (@samp{C} or @samp{F}, respectively, in the following 1207character). In the case of function definitions, a K&R-style list of 1208arguments followed by their declarations is also provided, inside 1209comments, after the declaration. 1210 1211@item -fno-asm 1212@opindex fno-asm 1213Do not recognize @code{asm}, @code{inline} or @code{typeof} as a 1214keyword, so that code can use these words as identifiers. You can use 1215the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__} 1216instead. @option{-ansi} implies @option{-fno-asm}. 1217 1218In C++, this switch only affects the @code{typeof} keyword, since 1219@code{asm} and @code{inline} are standard keywords. You may want to 1220use the @option{-fno-gnu-keywords} flag instead, which has the same 1221effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this 1222switch only affects the @code{asm} and @code{typeof} keywords, since 1223@code{inline} is a standard keyword in ISO C99. 1224 1225@item -fno-builtin 1226@itemx -fno-builtin-@var{function} 1227@opindex fno-builtin 1228@cindex built-in functions 1229Don't recognize built-in functions that do not begin with 1230@samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in 1231functions provided by GCC}, for details of the functions affected, 1232including those which are not built-in functions when @option{-ansi} or 1233@option{-std} options for strict ISO C conformance are used because they 1234do not have an ISO standard meaning. 1235 1236GCC normally generates special code to handle certain built-in functions 1237more efficiently; for instance, calls to @code{alloca} may become single 1238instructions that adjust the stack directly, and calls to @code{memcpy} 1239may become inline copy loops. The resulting code is often both smaller 1240and faster, but since the function calls no longer appear as such, you 1241cannot set a breakpoint on those calls, nor can you change the behavior 1242of the functions by linking with a different library. In addition, 1243when a function is recognized as a built-in function, GCC may use 1244information about that function to warn about problems with calls to 1245that function, or to generate more efficient code, even if the 1246resulting code still contains calls to that function. For example, 1247warnings are given with @option{-Wformat} for bad calls to 1248@code{printf}, when @code{printf} is built in, and @code{strlen} is 1249known not to modify global memory. 1250 1251With the @option{-fno-builtin-@var{function}} option 1252only the built-in function @var{function} is 1253disabled. @var{function} must not begin with @samp{__builtin_}. If a 1254function is named this is not built-in in this version of GCC, this 1255option is ignored. There is no corresponding 1256@option{-fbuiltin-@var{function}} option; if you wish to enable 1257built-in functions selectively when using @option{-fno-builtin} or 1258@option{-ffreestanding}, you may define macros such as: 1259 1260@smallexample 1261#define abs(n) __builtin_abs ((n)) 1262#define strcpy(d, s) __builtin_strcpy ((d), (s)) 1263@end smallexample 1264 1265@item -fhosted 1266@opindex fhosted 1267@cindex hosted environment 1268 1269Assert that compilation takes place in a hosted environment. This implies 1270@option{-fbuiltin}. A hosted environment is one in which the 1271entire standard library is available, and in which @code{main} has a return 1272type of @code{int}. Examples are nearly everything except a kernel. 1273This is equivalent to @option{-fno-freestanding}. 1274 1275@item -ffreestanding 1276@opindex ffreestanding 1277@cindex hosted environment 1278 1279Assert that compilation takes place in a freestanding environment. This 1280implies @option{-fno-builtin}. A freestanding environment 1281is one in which the standard library may not exist, and program startup may 1282not necessarily be at @code{main}. The most obvious example is an OS kernel. 1283This is equivalent to @option{-fno-hosted}. 1284 1285@xref{Standards,,Language Standards Supported by GCC}, for details of 1286freestanding and hosted environments. 1287 1288@item -fopenmp 1289@opindex fopenmp 1290@cindex openmp parallel 1291Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and 1292@code{!$omp} in Fortran. When @option{-fopenmp} is specified, the 1293compiler generates parallel code according to the OpenMP Application 1294Program Interface v2.5 @w{@uref{http://www.openmp.org/}}. 1295 1296@item -fms-extensions 1297@opindex fms-extensions 1298Accept some non-standard constructs used in Microsoft header files. 1299 1300Some cases of unnamed fields in structures and unions are only 1301accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union 1302fields within structs/unions}, for details. 1303 1304@item -trigraphs 1305@opindex trigraphs 1306Support ISO C trigraphs. The @option{-ansi} option (and @option{-std} 1307options for strict ISO C conformance) implies @option{-trigraphs}. 1308 1309@item -no-integrated-cpp 1310@opindex no-integrated-cpp 1311Performs a compilation in two passes: preprocessing and compiling. This 1312option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the 1313@option{-B} option. The user supplied compilation step can then add in 1314an additional preprocessing step after normal preprocessing but before 1315compiling. The default is to use the integrated cpp (internal cpp) 1316 1317The semantics of this option will change if "cc1", "cc1plus", and 1318"cc1obj" are merged. 1319 1320@cindex traditional C language 1321@cindex C language, traditional 1322@item -traditional 1323@itemx -traditional-cpp 1324@opindex traditional-cpp 1325@opindex traditional 1326Formerly, these options caused GCC to attempt to emulate a pre-standard 1327C compiler. They are now only supported with the @option{-E} switch. 1328The preprocessor continues to support a pre-standard mode. See the GNU 1329CPP manual for details. 1330 1331@item -fcond-mismatch 1332@opindex fcond-mismatch 1333Allow conditional expressions with mismatched types in the second and 1334third arguments. The value of such an expression is void. This option 1335is not supported for C++. 1336 1337@item -funsigned-char 1338@opindex funsigned-char 1339Let the type @code{char} be unsigned, like @code{unsigned char}. 1340 1341Each kind of machine has a default for what @code{char} should 1342be. It is either like @code{unsigned char} by default or like 1343@code{signed char} by default. 1344 1345Ideally, a portable program should always use @code{signed char} or 1346@code{unsigned char} when it depends on the signedness of an object. 1347But many programs have been written to use plain @code{char} and 1348expect it to be signed, or expect it to be unsigned, depending on the 1349machines they were written for. This option, and its inverse, let you 1350make such a program work with the opposite default. 1351 1352The type @code{char} is always a distinct type from each of 1353@code{signed char} or @code{unsigned char}, even though its behavior 1354is always just like one of those two. 1355 1356@item -fsigned-char 1357@opindex fsigned-char 1358Let the type @code{char} be signed, like @code{signed char}. 1359 1360Note that this is equivalent to @option{-fno-unsigned-char}, which is 1361the negative form of @option{-funsigned-char}. Likewise, the option 1362@option{-fno-signed-char} is equivalent to @option{-funsigned-char}. 1363 1364@item -fsigned-bitfields 1365@itemx -funsigned-bitfields 1366@itemx -fno-signed-bitfields 1367@itemx -fno-unsigned-bitfields 1368@opindex fsigned-bitfields 1369@opindex funsigned-bitfields 1370@opindex fno-signed-bitfields 1371@opindex fno-unsigned-bitfields 1372These options control whether a bit-field is signed or unsigned, when the 1373declaration does not use either @code{signed} or @code{unsigned}. By 1374default, such a bit-field is signed, because this is consistent: the 1375basic integer types such as @code{int} are signed types. 1376@end table 1377 1378@node C++ Dialect Options 1379@section Options Controlling C++ Dialect 1380 1381@cindex compiler options, C++ 1382@cindex C++ options, command line 1383@cindex options, C++ 1384This section describes the command-line options that are only meaningful 1385for C++ programs; but you can also use most of the GNU compiler options 1386regardless of what language your program is in. For example, you 1387might compile a file @code{firstClass.C} like this: 1388 1389@smallexample 1390g++ -g -frepo -O -c firstClass.C 1391@end smallexample 1392 1393@noindent 1394In this example, only @option{-frepo} is an option meant 1395only for C++ programs; you can use the other options with any 1396language supported by GCC@. 1397 1398Here is a list of options that are @emph{only} for compiling C++ programs: 1399 1400@table @gcctabopt 1401 1402@item -fabi-version=@var{n} 1403@opindex fabi-version 1404Use version @var{n} of the C++ ABI@. Version 2 is the version of the 1405C++ ABI that first appeared in G++ 3.4. Version 1 is the version of 1406the C++ ABI that first appeared in G++ 3.2. Version 0 will always be 1407the version that conforms most closely to the C++ ABI specification. 1408Therefore, the ABI obtained using version 0 will change as ABI bugs 1409are fixed. 1410 1411The default is version 2. 1412 1413@item -fno-access-control 1414@opindex fno-access-control 1415Turn off all access checking. This switch is mainly useful for working 1416around bugs in the access control code. 1417 1418@item -fcheck-new 1419@opindex fcheck-new 1420Check that the pointer returned by @code{operator new} is non-null 1421before attempting to modify the storage allocated. This check is 1422normally unnecessary because the C++ standard specifies that 1423@code{operator new} will only return @code{0} if it is declared 1424@samp{throw()}, in which case the compiler will always check the 1425return value even without this option. In all other cases, when 1426@code{operator new} has a non-empty exception specification, memory 1427exhaustion is signalled by throwing @code{std::bad_alloc}. See also 1428@samp{new (nothrow)}. 1429 1430@item -fconserve-space 1431@opindex fconserve-space 1432Put uninitialized or runtime-initialized global variables into the 1433common segment, as C does. This saves space in the executable at the 1434cost of not diagnosing duplicate definitions. If you compile with this 1435flag and your program mysteriously crashes after @code{main()} has 1436completed, you may have an object that is being destroyed twice because 1437two definitions were merged. 1438 1439This option is no longer useful on most targets, now that support has 1440been added for putting variables into BSS without making them common. 1441 1442@item -ffriend-injection 1443@opindex ffriend-injection 1444Inject friend functions into the enclosing namespace, so that they are 1445visible outside the scope of the class in which they are declared. 1446Friend functions were documented to work this way in the old Annotated 1447C++ Reference Manual, and versions of G++ before 4.1 always worked 1448that way. However, in ISO C++ a friend function which is not declared 1449in an enclosing scope can only be found using argument dependent 1450lookup. This option causes friends to be injected as they were in 1451earlier releases. 1452 1453This option is for compatibility, and may be removed in a future 1454release of G++. 1455 1456@item -fno-elide-constructors 1457@opindex fno-elide-constructors 1458The C++ standard allows an implementation to omit creating a temporary 1459which is only used to initialize another object of the same type. 1460Specifying this option disables that optimization, and forces G++ to 1461call the copy constructor in all cases. 1462 1463@item -fno-enforce-eh-specs 1464@opindex fno-enforce-eh-specs 1465Don't generate code to check for violation of exception specifications 1466at runtime. This option violates the C++ standard, but may be useful 1467for reducing code size in production builds, much like defining 1468@samp{NDEBUG}. This does not give user code permission to throw 1469exceptions in violation of the exception specifications; the compiler 1470will still optimize based on the specifications, so throwing an 1471unexpected exception will result in undefined behavior. 1472 1473@item -ffor-scope 1474@itemx -fno-for-scope 1475@opindex ffor-scope 1476@opindex fno-for-scope 1477If @option{-ffor-scope} is specified, the scope of variables declared in 1478a @i{for-init-statement} is limited to the @samp{for} loop itself, 1479as specified by the C++ standard. 1480If @option{-fno-for-scope} is specified, the scope of variables declared in 1481a @i{for-init-statement} extends to the end of the enclosing scope, 1482as was the case in old versions of G++, and other (traditional) 1483implementations of C++. 1484 1485The default if neither flag is given to follow the standard, 1486but to allow and give a warning for old-style code that would 1487otherwise be invalid, or have different behavior. 1488 1489@item -fno-gnu-keywords 1490@opindex fno-gnu-keywords 1491Do not recognize @code{typeof} as a keyword, so that code can use this 1492word as an identifier. You can use the keyword @code{__typeof__} instead. 1493@option{-ansi} implies @option{-fno-gnu-keywords}. 1494 1495@item -fno-implicit-templates 1496@opindex fno-implicit-templates 1497Never emit code for non-inline templates which are instantiated 1498implicitly (i.e.@: by use); only emit code for explicit instantiations. 1499@xref{Template Instantiation}, for more information. 1500 1501@item -fno-implicit-inline-templates 1502@opindex fno-implicit-inline-templates 1503Don't emit code for implicit instantiations of inline templates, either. 1504The default is to handle inlines differently so that compiles with and 1505without optimization will need the same set of explicit instantiations. 1506 1507@item -fno-implement-inlines 1508@opindex fno-implement-inlines 1509To save space, do not emit out-of-line copies of inline functions 1510controlled by @samp{#pragma implementation}. This will cause linker 1511errors if these functions are not inlined everywhere they are called. 1512 1513@item -fms-extensions 1514@opindex fms-extensions 1515Disable pedantic warnings about constructs used in MFC, such as implicit 1516int and getting a pointer to member function via non-standard syntax. 1517 1518@item -fno-nonansi-builtins 1519@opindex fno-nonansi-builtins 1520Disable built-in declarations of functions that are not mandated by 1521ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit}, 1522@code{index}, @code{bzero}, @code{conjf}, and other related functions. 1523 1524@item -fno-operator-names 1525@opindex fno-operator-names 1526Do not treat the operator name keywords @code{and}, @code{bitand}, 1527@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as 1528synonyms as keywords. 1529 1530@item -fno-optional-diags 1531@opindex fno-optional-diags 1532Disable diagnostics that the standard says a compiler does not need to 1533issue. Currently, the only such diagnostic issued by G++ is the one for 1534a name having multiple meanings within a class. 1535 1536@item -fpermissive 1537@opindex fpermissive 1538Downgrade some diagnostics about nonconformant code from errors to 1539warnings. Thus, using @option{-fpermissive} will allow some 1540nonconforming code to compile. 1541 1542@item -frepo 1543@opindex frepo 1544Enable automatic template instantiation at link time. This option also 1545implies @option{-fno-implicit-templates}. @xref{Template 1546Instantiation}, for more information. 1547 1548@item -fno-rtti 1549@opindex fno-rtti 1550Disable generation of information about every class with virtual 1551functions for use by the C++ runtime type identification features 1552(@samp{dynamic_cast} and @samp{typeid}). If you don't use those parts 1553of the language, you can save some space by using this flag. Note that 1554exception handling uses the same information, but it will generate it as 1555needed. The @samp{dynamic_cast} operator can still be used for casts that 1556do not require runtime type information, i.e. casts to @code{void *} or to 1557unambiguous base classes. 1558 1559@item -fstats 1560@opindex fstats 1561Emit statistics about front-end processing at the end of the compilation. 1562This information is generally only useful to the G++ development team. 1563 1564@item -ftemplate-depth-@var{n} 1565@opindex ftemplate-depth 1566Set the maximum instantiation depth for template classes to @var{n}. 1567A limit on the template instantiation depth is needed to detect 1568endless recursions during template class instantiation. ANSI/ISO C++ 1569conforming programs must not rely on a maximum depth greater than 17. 1570 1571@item -fno-threadsafe-statics 1572@opindex fno-threadsafe-statics 1573Do not emit the extra code to use the routines specified in the C++ 1574ABI for thread-safe initialization of local statics. You can use this 1575option to reduce code size slightly in code that doesn't need to be 1576thread-safe. 1577 1578@item -fuse-cxa-atexit 1579@opindex fuse-cxa-atexit 1580Register destructors for objects with static storage duration with the 1581@code{__cxa_atexit} function rather than the @code{atexit} function. 1582This option is required for fully standards-compliant handling of static 1583destructors, but will only work if your C library supports 1584@code{__cxa_atexit}. 1585 1586@item -fno-use-cxa-get-exception-ptr 1587@opindex fno-use-cxa-get-exception-ptr 1588Don't use the @code{__cxa_get_exception_ptr} runtime routine. This 1589will cause @code{std::uncaught_exception} to be incorrect, but is necessary 1590if the runtime routine is not available. 1591 1592@item -fvisibility-inlines-hidden 1593@opindex fvisibility-inlines-hidden 1594This switch declares that the user does not attempt to compare 1595pointers to inline methods where the addresses of the two functions 1596were taken in different shared objects. 1597 1598The effect of this is that GCC may, effectively, mark inline methods with 1599@code{__attribute__ ((visibility ("hidden")))} so that they do not 1600appear in the export table of a DSO and do not require a PLT indirection 1601when used within the DSO@. Enabling this option can have a dramatic effect 1602on load and link times of a DSO as it massively reduces the size of the 1603dynamic export table when the library makes heavy use of templates. 1604 1605The behaviour of this switch is not quite the same as marking the 1606methods as hidden directly, because it does not affect static variables 1607local to the function or cause the compiler to deduce that 1608the function is defined in only one shared object. 1609 1610You may mark a method as having a visibility explicitly to negate the 1611effect of the switch for that method. For example, if you do want to 1612compare pointers to a particular inline method, you might mark it as 1613having default visibility. Marking the enclosing class with explicit 1614visibility will have no effect. 1615 1616Explicitly instantiated inline methods are unaffected by this option 1617as their linkage might otherwise cross a shared library boundary. 1618@xref{Template Instantiation}. 1619 1620@item -fno-weak 1621@opindex fno-weak 1622Do not use weak symbol support, even if it is provided by the linker. 1623By default, G++ will use weak symbols if they are available. This 1624option exists only for testing, and should not be used by end-users; 1625it will result in inferior code and has no benefits. This option may 1626be removed in a future release of G++. 1627 1628@item -nostdinc++ 1629@opindex nostdinc++ 1630Do not search for header files in the standard directories specific to 1631C++, but do still search the other standard directories. (This option 1632is used when building the C++ library.) 1633@end table 1634 1635In addition, these optimization, warning, and code generation options 1636have meanings only for C++ programs: 1637 1638@table @gcctabopt 1639@item -fno-default-inline 1640@opindex fno-default-inline 1641Do not assume @samp{inline} for functions defined inside a class scope. 1642@xref{Optimize Options,,Options That Control Optimization}. Note that these 1643functions will have linkage like inline functions; they just won't be 1644inlined by default. 1645 1646@item -Wabi @r{(C++ only)} 1647@opindex Wabi 1648Warn when G++ generates code that is probably not compatible with the 1649vendor-neutral C++ ABI@. Although an effort has been made to warn about 1650all such cases, there are probably some cases that are not warned about, 1651even though G++ is generating incompatible code. There may also be 1652cases where warnings are emitted even though the code that is generated 1653will be compatible. 1654 1655You should rewrite your code to avoid these warnings if you are 1656concerned about the fact that code generated by G++ may not be binary 1657compatible with code generated by other compilers. 1658 1659The known incompatibilities at this point include: 1660 1661@itemize @bullet 1662 1663@item 1664Incorrect handling of tail-padding for bit-fields. G++ may attempt to 1665pack data into the same byte as a base class. For example: 1666 1667@smallexample 1668struct A @{ virtual void f(); int f1 : 1; @}; 1669struct B : public A @{ int f2 : 1; @}; 1670@end smallexample 1671 1672@noindent 1673In this case, G++ will place @code{B::f2} into the same byte 1674as@code{A::f1}; other compilers will not. You can avoid this problem 1675by explicitly padding @code{A} so that its size is a multiple of the 1676byte size on your platform; that will cause G++ and other compilers to 1677layout @code{B} identically. 1678 1679@item 1680Incorrect handling of tail-padding for virtual bases. G++ does not use 1681tail padding when laying out virtual bases. For example: 1682 1683@smallexample 1684struct A @{ virtual void f(); char c1; @}; 1685struct B @{ B(); char c2; @}; 1686struct C : public A, public virtual B @{@}; 1687@end smallexample 1688 1689@noindent 1690In this case, G++ will not place @code{B} into the tail-padding for 1691@code{A}; other compilers will. You can avoid this problem by 1692explicitly padding @code{A} so that its size is a multiple of its 1693alignment (ignoring virtual base classes); that will cause G++ and other 1694compilers to layout @code{C} identically. 1695 1696@item 1697Incorrect handling of bit-fields with declared widths greater than that 1698of their underlying types, when the bit-fields appear in a union. For 1699example: 1700 1701@smallexample 1702union U @{ int i : 4096; @}; 1703@end smallexample 1704 1705@noindent 1706Assuming that an @code{int} does not have 4096 bits, G++ will make the 1707union too small by the number of bits in an @code{int}. 1708 1709@item 1710Empty classes can be placed at incorrect offsets. For example: 1711 1712@smallexample 1713struct A @{@}; 1714 1715struct B @{ 1716 A a; 1717 virtual void f (); 1718@}; 1719 1720struct C : public B, public A @{@}; 1721@end smallexample 1722 1723@noindent 1724G++ will place the @code{A} base class of @code{C} at a nonzero offset; 1725it should be placed at offset zero. G++ mistakenly believes that the 1726@code{A} data member of @code{B} is already at offset zero. 1727 1728@item 1729Names of template functions whose types involve @code{typename} or 1730template template parameters can be mangled incorrectly. 1731 1732@smallexample 1733template <typename Q> 1734void f(typename Q::X) @{@} 1735 1736template <template <typename> class Q> 1737void f(typename Q<int>::X) @{@} 1738@end smallexample 1739 1740@noindent 1741Instantiations of these templates may be mangled incorrectly. 1742 1743@end itemize 1744 1745@item -Wctor-dtor-privacy @r{(C++ only)} 1746@opindex Wctor-dtor-privacy 1747Warn when a class seems unusable because all the constructors or 1748destructors in that class are private, and it has neither friends nor 1749public static member functions. 1750 1751@item -Wnon-virtual-dtor @r{(C++ only)} 1752@opindex Wnon-virtual-dtor 1753Warn when a class appears to be polymorphic, thereby requiring a virtual 1754destructor, yet it declares a non-virtual one. This warning is also 1755enabled if -Weffc++ is specified. 1756 1757@item -Wreorder @r{(C++ only)} 1758@opindex Wreorder 1759@cindex reordering, warning 1760@cindex warning for reordering of member initializers 1761Warn when the order of member initializers given in the code does not 1762match the order in which they must be executed. For instance: 1763 1764@smallexample 1765struct A @{ 1766 int i; 1767 int j; 1768 A(): j (0), i (1) @{ @} 1769@}; 1770@end smallexample 1771 1772The compiler will rearrange the member initializers for @samp{i} 1773and @samp{j} to match the declaration order of the members, emitting 1774a warning to that effect. This warning is enabled by @option{-Wall}. 1775@end table 1776 1777The following @option{-W@dots{}} options are not affected by @option{-Wall}. 1778 1779@table @gcctabopt 1780@item -Weffc++ @r{(C++ only)} 1781@opindex Weffc++ 1782Warn about violations of the following style guidelines from Scott Meyers' 1783@cite{Effective C++} book: 1784 1785@itemize @bullet 1786@item 1787Item 11: Define a copy constructor and an assignment operator for classes 1788with dynamically allocated memory. 1789 1790@item 1791Item 12: Prefer initialization to assignment in constructors. 1792 1793@item 1794Item 14: Make destructors virtual in base classes. 1795 1796@item 1797Item 15: Have @code{operator=} return a reference to @code{*this}. 1798 1799@item 1800Item 23: Don't try to return a reference when you must return an object. 1801 1802@end itemize 1803 1804Also warn about violations of the following style guidelines from 1805Scott Meyers' @cite{More Effective C++} book: 1806 1807@itemize @bullet 1808@item 1809Item 6: Distinguish between prefix and postfix forms of increment and 1810decrement operators. 1811 1812@item 1813Item 7: Never overload @code{&&}, @code{||}, or @code{,}. 1814 1815@end itemize 1816 1817When selecting this option, be aware that the standard library 1818headers do not obey all of these guidelines; use @samp{grep -v} 1819to filter out those warnings. 1820 1821@item -Wno-deprecated @r{(C++ only)} 1822@opindex Wno-deprecated 1823Do not warn about usage of deprecated features. @xref{Deprecated Features}. 1824 1825@item -Wstrict-null-sentinel @r{(C++ only)} 1826@opindex Wstrict-null-sentinel 1827Warn also about the use of an uncasted @code{NULL} as sentinel. When 1828compiling only with GCC this is a valid sentinel, as @code{NULL} is defined 1829to @code{__null}. Although it is a null pointer constant not a null pointer, 1830it is guaranteed to of the same size as a pointer. But this use is 1831not portable across different compilers. 1832 1833@item -Wno-non-template-friend @r{(C++ only)} 1834@opindex Wno-non-template-friend 1835Disable warnings when non-templatized friend functions are declared 1836within a template. Since the advent of explicit template specification 1837support in G++, if the name of the friend is an unqualified-id (i.e., 1838@samp{friend foo(int)}), the C++ language specification demands that the 1839friend declare or define an ordinary, nontemplate function. (Section 184014.5.3). Before G++ implemented explicit specification, unqualified-ids 1841could be interpreted as a particular specialization of a templatized 1842function. Because this non-conforming behavior is no longer the default 1843behavior for G++, @option{-Wnon-template-friend} allows the compiler to 1844check existing code for potential trouble spots and is on by default. 1845This new compiler behavior can be turned off with 1846@option{-Wno-non-template-friend} which keeps the conformant compiler code 1847but disables the helpful warning. 1848 1849@item -Wold-style-cast @r{(C++ only)} 1850@opindex Wold-style-cast 1851Warn if an old-style (C-style) cast to a non-void type is used within 1852a C++ program. The new-style casts (@samp{dynamic_cast}, 1853@samp{static_cast}, @samp{reinterpret_cast}, and @samp{const_cast}) are 1854less vulnerable to unintended effects and much easier to search for. 1855 1856@item -Woverloaded-virtual @r{(C++ only)} 1857@opindex Woverloaded-virtual 1858@cindex overloaded virtual fn, warning 1859@cindex warning for overloaded virtual fn 1860Warn when a function declaration hides virtual functions from a 1861base class. For example, in: 1862 1863@smallexample 1864struct A @{ 1865 virtual void f(); 1866@}; 1867 1868struct B: public A @{ 1869 void f(int); 1870@}; 1871@end smallexample 1872 1873the @code{A} class version of @code{f} is hidden in @code{B}, and code 1874like: 1875 1876@smallexample 1877B* b; 1878b->f(); 1879@end smallexample 1880 1881will fail to compile. 1882 1883@item -Wno-pmf-conversions @r{(C++ only)} 1884@opindex Wno-pmf-conversions 1885Disable the diagnostic for converting a bound pointer to member function 1886to a plain pointer. 1887 1888@item -Wsign-promo @r{(C++ only)} 1889@opindex Wsign-promo 1890Warn when overload resolution chooses a promotion from unsigned or 1891enumerated type to a signed type, over a conversion to an unsigned type of 1892the same size. Previous versions of G++ would try to preserve 1893unsignedness, but the standard mandates the current behavior. 1894 1895@smallexample 1896struct A @{ 1897 operator int (); 1898 A& operator = (int); 1899@}; 1900 1901main () 1902@{ 1903 A a,b; 1904 a = b; 1905@} 1906@end smallexample 1907 1908In this example, G++ will synthesize a default @samp{A& operator = 1909(const A&);}, while cfront will use the user-defined @samp{operator =}. 1910@end table 1911 1912@node Language Independent Options 1913@section Options to Control Diagnostic Messages Formatting 1914@cindex options to control diagnostics formatting 1915@cindex diagnostic messages 1916@cindex message formatting 1917 1918Traditionally, diagnostic messages have been formatted irrespective of 1919the output device's aspect (e.g.@: its width, @dots{}). The options described 1920below can be used to control the diagnostic messages formatting 1921algorithm, e.g.@: how many characters per line, how often source location 1922information should be reported. Right now, only the C++ front end can 1923honor these options. However it is expected, in the near future, that 1924the remaining front ends would be able to digest them correctly. 1925 1926@table @gcctabopt 1927@item -fmessage-length=@var{n} 1928@opindex fmessage-length 1929Try to format error messages so that they fit on lines of about @var{n} 1930characters. The default is 72 characters for @command{g++} and 0 for the rest of 1931the front ends supported by GCC@. If @var{n} is zero, then no 1932line-wrapping will be done; each error message will appear on a single 1933line. 1934 1935@opindex fdiagnostics-show-location 1936@item -fdiagnostics-show-location=once 1937Only meaningful in line-wrapping mode. Instructs the diagnostic messages 1938reporter to emit @emph{once} source location information; that is, in 1939case the message is too long to fit on a single physical line and has to 1940be wrapped, the source location won't be emitted (as prefix) again, 1941over and over, in subsequent continuation lines. This is the default 1942behavior. 1943 1944@item -fdiagnostics-show-location=every-line 1945Only meaningful in line-wrapping mode. Instructs the diagnostic 1946messages reporter to emit the same source location information (as 1947prefix) for physical lines that result from the process of breaking 1948a message which is too long to fit on a single line. 1949 1950@item -fdiagnostics-show-option 1951@opindex fdiagnostics-show-option 1952This option instructs the diagnostic machinery to add text to each 1953diagnostic emitted, which indicates which command line option directly 1954controls that diagnostic, when such an option is known to the 1955diagnostic machinery. 1956 1957@end table 1958 1959@node Warning Options 1960@section Options to Request or Suppress Warnings 1961@cindex options to control warnings 1962@cindex warning messages 1963@cindex messages, warning 1964@cindex suppressing warnings 1965 1966Warnings are diagnostic messages that report constructions which 1967are not inherently erroneous but which are risky or suggest there 1968may have been an error. 1969 1970You can request many specific warnings with options beginning @samp{-W}, 1971for example @option{-Wimplicit} to request warnings on implicit 1972declarations. Each of these specific warning options also has a 1973negative form beginning @samp{-Wno-} to turn off warnings; 1974for example, @option{-Wno-implicit}. This manual lists only one of the 1975two forms, whichever is not the default. 1976 1977The following options control the amount and kinds of warnings produced 1978by GCC; for further, language-specific options also refer to 1979@ref{C++ Dialect Options}. 1980 1981@table @gcctabopt 1982@cindex syntax checking 1983@item -fsyntax-only 1984@opindex fsyntax-only 1985Check the code for syntax errors, but don't do anything beyond that. 1986 1987@item -pedantic 1988@opindex pedantic 1989Issue all the warnings demanded by strict ISO C and ISO C++; 1990reject all programs that use forbidden extensions, and some other 1991programs that do not follow ISO C and ISO C++. For ISO C, follows the 1992version of the ISO C standard specified by any @option{-std} option used. 1993 1994Valid ISO C and ISO C++ programs should compile properly with or without 1995this option (though a rare few will require @option{-ansi} or a 1996@option{-std} option specifying the required version of ISO C)@. However, 1997without this option, certain GNU extensions and traditional C and C++ 1998features are supported as well. With this option, they are rejected. 1999 2000@option{-pedantic} does not cause warning messages for use of the 2001alternate keywords whose names begin and end with @samp{__}. Pedantic 2002warnings are also disabled in the expression that follows 2003@code{__extension__}. However, only system header files should use 2004these escape routes; application programs should avoid them. 2005@xref{Alternate Keywords}. 2006 2007Some users try to use @option{-pedantic} to check programs for strict ISO 2008C conformance. They soon find that it does not do quite what they want: 2009it finds some non-ISO practices, but not all---only those for which 2010ISO C @emph{requires} a diagnostic, and some others for which 2011diagnostics have been added. 2012 2013A feature to report any failure to conform to ISO C might be useful in 2014some instances, but would require considerable additional work and would 2015be quite different from @option{-pedantic}. We don't have plans to 2016support such a feature in the near future. 2017 2018Where the standard specified with @option{-std} represents a GNU 2019extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a 2020corresponding @dfn{base standard}, the version of ISO C on which the GNU 2021extended dialect is based. Warnings from @option{-pedantic} are given 2022where they are required by the base standard. (It would not make sense 2023for such warnings to be given only for features not in the specified GNU 2024C dialect, since by definition the GNU dialects of C include all 2025features the compiler supports with the given option, and there would be 2026nothing to warn about.) 2027 2028@item -pedantic-errors 2029@opindex pedantic-errors 2030Like @option{-pedantic}, except that errors are produced rather than 2031warnings. 2032 2033@item -w 2034@opindex w 2035Inhibit all warning messages. 2036 2037@item -Wno-import 2038@opindex Wno-import 2039Inhibit warning messages about the use of @samp{#import}. 2040 2041@item -Wchar-subscripts 2042@opindex Wchar-subscripts 2043Warn if an array subscript has type @code{char}. This is a common cause 2044of error, as programmers often forget that this type is signed on some 2045machines. 2046This warning is enabled by @option{-Wall}. 2047 2048@item -Wcomment 2049@opindex Wcomment 2050Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*} 2051comment, or whenever a Backslash-Newline appears in a @samp{//} comment. 2052This warning is enabled by @option{-Wall}. 2053 2054@item -Wfatal-errors 2055@opindex Wfatal-errors 2056This option causes the compiler to abort compilation on the first error 2057occurred rather than trying to keep going and printing further error 2058messages. 2059 2060@item -Wformat 2061@opindex Wformat 2062@opindex ffreestanding 2063@opindex fno-builtin 2064Check calls to @code{printf} and @code{scanf}, etc., to make sure that 2065the arguments supplied have types appropriate to the format string 2066specified, and that the conversions specified in the format string make 2067sense. This includes standard functions, and others specified by format 2068attributes (@pxref{Function Attributes}), in the @code{printf}, 2069@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension, 2070not in the C standard) families (or other target-specific families). 2071Which functions are checked without format attributes having been 2072specified depends on the standard version selected, and such checks of 2073functions without the attribute specified are disabled by 2074@option{-ffreestanding} or @option{-fno-builtin}. 2075 2076The formats are checked against the format features supported by GNU 2077libc version 2.2. These include all ISO C90 and C99 features, as well 2078as features from the Single Unix Specification and some BSD and GNU 2079extensions. Other library implementations may not support all these 2080features; GCC does not support warning about features that go beyond a 2081particular library's limitations. However, if @option{-pedantic} is used 2082with @option{-Wformat}, warnings will be given about format features not 2083in the selected standard version (but not for @code{strfmon} formats, 2084since those are not in any version of the C standard). @xref{C Dialect 2085Options,,Options Controlling C Dialect}. 2086 2087Since @option{-Wformat} also checks for null format arguments for 2088several functions, @option{-Wformat} also implies @option{-Wnonnull}. 2089 2090@option{-Wformat} is included in @option{-Wall}. For more control over some 2091aspects of format checking, the options @option{-Wformat-y2k}, 2092@option{-Wno-format-extra-args}, @option{-Wno-format-zero-length}, 2093@option{-Wformat-nonliteral}, @option{-Wformat-security}, and 2094@option{-Wformat=2} are available, but are not included in @option{-Wall}. 2095 2096@item -Wformat-y2k 2097@opindex Wformat-y2k 2098If @option{-Wformat} is specified, also warn about @code{strftime} 2099formats which may yield only a two-digit year. 2100 2101@item -Wno-format-extra-args 2102@opindex Wno-format-extra-args 2103If @option{-Wformat} is specified, do not warn about excess arguments to a 2104@code{printf} or @code{scanf} format function. The C standard specifies 2105that such arguments are ignored. 2106 2107Where the unused arguments lie between used arguments that are 2108specified with @samp{$} operand number specifications, normally 2109warnings are still given, since the implementation could not know what 2110type to pass to @code{va_arg} to skip the unused arguments. However, 2111in the case of @code{scanf} formats, this option will suppress the 2112warning if the unused arguments are all pointers, since the Single 2113Unix Specification says that such unused arguments are allowed. 2114 2115@item -Wno-format-zero-length 2116@opindex Wno-format-zero-length 2117If @option{-Wformat} is specified, do not warn about zero-length formats. 2118The C standard specifies that zero-length formats are allowed. 2119 2120@item -Wformat-nonliteral 2121@opindex Wformat-nonliteral 2122If @option{-Wformat} is specified, also warn if the format string is not a 2123string literal and so cannot be checked, unless the format function 2124takes its format arguments as a @code{va_list}. 2125 2126@item -Wformat-security 2127@opindex Wformat-security 2128If @option{-Wformat} is specified, also warn about uses of format 2129functions that represent possible security problems. At present, this 2130warns about calls to @code{printf} and @code{scanf} functions where the 2131format string is not a string literal and there are no format arguments, 2132as in @code{printf (foo);}. This may be a security hole if the format 2133string came from untrusted input and contains @samp{%n}. (This is 2134currently a subset of what @option{-Wformat-nonliteral} warns about, but 2135in future warnings may be added to @option{-Wformat-security} that are not 2136included in @option{-Wformat-nonliteral}.) 2137 2138@item -Wformat=2 2139@opindex Wformat=2 2140Enable @option{-Wformat} plus format checks not included in 2141@option{-Wformat}. Currently equivalent to @samp{-Wformat 2142-Wformat-nonliteral -Wformat-security -Wformat-y2k}. 2143 2144@item -Wnonnull 2145@opindex Wnonnull 2146Warn about passing a null pointer for arguments marked as 2147requiring a non-null value by the @code{nonnull} function attribute. 2148 2149@option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It 2150can be disabled with the @option{-Wno-nonnull} option. 2151 2152@item -Winit-self @r{(C and C++ only)} 2153@opindex Winit-self 2154Warn about uninitialized variables which are initialized with themselves. 2155Note this option can only be used with the @option{-Wuninitialized} option, 2156which in turn only works with @option{-O1} and above. 2157 2158For example, GCC will warn about @code{i} being uninitialized in the 2159following snippet only when @option{-Winit-self} has been specified: 2160@smallexample 2161@group 2162int f() 2163@{ 2164 int i = i; 2165 return i; 2166@} 2167@end group 2168@end smallexample 2169 2170@item -Wimplicit-int 2171@opindex Wimplicit-int 2172Warn when a declaration does not specify a type. 2173This warning is enabled by @option{-Wall}. 2174 2175@item -Wimplicit-function-declaration 2176@itemx -Werror-implicit-function-declaration 2177@opindex Wimplicit-function-declaration 2178@opindex Werror-implicit-function-declaration 2179Give a warning (or error) whenever a function is used before being 2180declared. The form @option{-Wno-error-implicit-function-declaration} 2181is not supported. 2182This warning is enabled by @option{-Wall} (as a warning, not an error). 2183 2184@item -Wimplicit 2185@opindex Wimplicit 2186Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}. 2187This warning is enabled by @option{-Wall}. 2188 2189@item -Wmain 2190@opindex Wmain 2191Warn if the type of @samp{main} is suspicious. @samp{main} should be a 2192function with external linkage, returning int, taking either zero 2193arguments, two, or three arguments of appropriate types. 2194This warning is enabled by @option{-Wall}. 2195 2196@item -Wmissing-braces 2197@opindex Wmissing-braces 2198Warn if an aggregate or union initializer is not fully bracketed. In 2199the following example, the initializer for @samp{a} is not fully 2200bracketed, but that for @samp{b} is fully bracketed. 2201 2202@smallexample 2203int a[2][2] = @{ 0, 1, 2, 3 @}; 2204int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @}; 2205@end smallexample 2206 2207This warning is enabled by @option{-Wall}. 2208 2209@item -Wmissing-include-dirs @r{(C and C++ only)} 2210@opindex Wmissing-include-dirs 2211Warn if a user-supplied include directory does not exist. 2212 2213@item -Wparentheses 2214@opindex Wparentheses 2215Warn if parentheses are omitted in certain contexts, such 2216as when there is an assignment in a context where a truth value 2217is expected, or when operators are nested whose precedence people 2218often get confused about. 2219 2220Also warn if a comparison like @samp{x<=y<=z} appears; this is 2221equivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different 2222interpretation from that of ordinary mathematical notation. 2223 2224Also warn about constructions where there may be confusion to which 2225@code{if} statement an @code{else} branch belongs. Here is an example of 2226such a case: 2227 2228@smallexample 2229@group 2230@{ 2231 if (a) 2232 if (b) 2233 foo (); 2234 else 2235 bar (); 2236@} 2237@end group 2238@end smallexample 2239 2240In C/C++, every @code{else} branch belongs to the innermost possible 2241@code{if} statement, which in this example is @code{if (b)}. This is 2242often not what the programmer expected, as illustrated in the above 2243example by indentation the programmer chose. When there is the 2244potential for this confusion, GCC will issue a warning when this flag 2245is specified. To eliminate the warning, add explicit braces around 2246the innermost @code{if} statement so there is no way the @code{else} 2247could belong to the enclosing @code{if}. The resulting code would 2248look like this: 2249 2250@smallexample 2251@group 2252@{ 2253 if (a) 2254 @{ 2255 if (b) 2256 foo (); 2257 else 2258 bar (); 2259 @} 2260@} 2261@end group 2262@end smallexample 2263 2264This warning is enabled by @option{-Wall}. 2265 2266@item -Wsequence-point 2267@opindex Wsequence-point 2268Warn about code that may have undefined semantics because of violations 2269of sequence point rules in the C and C++ standards. 2270 2271The C and C++ standards defines the order in which expressions in a C/C++ 2272program are evaluated in terms of @dfn{sequence points}, which represent 2273a partial ordering between the execution of parts of the program: those 2274executed before the sequence point, and those executed after it. These 2275occur after the evaluation of a full expression (one which is not part 2276of a larger expression), after the evaluation of the first operand of a 2277@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a 2278function is called (but after the evaluation of its arguments and the 2279expression denoting the called function), and in certain other places. 2280Other than as expressed by the sequence point rules, the order of 2281evaluation of subexpressions of an expression is not specified. All 2282these rules describe only a partial order rather than a total order, 2283since, for example, if two functions are called within one expression 2284with no sequence point between them, the order in which the functions 2285are called is not specified. However, the standards committee have 2286ruled that function calls do not overlap. 2287 2288It is not specified when between sequence points modifications to the 2289values of objects take effect. Programs whose behavior depends on this 2290have undefined behavior; the C and C++ standards specify that ``Between 2291the previous and next sequence point an object shall have its stored 2292value modified at most once by the evaluation of an expression. 2293Furthermore, the prior value shall be read only to determine the value 2294to be stored.''. If a program breaks these rules, the results on any 2295particular implementation are entirely unpredictable. 2296 2297Examples of code with undefined behavior are @code{a = a++;}, @code{a[n] 2298= b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not 2299diagnosed by this option, and it may give an occasional false positive 2300result, but in general it has been found fairly effective at detecting 2301this sort of problem in programs. 2302 2303The standard is worded confusingly, therefore there is some debate 2304over the precise meaning of the sequence point rules in subtle cases. 2305Links to discussions of the problem, including proposed formal 2306definitions, may be found on the GCC readings page, at 2307@w{@uref{http://gcc.gnu.org/readings.html}}. 2308 2309This warning is enabled by @option{-Wall} for C and C++. 2310 2311@item -Wreturn-type 2312@opindex Wreturn-type 2313Warn whenever a function is defined with a return-type that defaults to 2314@code{int}. Also warn about any @code{return} statement with no 2315return-value in a function whose return-type is not @code{void}. 2316 2317For C, also warn if the return type of a function has a type qualifier 2318such as @code{const}. Such a type qualifier has no effect, since the 2319value returned by a function is not an lvalue. ISO C prohibits 2320qualified @code{void} return types on function definitions, so such 2321return types always receive a warning even without this option. 2322 2323For C++, a function without return type always produces a diagnostic 2324message, even when @option{-Wno-return-type} is specified. The only 2325exceptions are @samp{main} and functions defined in system headers. 2326 2327This warning is enabled by @option{-Wall}. 2328 2329@item -Wswitch 2330@opindex Wswitch 2331Warn whenever a @code{switch} statement has an index of enumerated type 2332and lacks a @code{case} for one or more of the named codes of that 2333enumeration. (The presence of a @code{default} label prevents this 2334warning.) @code{case} labels outside the enumeration range also 2335provoke warnings when this option is used. 2336This warning is enabled by @option{-Wall}. 2337 2338@item -Wswitch-default 2339@opindex Wswitch-switch 2340Warn whenever a @code{switch} statement does not have a @code{default} 2341case. 2342 2343@item -Wswitch-enum 2344@opindex Wswitch-enum 2345Warn whenever a @code{switch} statement has an index of enumerated type 2346and lacks a @code{case} for one or more of the named codes of that 2347enumeration. @code{case} labels outside the enumeration range also 2348provoke warnings when this option is used. 2349 2350@item -Wtrigraphs 2351@opindex Wtrigraphs 2352Warn if any trigraphs are encountered that might change the meaning of 2353the program (trigraphs within comments are not warned about). 2354This warning is enabled by @option{-Wall}. 2355 2356@item -Wunused-function 2357@opindex Wunused-function 2358Warn whenever a static function is declared but not defined or a 2359non-inline static function is unused. 2360This warning is enabled by @option{-Wall}. 2361 2362@item -Wunused-label 2363@opindex Wunused-label 2364Warn whenever a label is declared but not used. 2365This warning is enabled by @option{-Wall}. 2366 2367To suppress this warning use the @samp{unused} attribute 2368(@pxref{Variable Attributes}). 2369 2370@item -Wunused-parameter 2371@opindex Wunused-parameter 2372Warn whenever a function parameter is unused aside from its declaration. 2373 2374To suppress this warning use the @samp{unused} attribute 2375(@pxref{Variable Attributes}). 2376 2377@item -Wunused-variable 2378@opindex Wunused-variable 2379Warn whenever a local variable or non-constant static variable is unused 2380aside from its declaration. 2381This warning is enabled by @option{-Wall}. 2382 2383To suppress this warning use the @samp{unused} attribute 2384(@pxref{Variable Attributes}). 2385 2386@item -Wunused-value 2387@opindex Wunused-value 2388Warn whenever a statement computes a result that is explicitly not used. 2389This warning is enabled by @option{-Wall}. 2390 2391To suppress this warning cast the expression to @samp{void}. 2392 2393@item -Wunused 2394@opindex Wunused 2395All the above @option{-Wunused} options combined. 2396 2397In order to get a warning about an unused function parameter, you must 2398either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies 2399@samp{-Wunused}), or separately specify @option{-Wunused-parameter}. 2400 2401@item -Wuninitialized 2402@opindex Wuninitialized 2403Warn if an automatic variable is used without first being initialized or 2404if a variable may be clobbered by a @code{setjmp} call. 2405 2406These warnings are possible only in optimizing compilation, 2407because they require data flow information that is computed only 2408when optimizing. If you do not specify @option{-O}, you will not get 2409these warnings. Instead, GCC will issue a warning about @option{-Wuninitialized} 2410requiring @option{-O}. 2411 2412If you want to warn about code which uses the uninitialized value of the 2413variable in its own initializer, use the @option{-Winit-self} option. 2414 2415These warnings occur for individual uninitialized or clobbered 2416elements of structure, union or array variables as well as for 2417variables which are uninitialized or clobbered as a whole. They do 2418not occur for variables or elements declared @code{volatile}. Because 2419these warnings depend on optimization, the exact variables or elements 2420for which there are warnings will depend on the precise optimization 2421options and version of GCC used. 2422 2423Note that there may be no warning about a variable that is used only 2424to compute a value that itself is never used, because such 2425computations may be deleted by data flow analysis before the warnings 2426are printed. 2427 2428These warnings are made optional because GCC is not smart 2429enough to see all the reasons why the code might be correct 2430despite appearing to have an error. Here is one example of how 2431this can happen: 2432 2433@smallexample 2434@group 2435@{ 2436 int x; 2437 switch (y) 2438 @{ 2439 case 1: x = 1; 2440 break; 2441 case 2: x = 4; 2442 break; 2443 case 3: x = 5; 2444 @} 2445 foo (x); 2446@} 2447@end group 2448@end smallexample 2449 2450@noindent 2451If the value of @code{y} is always 1, 2 or 3, then @code{x} is 2452always initialized, but GCC doesn't know this. Here is 2453another common case: 2454 2455@smallexample 2456@{ 2457 int save_y; 2458 if (change_y) save_y = y, y = new_y; 2459 @dots{} 2460 if (change_y) y = save_y; 2461@} 2462@end smallexample 2463 2464@noindent 2465This has no bug because @code{save_y} is used only if it is set. 2466 2467@cindex @code{longjmp} warnings 2468This option also warns when a non-volatile automatic variable might be 2469changed by a call to @code{longjmp}. These warnings as well are possible 2470only in optimizing compilation. 2471 2472The compiler sees only the calls to @code{setjmp}. It cannot know 2473where @code{longjmp} will be called; in fact, a signal handler could 2474call it at any point in the code. As a result, you may get a warning 2475even when there is in fact no problem because @code{longjmp} cannot 2476in fact be called at the place which would cause a problem. 2477 2478Some spurious warnings can be avoided if you declare all the functions 2479you use that never return as @code{noreturn}. @xref{Function 2480Attributes}. 2481 2482This warning is enabled by @option{-Wall}. 2483 2484@item -Wunknown-pragmas 2485@opindex Wunknown-pragmas 2486@cindex warning for unknown pragmas 2487@cindex unknown pragmas, warning 2488@cindex pragmas, warning of unknown 2489Warn when a #pragma directive is encountered which is not understood by 2490GCC@. If this command line option is used, warnings will even be issued 2491for unknown pragmas in system header files. This is not the case if 2492the warnings were only enabled by the @option{-Wall} command line option. 2493 2494@item -Wno-pragmas 2495@opindex Wno-pragmas 2496@opindex Wpragmas 2497Do not warn about misuses of pragmas, such as incorrect parameters, 2498invalid syntax, or conflicts between pragmas. See also 2499@samp{-Wunknown-pragmas}. 2500 2501@item -Wstrict-aliasing 2502@opindex Wstrict-aliasing 2503This option is only active when @option{-fstrict-aliasing} is active. 2504It warns about code which might break the strict aliasing rules that the 2505compiler is using for optimization. The warning does not catch all 2506cases, but does attempt to catch the more common pitfalls. It is 2507included in @option{-Wall}. 2508 2509@item -Wstrict-aliasing=2 2510@opindex Wstrict-aliasing=2 2511This option is only active when @option{-fstrict-aliasing} is active. 2512It warns about code which might break the strict aliasing rules that the 2513compiler is using for optimization. This warning catches more cases than 2514@option{-Wstrict-aliasing}, but it will also give a warning for some ambiguous 2515cases that are safe. 2516 2517@item -Wstrict-overflow 2518@item -Wstrict-overflow=@var{n} 2519@opindex Wstrict-overflow 2520This option is only active when @option{-fstrict-overflow} is active. 2521It warns about cases where the compiler optimizes based on the 2522assumption that signed overflow does not occur. Note that it does not 2523warn about all cases where the code might overflow: it only warns 2524about cases where the compiler implements some optimization. Thus 2525this warning depends on the optimization level. 2526 2527An optimization which assumes that signed overflow does not occur is 2528perfectly safe if the values of the variables involved are such that 2529overflow never does, in fact, occur. Therefore this warning can 2530easily give a false positive: a warning about code which is not 2531actually a problem. To help focus on important issues, several 2532warning levels are defined. No warnings are issued for the use of 2533undefined signed overflow when estimating how many iterations a loop 2534will require, in particular when determining whether a loop will be 2535executed at all. 2536 2537@table @option 2538@item -Wstrict-overflow=1 2539Warn about cases which are both questionable and easy to avoid. For 2540example: @code{x + 1 > x}; with @option{-fstrict-overflow}, the 2541compiler will simplify this to @code{1}. This level of 2542@option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels 2543are not, and must be explicitly requested. 2544 2545@item -Wstrict-overflow=2 2546Also warn about other cases where a comparison is simplified to a 2547constant. For example: @code{abs (x) >= 0}. This can only be 2548simplified when @option{-fstrict-overflow} is in effect, because 2549@code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than 2550zero. @option{-Wstrict-overflow} (with no level) is the same as 2551@option{-Wstrict-overflow=2}. 2552 2553@item -Wstrict-overflow=3 2554Also warn about other cases where a comparison is simplified. For 2555example: @code{x + 1 > 1} will be simplified to @code{x > 0}. 2556 2557@item -Wstrict-overflow=4 2558Also warn about other simplifications not covered by the above cases. 2559For example: @code{(x * 10) / 5} will be simplified to @code{x * 2}. 2560 2561@item -Wstrict-overflow=5 2562Also warn about cases where the compiler reduces the magnitude of a 2563constant involved in a comparison. For example: @code{x + 2 > y} will 2564be simplified to @code{x + 1 >= y}. This is reported only at the 2565highest warning level because this simplification applies to many 2566comparisons, so this warning level will give a very large number of 2567false positives. 2568@end table 2569 2570@item -Wall 2571@opindex Wall 2572All of the above @samp{-W} options combined. This enables all the 2573warnings about constructions that some users consider questionable, and 2574that are easy to avoid (or modify to prevent the warning), even in 2575conjunction with macros. This also enables some language-specific 2576warnings described in @ref{C++ Dialect Options}. 2577@end table 2578 2579The following @option{-W@dots{}} options are not implied by @option{-Wall}. 2580Some of them warn about constructions that users generally do not 2581consider questionable, but which occasionally you might wish to check 2582for; others warn about constructions that are necessary or hard to avoid 2583in some cases, and there is no simple way to modify the code to suppress 2584the warning. 2585 2586@table @gcctabopt 2587@item -Wextra 2588@opindex W 2589@opindex Wextra 2590(This option used to be called @option{-W}. The older name is still 2591supported, but the newer name is more descriptive.) Print extra warning 2592messages for these events: 2593 2594@itemize @bullet 2595@item 2596A function can return either with or without a value. (Falling 2597off the end of the function body is considered returning without 2598a value.) For example, this function would evoke such a 2599warning: 2600 2601@smallexample 2602@group 2603foo (a) 2604@{ 2605 if (a > 0) 2606 return a; 2607@} 2608@end group 2609@end smallexample 2610 2611@item 2612An expression-statement or the left-hand side of a comma expression 2613contains no side effects. 2614To suppress the warning, cast the unused expression to void. 2615For example, an expression such as @samp{x[i,j]} will cause a warning, 2616but @samp{x[(void)i,j]} will not. 2617 2618@item 2619An unsigned value is compared against zero with @samp{<} or @samp{>=}. 2620 2621@item 2622Storage-class specifiers like @code{static} are not the first things in 2623a declaration. According to the C Standard, this usage is obsolescent. 2624 2625@item 2626If @option{-Wall} or @option{-Wunused} is also specified, warn about unused 2627arguments. 2628 2629@item 2630A comparison between signed and unsigned values could produce an 2631incorrect result when the signed value is converted to unsigned. 2632(But don't warn if @option{-Wno-sign-compare} is also specified.) 2633 2634@item 2635An aggregate has an initializer which does not initialize all members. 2636This warning can be independently controlled by 2637@option{-Wmissing-field-initializers}. 2638 2639@item 2640An initialized field without side effects is overridden when using 2641designated initializers (@pxref{Designated Inits, , Designated 2642Initializers}). This warning can be independently controlled by 2643@option{-Woverride-init}. 2644 2645@item 2646A function parameter is declared without a type specifier in K&R-style 2647functions: 2648 2649@smallexample 2650void foo(bar) @{ @} 2651@end smallexample 2652 2653@item 2654An empty body occurs in an @samp{if} or @samp{else} statement. 2655 2656@item 2657A pointer is compared against integer zero with @samp{<}, @samp{<=}, 2658@samp{>}, or @samp{>=}. 2659 2660@item 2661A variable might be changed by @samp{longjmp} or @samp{vfork}. 2662 2663@item @r{(C++ only)} 2664An enumerator and a non-enumerator both appear in a conditional expression. 2665 2666@item @r{(C++ only)} 2667A non-static reference or non-static @samp{const} member appears in a 2668class without constructors. 2669 2670@item @r{(C++ only)} 2671Ambiguous virtual bases. 2672 2673@item @r{(C++ only)} 2674Subscripting an array which has been declared @samp{register}. 2675 2676@item @r{(C++ only)} 2677Taking the address of a variable which has been declared @samp{register}. 2678 2679@item @r{(C++ only)} 2680A base class is not initialized in a derived class' copy constructor. 2681@end itemize 2682 2683@item -Wno-div-by-zero 2684@opindex Wno-div-by-zero 2685@opindex Wdiv-by-zero 2686Do not warn about compile-time integer division by zero. Floating point 2687division by zero is not warned about, as it can be a legitimate way of 2688obtaining infinities and NaNs. 2689 2690@item -Wsystem-headers 2691@opindex Wsystem-headers 2692@cindex warnings from system headers 2693@cindex system headers, warnings from 2694Print warning messages for constructs found in system header files. 2695Warnings from system headers are normally suppressed, on the assumption 2696that they usually do not indicate real problems and would only make the 2697compiler output harder to read. Using this command line option tells 2698GCC to emit warnings from system headers as if they occurred in user 2699code. However, note that using @option{-Wall} in conjunction with this 2700option will @emph{not} warn about unknown pragmas in system 2701headers---for that, @option{-Wunknown-pragmas} must also be used. 2702 2703@item -Wfloat-equal 2704@opindex Wfloat-equal 2705Warn if floating point values are used in equality comparisons. 2706 2707The idea behind this is that sometimes it is convenient (for the 2708programmer) to consider floating-point values as approximations to 2709infinitely precise real numbers. If you are doing this, then you need 2710to compute (by analyzing the code, or in some other way) the maximum or 2711likely maximum error that the computation introduces, and allow for it 2712when performing comparisons (and when producing output, but that's a 2713different problem). In particular, instead of testing for equality, you 2714would check to see whether the two values have ranges that overlap; and 2715this is done with the relational operators, so equality comparisons are 2716probably mistaken. 2717 2718@item -Wtraditional @r{(C only)} 2719@opindex Wtraditional 2720Warn about certain constructs that behave differently in traditional and 2721ISO C@. Also warn about ISO C constructs that have no traditional C 2722equivalent, and/or problematic constructs which should be avoided. 2723 2724@itemize @bullet 2725@item 2726Macro parameters that appear within string literals in the macro body. 2727In traditional C macro replacement takes place within string literals, 2728but does not in ISO C@. 2729 2730@item 2731In traditional C, some preprocessor directives did not exist. 2732Traditional preprocessors would only consider a line to be a directive 2733if the @samp{#} appeared in column 1 on the line. Therefore 2734@option{-Wtraditional} warns about directives that traditional C 2735understands but would ignore because the @samp{#} does not appear as the 2736first character on the line. It also suggests you hide directives like 2737@samp{#pragma} not understood by traditional C by indenting them. Some 2738traditional implementations would not recognize @samp{#elif}, so it 2739suggests avoiding it altogether. 2740 2741@item 2742A function-like macro that appears without arguments. 2743 2744@item 2745The unary plus operator. 2746 2747@item 2748The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point 2749constant suffixes. (Traditional C does support the @samp{L} suffix on integer 2750constants.) Note, these suffixes appear in macros defined in the system 2751headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}. 2752Use of these macros in user code might normally lead to spurious 2753warnings, however GCC's integrated preprocessor has enough context to 2754avoid warning in these cases. 2755 2756@item 2757A function declared external in one block and then used after the end of 2758the block. 2759 2760@item 2761A @code{switch} statement has an operand of type @code{long}. 2762 2763@item 2764A non-@code{static} function declaration follows a @code{static} one. 2765This construct is not accepted by some traditional C compilers. 2766 2767@item 2768The ISO type of an integer constant has a different width or 2769signedness from its traditional type. This warning is only issued if 2770the base of the constant is ten. I.e.@: hexadecimal or octal values, which 2771typically represent bit patterns, are not warned about. 2772 2773@item 2774Usage of ISO string concatenation is detected. 2775 2776@item 2777Initialization of automatic aggregates. 2778 2779@item 2780Identifier conflicts with labels. Traditional C lacks a separate 2781namespace for labels. 2782 2783@item 2784Initialization of unions. If the initializer is zero, the warning is 2785omitted. This is done under the assumption that the zero initializer in 2786user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing 2787initializer warnings and relies on default initialization to zero in the 2788traditional C case. 2789 2790@item 2791Conversions by prototypes between fixed/floating point values and vice 2792versa. The absence of these prototypes when compiling with traditional 2793C would cause serious problems. This is a subset of the possible 2794conversion warnings, for the full set use @option{-Wconversion}. 2795 2796@item 2797Use of ISO C style function definitions. This warning intentionally is 2798@emph{not} issued for prototype declarations or variadic functions 2799because these ISO C features will appear in your code when using 2800libiberty's traditional C compatibility macros, @code{PARAMS} and 2801@code{VPARAMS}. This warning is also bypassed for nested functions 2802because that feature is already a GCC extension and thus not relevant to 2803traditional C compatibility. 2804@end itemize 2805 2806@item -Wdeclaration-after-statement @r{(C only)} 2807@opindex Wdeclaration-after-statement 2808Warn when a declaration is found after a statement in a block. This 2809construct, known from C++, was introduced with ISO C99 and is by default 2810allowed in GCC@. It is not supported by ISO C90 and was not supported by 2811GCC versions before GCC 3.0. @xref{Mixed Declarations}. 2812 2813@item -Wundef 2814@opindex Wundef 2815Warn if an undefined identifier is evaluated in an @samp{#if} directive. 2816 2817@item -Wno-endif-labels 2818@opindex Wno-endif-labels 2819@opindex Wendif-labels 2820Do not warn whenever an @samp{#else} or an @samp{#endif} are followed by text. 2821 2822@item -Wshadow 2823@opindex Wshadow 2824Warn whenever a local variable shadows another local variable, parameter or 2825global variable or whenever a built-in function is shadowed. 2826 2827@item -Wlarger-than-@var{len} 2828@opindex Wlarger-than 2829Warn whenever an object of larger than @var{len} bytes is defined. 2830 2831@item -Wunsafe-loop-optimizations 2832@opindex Wunsafe-loop-optimizations 2833Warn if the loop cannot be optimized because the compiler could not 2834assume anything on the bounds of the loop indices. With 2835@option{-funsafe-loop-optimizations} warn if the compiler made 2836such assumptions. 2837 2838@item -Wpointer-arith 2839@opindex Wpointer-arith 2840Warn about anything that depends on the ``size of'' a function type or 2841of @code{void}. GNU C assigns these types a size of 1, for 2842convenience in calculations with @code{void *} pointers and pointers 2843to functions. 2844 2845@item -Wbad-function-cast @r{(C only)} 2846@opindex Wbad-function-cast 2847Warn whenever a function call is cast to a non-matching type. 2848For example, warn if @code{int malloc()} is cast to @code{anything *}. 2849 2850@item -Wc++-compat 2851Warn about ISO C constructs that are outside of the common subset of 2852ISO C and ISO C++, e.g.@: request for implicit conversion from 2853@code{void *} to a pointer to non-@code{void} type. 2854 2855@item -Wcast-qual 2856@opindex Wcast-qual 2857Warn whenever a pointer is cast so as to remove a type qualifier from 2858the target type. For example, warn if a @code{const char *} is cast 2859to an ordinary @code{char *}. 2860 2861@item -Wcast-align 2862@opindex Wcast-align 2863Warn whenever a pointer is cast such that the required alignment of the 2864target is increased. For example, warn if a @code{char *} is cast to 2865an @code{int *} on machines where integers can only be accessed at 2866two- or four-byte boundaries. 2867 2868@item -Wwrite-strings 2869@opindex Wwrite-strings 2870When compiling C, give string constants the type @code{const 2871char[@var{length}]} so that 2872copying the address of one into a non-@code{const} @code{char *} 2873pointer will get a warning; when compiling C++, warn about the 2874deprecated conversion from string literals to @code{char *}. This 2875warning, by default, is enabled for C++ programs. 2876These warnings will help you find at 2877compile time code that can try to write into a string constant, but 2878only if you have been very careful about using @code{const} in 2879declarations and prototypes. Otherwise, it will just be a nuisance; 2880this is why we did not make @option{-Wall} request these warnings. 2881 2882@item -Wconversion 2883@opindex Wconversion 2884Warn if a prototype causes a type conversion that is different from what 2885would happen to the same argument in the absence of a prototype. This 2886includes conversions of fixed point to floating and vice versa, and 2887conversions changing the width or signedness of a fixed point argument 2888except when the same as the default promotion. 2889 2890Also, warn if a negative integer constant expression is implicitly 2891converted to an unsigned type. For example, warn about the assignment 2892@code{x = -1} if @code{x} is unsigned. But do not warn about explicit 2893casts like @code{(unsigned) -1}. 2894 2895@item -Wsign-compare 2896@opindex Wsign-compare 2897@cindex warning for comparison of signed and unsigned values 2898@cindex comparison of signed and unsigned values, warning 2899@cindex signed and unsigned values, comparison warning 2900Warn when a comparison between signed and unsigned values could produce 2901an incorrect result when the signed value is converted to unsigned. 2902This warning is also enabled by @option{-Wextra}; to get the other warnings 2903of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}. 2904 2905@item -Waddress 2906@opindex Waddress 2907@opindex Wno-address 2908Warn about suspicious uses of memory addresses. These include using 2909the address of a function in a conditional expression, such as 2910@code{void func(void); if (func)}, and comparisons against the memory 2911address of a string literal, such as @code{if (x == "abc")}. Such 2912uses typically indicate a programmer error: the address of a function 2913always evaluates to true, so their use in a conditional usually 2914indicate that the programmer forgot the parentheses in a function 2915call; and comparisons against string literals result in unspecified 2916behavior and are not portable in C, so they usually indicate that the 2917programmer intended to use @code{strcmp}. This warning is enabled by 2918@option{-Wall}. 2919 2920@item -Waggregate-return 2921@opindex Waggregate-return 2922Warn if any functions that return structures or unions are defined or 2923called. (In languages where you can return an array, this also elicits 2924a warning.) 2925 2926@item -Wno-attributes 2927@opindex Wno-attributes 2928@opindex Wattributes 2929Do not warn if an unexpected @code{__attribute__} is used, such as 2930unrecognized attributes, function attributes applied to variables, 2931etc. This will not stop errors for incorrect use of supported 2932attributes. 2933 2934@item -Wstrict-prototypes @r{(C only)} 2935@opindex Wstrict-prototypes 2936Warn if a function is declared or defined without specifying the 2937argument types. (An old-style function definition is permitted without 2938a warning if preceded by a declaration which specifies the argument 2939types.) 2940 2941@item -Wold-style-definition @r{(C only)} 2942@opindex Wold-style-definition 2943Warn if an old-style function definition is used. A warning is given 2944even if there is a previous prototype. 2945 2946@item -Wmissing-prototypes @r{(C only)} 2947@opindex Wmissing-prototypes 2948Warn if a global function is defined without a previous prototype 2949declaration. This warning is issued even if the definition itself 2950provides a prototype. The aim is to detect global functions that fail 2951to be declared in header files. 2952 2953@item -Wmissing-declarations @r{(C only)} 2954@opindex Wmissing-declarations 2955Warn if a global function is defined without a previous declaration. 2956Do so even if the definition itself provides a prototype. 2957Use this option to detect global functions that are not declared in 2958header files. 2959 2960@item -Wmissing-field-initializers 2961@opindex Wmissing-field-initializers 2962@opindex W 2963@opindex Wextra 2964Warn if a structure's initializer has some fields missing. For 2965example, the following code would cause such a warning, because 2966@code{x.h} is implicitly zero: 2967 2968@smallexample 2969struct s @{ int f, g, h; @}; 2970struct s x = @{ 3, 4 @}; 2971@end smallexample 2972 2973This option does not warn about designated initializers, so the following 2974modification would not trigger a warning: 2975 2976@smallexample 2977struct s @{ int f, g, h; @}; 2978struct s x = @{ .f = 3, .g = 4 @}; 2979@end smallexample 2980 2981This warning is included in @option{-Wextra}. To get other @option{-Wextra} 2982warnings without this one, use @samp{-Wextra -Wno-missing-field-initializers}. 2983 2984@item -Wmissing-noreturn 2985@opindex Wmissing-noreturn 2986Warn about functions which might be candidates for attribute @code{noreturn}. 2987Note these are only possible candidates, not absolute ones. Care should 2988be taken to manually verify functions actually do not ever return before 2989adding the @code{noreturn} attribute, otherwise subtle code generation 2990bugs could be introduced. You will not get a warning for @code{main} in 2991hosted C environments. 2992 2993@item -Wmissing-format-attribute 2994@opindex Wmissing-format-attribute 2995@opindex Wformat 2996Warn about function pointers which might be candidates for @code{format} 2997attributes. Note these are only possible candidates, not absolute ones. 2998GCC will guess that function pointers with @code{format} attributes that 2999are used in assignment, initialization, parameter passing or return 3000statements should have a corresponding @code{format} attribute in the 3001resulting type. I.e.@: the left-hand side of the assignment or 3002initialization, the type of the parameter variable, or the return type 3003of the containing function respectively should also have a @code{format} 3004attribute to avoid the warning. 3005 3006GCC will also warn about function definitions which might be 3007candidates for @code{format} attributes. Again, these are only 3008possible candidates. GCC will guess that @code{format} attributes 3009might be appropriate for any function that calls a function like 3010@code{vprintf} or @code{vscanf}, but this might not always be the 3011case, and some functions for which @code{format} attributes are 3012appropriate may not be detected. 3013 3014@item -Wno-multichar 3015@opindex Wno-multichar 3016@opindex Wmultichar 3017Do not warn if a multicharacter constant (@samp{'FOOF'}) is used. 3018Usually they indicate a typo in the user's code, as they have 3019implementation-defined values, and should not be used in portable code. 3020 3021@item -Wnormalized=<none|id|nfc|nfkc> 3022@opindex Wnormalized 3023@cindex NFC 3024@cindex NFKC 3025@cindex character set, input normalization 3026In ISO C and ISO C++, two identifiers are different if they are 3027different sequences of characters. However, sometimes when characters 3028outside the basic ASCII character set are used, you can have two 3029different character sequences that look the same. To avoid confusion, 3030the ISO 10646 standard sets out some @dfn{normalization rules} which 3031when applied ensure that two sequences that look the same are turned into 3032the same sequence. GCC can warn you if you are using identifiers which 3033have not been normalized; this option controls that warning. 3034 3035There are four levels of warning that GCC supports. The default is 3036@option{-Wnormalized=nfc}, which warns about any identifier which is 3037not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the 3038recommended form for most uses. 3039 3040Unfortunately, there are some characters which ISO C and ISO C++ allow 3041in identifiers that when turned into NFC aren't allowable as 3042identifiers. That is, there's no way to use these symbols in portable 3043ISO C or C++ and have all your identifiers in NFC. 3044@option{-Wnormalized=id} suppresses the warning for these characters. 3045It is hoped that future versions of the standards involved will correct 3046this, which is why this option is not the default. 3047 3048You can switch the warning off for all characters by writing 3049@option{-Wnormalized=none}. You would only want to do this if you 3050were using some other normalization scheme (like ``D''), because 3051otherwise you can easily create bugs that are literally impossible to see. 3052 3053Some characters in ISO 10646 have distinct meanings but look identical 3054in some fonts or display methodologies, especially once formatting has 3055been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL 3056LETTER N'', will display just like a regular @code{n} which has been 3057placed in a superscript. ISO 10646 defines the @dfn{NFKC} 3058normalization scheme to convert all these into a standard form as 3059well, and GCC will warn if your code is not in NFKC if you use 3060@option{-Wnormalized=nfkc}. This warning is comparable to warning 3061about every identifier that contains the letter O because it might be 3062confused with the digit 0, and so is not the default, but may be 3063useful as a local coding convention if the programming environment is 3064unable to be fixed to display these characters distinctly. 3065 3066@item -Wno-deprecated-declarations 3067@opindex Wno-deprecated-declarations 3068Do not warn about uses of functions (@pxref{Function Attributes}), 3069variables (@pxref{Variable Attributes}), and types (@pxref{Type 3070Attributes}) marked as deprecated by using the @code{deprecated} 3071attribute. 3072 3073@item -Wno-overflow 3074@opindex Wno-overflow 3075Do not warn about compile-time overflow in constant expressions. 3076 3077@item -Woverride-init 3078@opindex Woverride-init 3079@opindex W 3080@opindex Wextra 3081Warn if an initialized field without side effects is overridden when 3082using designated initializers (@pxref{Designated Inits, , Designated 3083Initializers}). 3084 3085This warning is included in @option{-Wextra}. To get other 3086@option{-Wextra} warnings without this one, use @samp{-Wextra 3087-Wno-override-init}. 3088 3089@item -Wpacked 3090@opindex Wpacked 3091Warn if a structure is given the packed attribute, but the packed 3092attribute has no effect on the layout or size of the structure. 3093Such structures may be mis-aligned for little benefit. For 3094instance, in this code, the variable @code{f.x} in @code{struct bar} 3095will be misaligned even though @code{struct bar} does not itself 3096have the packed attribute: 3097 3098@smallexample 3099@group 3100struct foo @{ 3101 int x; 3102 char a, b, c, d; 3103@} __attribute__((packed)); 3104struct bar @{ 3105 char z; 3106 struct foo f; 3107@}; 3108@end group 3109@end smallexample 3110 3111@item -Wpadded 3112@opindex Wpadded 3113Warn if padding is included in a structure, either to align an element 3114of the structure or to align the whole structure. Sometimes when this 3115happens it is possible to rearrange the fields of the structure to 3116reduce the padding and so make the structure smaller. 3117 3118@item -Wredundant-decls 3119@opindex Wredundant-decls 3120Warn if anything is declared more than once in the same scope, even in 3121cases where multiple declaration is valid and changes nothing. 3122 3123@item -Wnested-externs @r{(C only)} 3124@opindex Wnested-externs 3125Warn if an @code{extern} declaration is encountered within a function. 3126 3127@item -Wunreachable-code 3128@opindex Wunreachable-code 3129Warn if the compiler detects that code will never be executed. 3130 3131This option is intended to warn when the compiler detects that at 3132least a whole line of source code will never be executed, because 3133some condition is never satisfied or because it is after a 3134procedure that never returns. 3135 3136It is possible for this option to produce a warning even though there 3137are circumstances under which part of the affected line can be executed, 3138so care should be taken when removing apparently-unreachable code. 3139 3140For instance, when a function is inlined, a warning may mean that the 3141line is unreachable in only one inlined copy of the function. 3142 3143This option is not made part of @option{-Wall} because in a debugging 3144version of a program there is often substantial code which checks 3145correct functioning of the program and is, hopefully, unreachable 3146because the program does work. Another common use of unreachable 3147code is to provide behavior which is selectable at compile-time. 3148 3149@item -Winline 3150@opindex Winline 3151Warn if a function can not be inlined and it was declared as inline. 3152Even with this option, the compiler will not warn about failures to 3153inline functions declared in system headers. 3154 3155The compiler uses a variety of heuristics to determine whether or not 3156to inline a function. For example, the compiler takes into account 3157the size of the function being inlined and the amount of inlining 3158that has already been done in the current function. Therefore, 3159seemingly insignificant changes in the source program can cause the 3160warnings produced by @option{-Winline} to appear or disappear. 3161 3162@item -Wno-invalid-offsetof @r{(C++ only)} 3163@opindex Wno-invalid-offsetof 3164Suppress warnings from applying the @samp{offsetof} macro to a non-POD 3165type. According to the 1998 ISO C++ standard, applying @samp{offsetof} 3166to a non-POD type is undefined. In existing C++ implementations, 3167however, @samp{offsetof} typically gives meaningful results even when 3168applied to certain kinds of non-POD types. (Such as a simple 3169@samp{struct} that fails to be a POD type only by virtue of having a 3170constructor.) This flag is for users who are aware that they are 3171writing nonportable code and who have deliberately chosen to ignore the 3172warning about it. 3173 3174The restrictions on @samp{offsetof} may be relaxed in a future version 3175of the C++ standard. 3176 3177@item -Wno-int-to-pointer-cast @r{(C only)} 3178@opindex Wno-int-to-pointer-cast 3179Suppress warnings from casts to pointer type of an integer of a 3180different size. 3181 3182@item -Wno-pointer-to-int-cast @r{(C only)} 3183@opindex Wno-pointer-to-int-cast 3184Suppress warnings from casts from a pointer to an integer type of a 3185different size. 3186 3187@item -Winvalid-pch 3188@opindex Winvalid-pch 3189Warn if a precompiled header (@pxref{Precompiled Headers}) is found in 3190the search path but can't be used. 3191 3192@item -Wlong-long 3193@opindex Wlong-long 3194@opindex Wno-long-long 3195Warn if @samp{long long} type is used. This is default. To inhibit 3196the warning messages, use @option{-Wno-long-long}. Flags 3197@option{-Wlong-long} and @option{-Wno-long-long} are taken into account 3198only when @option{-pedantic} flag is used. 3199 3200@item -Wvariadic-macros 3201@opindex Wvariadic-macros 3202@opindex Wno-variadic-macros 3203Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU 3204alternate syntax when in pedantic ISO C99 mode. This is default. 3205To inhibit the warning messages, use @option{-Wno-variadic-macros}. 3206 3207@item -Wvla 3208@opindex Wvla 3209@opindex Wno-vla 3210Warn if variable length array is used in the code. 3211@option{-Wno-vla} will prevent the @option{-pedantic} warning of 3212the variable length array. 3213 3214@item -Wvolatile-register-var 3215@opindex Wvolatile-register-var 3216@opindex Wno-volatile-register-var 3217Warn if a register variable is declared volatile. The volatile 3218modifier does not inhibit all optimizations that may eliminate reads 3219and/or writes to register variables. 3220 3221@item -Wdisabled-optimization 3222@opindex Wdisabled-optimization 3223Warn if a requested optimization pass is disabled. This warning does 3224not generally indicate that there is anything wrong with your code; it 3225merely indicates that GCC's optimizers were unable to handle the code 3226effectively. Often, the problem is that your code is too big or too 3227complex; GCC will refuse to optimize programs when the optimization 3228itself is likely to take inordinate amounts of time. 3229 3230@item -Wpointer-sign 3231@opindex Wpointer-sign 3232@opindex Wno-pointer-sign 3233Warn for pointer argument passing or assignment with different signedness. 3234This option is only supported for C. It is implied by @option{-Wall} 3235and by @option{-pedantic}, which can be disabled with 3236@option{-Wno-pointer-sign}. 3237 3238@item -Werror 3239@opindex Werror 3240Make all warnings into errors. 3241 3242@item -Werror= 3243@opindex Werror= 3244Make the specified warning into an errors. The specifier for a 3245warning is appended, for example @option{-Werror=switch} turns the 3246warnings controlled by @option{-Wswitch} into errors. This switch 3247takes a negative form, to be used to negate @option{-Werror} for 3248specific warnings, for example @option{-Wno-error=switch} makes 3249@option{-Wswitch} warnings not be errors, even when @option{-Werror} 3250is in effect. You can use the @option{-fdiagnostics-show-option} 3251option to have each controllable warning amended with the option which 3252controls it, to determine what to use with this option. 3253 3254Note that specifying @option{-Werror=}@var{foo} automatically implies 3255@option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not 3256imply anything. 3257 3258@item -Wstack-protector 3259@opindex Wstack-protector 3260This option is only active when @option{-fstack-protector} is active. It 3261warns about functions that will not be protected against stack smashing. 3262 3263@item -Woverlength-strings 3264@opindex Woverlength-strings 3265Warn about string constants which are longer than the ``minimum 3266maximum'' length specified in the C standard. Modern compilers 3267generally allow string constants which are much longer than the 3268standard's minimum limit, but very portable programs should avoid 3269using longer strings. 3270 3271The limit applies @emph{after} string constant concatenation, and does 3272not count the trailing NUL@. In C89, the limit was 509 characters; in 3273C99, it was raised to 4095. C++98 does not specify a normative 3274minimum maximum, so we do not diagnose overlength strings in C++@. 3275 3276This option is implied by @option{-pedantic}, and can be disabled with 3277@option{-Wno-overlength-strings}. 3278@end table 3279 3280@node Debugging Options 3281@section Options for Debugging Your Program or GCC 3282@cindex options, debugging 3283@cindex debugging information options 3284 3285GCC has various special options that are used for debugging 3286either your program or GCC: 3287 3288@table @gcctabopt 3289@item -g 3290@opindex g 3291Produce debugging information in the operating system's native format 3292(stabs, COFF, XCOFF, or DWARF 2)@. GDB can work with this debugging 3293information. 3294 3295On most systems that use stabs format, @option{-g} enables use of extra 3296debugging information that only GDB can use; this extra information 3297makes debugging work better in GDB but will probably make other debuggers 3298crash or 3299refuse to read the program. If you want to control for certain whether 3300to generate the extra information, use @option{-gstabs+}, @option{-gstabs}, 3301@option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below). 3302 3303GCC allows you to use @option{-g} with 3304@option{-O}. The shortcuts taken by optimized code may occasionally 3305produce surprising results: some variables you declared may not exist 3306at all; flow of control may briefly move where you did not expect it; 3307some statements may not be executed because they compute constant 3308results or their values were already at hand; some statements may 3309execute in different places because they were moved out of loops. 3310 3311Nevertheless it proves possible to debug optimized output. This makes 3312it reasonable to use the optimizer for programs that might have bugs. 3313 3314The following options are useful when GCC is generated with the 3315capability for more than one debugging format. 3316 3317@item -ggdb 3318@opindex ggdb 3319Produce debugging information for use by GDB@. This means to use the 3320most expressive format available (DWARF 2, stabs, or the native format 3321if neither of those are supported), including GDB extensions if at all 3322possible. 3323 3324@item -gstabs 3325@opindex gstabs 3326Produce debugging information in stabs format (if that is supported), 3327without GDB extensions. This is the format used by DBX on most BSD 3328systems. On MIPS, Alpha and System V Release 4 systems this option 3329produces stabs debugging output which is not understood by DBX or SDB@. 3330On System V Release 4 systems this option requires the GNU assembler. 3331 3332@item -feliminate-unused-debug-symbols 3333@opindex feliminate-unused-debug-symbols 3334Produce debugging information in stabs format (if that is supported), 3335for only symbols that are actually used. 3336 3337@item -femit-class-debug-always 3338Instead of emitting debugging information for a C++ class in only one 3339object file, emit it in all object files using the class. This option 3340should be used only with debuggers that are unable to handle the way GCC 3341normally emits debugging information for classes because using this 3342option will increase the size of debugging information by as much as a 3343factor of two. 3344 3345@item -gstabs+ 3346@opindex gstabs+ 3347Produce debugging information in stabs format (if that is supported), 3348using GNU extensions understood only by the GNU debugger (GDB)@. The 3349use of these extensions is likely to make other debuggers crash or 3350refuse to read the program. 3351 3352@item -gcoff 3353@opindex gcoff 3354Produce debugging information in COFF format (if that is supported). 3355This is the format used by SDB on most System V systems prior to 3356System V Release 4. 3357 3358@item -gxcoff 3359@opindex gxcoff 3360Produce debugging information in XCOFF format (if that is supported). 3361This is the format used by the DBX debugger on IBM RS/6000 systems. 3362 3363@item -gxcoff+ 3364@opindex gxcoff+ 3365Produce debugging information in XCOFF format (if that is supported), 3366using GNU extensions understood only by the GNU debugger (GDB)@. The 3367use of these extensions is likely to make other debuggers crash or 3368refuse to read the program, and may cause assemblers other than the GNU 3369assembler (GAS) to fail with an error. 3370 3371@item -gdwarf-2 3372@opindex gdwarf-2 3373Produce debugging information in DWARF version 2 format (if that is 3374supported). This is the format used by DBX on IRIX 6. With this 3375option, GCC uses features of DWARF version 3 when they are useful; 3376version 3 is upward compatible with version 2, but may still cause 3377problems for older debuggers. 3378 3379@item -gvms 3380@opindex gvms 3381Produce debugging information in VMS debug format (if that is 3382supported). This is the format used by DEBUG on VMS systems. 3383 3384@item -g@var{level} 3385@itemx -ggdb@var{level} 3386@itemx -gstabs@var{level} 3387@itemx -gcoff@var{level} 3388@itemx -gxcoff@var{level} 3389@itemx -gvms@var{level} 3390Request debugging information and also use @var{level} to specify how 3391much information. The default level is 2. 3392 3393Level 1 produces minimal information, enough for making backtraces in 3394parts of the program that you don't plan to debug. This includes 3395descriptions of functions and external variables, but no information 3396about local variables and no line numbers. 3397 3398Level 3 includes extra information, such as all the macro definitions 3399present in the program. Some debuggers support macro expansion when 3400you use @option{-g3}. 3401 3402@option{-gdwarf-2} does not accept a concatenated debug level, because 3403GCC used to support an option @option{-gdwarf} that meant to generate 3404debug information in version 1 of the DWARF format (which is very 3405different from version 2), and it would have been too confusing. That 3406debug format is long obsolete, but the option cannot be changed now. 3407Instead use an additional @option{-g@var{level}} option to change the 3408debug level for DWARF2. 3409 3410@item -feliminate-dwarf2-dups 3411@opindex feliminate-dwarf2-dups 3412Compress DWARF2 debugging information by eliminating duplicated 3413information about each symbol. This option only makes sense when 3414generating DWARF2 debugging information with @option{-gdwarf-2}. 3415 3416@item -femit-struct-debug-baseonly 3417Emit debug information for struct-like types 3418only when the base name of the compilation source file 3419matches the base name of file in which the struct was defined. 3420 3421This option substantially reduces the size of debugging information, 3422but at significant potential loss in type information to the debugger. 3423See @option{-femit-struct-debug-reduced} for a less aggressive option. 3424See @option{-femit-struct-debug-detailed} for more detailed control. 3425 3426This option works only with DWARF 2. 3427 3428@item -femit-struct-debug-reduced 3429Emit debug information for struct-like types 3430only when the base name of the compilation source file 3431matches the base name of file in which the type was defined, 3432unless the struct is a template or defined in a system header. 3433 3434This option significantly reduces the size of debugging information, 3435with some potential loss in type information to the debugger. 3436See @option{-femit-struct-debug-baseonly} for a more aggressive option. 3437See @option{-femit-struct-debug-detailed} for more detailed control. 3438 3439This option works only with DWARF 2. 3440 3441@item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} 3442Specify the struct-like types 3443for which the compiler will generate debug information. 3444The intent is to reduce duplicate struct debug information 3445between different object files within the same program. 3446 3447This option is a detailed version of 3448@option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly}, 3449which will serve for most needs. 3450 3451A specification has the syntax 3452[@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none}) 3453 3454The optional first word limits the specification to 3455structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}). 3456A struct type is used directly when it is the type of a variable, member. 3457Indirect uses arise through pointers to structs. 3458That is, when use of an incomplete struct would be legal, the use is indirect. 3459An example is 3460@samp{struct one direct; struct two * indirect;}. 3461 3462The optional second word limits the specification to 3463ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}). 3464Generic structs are a bit complicated to explain. 3465For C++, these are non-explicit specializations of template classes, 3466or non-template classes within the above. 3467Other programming languages have generics, 3468but @samp{-femit-struct-debug-detailed} does not yet implement them. 3469 3470The third word specifies the source files for those 3471structs for which the compiler will emit debug information. 3472The values @samp{none} and @samp{any} have the normal meaning. 3473The value @samp{base} means that 3474the base of name of the file in which the type declaration appears 3475must match the base of the name of the main compilation file. 3476In practice, this means that 3477types declared in @file{foo.c} and @file{foo.h} will have debug information, 3478but types declared in other header will not. 3479The value @samp{sys} means those types satisfying @samp{base} 3480or declared in system or compiler headers. 3481 3482You may need to experiment to determine the best settings for your application. 3483 3484The default is @samp{-femit-struct-debug-detailed=all}. 3485 3486This option works only with DWARF 2. 3487 3488@cindex @command{prof} 3489@item -p 3490@opindex p 3491Generate extra code to write profile information suitable for the 3492analysis program @command{prof}. You must use this option when compiling 3493the source files you want data about, and you must also use it when 3494linking. 3495 3496@cindex @command{gprof} 3497@item -pg 3498@opindex pg 3499Generate extra code to write profile information suitable for the 3500analysis program @command{gprof}. You must use this option when compiling 3501the source files you want data about, and you must also use it when 3502linking. 3503 3504@item -Q 3505@opindex Q 3506Makes the compiler print out each function name as it is compiled, and 3507print some statistics about each pass when it finishes. 3508 3509@item -ftime-report 3510@opindex ftime-report 3511Makes the compiler print some statistics about the time consumed by each 3512pass when it finishes. 3513 3514@item -fmem-report 3515@opindex fmem-report 3516Makes the compiler print some statistics about permanent memory 3517allocation when it finishes. 3518 3519@item -fprofile-arcs 3520@opindex fprofile-arcs 3521Add code so that program flow @dfn{arcs} are instrumented. During 3522execution the program records how many times each branch and call is 3523executed and how many times it is taken or returns. When the compiled 3524program exits it saves this data to a file called 3525@file{@var{auxname}.gcda} for each source file. The data may be used for 3526profile-directed optimizations (@option{-fbranch-probabilities}), or for 3527test coverage analysis (@option{-ftest-coverage}). Each object file's 3528@var{auxname} is generated from the name of the output file, if 3529explicitly specified and it is not the final executable, otherwise it is 3530the basename of the source file. In both cases any suffix is removed 3531(e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or 3532@file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}). 3533@xref{Cross-profiling}. 3534 3535@cindex @command{gcov} 3536@item --coverage 3537@opindex coverage 3538 3539This option is used to compile and link code instrumented for coverage 3540analysis. The option is a synonym for @option{-fprofile-arcs} 3541@option{-ftest-coverage} (when compiling) and @option{-lgcov} (when 3542linking). See the documentation for those options for more details. 3543 3544@itemize 3545 3546@item 3547Compile the source files with @option{-fprofile-arcs} plus optimization 3548and code generation options. For test coverage analysis, use the 3549additional @option{-ftest-coverage} option. You do not need to profile 3550every source file in a program. 3551 3552@item 3553Link your object files with @option{-lgcov} or @option{-fprofile-arcs} 3554(the latter implies the former). 3555 3556@item 3557Run the program on a representative workload to generate the arc profile 3558information. This may be repeated any number of times. You can run 3559concurrent instances of your program, and provided that the file system 3560supports locking, the data files will be correctly updated. Also 3561@code{fork} calls are detected and correctly handled (double counting 3562will not happen). 3563 3564@item 3565For profile-directed optimizations, compile the source files again with 3566the same optimization and code generation options plus 3567@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that 3568Control Optimization}). 3569 3570@item 3571For test coverage analysis, use @command{gcov} to produce human readable 3572information from the @file{.gcno} and @file{.gcda} files. Refer to the 3573@command{gcov} documentation for further information. 3574 3575@end itemize 3576 3577With @option{-fprofile-arcs}, for each function of your program GCC 3578creates a program flow graph, then finds a spanning tree for the graph. 3579Only arcs that are not on the spanning tree have to be instrumented: the 3580compiler adds code to count the number of times that these arcs are 3581executed. When an arc is the only exit or only entrance to a block, the 3582instrumentation code can be added to the block; otherwise, a new basic 3583block must be created to hold the instrumentation code. 3584 3585@need 2000 3586@item -ftest-coverage 3587@opindex ftest-coverage 3588Produce a notes file that the @command{gcov} code-coverage utility 3589(@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to 3590show program coverage. Each source file's note file is called 3591@file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option 3592above for a description of @var{auxname} and instructions on how to 3593generate test coverage data. Coverage data will match the source files 3594more closely, if you do not optimize. 3595 3596@item -d@var{letters} 3597@item -fdump-rtl-@var{pass} 3598@opindex d 3599Says to make debugging dumps during compilation at times specified by 3600@var{letters}. This is used for debugging the RTL-based passes of the 3601compiler. The file names for most of the dumps are made by appending a 3602pass number and a word to the @var{dumpname}. @var{dumpname} is generated 3603from the name of the output file, if explicitly specified and it is not 3604an executable, otherwise it is the basename of the source file. 3605 3606Most debug dumps can be enabled either passing a letter to the @option{-d} 3607option, or with a long @option{-fdump-rtl} switch; here are the possible 3608letters for use in @var{letters} and @var{pass}, and their meanings: 3609 3610@table @gcctabopt 3611@item -dA 3612@opindex dA 3613Annotate the assembler output with miscellaneous debugging information. 3614 3615@item -dB 3616@itemx -fdump-rtl-bbro 3617@opindex dB 3618@opindex fdump-rtl-bbro 3619Dump after block reordering, to @file{@var{file}.148r.bbro}. 3620 3621@item -dc 3622@itemx -fdump-rtl-combine 3623@opindex dc 3624@opindex fdump-rtl-combine 3625Dump after instruction combination, to the file @file{@var{file}.129r.combine}. 3626 3627@item -dC 3628@itemx -fdump-rtl-ce1 3629@itemx -fdump-rtl-ce2 3630@opindex dC 3631@opindex fdump-rtl-ce1 3632@opindex fdump-rtl-ce2 3633@option{-dC} and @option{-fdump-rtl-ce1} enable dumping after the 3634first if conversion, to the file @file{@var{file}.117r.ce1}. @option{-dC} 3635and @option{-fdump-rtl-ce2} enable dumping after the second if 3636conversion, to the file @file{@var{file}.130r.ce2}. 3637 3638@item -dd 3639@itemx -fdump-rtl-btl 3640@itemx -fdump-rtl-dbr 3641@opindex dd 3642@opindex fdump-rtl-btl 3643@opindex fdump-rtl-dbr 3644@option{-dd} and @option{-fdump-rtl-btl} enable dumping after branch 3645target load optimization, to @file{@var{file}.31.btl}. @option{-dd} 3646and @option{-fdump-rtl-dbr} enable dumping after delayed branch 3647scheduling, to @file{@var{file}.36.dbr}. 3648 3649@item -dD 3650@opindex dD 3651Dump all macro definitions, at the end of preprocessing, in addition to 3652normal output. 3653 3654@item -dE 3655@itemx -fdump-rtl-ce3 3656@opindex dE 3657@opindex fdump-rtl-ce3 3658Dump after the third if conversion, to @file{@var{file}.146r.ce3}. 3659 3660@item -df 3661@itemx -fdump-rtl-cfg 3662@itemx -fdump-rtl-life 3663@opindex df 3664@opindex fdump-rtl-cfg 3665@opindex fdump-rtl-life 3666@option{-df} and @option{-fdump-rtl-cfg} enable dumping after control 3667and data flow analysis, to @file{@var{file}.116r.cfg}. @option{-df} 3668and @option{-fdump-rtl-cfg} enable dumping dump after life analysis, 3669to @file{@var{file}.128r.life1} and @file{@var{file}.135r.life2}. 3670 3671@item -dg 3672@itemx -fdump-rtl-greg 3673@opindex dg 3674@opindex fdump-rtl-greg 3675Dump after global register allocation, to @file{@var{file}.139r.greg}. 3676 3677@item -dG 3678@itemx -fdump-rtl-gcse 3679@itemx -fdump-rtl-bypass 3680@opindex dG 3681@opindex fdump-rtl-gcse 3682@opindex fdump-rtl-bypass 3683@option{-dG} and @option{-fdump-rtl-gcse} enable dumping after GCSE, to 3684@file{@var{file}.114r.gcse}. @option{-dG} and @option{-fdump-rtl-bypass} 3685enable dumping after jump bypassing and control flow optimizations, to 3686@file{@var{file}.115r.bypass}. 3687 3688@item -dh 3689@itemx -fdump-rtl-eh 3690@opindex dh 3691@opindex fdump-rtl-eh 3692Dump after finalization of EH handling code, to @file{@var{file}.02.eh}. 3693 3694@item -di 3695@itemx -fdump-rtl-sibling 3696@opindex di 3697@opindex fdump-rtl-sibling 3698Dump after sibling call optimizations, to @file{@var{file}.106r.sibling}. 3699 3700@item -dj 3701@itemx -fdump-rtl-jump 3702@opindex dj 3703@opindex fdump-rtl-jump 3704Dump after the first jump optimization, to @file{@var{file}.112r.jump}. 3705 3706@item -dk 3707@itemx -fdump-rtl-stack 3708@opindex dk 3709@opindex fdump-rtl-stack 3710Dump after conversion from registers to stack, to @file{@var{file}.152r.stack}. 3711 3712@item -dl 3713@itemx -fdump-rtl-lreg 3714@opindex dl 3715@opindex fdump-rtl-lreg 3716Dump after local register allocation, to @file{@var{file}.138r.lreg}. 3717 3718@item -dL 3719@itemx -fdump-rtl-loop2 3720@opindex dL 3721@opindex fdump-rtl-loop2 3722@option{-dL} and @option{-fdump-rtl-loop2} enable dumping after the 3723loop optimization pass, to @file{@var{file}.119r.loop2}, 3724@file{@var{file}.120r.loop2_init}, 3725@file{@var{file}.121r.loop2_invariant}, and 3726@file{@var{file}.125r.loop2_done}. 3727 3728@item -dm 3729@itemx -fdump-rtl-sms 3730@opindex dm 3731@opindex fdump-rtl-sms 3732Dump after modulo scheduling, to @file{@var{file}.136r.sms}. 3733 3734@item -dM 3735@itemx -fdump-rtl-mach 3736@opindex dM 3737@opindex fdump-rtl-mach 3738Dump after performing the machine dependent reorganization pass, to 3739@file{@var{file}.155r.mach}. 3740 3741@item -dn 3742@itemx -fdump-rtl-rnreg 3743@opindex dn 3744@opindex fdump-rtl-rnreg 3745Dump after register renumbering, to @file{@var{file}.147r.rnreg}. 3746 3747@item -dN 3748@itemx -fdump-rtl-regmove 3749@opindex dN 3750@opindex fdump-rtl-regmove 3751Dump after the register move pass, to @file{@var{file}.132r.regmove}. 3752 3753@item -do 3754@itemx -fdump-rtl-postreload 3755@opindex do 3756@opindex fdump-rtl-postreload 3757Dump after post-reload optimizations, to @file{@var{file}.24.postreload}. 3758 3759@item -dr 3760@itemx -fdump-rtl-expand 3761@opindex dr 3762@opindex fdump-rtl-expand 3763Dump after RTL generation, to @file{@var{file}.104r.expand}. 3764 3765@item -dR 3766@itemx -fdump-rtl-sched2 3767@opindex dR 3768@opindex fdump-rtl-sched2 3769Dump after the second scheduling pass, to @file{@var{file}.150r.sched2}. 3770 3771@item -ds 3772@itemx -fdump-rtl-cse 3773@opindex ds 3774@opindex fdump-rtl-cse 3775Dump after CSE (including the jump optimization that sometimes follows 3776CSE), to @file{@var{file}.113r.cse}. 3777 3778@item -dS 3779@itemx -fdump-rtl-sched 3780@opindex dS 3781@opindex fdump-rtl-sched 3782Dump after the first scheduling pass, to @file{@var{file}.21.sched}. 3783 3784@item -dt 3785@itemx -fdump-rtl-cse2 3786@opindex dt 3787@opindex fdump-rtl-cse2 3788Dump after the second CSE pass (including the jump optimization that 3789sometimes follows CSE), to @file{@var{file}.127r.cse2}. 3790 3791@item -dT 3792@itemx -fdump-rtl-tracer 3793@opindex dT 3794@opindex fdump-rtl-tracer 3795Dump after running tracer, to @file{@var{file}.118r.tracer}. 3796 3797@item -dV 3798@itemx -fdump-rtl-vpt 3799@itemx -fdump-rtl-vartrack 3800@opindex dV 3801@opindex fdump-rtl-vpt 3802@opindex fdump-rtl-vartrack 3803@option{-dV} and @option{-fdump-rtl-vpt} enable dumping after the value 3804profile transformations, to @file{@var{file}.10.vpt}. @option{-dV} 3805and @option{-fdump-rtl-vartrack} enable dumping after variable tracking, 3806to @file{@var{file}.154r.vartrack}. 3807 3808@item -dw 3809@itemx -fdump-rtl-flow2 3810@opindex dw 3811@opindex fdump-rtl-flow2 3812Dump after the second flow pass, to @file{@var{file}.142r.flow2}. 3813 3814@item -dz 3815@itemx -fdump-rtl-peephole2 3816@opindex dz 3817@opindex fdump-rtl-peephole2 3818Dump after the peephole pass, to @file{@var{file}.145r.peephole2}. 3819 3820@item -dZ 3821@itemx -fdump-rtl-web 3822@opindex dZ 3823@opindex fdump-rtl-web 3824Dump after live range splitting, to @file{@var{file}.126r.web}. 3825 3826@item -da 3827@itemx -fdump-rtl-all 3828@opindex da 3829@opindex fdump-rtl-all 3830Produce all the dumps listed above. 3831 3832@item -dH 3833@opindex dH 3834Produce a core dump whenever an error occurs. 3835 3836@item -dm 3837@opindex dm 3838Print statistics on memory usage, at the end of the run, to 3839standard error. 3840 3841@item -dp 3842@opindex dp 3843Annotate the assembler output with a comment indicating which 3844pattern and alternative was used. The length of each instruction is 3845also printed. 3846 3847@item -dP 3848@opindex dP 3849Dump the RTL in the assembler output as a comment before each instruction. 3850Also turns on @option{-dp} annotation. 3851 3852@item -dv 3853@opindex dv 3854For each of the other indicated dump files (either with @option{-d} or 3855@option{-fdump-rtl-@var{pass}}), dump a representation of the control flow 3856graph suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}. 3857 3858@item -dx 3859@opindex dx 3860Just generate RTL for a function instead of compiling it. Usually used 3861with @samp{r} (@option{-fdump-rtl-expand}). 3862 3863@item -dy 3864@opindex dy 3865Dump debugging information during parsing, to standard error. 3866@end table 3867 3868@item -fdump-noaddr 3869@opindex fdump-noaddr 3870When doing debugging dumps (see @option{-d} option above), suppress 3871address output. This makes it more feasible to use diff on debugging 3872dumps for compiler invocations with different compiler binaries and/or 3873different text / bss / data / heap / stack / dso start locations. 3874 3875@item -fdump-unnumbered 3876@opindex fdump-unnumbered 3877When doing debugging dumps (see @option{-d} option above), suppress instruction 3878numbers, line number note and address output. This makes it more feasible to 3879use diff on debugging dumps for compiler invocations with different 3880options, in particular with and without @option{-g}. 3881 3882@item -fdump-translation-unit @r{(C++ only)} 3883@itemx -fdump-translation-unit-@var{options} @r{(C++ only)} 3884@opindex fdump-translation-unit 3885Dump a representation of the tree structure for the entire translation 3886unit to a file. The file name is made by appending @file{.tu} to the 3887source file name. If the @samp{-@var{options}} form is used, @var{options} 3888controls the details of the dump as described for the 3889@option{-fdump-tree} options. 3890 3891@item -fdump-class-hierarchy @r{(C++ only)} 3892@itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)} 3893@opindex fdump-class-hierarchy 3894Dump a representation of each class's hierarchy and virtual function 3895table layout to a file. The file name is made by appending @file{.class} 3896to the source file name. If the @samp{-@var{options}} form is used, 3897@var{options} controls the details of the dump as described for the 3898@option{-fdump-tree} options. 3899 3900@item -fdump-ipa-@var{switch} 3901@opindex fdump-ipa 3902Control the dumping at various stages of inter-procedural analysis 3903language tree to a file. The file name is generated by appending a switch 3904specific suffix to the source file name. The following dumps are possible: 3905 3906@table @samp 3907@item all 3908Enables all inter-procedural analysis dumps; currently the only produced 3909dump is the @samp{cgraph} dump. 3910 3911@item cgraph 3912Dumps information about call-graph optimization, unused function removal, 3913and inlining decisions. 3914@end table 3915 3916@item -fdump-tree-@var{switch} 3917@itemx -fdump-tree-@var{switch}-@var{options} 3918@opindex fdump-tree 3919Control the dumping at various stages of processing the intermediate 3920language tree to a file. The file name is generated by appending a switch 3921specific suffix to the source file name. If the @samp{-@var{options}} 3922form is used, @var{options} is a list of @samp{-} separated options that 3923control the details of the dump. Not all options are applicable to all 3924dumps, those which are not meaningful will be ignored. The following 3925options are available 3926 3927@table @samp 3928@item address 3929Print the address of each node. Usually this is not meaningful as it 3930changes according to the environment and source file. Its primary use 3931is for tying up a dump file with a debug environment. 3932@item slim 3933Inhibit dumping of members of a scope or body of a function merely 3934because that scope has been reached. Only dump such items when they 3935are directly reachable by some other path. When dumping pretty-printed 3936trees, this option inhibits dumping the bodies of control structures. 3937@item raw 3938Print a raw representation of the tree. By default, trees are 3939pretty-printed into a C-like representation. 3940@item details 3941Enable more detailed dumps (not honored by every dump option). 3942@item stats 3943Enable dumping various statistics about the pass (not honored by every dump 3944option). 3945@item blocks 3946Enable showing basic block boundaries (disabled in raw dumps). 3947@item vops 3948Enable showing virtual operands for every statement. 3949@item lineno 3950Enable showing line numbers for statements. 3951@item uid 3952Enable showing the unique ID (@code{DECL_UID}) for each variable. 3953@item all 3954Turn on all options, except @option{raw}, @option{slim} and @option{lineno}. 3955@end table 3956 3957The following tree dumps are possible: 3958@table @samp 3959 3960@item original 3961Dump before any tree based optimization, to @file{@var{file}.original}. 3962 3963@item optimized 3964Dump after all tree based optimization, to @file{@var{file}.optimized}. 3965 3966@item inlined 3967Dump after function inlining, to @file{@var{file}.inlined}. 3968 3969@item gimple 3970@opindex fdump-tree-gimple 3971Dump each function before and after the gimplification pass to a file. The 3972file name is made by appending @file{.gimple} to the source file name. 3973 3974@item cfg 3975@opindex fdump-tree-cfg 3976Dump the control flow graph of each function to a file. The file name is 3977made by appending @file{.cfg} to the source file name. 3978 3979@item vcg 3980@opindex fdump-tree-vcg 3981Dump the control flow graph of each function to a file in VCG format. The 3982file name is made by appending @file{.vcg} to the source file name. Note 3983that if the file contains more than one function, the generated file cannot 3984be used directly by VCG@. You will need to cut and paste each function's 3985graph into its own separate file first. 3986 3987@item ch 3988@opindex fdump-tree-ch 3989Dump each function after copying loop headers. The file name is made by 3990appending @file{.ch} to the source file name. 3991 3992@item ssa 3993@opindex fdump-tree-ssa 3994Dump SSA related information to a file. The file name is made by appending 3995@file{.ssa} to the source file name. 3996 3997@item salias 3998@opindex fdump-tree-salias 3999Dump structure aliasing variable information to a file. This file name 4000is made by appending @file{.salias} to the source file name. 4001 4002@item alias 4003@opindex fdump-tree-alias 4004Dump aliasing information for each function. The file name is made by 4005appending @file{.alias} to the source file name. 4006 4007@item ccp 4008@opindex fdump-tree-ccp 4009Dump each function after CCP@. The file name is made by appending 4010@file{.ccp} to the source file name. 4011 4012@item storeccp 4013@opindex fdump-tree-storeccp 4014Dump each function after STORE-CCP. The file name is made by appending 4015@file{.storeccp} to the source file name. 4016 4017@item pre 4018@opindex fdump-tree-pre 4019Dump trees after partial redundancy elimination. The file name is made 4020by appending @file{.pre} to the source file name. 4021 4022@item fre 4023@opindex fdump-tree-fre 4024Dump trees after full redundancy elimination. The file name is made 4025by appending @file{.fre} to the source file name. 4026 4027@item copyprop 4028@opindex fdump-tree-copyprop 4029Dump trees after copy propagation. The file name is made 4030by appending @file{.copyprop} to the source file name. 4031 4032@item store_copyprop 4033@opindex fdump-tree-store_copyprop 4034Dump trees after store copy-propagation. The file name is made 4035by appending @file{.store_copyprop} to the source file name. 4036 4037@item dce 4038@opindex fdump-tree-dce 4039Dump each function after dead code elimination. The file name is made by 4040appending @file{.dce} to the source file name. 4041 4042@item mudflap 4043@opindex fdump-tree-mudflap 4044Dump each function after adding mudflap instrumentation. The file name is 4045made by appending @file{.mudflap} to the source file name. 4046 4047@item sra 4048@opindex fdump-tree-sra 4049Dump each function after performing scalar replacement of aggregates. The 4050file name is made by appending @file{.sra} to the source file name. 4051 4052@item sink 4053@opindex fdump-tree-sink 4054Dump each function after performing code sinking. The file name is made 4055by appending @file{.sink} to the source file name. 4056 4057@item dom 4058@opindex fdump-tree-dom 4059Dump each function after applying dominator tree optimizations. The file 4060name is made by appending @file{.dom} to the source file name. 4061 4062@item dse 4063@opindex fdump-tree-dse 4064Dump each function after applying dead store elimination. The file 4065name is made by appending @file{.dse} to the source file name. 4066 4067@item phiopt 4068@opindex fdump-tree-phiopt 4069Dump each function after optimizing PHI nodes into straightline code. The file 4070name is made by appending @file{.phiopt} to the source file name. 4071 4072@item forwprop 4073@opindex fdump-tree-forwprop 4074Dump each function after forward propagating single use variables. The file 4075name is made by appending @file{.forwprop} to the source file name. 4076 4077@item copyrename 4078@opindex fdump-tree-copyrename 4079Dump each function after applying the copy rename optimization. The file 4080name is made by appending @file{.copyrename} to the source file name. 4081 4082@item nrv 4083@opindex fdump-tree-nrv 4084Dump each function after applying the named return value optimization on 4085generic trees. The file name is made by appending @file{.nrv} to the source 4086file name. 4087 4088@item vect 4089@opindex fdump-tree-vect 4090Dump each function after applying vectorization of loops. The file name is 4091made by appending @file{.vect} to the source file name. 4092 4093@item vrp 4094@opindex fdump-tree-vrp 4095Dump each function after Value Range Propagation (VRP). The file name 4096is made by appending @file{.vrp} to the source file name. 4097 4098@item all 4099@opindex fdump-tree-all 4100Enable all the available tree dumps with the flags provided in this option. 4101@end table 4102 4103@item -ftree-vectorizer-verbose=@var{n} 4104@opindex ftree-vectorizer-verbose 4105This option controls the amount of debugging output the vectorizer prints. 4106This information is written to standard error, unless 4107@option{-fdump-tree-all} or @option{-fdump-tree-vect} is specified, 4108in which case it is output to the usual dump listing file, @file{.vect}. 4109For @var{n}=0 no diagnostic information is reported. 4110If @var{n}=1 the vectorizer reports each loop that got vectorized, 4111and the total number of loops that got vectorized. 4112If @var{n}=2 the vectorizer also reports non-vectorized loops that passed 4113the first analysis phase (vect_analyze_loop_form) - i.e. countable, 4114inner-most, single-bb, single-entry/exit loops. This is the same verbosity 4115level that @option{-fdump-tree-vect-stats} uses. 4116Higher verbosity levels mean either more information dumped for each 4117reported loop, or same amount of information reported for more loops: 4118If @var{n}=3, alignment related information is added to the reports. 4119If @var{n}=4, data-references related information (e.g. memory dependences, 4120memory access-patterns) is added to the reports. 4121If @var{n}=5, the vectorizer reports also non-vectorized inner-most loops 4122that did not pass the first analysis phase (i.e. may not be countable, or 4123may have complicated control-flow). 4124If @var{n}=6, the vectorizer reports also non-vectorized nested loops. 4125For @var{n}=7, all the information the vectorizer generates during its 4126analysis and transformation is reported. This is the same verbosity level 4127that @option{-fdump-tree-vect-details} uses. 4128 4129@item -frandom-seed=@var{string} 4130@opindex frandom-string 4131This option provides a seed that GCC uses when it would otherwise use 4132random numbers. It is used to generate certain symbol names 4133that have to be different in every compiled file. It is also used to 4134place unique stamps in coverage data files and the object files that 4135produce them. You can use the @option{-frandom-seed} option to produce 4136reproducibly identical object files. 4137 4138The @var{string} should be different for every file you compile. 4139 4140@item -fsched-verbose=@var{n} 4141@opindex fsched-verbose 4142On targets that use instruction scheduling, this option controls the 4143amount of debugging output the scheduler prints. This information is 4144written to standard error, unless @option{-dS} or @option{-dR} is 4145specified, in which case it is output to the usual dump 4146listing file, @file{.sched} or @file{.sched2} respectively. However 4147for @var{n} greater than nine, the output is always printed to standard 4148error. 4149 4150For @var{n} greater than zero, @option{-fsched-verbose} outputs the 4151same information as @option{-dRS}. For @var{n} greater than one, it 4152also output basic block probabilities, detailed ready list information 4153and unit/insn info. For @var{n} greater than two, it includes RTL 4154at abort point, control-flow and regions info. And for @var{n} over 4155four, @option{-fsched-verbose} also includes dependence info. 4156 4157@item -save-temps 4158@opindex save-temps 4159Store the usual ``temporary'' intermediate files permanently; place them 4160in the current directory and name them based on the source file. Thus, 4161compiling @file{foo.c} with @samp{-c -save-temps} would produce files 4162@file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a 4163preprocessed @file{foo.i} output file even though the compiler now 4164normally uses an integrated preprocessor. 4165 4166When used in combination with the @option{-x} command line option, 4167@option{-save-temps} is sensible enough to avoid over writing an 4168input source file with the same extension as an intermediate file. 4169The corresponding intermediate file may be obtained by renaming the 4170source file before using @option{-save-temps}. 4171 4172@item -time 4173@opindex time 4174Report the CPU time taken by each subprocess in the compilation 4175sequence. For C source files, this is the compiler proper and assembler 4176(plus the linker if linking is done). The output looks like this: 4177 4178@smallexample 4179# cc1 0.12 0.01 4180# as 0.00 0.01 4181@end smallexample 4182 4183The first number on each line is the ``user time'', that is time spent 4184executing the program itself. The second number is ``system time'', 4185time spent executing operating system routines on behalf of the program. 4186Both numbers are in seconds. 4187 4188@item -fvar-tracking 4189@opindex fvar-tracking 4190Run variable tracking pass. It computes where variables are stored at each 4191position in code. Better debugging information is then generated 4192(if the debugging information format supports this information). 4193 4194It is enabled by default when compiling with optimization (@option{-Os}, 4195@option{-O}, @option{-O2}, ...), debugging information (@option{-g}) and 4196the debug info format supports it. 4197 4198@item -print-file-name=@var{library} 4199@opindex print-file-name 4200Print the full absolute name of the library file @var{library} that 4201would be used when linking---and don't do anything else. With this 4202option, GCC does not compile or link anything; it just prints the 4203file name. 4204 4205@item -print-multi-directory 4206@opindex print-multi-directory 4207Print the directory name corresponding to the multilib selected by any 4208other switches present in the command line. This directory is supposed 4209to exist in @env{GCC_EXEC_PREFIX}. 4210 4211@item -print-multi-lib 4212@opindex print-multi-lib 4213Print the mapping from multilib directory names to compiler switches 4214that enable them. The directory name is separated from the switches by 4215@samp{;}, and each switch starts with an @samp{@@} instead of the 4216@samp{-}, without spaces between multiple switches. This is supposed to 4217ease shell-processing. 4218 4219@item -print-prog-name=@var{program} 4220@opindex print-prog-name 4221Like @option{-print-file-name}, but searches for a program such as @samp{cpp}. 4222 4223@item -print-libgcc-file-name 4224@opindex print-libgcc-file-name 4225Same as @option{-print-file-name=libgcc.a}. 4226 4227This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs} 4228but you do want to link with @file{libgcc.a}. You can do 4229 4230@smallexample 4231gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name` 4232@end smallexample 4233 4234@item -print-search-dirs 4235@opindex print-search-dirs 4236Print the name of the configured installation directory and a list of 4237program and library directories @command{gcc} will search---and don't do anything else. 4238 4239This is useful when @command{gcc} prints the error message 4240@samp{installation problem, cannot exec cpp0: No such file or directory}. 4241To resolve this you either need to put @file{cpp0} and the other compiler 4242components where @command{gcc} expects to find them, or you can set the environment 4243variable @env{GCC_EXEC_PREFIX} to the directory where you installed them. 4244Don't forget the trailing @samp{/}. 4245@xref{Environment Variables}. 4246 4247@item -dumpmachine 4248@opindex dumpmachine 4249Print the compiler's target machine (for example, 4250@samp{i686-pc-linux-gnu})---and don't do anything else. 4251 4252@item -dumpversion 4253@opindex dumpversion 4254Print the compiler version (for example, @samp{3.0})---and don't do 4255anything else. 4256 4257@item -dumpspecs 4258@opindex dumpspecs 4259Print the compiler's built-in specs---and don't do anything else. (This 4260is used when GCC itself is being built.) @xref{Spec Files}. 4261 4262@item -feliminate-unused-debug-types 4263@opindex feliminate-unused-debug-types 4264Normally, when producing DWARF2 output, GCC will emit debugging 4265information for all types declared in a compilation 4266unit, regardless of whether or not they are actually used 4267in that compilation unit. Sometimes this is useful, such as 4268if, in the debugger, you want to cast a value to a type that is 4269not actually used in your program (but is declared). More often, 4270however, this results in a significant amount of wasted space. 4271With this option, GCC will avoid producing debug symbol output 4272for types that are nowhere used in the source file being compiled. 4273@end table 4274 4275@node Optimize Options 4276@section Options That Control Optimization 4277@cindex optimize options 4278@cindex options, optimization 4279 4280These options control various sorts of optimizations. 4281 4282Without any optimization option, the compiler's goal is to reduce the 4283cost of compilation and to make debugging produce the expected 4284results. Statements are independent: if you stop the program with a 4285breakpoint between statements, you can then assign a new value to any 4286variable or change the program counter to any other statement in the 4287function and get exactly the results you would expect from the source 4288code. 4289 4290Turning on optimization flags makes the compiler attempt to improve 4291the performance and/or code size at the expense of compilation time 4292and possibly the ability to debug the program. 4293 4294The compiler performs optimization based on the knowledge it has of 4295the program. Optimization levels @option{-O} and above, in 4296particular, enable @emph{unit-at-a-time} mode, which allows the 4297compiler to consider information gained from later functions in 4298the file when compiling a function. Compiling multiple files at 4299once to a single output file in @emph{unit-at-a-time} mode allows 4300the compiler to use information gained from all of the files when 4301compiling each of them. 4302 4303Not all optimizations are controlled directly by a flag. Only 4304optimizations that have a flag are listed. 4305 4306@table @gcctabopt 4307@item -O 4308@itemx -O1 4309@opindex O 4310@opindex O1 4311Optimize. Optimizing compilation takes somewhat more time, and a lot 4312more memory for a large function. 4313 4314With @option{-O}, the compiler tries to reduce code size and execution 4315time, without performing any optimizations that take a great deal of 4316compilation time. 4317 4318@option{-O} turns on the following optimization flags: 4319@gccoptlist{-fdefer-pop @gol 4320-fdelayed-branch @gol 4321-fguess-branch-probability @gol 4322-fcprop-registers @gol 4323-fif-conversion @gol 4324-fif-conversion2 @gol 4325-ftree-ccp @gol 4326-ftree-dce @gol 4327-ftree-dominator-opts @gol 4328-ftree-dse @gol 4329-ftree-ter @gol 4330-ftree-lrs @gol 4331-ftree-sra @gol 4332-ftree-copyrename @gol 4333-ftree-fre @gol 4334-ftree-ch @gol 4335-funit-at-a-time @gol 4336-fmerge-constants} 4337 4338@option{-O} also turns on @option{-fomit-frame-pointer} on machines 4339where doing so does not interfere with debugging. 4340 4341@item -O2 4342@opindex O2 4343Optimize even more. GCC performs nearly all supported optimizations 4344that do not involve a space-speed tradeoff. The compiler does not 4345perform loop unrolling or function inlining when you specify @option{-O2}. 4346As compared to @option{-O}, this option increases both compilation time 4347and the performance of the generated code. 4348 4349@option{-O2} turns on all optimization flags specified by @option{-O}. It 4350also turns on the following optimization flags: 4351@gccoptlist{-fthread-jumps @gol 4352-fcrossjumping @gol 4353-foptimize-sibling-calls @gol 4354-fcse-follow-jumps -fcse-skip-blocks @gol 4355-fgcse -fgcse-lm @gol 4356-fexpensive-optimizations @gol 4357-frerun-cse-after-loop @gol 4358-fcaller-saves @gol 4359-fpeephole2 @gol 4360-fschedule-insns -fschedule-insns2 @gol 4361-fsched-interblock -fsched-spec @gol 4362-fregmove @gol 4363-fstrict-aliasing -fstrict-overflow @gol 4364-fdelete-null-pointer-checks @gol 4365-freorder-blocks -freorder-functions @gol 4366-falign-functions -falign-jumps @gol 4367-falign-loops -falign-labels @gol 4368-ftree-vrp @gol 4369-ftree-pre} 4370 4371Please note the warning under @option{-fgcse} about 4372invoking @option{-O2} on programs that use computed gotos. 4373 4374@option{-O2} doesn't turn on @option{-ftree-vrp} for the Ada compiler. 4375This option must be explicitly specified on the command line to be 4376enabled for the Ada compiler. 4377 4378@item -O3 4379@opindex O3 4380Optimize yet more. @option{-O3} turns on all optimizations specified by 4381@option{-O2} and also turns on the @option{-finline-functions}, 4382@option{-funswitch-loops} and @option{-fgcse-after-reload} options. 4383 4384@item -O0 4385@opindex O0 4386Do not optimize. This is the default. 4387 4388@item -Os 4389@opindex Os 4390Optimize for size. @option{-Os} enables all @option{-O2} optimizations that 4391do not typically increase code size. It also performs further 4392optimizations designed to reduce code size. 4393 4394@option{-Os} disables the following optimization flags: 4395@gccoptlist{-falign-functions -falign-jumps -falign-loops @gol 4396-falign-labels -freorder-blocks -freorder-blocks-and-partition @gol 4397-fprefetch-loop-arrays -ftree-vect-loop-version} 4398 4399If you use multiple @option{-O} options, with or without level numbers, 4400the last such option is the one that is effective. 4401@end table 4402 4403Options of the form @option{-f@var{flag}} specify machine-independent 4404flags. Most flags have both positive and negative forms; the negative 4405form of @option{-ffoo} would be @option{-fno-foo}. In the table 4406below, only one of the forms is listed---the one you typically will 4407use. You can figure out the other form by either removing @samp{no-} 4408or adding it. 4409 4410The following options control specific optimizations. They are either 4411activated by @option{-O} options or are related to ones that are. You 4412can use the following flags in the rare cases when ``fine-tuning'' of 4413optimizations to be performed is desired. 4414 4415@table @gcctabopt 4416@item -fno-default-inline 4417@opindex fno-default-inline 4418Do not make member functions inline by default merely because they are 4419defined inside the class scope (C++ only). Otherwise, when you specify 4420@w{@option{-O}}, member functions defined inside class scope are compiled 4421inline by default; i.e., you don't need to add @samp{inline} in front of 4422the member function name. 4423 4424@item -fno-defer-pop 4425@opindex fno-defer-pop 4426Always pop the arguments to each function call as soon as that function 4427returns. For machines which must pop arguments after a function call, 4428the compiler normally lets arguments accumulate on the stack for several 4429function calls and pops them all at once. 4430 4431Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4432 4433@item -fforce-mem 4434@opindex fforce-mem 4435Force memory operands to be copied into registers before doing 4436arithmetic on them. This produces better code by making all memory 4437references potential common subexpressions. When they are not common 4438subexpressions, instruction combination should eliminate the separate 4439register-load. This option is now a nop and will be removed in 4.3. 4440 4441@item -fforce-addr 4442@opindex fforce-addr 4443Force memory address constants to be copied into registers before 4444doing arithmetic on them. 4445 4446@item -fomit-frame-pointer 4447@opindex fomit-frame-pointer 4448Don't keep the frame pointer in a register for functions that 4449don't need one. This avoids the instructions to save, set up and 4450restore frame pointers; it also makes an extra register available 4451in many functions. @strong{It also makes debugging impossible on 4452some machines.} 4453 4454On some machines, such as the VAX, this flag has no effect, because 4455the standard calling sequence automatically handles the frame pointer 4456and nothing is saved by pretending it doesn't exist. The 4457machine-description macro @code{FRAME_POINTER_REQUIRED} controls 4458whether a target machine supports this flag. @xref{Registers,,Register 4459Usage, gccint, GNU Compiler Collection (GCC) Internals}. 4460 4461Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4462 4463@item -foptimize-sibling-calls 4464@opindex foptimize-sibling-calls 4465Optimize sibling and tail recursive calls. 4466 4467Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4468 4469@item -fno-inline 4470@opindex fno-inline 4471Don't pay attention to the @code{inline} keyword. Normally this option 4472is used to keep the compiler from expanding any functions inline. 4473Note that if you are not optimizing, no functions can be expanded inline. 4474 4475@item -finline-functions 4476@opindex finline-functions 4477Integrate all simple functions into their callers. The compiler 4478heuristically decides which functions are simple enough to be worth 4479integrating in this way. 4480 4481If all calls to a given function are integrated, and the function is 4482declared @code{static}, then the function is normally not output as 4483assembler code in its own right. 4484 4485Enabled at level @option{-O3}. 4486 4487@item -finline-functions-called-once 4488@opindex finline-functions-called-once 4489Consider all @code{static} functions called once for inlining into their 4490caller even if they are not marked @code{inline}. If a call to a given 4491function is integrated, then the function is not output as assembler code 4492in its own right. 4493 4494Enabled if @option{-funit-at-a-time} is enabled. 4495 4496@item -fearly-inlining 4497@opindex fearly-inlining 4498Inline functions marked by @code{always_inline} and functions whose body seems 4499smaller than the function call overhead early before doing 4500@option{-fprofile-generate} instrumentation and real inlining pass. Doing so 4501makes profiling significantly cheaper and usually inlining faster on programs 4502having large chains of nested wrapper functions. 4503 4504Enabled by default. 4505 4506@item -finline-limit=@var{n} 4507@opindex finline-limit 4508By default, GCC limits the size of functions that can be inlined. This flag 4509allows the control of this limit for functions that are explicitly marked as 4510inline (i.e., marked with the inline keyword or defined within the class 4511definition in c++). @var{n} is the size of functions that can be inlined in 4512number of pseudo instructions (not counting parameter handling). The default 4513value of @var{n} is 600. 4514Increasing this value can result in more inlined code at 4515the cost of compilation time and memory consumption. Decreasing usually makes 4516the compilation faster and less code will be inlined (which presumably 4517means slower programs). This option is particularly useful for programs that 4518use inlining heavily such as those based on recursive templates with C++. 4519 4520Inlining is actually controlled by a number of parameters, which may be 4521specified individually by using @option{--param @var{name}=@var{value}}. 4522The @option{-finline-limit=@var{n}} option sets some of these parameters 4523as follows: 4524 4525@table @gcctabopt 4526@item max-inline-insns-single 4527 is set to @var{n}/2. 4528@item max-inline-insns-auto 4529 is set to @var{n}/2. 4530@item min-inline-insns 4531 is set to 130 or @var{n}/4, whichever is smaller. 4532@item max-inline-insns-rtl 4533 is set to @var{n}. 4534@end table 4535 4536See below for a documentation of the individual 4537parameters controlling inlining. 4538 4539@emph{Note:} pseudo instruction represents, in this particular context, an 4540abstract measurement of function's size. In no way does it represent a count 4541of assembly instructions and as such its exact meaning might change from one 4542release to an another. 4543 4544@item -fkeep-inline-functions 4545@opindex fkeep-inline-functions 4546In C, emit @code{static} functions that are declared @code{inline} 4547into the object file, even if the function has been inlined into all 4548of its callers. This switch does not affect functions using the 4549@code{extern inline} extension in GNU C@. In C++, emit any and all 4550inline functions into the object file. 4551 4552@item -fkeep-static-consts 4553@opindex fkeep-static-consts 4554Emit variables declared @code{static const} when optimization isn't turned 4555on, even if the variables aren't referenced. 4556 4557GCC enables this option by default. If you want to force the compiler to 4558check if the variable was referenced, regardless of whether or not 4559optimization is turned on, use the @option{-fno-keep-static-consts} option. 4560 4561@item -fmerge-constants 4562Attempt to merge identical constants (string constants and floating point 4563constants) across compilation units. 4564 4565This option is the default for optimized compilation if the assembler and 4566linker support it. Use @option{-fno-merge-constants} to inhibit this 4567behavior. 4568 4569Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4570 4571@item -fmerge-all-constants 4572Attempt to merge identical constants and identical variables. 4573 4574This option implies @option{-fmerge-constants}. In addition to 4575@option{-fmerge-constants} this considers e.g.@: even constant initialized 4576arrays or initialized constant variables with integral or floating point 4577types. Languages like C or C++ require each non-automatic variable to 4578have distinct location, so using this option will result in non-conforming 4579behavior. 4580 4581@item -fmodulo-sched 4582@opindex fmodulo-sched 4583Perform swing modulo scheduling immediately before the first scheduling 4584pass. This pass looks at innermost loops and reorders their 4585instructions by overlapping different iterations. 4586 4587@item -fno-branch-count-reg 4588@opindex fno-branch-count-reg 4589Do not use ``decrement and branch'' instructions on a count register, 4590but instead generate a sequence of instructions that decrement a 4591register, compare it against zero, then branch based upon the result. 4592This option is only meaningful on architectures that support such 4593instructions, which include x86, PowerPC, IA-64 and S/390. 4594 4595The default is @option{-fbranch-count-reg}. 4596 4597@item -fno-function-cse 4598@opindex fno-function-cse 4599Do not put function addresses in registers; make each instruction that 4600calls a constant function contain the function's address explicitly. 4601 4602This option results in less efficient code, but some strange hacks 4603that alter the assembler output may be confused by the optimizations 4604performed when this option is not used. 4605 4606The default is @option{-ffunction-cse} 4607 4608@item -fno-zero-initialized-in-bss 4609@opindex fno-zero-initialized-in-bss 4610If the target supports a BSS section, GCC by default puts variables that 4611are initialized to zero into BSS@. This can save space in the resulting 4612code. 4613 4614This option turns off this behavior because some programs explicitly 4615rely on variables going to the data section. E.g., so that the 4616resulting executable can find the beginning of that section and/or make 4617assumptions based on that. 4618 4619The default is @option{-fzero-initialized-in-bss}. 4620 4621@item -fbounds-check 4622@opindex fbounds-check 4623For front-ends that support it, generate additional code to check that 4624indices used to access arrays are within the declared range. This is 4625currently only supported by the Java and Fortran front-ends, where 4626this option defaults to true and false respectively. 4627 4628@item -fmudflap -fmudflapth -fmudflapir 4629@opindex fmudflap 4630@opindex fmudflapth 4631@opindex fmudflapir 4632@cindex bounds checking 4633@cindex mudflap 4634For front-ends that support it (C and C++), instrument all risky 4635pointer/array dereferencing operations, some standard library 4636string/heap functions, and some other associated constructs with 4637range/validity tests. Modules so instrumented should be immune to 4638buffer overflows, invalid heap use, and some other classes of C/C++ 4639programming errors. The instrumentation relies on a separate runtime 4640library (@file{libmudflap}), which will be linked into a program if 4641@option{-fmudflap} is given at link time. Run-time behavior of the 4642instrumented program is controlled by the @env{MUDFLAP_OPTIONS} 4643environment variable. See @code{env MUDFLAP_OPTIONS=-help a.out} 4644for its options. 4645 4646Use @option{-fmudflapth} instead of @option{-fmudflap} to compile and to 4647link if your program is multi-threaded. Use @option{-fmudflapir}, in 4648addition to @option{-fmudflap} or @option{-fmudflapth}, if 4649instrumentation should ignore pointer reads. This produces less 4650instrumentation (and therefore faster execution) and still provides 4651some protection against outright memory corrupting writes, but allows 4652erroneously read data to propagate within a program. 4653 4654@item -fthread-jumps 4655@opindex fthread-jumps 4656Perform optimizations where we check to see if a jump branches to a 4657location where another comparison subsumed by the first is found. If 4658so, the first branch is redirected to either the destination of the 4659second branch or a point immediately following it, depending on whether 4660the condition is known to be true or false. 4661 4662Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4663 4664@item -fcse-follow-jumps 4665@opindex fcse-follow-jumps 4666In common subexpression elimination, scan through jump instructions 4667when the target of the jump is not reached by any other path. For 4668example, when CSE encounters an @code{if} statement with an 4669@code{else} clause, CSE will follow the jump when the condition 4670tested is false. 4671 4672Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4673 4674@item -fcse-skip-blocks 4675@opindex fcse-skip-blocks 4676This is similar to @option{-fcse-follow-jumps}, but causes CSE to 4677follow jumps which conditionally skip over blocks. When CSE 4678encounters a simple @code{if} statement with no else clause, 4679@option{-fcse-skip-blocks} causes CSE to follow the jump around the 4680body of the @code{if}. 4681 4682Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4683 4684@item -frerun-cse-after-loop 4685@opindex frerun-cse-after-loop 4686Re-run common subexpression elimination after loop optimizations has been 4687performed. 4688 4689Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4690 4691@item -fgcse 4692@opindex fgcse 4693Perform a global common subexpression elimination pass. 4694This pass also performs global constant and copy propagation. 4695 4696@emph{Note:} When compiling a program using computed gotos, a GCC 4697extension, you may get better runtime performance if you disable 4698the global common subexpression elimination pass by adding 4699@option{-fno-gcse} to the command line. 4700 4701Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4702 4703@item -fgcse-lm 4704@opindex fgcse-lm 4705When @option{-fgcse-lm} is enabled, global common subexpression elimination will 4706attempt to move loads which are only killed by stores into themselves. This 4707allows a loop containing a load/store sequence to be changed to a load outside 4708the loop, and a copy/store within the loop. 4709 4710Enabled by default when gcse is enabled. 4711 4712@item -fgcse-sm 4713@opindex fgcse-sm 4714When @option{-fgcse-sm} is enabled, a store motion pass is run after 4715global common subexpression elimination. This pass will attempt to move 4716stores out of loops. When used in conjunction with @option{-fgcse-lm}, 4717loops containing a load/store sequence can be changed to a load before 4718the loop and a store after the loop. 4719 4720Not enabled at any optimization level. 4721 4722@item -fgcse-las 4723@opindex fgcse-las 4724When @option{-fgcse-las} is enabled, the global common subexpression 4725elimination pass eliminates redundant loads that come after stores to the 4726same memory location (both partial and full redundancies). 4727 4728Not enabled at any optimization level. 4729 4730@item -fgcse-after-reload 4731@opindex fgcse-after-reload 4732When @option{-fgcse-after-reload} is enabled, a redundant load elimination 4733pass is performed after reload. The purpose of this pass is to cleanup 4734redundant spilling. 4735 4736@item -funsafe-loop-optimizations 4737@opindex funsafe-loop-optimizations 4738If given, the loop optimizer will assume that loop indices do not 4739overflow, and that the loops with nontrivial exit condition are not 4740infinite. This enables a wider range of loop optimizations even if 4741the loop optimizer itself cannot prove that these assumptions are valid. 4742Using @option{-Wunsafe-loop-optimizations}, the compiler will warn you 4743if it finds this kind of loop. 4744 4745@item -fcrossjumping 4746@opindex crossjumping 4747Perform cross-jumping transformation. This transformation unifies equivalent code and save code size. The 4748resulting code may or may not perform better than without cross-jumping. 4749 4750Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4751 4752@item -fif-conversion 4753@opindex if-conversion 4754Attempt to transform conditional jumps into branch-less equivalents. This 4755include use of conditional moves, min, max, set flags and abs instructions, and 4756some tricks doable by standard arithmetics. The use of conditional execution 4757on chips where it is available is controlled by @code{if-conversion2}. 4758 4759Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4760 4761@item -fif-conversion2 4762@opindex if-conversion2 4763Use conditional execution (where available) to transform conditional jumps into 4764branch-less equivalents. 4765 4766Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4767 4768@item -fdelete-null-pointer-checks 4769@opindex fdelete-null-pointer-checks 4770Use global dataflow analysis to identify and eliminate useless checks 4771for null pointers. The compiler assumes that dereferencing a null 4772pointer would have halted the program. If a pointer is checked after 4773it has already been dereferenced, it cannot be null. 4774 4775In some environments, this assumption is not true, and programs can 4776safely dereference null pointers. Use 4777@option{-fno-delete-null-pointer-checks} to disable this optimization 4778for programs which depend on that behavior. 4779 4780Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4781 4782@item -fexpensive-optimizations 4783@opindex fexpensive-optimizations 4784Perform a number of minor optimizations that are relatively expensive. 4785 4786Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4787 4788@item -foptimize-register-move 4789@itemx -fregmove 4790@opindex foptimize-register-move 4791@opindex fregmove 4792Attempt to reassign register numbers in move instructions and as 4793operands of other simple instructions in order to maximize the amount of 4794register tying. This is especially helpful on machines with two-operand 4795instructions. 4796 4797Note @option{-fregmove} and @option{-foptimize-register-move} are the same 4798optimization. 4799 4800Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4801 4802@item -fdelayed-branch 4803@opindex fdelayed-branch 4804If supported for the target machine, attempt to reorder instructions 4805to exploit instruction slots available after delayed branch 4806instructions. 4807 4808Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4809 4810@item -fschedule-insns 4811@opindex fschedule-insns 4812If supported for the target machine, attempt to reorder instructions to 4813eliminate execution stalls due to required data being unavailable. This 4814helps machines that have slow floating point or memory load instructions 4815by allowing other instructions to be issued until the result of the load 4816or floating point instruction is required. 4817 4818Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4819 4820@item -fschedule-insns2 4821@opindex fschedule-insns2 4822Similar to @option{-fschedule-insns}, but requests an additional pass of 4823instruction scheduling after register allocation has been done. This is 4824especially useful on machines with a relatively small number of 4825registers and where memory load instructions take more than one cycle. 4826 4827Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4828 4829@item -fno-sched-interblock 4830@opindex fno-sched-interblock 4831Don't schedule instructions across basic blocks. This is normally 4832enabled by default when scheduling before register allocation, i.e.@: 4833with @option{-fschedule-insns} or at @option{-O2} or higher. 4834 4835@item -fno-sched-spec 4836@opindex fno-sched-spec 4837Don't allow speculative motion of non-load instructions. This is normally 4838enabled by default when scheduling before register allocation, i.e.@: 4839with @option{-fschedule-insns} or at @option{-O2} or higher. 4840 4841@item -fsched-spec-load 4842@opindex fsched-spec-load 4843Allow speculative motion of some load instructions. This only makes 4844sense when scheduling before register allocation, i.e.@: with 4845@option{-fschedule-insns} or at @option{-O2} or higher. 4846 4847@item -fsched-spec-load-dangerous 4848@opindex fsched-spec-load-dangerous 4849Allow speculative motion of more load instructions. This only makes 4850sense when scheduling before register allocation, i.e.@: with 4851@option{-fschedule-insns} or at @option{-O2} or higher. 4852 4853@item -fsched-stalled-insns=@var{n} 4854@opindex fsched-stalled-insns 4855Define how many insns (if any) can be moved prematurely from the queue 4856of stalled insns into the ready list, during the second scheduling pass. 4857 4858@item -fsched-stalled-insns-dep=@var{n} 4859@opindex fsched-stalled-insns-dep 4860Define how many insn groups (cycles) will be examined for a dependency 4861on a stalled insn that is candidate for premature removal from the queue 4862of stalled insns. Has an effect only during the second scheduling pass, 4863and only if @option{-fsched-stalled-insns} is used and its value is not zero. 4864 4865@item -fsched2-use-superblocks 4866@opindex fsched2-use-superblocks 4867When scheduling after register allocation, do use superblock scheduling 4868algorithm. Superblock scheduling allows motion across basic block boundaries 4869resulting on faster schedules. This option is experimental, as not all machine 4870descriptions used by GCC model the CPU closely enough to avoid unreliable 4871results from the algorithm. 4872 4873This only makes sense when scheduling after register allocation, i.e.@: with 4874@option{-fschedule-insns2} or at @option{-O2} or higher. 4875 4876@item -fsched2-use-traces 4877@opindex fsched2-use-traces 4878Use @option{-fsched2-use-superblocks} algorithm when scheduling after register 4879allocation and additionally perform code duplication in order to increase the 4880size of superblocks using tracer pass. See @option{-ftracer} for details on 4881trace formation. 4882 4883This mode should produce faster but significantly longer programs. Also 4884without @option{-fbranch-probabilities} the traces constructed may not 4885match the reality and hurt the performance. This only makes 4886sense when scheduling after register allocation, i.e.@: with 4887@option{-fschedule-insns2} or at @option{-O2} or higher. 4888 4889@item -fsee 4890@opindex fsee 4891Eliminates redundant extension instructions and move the non redundant 4892ones to optimal placement using LCM. 4893 4894@item -freschedule-modulo-scheduled-loops 4895@opindex fscheduling-in-modulo-scheduled-loops 4896The modulo scheduling comes before the traditional scheduling, if a loop was modulo scheduled 4897we may want to prevent the later scheduling passes from changing its schedule, we use this 4898option to control that. 4899 4900@item -fcaller-saves 4901@opindex fcaller-saves 4902Enable values to be allocated in registers that will be clobbered by 4903function calls, by emitting extra instructions to save and restore the 4904registers around such calls. Such allocation is done only when it 4905seems to result in better code than would otherwise be produced. 4906 4907This option is always enabled by default on certain machines, usually 4908those which have no call-preserved registers to use instead. 4909 4910Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4911 4912@item -ftree-pre 4913Perform Partial Redundancy Elimination (PRE) on trees. This flag is 4914enabled by default at @option{-O2} and @option{-O3}. 4915 4916@item -ftree-fre 4917Perform Full Redundancy Elimination (FRE) on trees. The difference 4918between FRE and PRE is that FRE only considers expressions 4919that are computed on all paths leading to the redundant computation. 4920This analysis faster than PRE, though it exposes fewer redundancies. 4921This flag is enabled by default at @option{-O} and higher. 4922 4923@item -ftree-copy-prop 4924Perform copy propagation on trees. This pass eliminates unnecessary 4925copy operations. This flag is enabled by default at @option{-O} and 4926higher. 4927 4928@item -ftree-store-copy-prop 4929Perform copy propagation of memory loads and stores. This pass 4930eliminates unnecessary copy operations in memory references 4931(structures, global variables, arrays, etc). This flag is enabled by 4932default at @option{-O2} and higher. 4933 4934@item -ftree-salias 4935Perform structural alias analysis on trees. This flag 4936is enabled by default at @option{-O} and higher. 4937 4938@item -fipa-pta 4939Perform interprocedural pointer analysis. 4940 4941@item -ftree-sink 4942Perform forward store motion on trees. This flag is 4943enabled by default at @option{-O} and higher. 4944 4945@item -ftree-ccp 4946Perform sparse conditional constant propagation (CCP) on trees. This 4947pass only operates on local scalar variables and is enabled by default 4948at @option{-O} and higher. 4949 4950@item -ftree-store-ccp 4951Perform sparse conditional constant propagation (CCP) on trees. This 4952pass operates on both local scalar variables and memory stores and 4953loads (global variables, structures, arrays, etc). This flag is 4954enabled by default at @option{-O2} and higher. 4955 4956@item -ftree-dce 4957Perform dead code elimination (DCE) on trees. This flag is enabled by 4958default at @option{-O} and higher. 4959 4960@item -ftree-dominator-opts 4961Perform a variety of simple scalar cleanups (constant/copy 4962propagation, redundancy elimination, range propagation and expression 4963simplification) based on a dominator tree traversal. This also 4964performs jump threading (to reduce jumps to jumps). This flag is 4965enabled by default at @option{-O} and higher. 4966 4967@item -ftree-ch 4968Perform loop header copying on trees. This is beneficial since it increases 4969effectiveness of code motion optimizations. It also saves one jump. This flag 4970is enabled by default at @option{-O} and higher. It is not enabled 4971for @option{-Os}, since it usually increases code size. 4972 4973@item -ftree-loop-optimize 4974Perform loop optimizations on trees. This flag is enabled by default 4975at @option{-O} and higher. 4976 4977@item -ftree-loop-linear 4978Perform linear loop transformations on tree. This flag can improve cache 4979performance and allow further loop optimizations to take place. 4980 4981@item -ftree-loop-im 4982Perform loop invariant motion on trees. This pass moves only invariants that 4983would be hard to handle at RTL level (function calls, operations that expand to 4984nontrivial sequences of insns). With @option{-funswitch-loops} it also moves 4985operands of conditions that are invariant out of the loop, so that we can use 4986just trivial invariantness analysis in loop unswitching. The pass also includes 4987store motion. 4988 4989@item -ftree-loop-ivcanon 4990Create a canonical counter for number of iterations in the loop for that 4991determining number of iterations requires complicated analysis. Later 4992optimizations then may determine the number easily. Useful especially 4993in connection with unrolling. 4994 4995@item -fivopts 4996Perform induction variable optimizations (strength reduction, induction 4997variable merging and induction variable elimination) on trees. 4998 4999@item -ftree-sra 5000Perform scalar replacement of aggregates. This pass replaces structure 5001references with scalars to prevent committing structures to memory too 5002early. This flag is enabled by default at @option{-O} and higher. 5003 5004@item -ftree-copyrename 5005Perform copy renaming on trees. This pass attempts to rename compiler 5006temporaries to other variables at copy locations, usually resulting in 5007variable names which more closely resemble the original variables. This flag 5008is enabled by default at @option{-O} and higher. 5009 5010@item -ftree-ter 5011Perform temporary expression replacement during the SSA->normal phase. Single 5012use/single def temporaries are replaced at their use location with their 5013defining expression. This results in non-GIMPLE code, but gives the expanders 5014much more complex trees to work on resulting in better RTL generation. This is 5015enabled by default at @option{-O} and higher. 5016 5017@item -ftree-lrs 5018Perform live range splitting during the SSA->normal phase. Distinct live 5019ranges of a variable are split into unique variables, allowing for better 5020optimization later. This is enabled by default at @option{-O} and higher. 5021 5022@item -ftree-vectorize 5023Perform loop vectorization on trees. 5024 5025@item -ftree-vect-loop-version 5026@opindex ftree-vect-loop-version 5027Perform loop versioning when doing loop vectorization on trees. When a loop 5028appears to be vectorizable except that data alignment or data dependence cannot 5029be determined at compile time then vectorized and non-vectorized versions of 5030the loop are generated along with runtime checks for alignment or dependence 5031to control which version is executed. This option is enabled by default 5032except at level @option{-Os} where it is disabled. 5033 5034@item -ftree-vrp 5035Perform Value Range Propagation on trees. This is similar to the 5036constant propagation pass, but instead of values, ranges of values are 5037propagated. This allows the optimizers to remove unnecessary range 5038checks like array bound checks and null pointer checks. This is 5039enabled by default at @option{-O2} and higher. Null pointer check 5040elimination is only done if @option{-fdelete-null-pointer-checks} is 5041enabled. 5042 5043@item -ftracer 5044@opindex ftracer 5045Perform tail duplication to enlarge superblock size. This transformation 5046simplifies the control flow of the function allowing other optimizations to do 5047better job. 5048 5049@item -funroll-loops 5050@opindex funroll-loops 5051Unroll loops whose number of iterations can be determined at compile 5052time or upon entry to the loop. @option{-funroll-loops} implies 5053@option{-frerun-cse-after-loop}. This option makes code larger, 5054and may or may not make it run faster. 5055 5056@item -funroll-all-loops 5057@opindex funroll-all-loops 5058Unroll all loops, even if their number of iterations is uncertain when 5059the loop is entered. This usually makes programs run more slowly. 5060@option{-funroll-all-loops} implies the same options as 5061@option{-funroll-loops}, 5062 5063@item -fsplit-ivs-in-unroller 5064@opindex fsplit-ivs-in-unroller 5065Enables expressing of values of induction variables in later iterations 5066of the unrolled loop using the value in the first iteration. This breaks 5067long dependency chains, thus improving efficiency of the scheduling passes. 5068 5069Combination of @option{-fweb} and CSE is often sufficient to obtain the 5070same effect. However in cases the loop body is more complicated than 5071a single basic block, this is not reliable. It also does not work at all 5072on some of the architectures due to restrictions in the CSE pass. 5073 5074This optimization is enabled by default. 5075 5076@item -fvariable-expansion-in-unroller 5077@opindex fvariable-expansion-in-unroller 5078With this option, the compiler will create multiple copies of some 5079local variables when unrolling a loop which can result in superior code. 5080 5081@item -fprefetch-loop-arrays 5082@opindex fprefetch-loop-arrays 5083If supported by the target machine, generate instructions to prefetch 5084memory to improve the performance of loops that access large arrays. 5085 5086This option may generate better or worse code; results are highly 5087dependent on the structure of loops within the source code. 5088 5089Disabled at level @option{-Os}. 5090 5091@item -fno-peephole 5092@itemx -fno-peephole2 5093@opindex fno-peephole 5094@opindex fno-peephole2 5095Disable any machine-specific peephole optimizations. The difference 5096between @option{-fno-peephole} and @option{-fno-peephole2} is in how they 5097are implemented in the compiler; some targets use one, some use the 5098other, a few use both. 5099 5100@option{-fpeephole} is enabled by default. 5101@option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 5102 5103@item -fno-guess-branch-probability 5104@opindex fno-guess-branch-probability 5105Do not guess branch probabilities using heuristics. 5106 5107GCC will use heuristics to guess branch probabilities if they are 5108not provided by profiling feedback (@option{-fprofile-arcs}). These 5109heuristics are based on the control flow graph. If some branch probabilities 5110are specified by @samp{__builtin_expect}, then the heuristics will be 5111used to guess branch probabilities for the rest of the control flow graph, 5112taking the @samp{__builtin_expect} info into account. The interactions 5113between the heuristics and @samp{__builtin_expect} can be complex, and in 5114some cases, it may be useful to disable the heuristics so that the effects 5115of @samp{__builtin_expect} are easier to understand. 5116 5117The default is @option{-fguess-branch-probability} at levels 5118@option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 5119 5120@item -freorder-blocks 5121@opindex freorder-blocks 5122Reorder basic blocks in the compiled function in order to reduce number of 5123taken branches and improve code locality. 5124 5125Enabled at levels @option{-O2}, @option{-O3}. 5126 5127@item -freorder-blocks-and-partition 5128@opindex freorder-blocks-and-partition 5129In addition to reordering basic blocks in the compiled function, in order 5130to reduce number of taken branches, partitions hot and cold basic blocks 5131into separate sections of the assembly and .o files, to improve 5132paging and cache locality performance. 5133 5134This optimization is automatically turned off in the presence of 5135exception handling, for linkonce sections, for functions with a user-defined 5136section attribute and on any architecture that does not support named 5137sections. 5138 5139@item -freorder-functions 5140@opindex freorder-functions 5141Reorder functions in the object file in order to 5142improve code locality. This is implemented by using special 5143subsections @code{.text.hot} for most frequently executed functions and 5144@code{.text.unlikely} for unlikely executed functions. Reordering is done by 5145the linker so object file format must support named sections and linker must 5146place them in a reasonable way. 5147 5148Also profile feedback must be available in to make this option effective. See 5149@option{-fprofile-arcs} for details. 5150 5151Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 5152 5153@item -fstrict-aliasing 5154@opindex fstrict-aliasing 5155Allows the compiler to assume the strictest aliasing rules applicable to 5156the language being compiled. For C (and C++), this activates 5157optimizations based on the type of expressions. In particular, an 5158object of one type is assumed never to reside at the same address as an 5159object of a different type, unless the types are almost the same. For 5160example, an @code{unsigned int} can alias an @code{int}, but not a 5161@code{void*} or a @code{double}. A character type may alias any other 5162type. 5163 5164Pay special attention to code like this: 5165@smallexample 5166union a_union @{ 5167 int i; 5168 double d; 5169@}; 5170 5171int f() @{ 5172 a_union t; 5173 t.d = 3.0; 5174 return t.i; 5175@} 5176@end smallexample 5177The practice of reading from a different union member than the one most 5178recently written to (called ``type-punning'') is common. Even with 5179@option{-fstrict-aliasing}, type-punning is allowed, provided the memory 5180is accessed through the union type. So, the code above will work as 5181expected. However, this code might not: 5182@smallexample 5183int f() @{ 5184 a_union t; 5185 int* ip; 5186 t.d = 3.0; 5187 ip = &t.i; 5188 return *ip; 5189@} 5190@end smallexample 5191 5192Every language that wishes to perform language-specific alias analysis 5193should define a function that computes, given an @code{tree} 5194node, an alias set for the node. Nodes in different alias sets are not 5195allowed to alias. For an example, see the C front-end function 5196@code{c_get_alias_set}. 5197 5198Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 5199 5200@item -fstrict-overflow 5201@opindex fstrict-overflow 5202Allow the compiler to assume strict signed overflow rules, depending 5203on the language being compiled. For C (and C++) this means that 5204overflow when doing arithmetic with signed numbers is undefined, which 5205means that the compiler may assume that it will not happen. This 5206permits various optimizations. For example, the compiler will assume 5207that an expression like @code{i + 10 > i} will always be true for 5208signed @code{i}. This assumption is only valid if signed overflow is 5209undefined, as the expression is false if @code{i + 10} overflows when 5210using twos complement arithmetic. When this option is in effect any 5211attempt to determine whether an operation on signed numbers will 5212overflow must be written carefully to not actually involve overflow. 5213 5214See also the @option{-fwrapv} option. Using @option{-fwrapv} means 5215that signed overflow is fully defined: it wraps. When 5216@option{-fwrapv} is used, there is no difference between 5217@option{-fstrict-overflow} and @option{-fno-strict-overflow}. With 5218@option{-fwrapv} certain types of overflow are permitted. For 5219example, if the compiler gets an overflow when doing arithmetic on 5220constants, the overflowed value can still be used with 5221@option{-fwrapv}, but not otherwise. 5222 5223The @option{-fstrict-overflow} option is enabled at levels 5224@option{-O2}, @option{-O3}, @option{-Os}. 5225 5226@item -falign-functions 5227@itemx -falign-functions=@var{n} 5228@opindex falign-functions 5229Align the start of functions to the next power-of-two greater than 5230@var{n}, skipping up to @var{n} bytes. For instance, 5231@option{-falign-functions=32} aligns functions to the next 32-byte 5232boundary, but @option{-falign-functions=24} would align to the next 523332-byte boundary only if this can be done by skipping 23 bytes or less. 5234 5235@option{-fno-align-functions} and @option{-falign-functions=1} are 5236equivalent and mean that functions will not be aligned. 5237 5238Some assemblers only support this flag when @var{n} is a power of two; 5239in that case, it is rounded up. 5240 5241If @var{n} is not specified or is zero, use a machine-dependent default. 5242 5243Enabled at levels @option{-O2}, @option{-O3}. 5244 5245@item -falign-labels 5246@itemx -falign-labels=@var{n} 5247@opindex falign-labels 5248Align all branch targets to a power-of-two boundary, skipping up to 5249@var{n} bytes like @option{-falign-functions}. This option can easily 5250make code slower, because it must insert dummy operations for when the 5251branch target is reached in the usual flow of the code. 5252 5253@option{-fno-align-labels} and @option{-falign-labels=1} are 5254equivalent and mean that labels will not be aligned. 5255 5256If @option{-falign-loops} or @option{-falign-jumps} are applicable and 5257are greater than this value, then their values are used instead. 5258 5259If @var{n} is not specified or is zero, use a machine-dependent default 5260which is very likely to be @samp{1}, meaning no alignment. 5261 5262Enabled at levels @option{-O2}, @option{-O3}. 5263 5264@item -falign-loops 5265@itemx -falign-loops=@var{n} 5266@opindex falign-loops 5267Align loops to a power-of-two boundary, skipping up to @var{n} bytes 5268like @option{-falign-functions}. The hope is that the loop will be 5269executed many times, which will make up for any execution of the dummy 5270operations. 5271 5272@option{-fno-align-loops} and @option{-falign-loops=1} are 5273equivalent and mean that loops will not be aligned. 5274 5275If @var{n} is not specified or is zero, use a machine-dependent default. 5276 5277Enabled at levels @option{-O2}, @option{-O3}. 5278 5279@item -falign-jumps 5280@itemx -falign-jumps=@var{n} 5281@opindex falign-jumps 5282Align branch targets to a power-of-two boundary, for branch targets 5283where the targets can only be reached by jumping, skipping up to @var{n} 5284bytes like @option{-falign-functions}. In this case, no dummy operations 5285need be executed. 5286 5287@option{-fno-align-jumps} and @option{-falign-jumps=1} are 5288equivalent and mean that loops will not be aligned. 5289 5290If @var{n} is not specified or is zero, use a machine-dependent default. 5291 5292Enabled at levels @option{-O2}, @option{-O3}. 5293 5294@item -funit-at-a-time 5295@opindex funit-at-a-time 5296Parse the whole compilation unit before starting to produce code. 5297This allows some extra optimizations to take place but consumes 5298more memory (in general). There are some compatibility issues 5299with @emph{unit-at-a-time} mode: 5300@itemize @bullet 5301@item 5302enabling @emph{unit-at-a-time} mode may change the order 5303in which functions, variables, and top-level @code{asm} statements 5304are emitted, and will likely break code relying on some particular 5305ordering. The majority of such top-level @code{asm} statements, 5306though, can be replaced by @code{section} attributes. The 5307@option{fno-toplevel-reorder} option may be used to keep the ordering 5308used in the input file, at the cost of some optimizations. 5309 5310@item 5311@emph{unit-at-a-time} mode removes unreferenced static variables 5312and functions. This may result in undefined references 5313when an @code{asm} statement refers directly to variables or functions 5314that are otherwise unused. In that case either the variable/function 5315shall be listed as an operand of the @code{asm} statement operand or, 5316in the case of top-level @code{asm} statements the attribute @code{used} 5317shall be used on the declaration. 5318 5319@item 5320Static functions now can use non-standard passing conventions that 5321may break @code{asm} statements calling functions directly. Again, 5322attribute @code{used} will prevent this behavior. 5323@end itemize 5324 5325As a temporary workaround, @option{-fno-unit-at-a-time} can be used, 5326but this scheme may not be supported by future releases of GCC@. 5327 5328Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 5329 5330@item -fno-toplevel-reorder 5331Do not reorder top-level functions, variables, and @code{asm} 5332statements. Output them in the same order that they appear in the 5333input file. When this option is used, unreferenced static variables 5334will not be removed. This option is intended to support existing code 5335which relies on a particular ordering. For new code, it is better to 5336use attributes. 5337 5338@item -fweb 5339@opindex fweb 5340Constructs webs as commonly used for register allocation purposes and assign 5341each web individual pseudo register. This allows the register allocation pass 5342to operate on pseudos directly, but also strengthens several other optimization 5343passes, such as CSE, loop optimizer and trivial dead code remover. It can, 5344however, make debugging impossible, since variables will no longer stay in a 5345``home register''. 5346 5347Enabled by default with @option{-funroll-loops}. 5348 5349@item -fwhole-program 5350@opindex fwhole-program 5351Assume that the current compilation unit represents whole program being 5352compiled. All public functions and variables with the exception of @code{main} 5353and those merged by attribute @code{externally_visible} become static functions 5354and in a affect gets more aggressively optimized by interprocedural optimizers. 5355While this option is equivalent to proper use of @code{static} keyword for 5356programs consisting of single file, in combination with option 5357@option{--combine} this flag can be used to compile most of smaller scale C 5358programs since the functions and variables become local for the whole combined 5359compilation unit, not for the single source file itself. 5360 5361 5362@item -fno-cprop-registers 5363@opindex fno-cprop-registers 5364After register allocation and post-register allocation instruction splitting, 5365we perform a copy-propagation pass to try to reduce scheduling dependencies 5366and occasionally eliminate the copy. 5367 5368Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 5369 5370@item -fprofile-generate 5371@opindex fprofile-generate 5372 5373Enable options usually used for instrumenting application to produce 5374profile useful for later recompilation with profile feedback based 5375optimization. You must use @option{-fprofile-generate} both when 5376compiling and when linking your program. 5377 5378The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}. 5379 5380@item -fprofile-use 5381@opindex fprofile-use 5382Enable profile feedback directed optimizations, and optimizations 5383generally profitable only with profile feedback available. 5384 5385The following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt}, 5386@code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer} 5387 5388@end table 5389 5390The following options control compiler behavior regarding floating 5391point arithmetic. These options trade off between speed and 5392correctness. All must be specifically enabled. 5393 5394@table @gcctabopt 5395@item -ffloat-store 5396@opindex ffloat-store 5397Do not store floating point variables in registers, and inhibit other 5398options that might change whether a floating point value is taken from a 5399register or memory. 5400 5401@cindex floating point precision 5402This option prevents undesirable excess precision on machines such as 5403the 68000 where the floating registers (of the 68881) keep more 5404precision than a @code{double} is supposed to have. Similarly for the 5405x86 architecture. For most programs, the excess precision does only 5406good, but a few programs rely on the precise definition of IEEE floating 5407point. Use @option{-ffloat-store} for such programs, after modifying 5408them to store all pertinent intermediate computations into variables. 5409 5410@item -ffast-math 5411@opindex ffast-math 5412Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, @* 5413@option{-fno-trapping-math}, @option{-ffinite-math-only}, 5414@option{-fno-rounding-math}, @option{-fno-signaling-nans} 5415and @option{fcx-limited-range}. 5416 5417This option causes the preprocessor macro @code{__FAST_MATH__} to be defined. 5418 5419This option should never be turned on by any @option{-O} option since 5420it can result in incorrect output for programs which depend on 5421an exact implementation of IEEE or ISO rules/specifications for 5422math functions. 5423 5424@item -fno-math-errno 5425@opindex fno-math-errno 5426Do not set ERRNO after calling math functions that are executed 5427with a single instruction, e.g., sqrt. A program that relies on 5428IEEE exceptions for math error handling may want to use this flag 5429for speed while maintaining IEEE arithmetic compatibility. 5430 5431This option should never be turned on by any @option{-O} option since 5432it can result in incorrect output for programs which depend on 5433an exact implementation of IEEE or ISO rules/specifications for 5434math functions. 5435 5436The default is @option{-fmath-errno}. 5437 5438On Darwin and FreeBSD systems, the math library never sets @code{errno}. 5439There is therefore 5440no reason for the compiler to consider the possibility that it might, 5441and @option{-fno-math-errno} is the default. 5442 5443@item -funsafe-math-optimizations 5444@opindex funsafe-math-optimizations 5445Allow optimizations for floating-point arithmetic that (a) assume 5446that arguments and results are valid and (b) may violate IEEE or 5447ANSI standards. When used at link-time, it may include libraries 5448or startup files that change the default FPU control word or other 5449similar optimizations. 5450 5451This option should never be turned on by any @option{-O} option since 5452it can result in incorrect output for programs which depend on 5453an exact implementation of IEEE or ISO rules/specifications for 5454math functions. 5455 5456The default is @option{-fno-unsafe-math-optimizations}. 5457 5458@item -ffinite-math-only 5459@opindex ffinite-math-only 5460Allow optimizations for floating-point arithmetic that assume 5461that arguments and results are not NaNs or +-Infs. 5462 5463This option should never be turned on by any @option{-O} option since 5464it can result in incorrect output for programs which depend on 5465an exact implementation of IEEE or ISO rules/specifications. 5466 5467The default is @option{-fno-finite-math-only}. 5468 5469@item -fno-trapping-math 5470@opindex fno-trapping-math 5471Compile code assuming that floating-point operations cannot generate 5472user-visible traps. These traps include division by zero, overflow, 5473underflow, inexact result and invalid operation. This option implies 5474@option{-fno-signaling-nans}. Setting this option may allow faster 5475code if one relies on ``non-stop'' IEEE arithmetic, for example. 5476 5477This option should never be turned on by any @option{-O} option since 5478it can result in incorrect output for programs which depend on 5479an exact implementation of IEEE or ISO rules/specifications for 5480math functions. 5481 5482The default is @option{-ftrapping-math}. 5483 5484@item -frounding-math 5485@opindex frounding-math 5486Disable transformations and optimizations that assume default floating 5487point rounding behavior. This is round-to-zero for all floating point 5488to integer conversions, and round-to-nearest for all other arithmetic 5489truncations. This option should be specified for programs that change 5490the FP rounding mode dynamically, or that may be executed with a 5491non-default rounding mode. This option disables constant folding of 5492floating point expressions at compile-time (which may be affected by 5493rounding mode) and arithmetic transformations that are unsafe in the 5494presence of sign-dependent rounding modes. 5495 5496The default is @option{-fno-rounding-math}. 5497 5498This option is experimental and does not currently guarantee to 5499disable all GCC optimizations that are affected by rounding mode. 5500Future versions of GCC may provide finer control of this setting 5501using C99's @code{FENV_ACCESS} pragma. This command line option 5502will be used to specify the default state for @code{FENV_ACCESS}. 5503 5504@item -frtl-abstract-sequences 5505@opindex frtl-abstract-sequences 5506It is a size optimization method. This option is to find identical 5507sequences of code, which can be turned into pseudo-procedures and 5508then replace all occurrences with calls to the newly created 5509subroutine. It is kind of an opposite of @option{-finline-functions}. 5510This optimization runs at RTL level. 5511 5512@item -fsignaling-nans 5513@opindex fsignaling-nans 5514Compile code assuming that IEEE signaling NaNs may generate user-visible 5515traps during floating-point operations. Setting this option disables 5516optimizations that may change the number of exceptions visible with 5517signaling NaNs. This option implies @option{-ftrapping-math}. 5518 5519This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to 5520be defined. 5521 5522The default is @option{-fno-signaling-nans}. 5523 5524This option is experimental and does not currently guarantee to 5525disable all GCC optimizations that affect signaling NaN behavior. 5526 5527@item -fsingle-precision-constant 5528@opindex fsingle-precision-constant 5529Treat floating point constant as single precision constant instead of 5530implicitly converting it to double precision constant. 5531 5532@item -fcx-limited-range 5533@itemx -fno-cx-limited-range 5534@opindex fcx-limited-range 5535@opindex fno-cx-limited-range 5536When enabled, this option states that a range reduction step is not 5537needed when performing complex division. The default is 5538@option{-fno-cx-limited-range}, but is enabled by @option{-ffast-math}. 5539 5540This option controls the default setting of the ISO C99 5541@code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to 5542all languages. 5543 5544@end table 5545 5546The following options control optimizations that may improve 5547performance, but are not enabled by any @option{-O} options. This 5548section includes experimental options that may produce broken code. 5549 5550@table @gcctabopt 5551@item -fbranch-probabilities 5552@opindex fbranch-probabilities 5553After running a program compiled with @option{-fprofile-arcs} 5554(@pxref{Debugging Options,, Options for Debugging Your Program or 5555@command{gcc}}), you can compile it a second time using 5556@option{-fbranch-probabilities}, to improve optimizations based on 5557the number of times each branch was taken. When the program 5558compiled with @option{-fprofile-arcs} exits it saves arc execution 5559counts to a file called @file{@var{sourcename}.gcda} for each source 5560file The information in this data file is very dependent on the 5561structure of the generated code, so you must use the same source code 5562and the same optimization options for both compilations. 5563 5564With @option{-fbranch-probabilities}, GCC puts a 5565@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}. 5566These can be used to improve optimization. Currently, they are only 5567used in one place: in @file{reorg.c}, instead of guessing which path a 5568branch is mostly to take, the @samp{REG_BR_PROB} values are used to 5569exactly determine which path is taken more often. 5570 5571@item -fprofile-values 5572@opindex fprofile-values 5573If combined with @option{-fprofile-arcs}, it adds code so that some 5574data about values of expressions in the program is gathered. 5575 5576With @option{-fbranch-probabilities}, it reads back the data gathered 5577from profiling values of expressions and adds @samp{REG_VALUE_PROFILE} 5578notes to instructions for their later usage in optimizations. 5579 5580Enabled with @option{-fprofile-generate} and @option{-fprofile-use}. 5581 5582@item -fvpt 5583@opindex fvpt 5584If combined with @option{-fprofile-arcs}, it instructs the compiler to add 5585a code to gather information about values of expressions. 5586 5587With @option{-fbranch-probabilities}, it reads back the data gathered 5588and actually performs the optimizations based on them. 5589Currently the optimizations include specialization of division operation 5590using the knowledge about the value of the denominator. 5591 5592@item -frename-registers 5593@opindex frename-registers 5594Attempt to avoid false dependencies in scheduled code by making use 5595of registers left over after register allocation. This optimization 5596will most benefit processors with lots of registers. Depending on the 5597debug information format adopted by the target, however, it can 5598make debugging impossible, since variables will no longer stay in 5599a ``home register''. 5600 5601Enabled by default with @option{-funroll-loops}. 5602 5603@item -ftracer 5604@opindex ftracer 5605Perform tail duplication to enlarge superblock size. This transformation 5606simplifies the control flow of the function allowing other optimizations to do 5607better job. 5608 5609Enabled with @option{-fprofile-use}. 5610 5611@item -funroll-loops 5612@opindex funroll-loops 5613Unroll loops whose number of iterations can be determined at compile time or 5614upon entry to the loop. @option{-funroll-loops} implies 5615@option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}. 5616It also turns on complete loop peeling (i.e.@: complete removal of loops with 5617small constant number of iterations). This option makes code larger, and may 5618or may not make it run faster. 5619 5620Enabled with @option{-fprofile-use}. 5621 5622@item -funroll-all-loops 5623@opindex funroll-all-loops 5624Unroll all loops, even if their number of iterations is uncertain when 5625the loop is entered. This usually makes programs run more slowly. 5626@option{-funroll-all-loops} implies the same options as 5627@option{-funroll-loops}. 5628 5629@item -fpeel-loops 5630@opindex fpeel-loops 5631Peels the loops for that there is enough information that they do not 5632roll much (from profile feedback). It also turns on complete loop peeling 5633(i.e.@: complete removal of loops with small constant number of iterations). 5634 5635Enabled with @option{-fprofile-use}. 5636 5637@item -fmove-loop-invariants 5638@opindex fmove-loop-invariants 5639Enables the loop invariant motion pass in the RTL loop optimizer. Enabled 5640at level @option{-O1} 5641 5642@item -funswitch-loops 5643@opindex funswitch-loops 5644Move branches with loop invariant conditions out of the loop, with duplicates 5645of the loop on both branches (modified according to result of the condition). 5646 5647@item -ffunction-sections 5648@itemx -fdata-sections 5649@opindex ffunction-sections 5650@opindex fdata-sections 5651Place each function or data item into its own section in the output 5652file if the target supports arbitrary sections. The name of the 5653function or the name of the data item determines the section's name 5654in the output file. 5655 5656Use these options on systems where the linker can perform optimizations 5657to improve locality of reference in the instruction space. Most systems 5658using the ELF object format and SPARC processors running Solaris 2 have 5659linkers with such optimizations. AIX may have these optimizations in 5660the future. 5661 5662Only use these options when there are significant benefits from doing 5663so. When you specify these options, the assembler and linker will 5664create larger object and executable files and will also be slower. 5665You will not be able to use @code{gprof} on all systems if you 5666specify this option and you may have problems with debugging if 5667you specify both this option and @option{-g}. 5668 5669@item -fbranch-target-load-optimize 5670@opindex fbranch-target-load-optimize 5671Perform branch target register load optimization before prologue / epilogue 5672threading. 5673The use of target registers can typically be exposed only during reload, 5674thus hoisting loads out of loops and doing inter-block scheduling needs 5675a separate optimization pass. 5676 5677@item -fbranch-target-load-optimize2 5678@opindex fbranch-target-load-optimize2 5679Perform branch target register load optimization after prologue / epilogue 5680threading. 5681 5682@item -fbtr-bb-exclusive 5683@opindex fbtr-bb-exclusive 5684When performing branch target register load optimization, don't reuse 5685branch target registers in within any basic block. 5686 5687@item -fstack-protector 5688Emit extra code to check for buffer overflows, such as stack smashing 5689attacks. This is done by adding a guard variable to functions with 5690vulnerable objects. This includes functions that call alloca, and 5691functions with buffers larger than 8 bytes. The guards are initialized 5692when a function is entered and then checked when the function exits. 5693If a guard check fails, an error message is printed and the program exits. 5694 5695@item -fstack-protector-all 5696Like @option{-fstack-protector} except that all functions are protected. 5697 5698@item -fsection-anchors 5699@opindex fsection-anchors 5700Try to reduce the number of symbolic address calculations by using 5701shared ``anchor'' symbols to address nearby objects. This transformation 5702can help to reduce the number of GOT entries and GOT accesses on some 5703targets. 5704 5705For example, the implementation of the following function @code{foo}: 5706 5707@smallexample 5708static int a, b, c; 5709int foo (void) @{ return a + b + c; @} 5710@end smallexample 5711 5712would usually calculate the addresses of all three variables, but if you 5713compile it with @option{-fsection-anchors}, it will access the variables 5714from a common anchor point instead. The effect is similar to the 5715following pseudocode (which isn't valid C): 5716 5717@smallexample 5718int foo (void) 5719@{ 5720 register int *xr = &x; 5721 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x]; 5722@} 5723@end smallexample 5724 5725Not all targets support this option. 5726 5727@item --param @var{name}=@var{value} 5728@opindex param 5729In some places, GCC uses various constants to control the amount of 5730optimization that is done. For example, GCC will not inline functions 5731that contain more that a certain number of instructions. You can 5732control some of these constants on the command-line using the 5733@option{--param} option. 5734 5735The names of specific parameters, and the meaning of the values, are 5736tied to the internals of the compiler, and are subject to change 5737without notice in future releases. 5738 5739In each case, the @var{value} is an integer. The allowable choices for 5740@var{name} are given in the following table: 5741 5742@table @gcctabopt 5743@item salias-max-implicit-fields 5744The maximum number of fields in a variable without direct 5745structure accesses for which structure aliasing will consider trying 5746to track each field. The default is 5 5747 5748@item salias-max-array-elements 5749The maximum number of elements an array can have and its elements 5750still be tracked individually by structure aliasing. The default is 4 5751 5752@item sra-max-structure-size 5753The maximum structure size, in bytes, at which the scalar replacement 5754of aggregates (SRA) optimization will perform block copies. The 5755default value, 0, implies that GCC will select the most appropriate 5756size itself. 5757 5758@item sra-field-structure-ratio 5759The threshold ratio (as a percentage) between instantiated fields and 5760the complete structure size. We say that if the ratio of the number 5761of bytes in instantiated fields to the number of bytes in the complete 5762structure exceeds this parameter, then block copies are not used. The 5763default is 75. 5764 5765@item max-crossjump-edges 5766The maximum number of incoming edges to consider for crossjumping. 5767The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in 5768the number of edges incoming to each block. Increasing values mean 5769more aggressive optimization, making the compile time increase with 5770probably small improvement in executable size. 5771 5772@item min-crossjump-insns 5773The minimum number of instructions which must be matched at the end 5774of two blocks before crossjumping will be performed on them. This 5775value is ignored in the case where all instructions in the block being 5776crossjumped from are matched. The default value is 5. 5777 5778@item max-grow-copy-bb-insns 5779The maximum code size expansion factor when copying basic blocks 5780instead of jumping. The expansion is relative to a jump instruction. 5781The default value is 8. 5782 5783@item max-goto-duplication-insns 5784The maximum number of instructions to duplicate to a block that jumps 5785to a computed goto. To avoid @math{O(N^2)} behavior in a number of 5786passes, GCC factors computed gotos early in the compilation process, 5787and unfactors them as late as possible. Only computed jumps at the 5788end of a basic blocks with no more than max-goto-duplication-insns are 5789unfactored. The default value is 8. 5790 5791@item max-delay-slot-insn-search 5792The maximum number of instructions to consider when looking for an 5793instruction to fill a delay slot. If more than this arbitrary number of 5794instructions is searched, the time savings from filling the delay slot 5795will be minimal so stop searching. Increasing values mean more 5796aggressive optimization, making the compile time increase with probably 5797small improvement in executable run time. 5798 5799@item max-delay-slot-live-search 5800When trying to fill delay slots, the maximum number of instructions to 5801consider when searching for a block with valid live register 5802information. Increasing this arbitrarily chosen value means more 5803aggressive optimization, increasing the compile time. This parameter 5804should be removed when the delay slot code is rewritten to maintain the 5805control-flow graph. 5806 5807@item max-gcse-memory 5808The approximate maximum amount of memory that will be allocated in 5809order to perform the global common subexpression elimination 5810optimization. If more memory than specified is required, the 5811optimization will not be done. 5812 5813@item max-gcse-passes 5814The maximum number of passes of GCSE to run. The default is 1. 5815 5816@item max-pending-list-length 5817The maximum number of pending dependencies scheduling will allow 5818before flushing the current state and starting over. Large functions 5819with few branches or calls can create excessively large lists which 5820needlessly consume memory and resources. 5821 5822@item max-inline-insns-single 5823Several parameters control the tree inliner used in gcc. 5824This number sets the maximum number of instructions (counted in GCC's 5825internal representation) in a single function that the tree inliner 5826will consider for inlining. This only affects functions declared 5827inline and methods implemented in a class declaration (C++). 5828The default value is 450. 5829 5830@item max-inline-insns-auto 5831When you use @option{-finline-functions} (included in @option{-O3}), 5832a lot of functions that would otherwise not be considered for inlining 5833by the compiler will be investigated. To those functions, a different 5834(more restrictive) limit compared to functions declared inline can 5835be applied. 5836The default value is 90. 5837 5838@item large-function-insns 5839The limit specifying really large functions. For functions larger than this 5840limit after inlining inlining is constrained by 5841@option{--param large-function-growth}. This parameter is useful primarily 5842to avoid extreme compilation time caused by non-linear algorithms used by the 5843backend. 5844This parameter is ignored when @option{-funit-at-a-time} is not used. 5845The default value is 2700. 5846 5847@item large-function-growth 5848Specifies maximal growth of large function caused by inlining in percents. 5849This parameter is ignored when @option{-funit-at-a-time} is not used. 5850The default value is 100 which limits large function growth to 2.0 times 5851the original size. 5852 5853@item large-unit-insns 5854The limit specifying large translation unit. Growth caused by inlining of 5855units larger than this limit is limited by @option{--param inline-unit-growth}. 5856For small units this might be too tight (consider unit consisting of function A 5857that is inline and B that just calls A three time. If B is small relative to 5858A, the growth of unit is 300\% and yet such inlining is very sane. For very 5859large units consisting of small inlininable functions however the overall unit 5860growth limit is needed to avoid exponential explosion of code size. Thus for 5861smaller units, the size is increased to @option{--param large-unit-insns} 5862before applying @option{--param inline-unit-growth}. The default is 10000 5863 5864@item inline-unit-growth 5865Specifies maximal overall growth of the compilation unit caused by inlining. 5866This parameter is ignored when @option{-funit-at-a-time} is not used. 5867The default value is 50 which limits unit growth to 1.5 times the original 5868size. 5869 5870@item max-inline-insns-recursive 5871@itemx max-inline-insns-recursive-auto 5872Specifies maximum number of instructions out-of-line copy of self recursive inline 5873function can grow into by performing recursive inlining. 5874 5875For functions declared inline @option{--param max-inline-insns-recursive} is 5876taken into account. For function not declared inline, recursive inlining 5877happens only when @option{-finline-functions} (included in @option{-O3}) is 5878enabled and @option{--param max-inline-insns-recursive-auto} is used. The 5879default value is 450. 5880 5881@item max-inline-recursive-depth 5882@itemx max-inline-recursive-depth-auto 5883Specifies maximum recursion depth used by the recursive inlining. 5884 5885For functions declared inline @option{--param max-inline-recursive-depth} is 5886taken into account. For function not declared inline, recursive inlining 5887happens only when @option{-finline-functions} (included in @option{-O3}) is 5888enabled and @option{--param max-inline-recursive-depth-auto} is used. The 5889default value is 450. 5890 5891@item min-inline-recursive-probability 5892Recursive inlining is profitable only for function having deep recursion 5893in average and can hurt for function having little recursion depth by 5894increasing the prologue size or complexity of function body to other 5895optimizers. 5896 5897When profile feedback is available (see @option{-fprofile-generate}) the actual 5898recursion depth can be guessed from probability that function will recurse via 5899given call expression. This parameter limits inlining only to call expression 5900whose probability exceeds given threshold (in percents). The default value is 590110. 5902 5903@item inline-call-cost 5904Specify cost of call instruction relative to simple arithmetics operations 5905(having cost of 1). Increasing this cost disqualifies inlining of non-leaf 5906functions and at the same time increases size of leaf function that is believed to 5907reduce function size by being inlined. In effect it increases amount of 5908inlining for code having large abstraction penalty (many functions that just 5909pass the arguments to other functions) and decrease inlining for code with low 5910abstraction penalty. The default value is 16. 5911 5912@item max-unrolled-insns 5913The maximum number of instructions that a loop should have if that loop 5914is unrolled, and if the loop is unrolled, it determines how many times 5915the loop code is unrolled. 5916 5917@item max-average-unrolled-insns 5918The maximum number of instructions biased by probabilities of their execution 5919that a loop should have if that loop is unrolled, and if the loop is unrolled, 5920it determines how many times the loop code is unrolled. 5921 5922@item max-unroll-times 5923The maximum number of unrollings of a single loop. 5924 5925@item max-peeled-insns 5926The maximum number of instructions that a loop should have if that loop 5927is peeled, and if the loop is peeled, it determines how many times 5928the loop code is peeled. 5929 5930@item max-peel-times 5931The maximum number of peelings of a single loop. 5932 5933@item max-completely-peeled-insns 5934The maximum number of insns of a completely peeled loop. 5935 5936@item max-completely-peel-times 5937The maximum number of iterations of a loop to be suitable for complete peeling. 5938 5939@item max-unswitch-insns 5940The maximum number of insns of an unswitched loop. 5941 5942@item max-unswitch-level 5943The maximum number of branches unswitched in a single loop. 5944 5945@item lim-expensive 5946The minimum cost of an expensive expression in the loop invariant motion. 5947 5948@item iv-consider-all-candidates-bound 5949Bound on number of candidates for induction variables below that 5950all candidates are considered for each use in induction variable 5951optimizations. Only the most relevant candidates are considered 5952if there are more candidates, to avoid quadratic time complexity. 5953 5954@item iv-max-considered-uses 5955The induction variable optimizations give up on loops that contain more 5956induction variable uses. 5957 5958@item iv-always-prune-cand-set-bound 5959If number of candidates in the set is smaller than this value, 5960we always try to remove unnecessary ivs from the set during its 5961optimization when a new iv is added to the set. 5962 5963@item scev-max-expr-size 5964Bound on size of expressions used in the scalar evolutions analyzer. 5965Large expressions slow the analyzer. 5966 5967@item vect-max-version-checks 5968The maximum number of runtime checks that can be performed when doing 5969loop versioning in the vectorizer. See option ftree-vect-loop-version 5970for more information. 5971 5972@item max-iterations-to-track 5973 5974The maximum number of iterations of a loop the brute force algorithm 5975for analysis of # of iterations of the loop tries to evaluate. 5976 5977@item hot-bb-count-fraction 5978Select fraction of the maximal count of repetitions of basic block in program 5979given basic block needs to have to be considered hot. 5980 5981@item hot-bb-frequency-fraction 5982Select fraction of the maximal frequency of executions of basic block in 5983function given basic block needs to have to be considered hot 5984 5985@item max-predicted-iterations 5986The maximum number of loop iterations we predict statically. This is useful 5987in cases where function contain single loop with known bound and other loop 5988with unknown. We predict the known number of iterations correctly, while 5989the unknown number of iterations average to roughly 10. This means that the 5990loop without bounds would appear artificially cold relative to the other one. 5991 5992@item tracer-dynamic-coverage 5993@itemx tracer-dynamic-coverage-feedback 5994 5995This value is used to limit superblock formation once the given percentage of 5996executed instructions is covered. This limits unnecessary code size 5997expansion. 5998 5999The @option{tracer-dynamic-coverage-feedback} is used only when profile 6000feedback is available. The real profiles (as opposed to statically estimated 6001ones) are much less balanced allowing the threshold to be larger value. 6002 6003@item tracer-max-code-growth 6004Stop tail duplication once code growth has reached given percentage. This is 6005rather hokey argument, as most of the duplicates will be eliminated later in 6006cross jumping, so it may be set to much higher values than is the desired code 6007growth. 6008 6009@item tracer-min-branch-ratio 6010 6011Stop reverse growth when the reverse probability of best edge is less than this 6012threshold (in percent). 6013 6014@item tracer-min-branch-ratio 6015@itemx tracer-min-branch-ratio-feedback 6016 6017Stop forward growth if the best edge do have probability lower than this 6018threshold. 6019 6020Similarly to @option{tracer-dynamic-coverage} two values are present, one for 6021compilation for profile feedback and one for compilation without. The value 6022for compilation with profile feedback needs to be more conservative (higher) in 6023order to make tracer effective. 6024 6025@item max-cse-path-length 6026 6027Maximum number of basic blocks on path that cse considers. The default is 10. 6028 6029@item max-cse-insns 6030The maximum instructions CSE process before flushing. The default is 1000. 6031 6032@item global-var-threshold 6033 6034Counts the number of function calls (@var{n}) and the number of 6035call-clobbered variables (@var{v}). If @var{n}x@var{v} is larger than this limit, a 6036single artificial variable will be created to represent all the 6037call-clobbered variables at function call sites. This artificial 6038variable will then be made to alias every call-clobbered variable. 6039(done as @code{int * size_t} on the host machine; beware overflow). 6040 6041@item max-aliased-vops 6042 6043Maximum number of virtual operands allowed to represent aliases 6044before triggering the alias grouping heuristic. Alias grouping 6045reduces compile times and memory consumption needed for aliasing at 6046the expense of precision loss in alias information. 6047 6048@item ggc-min-expand 6049 6050GCC uses a garbage collector to manage its own memory allocation. This 6051parameter specifies the minimum percentage by which the garbage 6052collector's heap should be allowed to expand between collections. 6053Tuning this may improve compilation speed; it has no effect on code 6054generation. 6055 6056The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when 6057RAM >= 1GB@. If @code{getrlimit} is available, the notion of "RAM" is 6058the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If 6059GCC is not able to calculate RAM on a particular platform, the lower 6060bound of 30% is used. Setting this parameter and 6061@option{ggc-min-heapsize} to zero causes a full collection to occur at 6062every opportunity. This is extremely slow, but can be useful for 6063debugging. 6064 6065@item ggc-min-heapsize 6066 6067Minimum size of the garbage collector's heap before it begins bothering 6068to collect garbage. The first collection occurs after the heap expands 6069by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again, 6070tuning this may improve compilation speed, and has no effect on code 6071generation. 6072 6073The default is the smaller of RAM/8, RLIMIT_RSS, or a limit which 6074tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but 6075with a lower bound of 4096 (four megabytes) and an upper bound of 6076131072 (128 megabytes). If GCC is not able to calculate RAM on a 6077particular platform, the lower bound is used. Setting this parameter 6078very large effectively disables garbage collection. Setting this 6079parameter and @option{ggc-min-expand} to zero causes a full collection 6080to occur at every opportunity. 6081 6082@item max-reload-search-insns 6083The maximum number of instruction reload should look backward for equivalent 6084register. Increasing values mean more aggressive optimization, making the 6085compile time increase with probably slightly better performance. The default 6086value is 100. 6087 6088@item max-cselib-memory-locations 6089The maximum number of memory locations cselib should take into account. 6090Increasing values mean more aggressive optimization, making the compile time 6091increase with probably slightly better performance. The default value is 500. 6092 6093@item max-flow-memory-locations 6094Similar as @option{max-cselib-memory-locations} but for dataflow liveness. 6095The default value is 100. 6096 6097@item reorder-blocks-duplicate 6098@itemx reorder-blocks-duplicate-feedback 6099 6100Used by basic block reordering pass to decide whether to use unconditional 6101branch or duplicate the code on its destination. Code is duplicated when its 6102estimated size is smaller than this value multiplied by the estimated size of 6103unconditional jump in the hot spots of the program. 6104 6105The @option{reorder-block-duplicate-feedback} is used only when profile 6106feedback is available and may be set to higher values than 6107@option{reorder-block-duplicate} since information about the hot spots is more 6108accurate. 6109 6110@item max-sched-ready-insns 6111The maximum number of instructions ready to be issued the scheduler should 6112consider at any given time during the first scheduling pass. Increasing 6113values mean more thorough searches, making the compilation time increase 6114with probably little benefit. The default value is 100. 6115 6116@item max-sched-region-blocks 6117The maximum number of blocks in a region to be considered for 6118interblock scheduling. The default value is 10. 6119 6120@item max-sched-region-insns 6121The maximum number of insns in a region to be considered for 6122interblock scheduling. The default value is 100. 6123 6124@item min-spec-prob 6125The minimum probability (in percents) of reaching a source block 6126for interblock speculative scheduling. The default value is 40. 6127 6128@item max-sched-extend-regions-iters 6129The maximum number of iterations through CFG to extend regions. 61300 - disable region extension, 6131N - do at most N iterations. 6132The default value is 0. 6133 6134@item max-sched-insn-conflict-delay 6135The maximum conflict delay for an insn to be considered for speculative motion. 6136The default value is 3. 6137 6138@item sched-spec-prob-cutoff 6139The minimal probability of speculation success (in percents), so that 6140speculative insn will be scheduled. 6141The default value is 40. 6142 6143@item max-last-value-rtl 6144 6145The maximum size measured as number of RTLs that can be recorded in an expression 6146in combiner for a pseudo register as last known value of that register. The default 6147is 10000. 6148 6149@item integer-share-limit 6150Small integer constants can use a shared data structure, reducing the 6151compiler's memory usage and increasing its speed. This sets the maximum 6152value of a shared integer constant's. The default value is 256. 6153 6154@item min-virtual-mappings 6155Specifies the minimum number of virtual mappings in the incremental 6156SSA updater that should be registered to trigger the virtual mappings 6157heuristic defined by virtual-mappings-ratio. The default value is 6158100. 6159 6160@item virtual-mappings-ratio 6161If the number of virtual mappings is virtual-mappings-ratio bigger 6162than the number of virtual symbols to be updated, then the incremental 6163SSA updater switches to a full update for those symbols. The default 6164ratio is 3. 6165 6166@item ssp-buffer-size 6167The minimum size of buffers (i.e. arrays) that will receive stack smashing 6168protection when @option{-fstack-protection} is used. 6169 6170@item max-jump-thread-duplication-stmts 6171Maximum number of statements allowed in a block that needs to be 6172duplicated when threading jumps. 6173 6174@item max-fields-for-field-sensitive 6175Maximum number of fields in a structure we will treat in 6176a field sensitive manner during pointer analysis. 6177 6178@end table 6179@end table 6180 6181@node Preprocessor Options 6182@section Options Controlling the Preprocessor 6183@cindex preprocessor options 6184@cindex options, preprocessor 6185 6186These options control the C preprocessor, which is run on each C source 6187file before actual compilation. 6188 6189If you use the @option{-E} option, nothing is done except preprocessing. 6190Some of these options make sense only together with @option{-E} because 6191they cause the preprocessor output to be unsuitable for actual 6192compilation. 6193 6194@table @gcctabopt 6195@opindex Wp 6196You can use @option{-Wp,@var{option}} to bypass the compiler driver 6197and pass @var{option} directly through to the preprocessor. If 6198@var{option} contains commas, it is split into multiple options at the 6199commas. However, many options are modified, translated or interpreted 6200by the compiler driver before being passed to the preprocessor, and 6201@option{-Wp} forcibly bypasses this phase. The preprocessor's direct 6202interface is undocumented and subject to change, so whenever possible 6203you should avoid using @option{-Wp} and let the driver handle the 6204options instead. 6205 6206@item -Xpreprocessor @var{option} 6207@opindex preprocessor 6208Pass @var{option} as an option to the preprocessor. You can use this to 6209supply system-specific preprocessor options which GCC does not know how to 6210recognize. 6211 6212If you want to pass an option that takes an argument, you must use 6213@option{-Xpreprocessor} twice, once for the option and once for the argument. 6214@end table 6215 6216@include cppopts.texi 6217 6218@node Assembler Options 6219@section Passing Options to the Assembler 6220 6221@c prevent bad page break with this line 6222You can pass options to the assembler. 6223 6224@table @gcctabopt 6225@item -Wa,@var{option} 6226@opindex Wa 6227Pass @var{option} as an option to the assembler. If @var{option} 6228contains commas, it is split into multiple options at the commas. 6229 6230@item -Xassembler @var{option} 6231@opindex Xassembler 6232Pass @var{option} as an option to the assembler. You can use this to 6233supply system-specific assembler options which GCC does not know how to 6234recognize. 6235 6236If you want to pass an option that takes an argument, you must use 6237@option{-Xassembler} twice, once for the option and once for the argument. 6238 6239@end table 6240 6241@node Link Options 6242@section Options for Linking 6243@cindex link options 6244@cindex options, linking 6245 6246These options come into play when the compiler links object files into 6247an executable output file. They are meaningless if the compiler is 6248not doing a link step. 6249 6250@table @gcctabopt 6251@cindex file names 6252@item @var{object-file-name} 6253A file name that does not end in a special recognized suffix is 6254considered to name an object file or library. (Object files are 6255distinguished from libraries by the linker according to the file 6256contents.) If linking is done, these object files are used as input 6257to the linker. 6258 6259@item -c 6260@itemx -S 6261@itemx -E 6262@opindex c 6263@opindex S 6264@opindex E 6265If any of these options is used, then the linker is not run, and 6266object file names should not be used as arguments. @xref{Overall 6267Options}. 6268 6269@cindex Libraries 6270@item -l@var{library} 6271@itemx -l @var{library} 6272@opindex l 6273Search the library named @var{library} when linking. (The second 6274alternative with the library as a separate argument is only for 6275POSIX compliance and is not recommended.) 6276 6277It makes a difference where in the command you write this option; the 6278linker searches and processes libraries and object files in the order they 6279are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z} 6280after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers 6281to functions in @samp{z}, those functions may not be loaded. 6282 6283The linker searches a standard list of directories for the library, 6284which is actually a file named @file{lib@var{library}.a}. The linker 6285then uses this file as if it had been specified precisely by name. 6286 6287The directories searched include several standard system directories 6288plus any that you specify with @option{-L}. 6289 6290Normally the files found this way are library files---archive files 6291whose members are object files. The linker handles an archive file by 6292scanning through it for members which define symbols that have so far 6293been referenced but not defined. But if the file that is found is an 6294ordinary object file, it is linked in the usual fashion. The only 6295difference between using an @option{-l} option and specifying a file name 6296is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a} 6297and searches several directories. 6298 6299@item -nostartfiles 6300@opindex nostartfiles 6301Do not use the standard system startup files when linking. 6302The standard system libraries are used normally, unless @option{-nostdlib} 6303or @option{-nodefaultlibs} is used. 6304 6305@item -nodefaultlibs 6306@opindex nodefaultlibs 6307Do not use the standard system libraries when linking. 6308Only the libraries you specify will be passed to the linker. 6309The standard startup files are used normally, unless @option{-nostartfiles} 6310is used. The compiler may generate calls to @code{memcmp}, 6311@code{memset}, @code{memcpy} and @code{memmove}. 6312These entries are usually resolved by entries in 6313libc. These entry points should be supplied through some other 6314mechanism when this option is specified. 6315 6316@item -nostdlib 6317@opindex nostdlib 6318Do not use the standard system startup files or libraries when linking. 6319No startup files and only the libraries you specify will be passed to 6320the linker. The compiler may generate calls to @code{memcmp}, @code{memset}, 6321@code{memcpy} and @code{memmove}. 6322These entries are usually resolved by entries in 6323libc. These entry points should be supplied through some other 6324mechanism when this option is specified. 6325 6326@cindex @option{-lgcc}, use with @option{-nostdlib} 6327@cindex @option{-nostdlib} and unresolved references 6328@cindex unresolved references and @option{-nostdlib} 6329@cindex @option{-lgcc}, use with @option{-nodefaultlibs} 6330@cindex @option{-nodefaultlibs} and unresolved references 6331@cindex unresolved references and @option{-nodefaultlibs} 6332One of the standard libraries bypassed by @option{-nostdlib} and 6333@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines 6334that GCC uses to overcome shortcomings of particular machines, or special 6335needs for some languages. 6336(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler 6337Collection (GCC) Internals}, 6338for more discussion of @file{libgcc.a}.) 6339In most cases, you need @file{libgcc.a} even when you want to avoid 6340other standard libraries. In other words, when you specify @option{-nostdlib} 6341or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well. 6342This ensures that you have no unresolved references to internal GCC 6343library subroutines. (For example, @samp{__main}, used to ensure C++ 6344constructors will be called; @pxref{Collect2,,@code{collect2}, gccint, 6345GNU Compiler Collection (GCC) Internals}.) 6346 6347@item -pie 6348@opindex pie 6349Produce a position independent executable on targets which support it. 6350For predictable results, you must also specify the same set of options 6351that were used to generate code (@option{-fpie}, @option{-fPIE}, 6352or model suboptions) when you specify this option. 6353 6354@item -rdynamic 6355@opindex rdynamic 6356Pass the flag @option{-export-dynamic} to the ELF linker, on targets 6357that support it. This instructs the linker to add all symbols, not 6358only used ones, to the dynamic symbol table. This option is needed 6359for some uses of @code{dlopen} or to allow obtaining backtraces 6360from within a program. 6361 6362@item -s 6363@opindex s 6364Remove all symbol table and relocation information from the executable. 6365 6366@item -static 6367@opindex static 6368On systems that support dynamic linking, this prevents linking with the shared 6369libraries. On other systems, this option has no effect. 6370 6371@item -shared 6372@opindex shared 6373Produce a shared object which can then be linked with other objects to 6374form an executable. Not all systems support this option. For predictable 6375results, you must also specify the same set of options that were used to 6376generate code (@option{-fpic}, @option{-fPIC}, or model suboptions) 6377when you specify this option.@footnote{On some systems, @samp{gcc -shared} 6378needs to build supplementary stub code for constructors to work. On 6379multi-libbed systems, @samp{gcc -shared} must select the correct support 6380libraries to link against. Failing to supply the correct flags may lead 6381to subtle defects. Supplying them in cases where they are not necessary 6382is innocuous.} 6383 6384@item -shared-libgcc 6385@itemx -static-libgcc 6386@opindex shared-libgcc 6387@opindex static-libgcc 6388On systems that provide @file{libgcc} as a shared library, these options 6389force the use of either the shared or static version respectively. 6390If no shared version of @file{libgcc} was built when the compiler was 6391configured, these options have no effect. 6392 6393There are several situations in which an application should use the 6394shared @file{libgcc} instead of the static version. The most common 6395of these is when the application wishes to throw and catch exceptions 6396across different shared libraries. In that case, each of the libraries 6397as well as the application itself should use the shared @file{libgcc}. 6398 6399Therefore, the G++ and GCJ drivers automatically add 6400@option{-shared-libgcc} whenever you build a shared library or a main 6401executable, because C++ and Java programs typically use exceptions, so 6402this is the right thing to do. 6403 6404If, instead, you use the GCC driver to create shared libraries, you may 6405find that they will not always be linked with the shared @file{libgcc}. 6406If GCC finds, at its configuration time, that you have a non-GNU linker 6407or a GNU linker that does not support option @option{--eh-frame-hdr}, 6408it will link the shared version of @file{libgcc} into shared libraries 6409by default. Otherwise, it will take advantage of the linker and optimize 6410away the linking with the shared version of @file{libgcc}, linking with 6411the static version of libgcc by default. This allows exceptions to 6412propagate through such shared libraries, without incurring relocation 6413costs at library load time. 6414 6415However, if a library or main executable is supposed to throw or catch 6416exceptions, you must link it using the G++ or GCJ driver, as appropriate 6417for the languages used in the program, or using the option 6418@option{-shared-libgcc}, such that it is linked with the shared 6419@file{libgcc}. 6420 6421@item -symbolic 6422@opindex symbolic 6423Bind references to global symbols when building a shared object. Warn 6424about any unresolved references (unless overridden by the link editor 6425option @samp{-Xlinker -z -Xlinker defs}). Only a few systems support 6426this option. 6427 6428@item -Xlinker @var{option} 6429@opindex Xlinker 6430Pass @var{option} as an option to the linker. You can use this to 6431supply system-specific linker options which GCC does not know how to 6432recognize. 6433 6434If you want to pass an option that takes an argument, you must use 6435@option{-Xlinker} twice, once for the option and once for the argument. 6436For example, to pass @option{-assert definitions}, you must write 6437@samp{-Xlinker -assert -Xlinker definitions}. It does not work to write 6438@option{-Xlinker "-assert definitions"}, because this passes the entire 6439string as a single argument, which is not what the linker expects. 6440 6441@item -Wl,@var{option} 6442@opindex Wl 6443Pass @var{option} as an option to the linker. If @var{option} contains 6444commas, it is split into multiple options at the commas. 6445 6446@item -u @var{symbol} 6447@opindex u 6448Pretend the symbol @var{symbol} is undefined, to force linking of 6449library modules to define it. You can use @option{-u} multiple times with 6450different symbols to force loading of additional library modules. 6451@end table 6452 6453@node Directory Options 6454@section Options for Directory Search 6455@cindex directory options 6456@cindex options, directory search 6457@cindex search path 6458 6459These options specify directories to search for header files, for 6460libraries and for parts of the compiler: 6461 6462@table @gcctabopt 6463@item -I@var{dir} 6464@opindex I 6465Add the directory @var{dir} to the head of the list of directories to be 6466searched for header files. This can be used to override a system header 6467file, substituting your own version, since these directories are 6468searched before the system header file directories. However, you should 6469not use this option to add directories that contain vendor-supplied 6470system header files (use @option{-isystem} for that). If you use more than 6471one @option{-I} option, the directories are scanned in left-to-right 6472order; the standard system directories come after. 6473 6474If a standard system include directory, or a directory specified with 6475@option{-isystem}, is also specified with @option{-I}, the @option{-I} 6476option will be ignored. The directory will still be searched but as a 6477system directory at its normal position in the system include chain. 6478This is to ensure that GCC's procedure to fix buggy system headers and 6479the ordering for the include_next directive are not inadvertently changed. 6480If you really need to change the search order for system directories, 6481use the @option{-nostdinc} and/or @option{-isystem} options. 6482 6483@item -iquote@var{dir} 6484@opindex iquote 6485Add the directory @var{dir} to the head of the list of directories to 6486be searched for header files only for the case of @samp{#include 6487"@var{file}"}; they are not searched for @samp{#include <@var{file}>}, 6488otherwise just like @option{-I}. 6489 6490@item -L@var{dir} 6491@opindex L 6492Add directory @var{dir} to the list of directories to be searched 6493for @option{-l}. 6494 6495@item -B@var{prefix} 6496@opindex B 6497This option specifies where to find the executables, libraries, 6498include files, and data files of the compiler itself. 6499 6500The compiler driver program runs one or more of the subprograms 6501@file{cpp}, @file{cc1}, @file{as} and @file{ld}. It tries 6502@var{prefix} as a prefix for each program it tries to run, both with and 6503without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}). 6504 6505For each subprogram to be run, the compiler driver first tries the 6506@option{-B} prefix, if any. If that name is not found, or if @option{-B} 6507was not specified, the driver tries two standard prefixes, which are 6508@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of 6509those results in a file name that is found, the unmodified program 6510name is searched for using the directories specified in your 6511@env{PATH} environment variable. 6512 6513The compiler will check to see if the path provided by the @option{-B} 6514refers to a directory, and if necessary it will add a directory 6515separator character at the end of the path. 6516 6517@option{-B} prefixes that effectively specify directory names also apply 6518to libraries in the linker, because the compiler translates these 6519options into @option{-L} options for the linker. They also apply to 6520includes files in the preprocessor, because the compiler translates these 6521options into @option{-isystem} options for the preprocessor. In this case, 6522the compiler appends @samp{include} to the prefix. 6523 6524The run-time support file @file{libgcc.a} can also be searched for using 6525the @option{-B} prefix, if needed. If it is not found there, the two 6526standard prefixes above are tried, and that is all. The file is left 6527out of the link if it is not found by those means. 6528 6529Another way to specify a prefix much like the @option{-B} prefix is to use 6530the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment 6531Variables}. 6532 6533As a special kludge, if the path provided by @option{-B} is 6534@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to 65359, then it will be replaced by @file{[dir/]include}. This is to help 6536with boot-strapping the compiler. 6537 6538@item -specs=@var{file} 6539@opindex specs 6540Process @var{file} after the compiler reads in the standard @file{specs} 6541file, in order to override the defaults that the @file{gcc} driver 6542program uses when determining what switches to pass to @file{cc1}, 6543@file{cc1plus}, @file{as}, @file{ld}, etc. More than one 6544@option{-specs=@var{file}} can be specified on the command line, and they 6545are processed in order, from left to right. 6546 6547@item --sysroot=@var{dir} 6548@opindex sysroot 6549Use @var{dir} as the logical root directory for headers and libraries. 6550For example, if the compiler would normally search for headers in 6551@file{/usr/include} and libraries in @file{/usr/lib}, it will instead 6552search @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}. 6553 6554If you use both this option and the @option{-isysroot} option, then 6555the @option{--sysroot} option will apply to libraries, but the 6556@option{-isysroot} option will apply to header files. 6557 6558The GNU linker (beginning with version 2.16) has the necessary support 6559for this option. If your linker does not support this option, the 6560header file aspect of @option{--sysroot} will still work, but the 6561library aspect will not. 6562 6563@item -I- 6564@opindex I- 6565This option has been deprecated. Please use @option{-iquote} instead for 6566@option{-I} directories before the @option{-I-} and remove the @option{-I-}. 6567Any directories you specify with @option{-I} options before the @option{-I-} 6568option are searched only for the case of @samp{#include "@var{file}"}; 6569they are not searched for @samp{#include <@var{file}>}. 6570 6571If additional directories are specified with @option{-I} options after 6572the @option{-I-}, these directories are searched for all @samp{#include} 6573directives. (Ordinarily @emph{all} @option{-I} directories are used 6574this way.) 6575 6576In addition, the @option{-I-} option inhibits the use of the current 6577directory (where the current input file came from) as the first search 6578directory for @samp{#include "@var{file}"}. There is no way to 6579override this effect of @option{-I-}. With @option{-I.} you can specify 6580searching the directory which was current when the compiler was 6581invoked. That is not exactly the same as what the preprocessor does 6582by default, but it is often satisfactory. 6583 6584@option{-I-} does not inhibit the use of the standard system directories 6585for header files. Thus, @option{-I-} and @option{-nostdinc} are 6586independent. 6587@end table 6588 6589@c man end 6590 6591@node Spec Files 6592@section Specifying subprocesses and the switches to pass to them 6593@cindex Spec Files 6594 6595@command{gcc} is a driver program. It performs its job by invoking a 6596sequence of other programs to do the work of compiling, assembling and 6597linking. GCC interprets its command-line parameters and uses these to 6598deduce which programs it should invoke, and which command-line options 6599it ought to place on their command lines. This behavior is controlled 6600by @dfn{spec strings}. In most cases there is one spec string for each 6601program that GCC can invoke, but a few programs have multiple spec 6602strings to control their behavior. The spec strings built into GCC can 6603be overridden by using the @option{-specs=} command-line switch to specify 6604a spec file. 6605 6606@dfn{Spec files} are plaintext files that are used to construct spec 6607strings. They consist of a sequence of directives separated by blank 6608lines. The type of directive is determined by the first non-whitespace 6609character on the line and it can be one of the following: 6610 6611@table @code 6612@item %@var{command} 6613Issues a @var{command} to the spec file processor. The commands that can 6614appear here are: 6615 6616@table @code 6617@item %include <@var{file}> 6618@cindex %include 6619Search for @var{file} and insert its text at the current point in the 6620specs file. 6621 6622@item %include_noerr <@var{file}> 6623@cindex %include_noerr 6624Just like @samp{%include}, but do not generate an error message if the include 6625file cannot be found. 6626 6627@item %rename @var{old_name} @var{new_name} 6628@cindex %rename 6629Rename the spec string @var{old_name} to @var{new_name}. 6630 6631@end table 6632 6633@item *[@var{spec_name}]: 6634This tells the compiler to create, override or delete the named spec 6635string. All lines after this directive up to the next directive or 6636blank line are considered to be the text for the spec string. If this 6637results in an empty string then the spec will be deleted. (Or, if the 6638spec did not exist, then nothing will happened.) Otherwise, if the spec 6639does not currently exist a new spec will be created. If the spec does 6640exist then its contents will be overridden by the text of this 6641directive, unless the first character of that text is the @samp{+} 6642character, in which case the text will be appended to the spec. 6643 6644@item [@var{suffix}]: 6645Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive 6646and up to the next directive or blank line are considered to make up the 6647spec string for the indicated suffix. When the compiler encounters an 6648input file with the named suffix, it will processes the spec string in 6649order to work out how to compile that file. For example: 6650 6651@smallexample 6652.ZZ: 6653z-compile -input %i 6654@end smallexample 6655 6656This says that any input file whose name ends in @samp{.ZZ} should be 6657passed to the program @samp{z-compile}, which should be invoked with the 6658command-line switch @option{-input} and with the result of performing the 6659@samp{%i} substitution. (See below.) 6660 6661As an alternative to providing a spec string, the text that follows a 6662suffix directive can be one of the following: 6663 6664@table @code 6665@item @@@var{language} 6666This says that the suffix is an alias for a known @var{language}. This is 6667similar to using the @option{-x} command-line switch to GCC to specify a 6668language explicitly. For example: 6669 6670@smallexample 6671.ZZ: 6672@@c++ 6673@end smallexample 6674 6675Says that .ZZ files are, in fact, C++ source files. 6676 6677@item #@var{name} 6678This causes an error messages saying: 6679 6680@smallexample 6681@var{name} compiler not installed on this system. 6682@end smallexample 6683@end table 6684 6685GCC already has an extensive list of suffixes built into it. 6686This directive will add an entry to the end of the list of suffixes, but 6687since the list is searched from the end backwards, it is effectively 6688possible to override earlier entries using this technique. 6689 6690@end table 6691 6692GCC has the following spec strings built into it. Spec files can 6693override these strings or create their own. Note that individual 6694targets can also add their own spec strings to this list. 6695 6696@smallexample 6697asm Options to pass to the assembler 6698asm_final Options to pass to the assembler post-processor 6699cpp Options to pass to the C preprocessor 6700cc1 Options to pass to the C compiler 6701cc1plus Options to pass to the C++ compiler 6702endfile Object files to include at the end of the link 6703link Options to pass to the linker 6704lib Libraries to include on the command line to the linker 6705libgcc Decides which GCC support library to pass to the linker 6706linker Sets the name of the linker 6707predefines Defines to be passed to the C preprocessor 6708signed_char Defines to pass to CPP to say whether @code{char} is signed 6709 by default 6710startfile Object files to include at the start of the link 6711@end smallexample 6712 6713Here is a small example of a spec file: 6714 6715@smallexample 6716%rename lib old_lib 6717 6718*lib: 6719--start-group -lgcc -lc -leval1 --end-group %(old_lib) 6720@end smallexample 6721 6722This example renames the spec called @samp{lib} to @samp{old_lib} and 6723then overrides the previous definition of @samp{lib} with a new one. 6724The new definition adds in some extra command-line options before 6725including the text of the old definition. 6726 6727@dfn{Spec strings} are a list of command-line options to be passed to their 6728corresponding program. In addition, the spec strings can contain 6729@samp{%}-prefixed sequences to substitute variable text or to 6730conditionally insert text into the command line. Using these constructs 6731it is possible to generate quite complex command lines. 6732 6733Here is a table of all defined @samp{%}-sequences for spec 6734strings. Note that spaces are not generated automatically around the 6735results of expanding these sequences. Therefore you can concatenate them 6736together or combine them with constant text in a single argument. 6737 6738@table @code 6739@item %% 6740Substitute one @samp{%} into the program name or argument. 6741 6742@item %i 6743Substitute the name of the input file being processed. 6744 6745@item %b 6746Substitute the basename of the input file being processed. 6747This is the substring up to (and not including) the last period 6748and not including the directory. 6749 6750@item %B 6751This is the same as @samp{%b}, but include the file suffix (text after 6752the last period). 6753 6754@item %d 6755Marks the argument containing or following the @samp{%d} as a 6756temporary file name, so that that file will be deleted if GCC exits 6757successfully. Unlike @samp{%g}, this contributes no text to the 6758argument. 6759 6760@item %g@var{suffix} 6761Substitute a file name that has suffix @var{suffix} and is chosen 6762once per compilation, and mark the argument in the same way as 6763@samp{%d}. To reduce exposure to denial-of-service attacks, the file 6764name is now chosen in a way that is hard to predict even when previously 6765chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s} 6766might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches 6767the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is 6768treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g} 6769was simply substituted with a file name chosen once per compilation, 6770without regard to any appended suffix (which was therefore treated 6771just like ordinary text), making such attacks more likely to succeed. 6772 6773@item %u@var{suffix} 6774Like @samp{%g}, but generates a new temporary file name even if 6775@samp{%u@var{suffix}} was already seen. 6776 6777@item %U@var{suffix} 6778Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a 6779new one if there is no such last file name. In the absence of any 6780@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share 6781the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s} 6782would involve the generation of two distinct file names, one 6783for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was 6784simply substituted with a file name chosen for the previous @samp{%u}, 6785without regard to any appended suffix. 6786 6787@item %j@var{suffix} 6788Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is 6789writable, and if save-temps is off; otherwise, substitute the name 6790of a temporary file, just like @samp{%u}. This temporary file is not 6791meant for communication between processes, but rather as a junk 6792disposal mechanism. 6793 6794@item %|@var{suffix} 6795@itemx %m@var{suffix} 6796Like @samp{%g}, except if @option{-pipe} is in effect. In that case 6797@samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at 6798all. These are the two most common ways to instruct a program that it 6799should read from standard input or write to standard output. If you 6800need something more elaborate you can use an @samp{%@{pipe:@code{X}@}} 6801construct: see for example @file{f/lang-specs.h}. 6802 6803@item %.@var{SUFFIX} 6804Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args 6805when it is subsequently output with @samp{%*}. @var{SUFFIX} is 6806terminated by the next space or %. 6807 6808@item %w 6809Marks the argument containing or following the @samp{%w} as the 6810designated output file of this compilation. This puts the argument 6811into the sequence of arguments that @samp{%o} will substitute later. 6812 6813@item %o 6814Substitutes the names of all the output files, with spaces 6815automatically placed around them. You should write spaces 6816around the @samp{%o} as well or the results are undefined. 6817@samp{%o} is for use in the specs for running the linker. 6818Input files whose names have no recognized suffix are not compiled 6819at all, but they are included among the output files, so they will 6820be linked. 6821 6822@item %O 6823Substitutes the suffix for object files. Note that this is 6824handled specially when it immediately follows @samp{%g, %u, or %U}, 6825because of the need for those to form complete file names. The 6826handling is such that @samp{%O} is treated exactly as if it had already 6827been substituted, except that @samp{%g, %u, and %U} do not currently 6828support additional @var{suffix} characters following @samp{%O} as they would 6829following, for example, @samp{.o}. 6830 6831@item %p 6832Substitutes the standard macro predefinitions for the 6833current target machine. Use this when running @code{cpp}. 6834 6835@item %P 6836Like @samp{%p}, but puts @samp{__} before and after the name of each 6837predefined macro, except for macros that start with @samp{__} or with 6838@samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO 6839C@. 6840 6841@item %I 6842Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}), 6843@option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}), 6844@option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options) 6845and @option{-imultilib} as necessary. 6846 6847@item %s 6848Current argument is the name of a library or startup file of some sort. 6849Search for that file in a standard list of directories and substitute 6850the full name found. 6851 6852@item %e@var{str} 6853Print @var{str} as an error message. @var{str} is terminated by a newline. 6854Use this when inconsistent options are detected. 6855 6856@item %(@var{name}) 6857Substitute the contents of spec string @var{name} at this point. 6858 6859@item %[@var{name}] 6860Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments. 6861 6862@item %x@{@var{option}@} 6863Accumulate an option for @samp{%X}. 6864 6865@item %X 6866Output the accumulated linker options specified by @option{-Wl} or a @samp{%x} 6867spec string. 6868 6869@item %Y 6870Output the accumulated assembler options specified by @option{-Wa}. 6871 6872@item %Z 6873Output the accumulated preprocessor options specified by @option{-Wp}. 6874 6875@item %a 6876Process the @code{asm} spec. This is used to compute the 6877switches to be passed to the assembler. 6878 6879@item %A 6880Process the @code{asm_final} spec. This is a spec string for 6881passing switches to an assembler post-processor, if such a program is 6882needed. 6883 6884@item %l 6885Process the @code{link} spec. This is the spec for computing the 6886command line passed to the linker. Typically it will make use of the 6887@samp{%L %G %S %D and %E} sequences. 6888 6889@item %D 6890Dump out a @option{-L} option for each directory that GCC believes might 6891contain startup files. If the target supports multilibs then the 6892current multilib directory will be prepended to each of these paths. 6893 6894@item %L 6895Process the @code{lib} spec. This is a spec string for deciding which 6896libraries should be included on the command line to the linker. 6897 6898@item %G 6899Process the @code{libgcc} spec. This is a spec string for deciding 6900which GCC support library should be included on the command line to the linker. 6901 6902@item %S 6903Process the @code{startfile} spec. This is a spec for deciding which 6904object files should be the first ones passed to the linker. Typically 6905this might be a file named @file{crt0.o}. 6906 6907@item %E 6908Process the @code{endfile} spec. This is a spec string that specifies 6909the last object files that will be passed to the linker. 6910 6911@item %C 6912Process the @code{cpp} spec. This is used to construct the arguments 6913to be passed to the C preprocessor. 6914 6915@item %1 6916Process the @code{cc1} spec. This is used to construct the options to be 6917passed to the actual C compiler (@samp{cc1}). 6918 6919@item %2 6920Process the @code{cc1plus} spec. This is used to construct the options to be 6921passed to the actual C++ compiler (@samp{cc1plus}). 6922 6923@item %* 6924Substitute the variable part of a matched option. See below. 6925Note that each comma in the substituted string is replaced by 6926a single space. 6927 6928@item %<@code{S} 6929Remove all occurrences of @code{-S} from the command line. Note---this 6930command is position dependent. @samp{%} commands in the spec string 6931before this one will see @code{-S}, @samp{%} commands in the spec string 6932after this one will not. 6933 6934@item %:@var{function}(@var{args}) 6935Call the named function @var{function}, passing it @var{args}. 6936@var{args} is first processed as a nested spec string, then split 6937into an argument vector in the usual fashion. The function returns 6938a string which is processed as if it had appeared literally as part 6939of the current spec. 6940 6941The following built-in spec functions are provided: 6942 6943@table @code 6944@item @code{if-exists} 6945The @code{if-exists} spec function takes one argument, an absolute 6946pathname to a file. If the file exists, @code{if-exists} returns the 6947pathname. Here is a small example of its usage: 6948 6949@smallexample 6950*startfile: 6951crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s 6952@end smallexample 6953 6954@item @code{if-exists-else} 6955The @code{if-exists-else} spec function is similar to the @code{if-exists} 6956spec function, except that it takes two arguments. The first argument is 6957an absolute pathname to a file. If the file exists, @code{if-exists-else} 6958returns the pathname. If it does not exist, it returns the second argument. 6959This way, @code{if-exists-else} can be used to select one file or another, 6960based on the existence of the first. Here is a small example of its usage: 6961 6962@smallexample 6963*startfile: 6964crt0%O%s %:if-exists(crti%O%s) \ 6965%:if-exists-else(crtbeginT%O%s crtbegin%O%s) 6966@end smallexample 6967 6968@item @code{replace-outfile} 6969The @code{replace-outfile} spec function takes two arguments. It looks for the 6970first argument in the outfiles array and replaces it with the second argument. Here 6971is a small example of its usage: 6972 6973@smallexample 6974%@{static|static-libgcc|static-libstdc++:%:replace-outfile(-lstdc++ \ 6975libstdc++.a%s)@} 6976 6977@end smallexample 6978 6979@end table 6980 6981@item %@{@code{S}@} 6982Substitutes the @code{-S} switch, if that switch was given to GCC@. 6983If that switch was not specified, this substitutes nothing. Note that 6984the leading dash is omitted when specifying this option, and it is 6985automatically inserted if the substitution is performed. Thus the spec 6986string @samp{%@{foo@}} would match the command-line option @option{-foo} 6987and would output the command line option @option{-foo}. 6988 6989@item %W@{@code{S}@} 6990Like %@{@code{S}@} but mark last argument supplied within as a file to be 6991deleted on failure. 6992 6993@item %@{@code{S}*@} 6994Substitutes all the switches specified to GCC whose names start 6995with @code{-S}, but which also take an argument. This is used for 6996switches like @option{-o}, @option{-D}, @option{-I}, etc. 6997GCC considers @option{-o foo} as being 6998one switch whose names starts with @samp{o}. %@{o*@} would substitute this 6999text, including the space. Thus two arguments would be generated. 7000 7001@item %@{@code{S}*&@code{T}*@} 7002Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options 7003(the order of @code{S} and @code{T} in the spec is not significant). 7004There can be any number of ampersand-separated variables; for each the 7005wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}. 7006 7007@item %@{@code{S}:@code{X}@} 7008Substitutes @code{X}, if the @samp{-S} switch was given to GCC@. 7009 7010@item %@{!@code{S}:@code{X}@} 7011Substitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@. 7012 7013@item %@{@code{S}*:@code{X}@} 7014Substitutes @code{X} if one or more switches whose names start with 7015@code{-S} are specified to GCC@. Normally @code{X} is substituted only 7016once, no matter how many such switches appeared. However, if @code{%*} 7017appears somewhere in @code{X}, then @code{X} will be substituted once 7018for each matching switch, with the @code{%*} replaced by the part of 7019that switch that matched the @code{*}. 7020 7021@item %@{.@code{S}:@code{X}@} 7022Substitutes @code{X}, if processing a file with suffix @code{S}. 7023 7024@item %@{!.@code{S}:@code{X}@} 7025Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}. 7026 7027@item %@{@code{S}|@code{P}:@code{X}@} 7028Substitutes @code{X} if either @code{-S} or @code{-P} was given to GCC@. 7029This may be combined with @samp{!}, @samp{.}, and @code{*} sequences as well, 7030although they have a stronger binding than the @samp{|}. If @code{%*} 7031appears in @code{X}, all of the alternatives must be starred, and only 7032the first matching alternative is substituted. 7033 7034For example, a spec string like this: 7035 7036@smallexample 7037%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@} 7038@end smallexample 7039 7040will output the following command-line options from the following input 7041command-line options: 7042 7043@smallexample 7044fred.c -foo -baz 7045jim.d -bar -boggle 7046-d fred.c -foo -baz -boggle 7047-d jim.d -bar -baz -boggle 7048@end smallexample 7049 7050@item %@{S:X; T:Y; :D@} 7051 7052If @code{S} was given to GCC, substitutes @code{X}; else if @code{T} was 7053given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can 7054be as many clauses as you need. This may be combined with @code{.}, 7055@code{!}, @code{|}, and @code{*} as needed. 7056 7057 7058@end table 7059 7060The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar 7061construct may contain other nested @samp{%} constructs or spaces, or 7062even newlines. They are processed as usual, as described above. 7063Trailing white space in @code{X} is ignored. White space may also 7064appear anywhere on the left side of the colon in these constructs, 7065except between @code{.} or @code{*} and the corresponding word. 7066 7067The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are 7068handled specifically in these constructs. If another value of 7069@option{-O} or the negated form of a @option{-f}, @option{-m}, or 7070@option{-W} switch is found later in the command line, the earlier 7071switch value is ignored, except with @{@code{S}*@} where @code{S} is 7072just one letter, which passes all matching options. 7073 7074The character @samp{|} at the beginning of the predicate text is used to 7075indicate that a command should be piped to the following command, but 7076only if @option{-pipe} is specified. 7077 7078It is built into GCC which switches take arguments and which do not. 7079(You might think it would be useful to generalize this to allow each 7080compiler's spec to say which switches take arguments. But this cannot 7081be done in a consistent fashion. GCC cannot even decide which input 7082files have been specified without knowing which switches take arguments, 7083and it must know which input files to compile in order to tell which 7084compilers to run). 7085 7086GCC also knows implicitly that arguments starting in @option{-l} are to be 7087treated as compiler output files, and passed to the linker in their 7088proper position among the other output files. 7089 7090@c man begin OPTIONS 7091 7092@node Target Options 7093@section Specifying Target Machine and Compiler Version 7094@cindex target options 7095@cindex cross compiling 7096@cindex specifying machine version 7097@cindex specifying compiler version and target machine 7098@cindex compiler version, specifying 7099@cindex target machine, specifying 7100 7101The usual way to run GCC is to run the executable called @file{gcc}, or 7102@file{<machine>-gcc} when cross-compiling, or 7103@file{<machine>-gcc-<version>} to run a version other than the one that 7104was installed last. Sometimes this is inconvenient, so GCC provides 7105options that will switch to another cross-compiler or version. 7106 7107@table @gcctabopt 7108@item -b @var{machine} 7109@opindex b 7110The argument @var{machine} specifies the target machine for compilation. 7111 7112The value to use for @var{machine} is the same as was specified as the 7113machine type when configuring GCC as a cross-compiler. For 7114example, if a cross-compiler was configured with @samp{configure 7115arm-elf}, meaning to compile for an arm processor with elf binaries, 7116then you would specify @option{-b arm-elf} to run that cross compiler. 7117Because there are other options beginning with @option{-b}, the 7118configuration must contain a hyphen. 7119 7120@item -V @var{version} 7121@opindex V 7122The argument @var{version} specifies which version of GCC to run. 7123This is useful when multiple versions are installed. For example, 7124@var{version} might be @samp{4.0}, meaning to run GCC version 4.0. 7125@end table 7126 7127The @option{-V} and @option{-b} options work by running the 7128@file{<machine>-gcc-<version>} executable, so there's no real reason to 7129use them if you can just run that directly. 7130 7131@node Submodel Options 7132@section Hardware Models and Configurations 7133@cindex submodel options 7134@cindex specifying hardware config 7135@cindex hardware models and configurations, specifying 7136@cindex machine dependent options 7137 7138Earlier we discussed the standard option @option{-b} which chooses among 7139different installed compilers for completely different target 7140machines, such as VAX vs.@: 68000 vs.@: 80386. 7141 7142In addition, each of these target machine types can have its own 7143special options, starting with @samp{-m}, to choose among various 7144hardware models or configurations---for example, 68010 vs 68020, 7145floating coprocessor or none. A single installed version of the 7146compiler can compile for any model or configuration, according to the 7147options specified. 7148 7149Some configurations of the compiler also support additional special 7150options, usually for compatibility with other compilers on the same 7151platform. 7152 7153@c This list is ordered alphanumerically by subsection name. 7154@c It should be the same order and spelling as these options are listed 7155@c in Machine Dependent Options 7156 7157@menu 7158* ARC Options:: 7159* ARM Options:: 7160* AVR Options:: 7161* Blackfin Options:: 7162* CRIS Options:: 7163* CRX Options:: 7164* Darwin Options:: 7165* DEC Alpha Options:: 7166* DEC Alpha/VMS Options:: 7167* FRV Options:: 7168* GNU/Linux Options:: 7169* H8/300 Options:: 7170* HPPA Options:: 7171* i386 and x86-64 Options:: 7172* IA-64 Options:: 7173* M32C Options:: 7174* M32R/D Options:: 7175* M680x0 Options:: 7176* M68hc1x Options:: 7177* MCore Options:: 7178* MIPS Options:: 7179* MMIX Options:: 7180* MN10300 Options:: 7181* MT Options:: 7182* PDP-11 Options:: 7183* PowerPC Options:: 7184* RS/6000 and PowerPC Options:: 7185* S/390 and zSeries Options:: 7186* Score Options:: 7187* SH Options:: 7188* SPARC Options:: 7189* System V Options:: 7190* TMS320C3x/C4x Options:: 7191* V850 Options:: 7192* VAX Options:: 7193* x86-64 Options:: 7194* Xstormy16 Options:: 7195* Xtensa Options:: 7196* zSeries Options:: 7197@end menu 7198 7199@node ARC Options 7200@subsection ARC Options 7201@cindex ARC Options 7202 7203These options are defined for ARC implementations: 7204 7205@table @gcctabopt 7206@item -EL 7207@opindex EL 7208Compile code for little endian mode. This is the default. 7209 7210@item -EB 7211@opindex EB 7212Compile code for big endian mode. 7213 7214@item -mmangle-cpu 7215@opindex mmangle-cpu 7216Prepend the name of the cpu to all public symbol names. 7217In multiple-processor systems, there are many ARC variants with different 7218instruction and register set characteristics. This flag prevents code 7219compiled for one cpu to be linked with code compiled for another. 7220No facility exists for handling variants that are ``almost identical''. 7221This is an all or nothing option. 7222 7223@item -mcpu=@var{cpu} 7224@opindex mcpu 7225Compile code for ARC variant @var{cpu}. 7226Which variants are supported depend on the configuration. 7227All variants support @option{-mcpu=base}, this is the default. 7228 7229@item -mtext=@var{text-section} 7230@itemx -mdata=@var{data-section} 7231@itemx -mrodata=@var{readonly-data-section} 7232@opindex mtext 7233@opindex mdata 7234@opindex mrodata 7235Put functions, data, and readonly data in @var{text-section}, 7236@var{data-section}, and @var{readonly-data-section} respectively 7237by default. This can be overridden with the @code{section} attribute. 7238@xref{Variable Attributes}. 7239 7240@end table 7241 7242@node ARM Options 7243@subsection ARM Options 7244@cindex ARM options 7245 7246These @samp{-m} options are defined for Advanced RISC Machines (ARM) 7247architectures: 7248 7249@table @gcctabopt 7250@item -mabi=@var{name} 7251@opindex mabi 7252Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu}, 7253@samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}. 7254 7255@item -mapcs-frame 7256@opindex mapcs-frame 7257Generate a stack frame that is compliant with the ARM Procedure Call 7258Standard for all functions, even if this is not strictly necessary for 7259correct execution of the code. Specifying @option{-fomit-frame-pointer} 7260with this option will cause the stack frames not to be generated for 7261leaf functions. The default is @option{-mno-apcs-frame}. 7262 7263@item -mapcs 7264@opindex mapcs 7265This is a synonym for @option{-mapcs-frame}. 7266 7267@ignore 7268@c not currently implemented 7269@item -mapcs-stack-check 7270@opindex mapcs-stack-check 7271Generate code to check the amount of stack space available upon entry to 7272every function (that actually uses some stack space). If there is 7273insufficient space available then either the function 7274@samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be 7275called, depending upon the amount of stack space required. The run time 7276system is required to provide these functions. The default is 7277@option{-mno-apcs-stack-check}, since this produces smaller code. 7278 7279@c not currently implemented 7280@item -mapcs-float 7281@opindex mapcs-float 7282Pass floating point arguments using the float point registers. This is 7283one of the variants of the APCS@. This option is recommended if the 7284target hardware has a floating point unit or if a lot of floating point 7285arithmetic is going to be performed by the code. The default is 7286@option{-mno-apcs-float}, since integer only code is slightly increased in 7287size if @option{-mapcs-float} is used. 7288 7289@c not currently implemented 7290@item -mapcs-reentrant 7291@opindex mapcs-reentrant 7292Generate reentrant, position independent code. The default is 7293@option{-mno-apcs-reentrant}. 7294@end ignore 7295 7296@item -mthumb-interwork 7297@opindex mthumb-interwork 7298Generate code which supports calling between the ARM and Thumb 7299instruction sets. Without this option the two instruction sets cannot 7300be reliably used inside one program. The default is 7301@option{-mno-thumb-interwork}, since slightly larger code is generated 7302when @option{-mthumb-interwork} is specified. 7303 7304@item -mno-sched-prolog 7305@opindex mno-sched-prolog 7306Prevent the reordering of instructions in the function prolog, or the 7307merging of those instruction with the instructions in the function's 7308body. This means that all functions will start with a recognizable set 7309of instructions (or in fact one of a choice from a small set of 7310different function prologues), and this information can be used to 7311locate the start if functions inside an executable piece of code. The 7312default is @option{-msched-prolog}. 7313 7314@item -mhard-float 7315@opindex mhard-float 7316Generate output containing floating point instructions. This is the 7317default. 7318 7319@item -msoft-float 7320@opindex msoft-float 7321Generate output containing library calls for floating point. 7322@strong{Warning:} the requisite libraries are not available for all ARM 7323targets. Normally the facilities of the machine's usual C compiler are 7324used, but this cannot be done directly in cross-compilation. You must make 7325your own arrangements to provide suitable library functions for 7326cross-compilation. 7327 7328@option{-msoft-float} changes the calling convention in the output file; 7329therefore, it is only useful if you compile @emph{all} of a program with 7330this option. In particular, you need to compile @file{libgcc.a}, the 7331library that comes with GCC, with @option{-msoft-float} in order for 7332this to work. 7333 7334@item -mfloat-abi=@var{name} 7335@opindex mfloat-abi 7336Specifies which ABI to use for floating point values. Permissible values 7337are: @samp{soft}, @samp{softfp} and @samp{hard}. 7338 7339@samp{soft} and @samp{hard} are equivalent to @option{-msoft-float} 7340and @option{-mhard-float} respectively. @samp{softfp} allows the generation 7341of floating point instructions, but still uses the soft-float calling 7342conventions. 7343 7344@item -mlittle-endian 7345@opindex mlittle-endian 7346Generate code for a processor running in little-endian mode. This is 7347the default for all standard configurations. 7348 7349@item -mbig-endian 7350@opindex mbig-endian 7351Generate code for a processor running in big-endian mode; the default is 7352to compile code for a little-endian processor. 7353 7354@item -mwords-little-endian 7355@opindex mwords-little-endian 7356This option only applies when generating code for big-endian processors. 7357Generate code for a little-endian word order but a big-endian byte 7358order. That is, a byte order of the form @samp{32107654}. Note: this 7359option should only be used if you require compatibility with code for 7360big-endian ARM processors generated by versions of the compiler prior to 73612.8. 7362 7363@item -mcpu=@var{name} 7364@opindex mcpu 7365This specifies the name of the target ARM processor. GCC uses this name 7366to determine what kind of instructions it can emit when generating 7367assembly code. Permissible names are: @samp{arm2}, @samp{arm250}, 7368@samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610}, 7369@samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm}, 7370@samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700}, 7371@samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100}, 7372@samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s}, 7373@samp{arm8}, @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100}, 7374@samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920}, 7375@samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s}, 7376@samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi}, 7377@samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s}, 7378@samp{arm10e}, @samp{arm1020e}, @samp{arm1022e}, 7379@samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp}, 7380@samp{arm1176jz-s}, @samp{arm1176jzf-s}, @samp{xscale}, @samp{iwmmxt}, 7381@samp{ep9312}. 7382 7383@itemx -mtune=@var{name} 7384@opindex mtune 7385This option is very similar to the @option{-mcpu=} option, except that 7386instead of specifying the actual target processor type, and hence 7387restricting which instructions can be used, it specifies that GCC should 7388tune the performance of the code as if the target were of the type 7389specified in this option, but still choosing the instructions that it 7390will generate based on the cpu specified by a @option{-mcpu=} option. 7391For some ARM implementations better performance can be obtained by using 7392this option. 7393 7394@item -march=@var{name} 7395@opindex march 7396This specifies the name of the target ARM architecture. GCC uses this 7397name to determine what kind of instructions it can emit when generating 7398assembly code. This option can be used in conjunction with or instead 7399of the @option{-mcpu=} option. Permissible names are: @samp{armv2}, 7400@samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t}, 7401@samp{armv5}, @samp{armv5t}, @samp{armv5te}, @samp{armv6}, @samp{armv6j}, 7402@samp{iwmmxt}, @samp{ep9312}. 7403 7404@item -mfpu=@var{name} 7405@itemx -mfpe=@var{number} 7406@itemx -mfp=@var{number} 7407@opindex mfpu 7408@opindex mfpe 7409@opindex mfp 7410This specifies what floating point hardware (or hardware emulation) is 7411available on the target. Permissible names are: @samp{fpa}, @samp{fpe2}, 7412@samp{fpe3}, @samp{maverick}, @samp{vfp}. @option{-mfp} and @option{-mfpe} 7413are synonyms for @option{-mfpu}=@samp{fpe}@var{number}, for compatibility 7414with older versions of GCC@. 7415 7416If @option{-msoft-float} is specified this specifies the format of 7417floating point values. 7418 7419@item -mstructure-size-boundary=@var{n} 7420@opindex mstructure-size-boundary 7421The size of all structures and unions will be rounded up to a multiple 7422of the number of bits set by this option. Permissible values are 8, 32 7423and 64. The default value varies for different toolchains. For the COFF 7424targeted toolchain the default value is 8. A value of 64 is only allowed 7425if the underlying ABI supports it. 7426 7427Specifying the larger number can produce faster, more efficient code, but 7428can also increase the size of the program. Different values are potentially 7429incompatible. Code compiled with one value cannot necessarily expect to 7430work with code or libraries compiled with another value, if they exchange 7431information using structures or unions. 7432 7433@item -mabort-on-noreturn 7434@opindex mabort-on-noreturn 7435Generate a call to the function @code{abort} at the end of a 7436@code{noreturn} function. It will be executed if the function tries to 7437return. 7438 7439@item -mlong-calls 7440@itemx -mno-long-calls 7441@opindex mlong-calls 7442@opindex mno-long-calls 7443Tells the compiler to perform function calls by first loading the 7444address of the function into a register and then performing a subroutine 7445call on this register. This switch is needed if the target function 7446will lie outside of the 64 megabyte addressing range of the offset based 7447version of subroutine call instruction. 7448 7449Even if this switch is enabled, not all function calls will be turned 7450into long calls. The heuristic is that static functions, functions 7451which have the @samp{short-call} attribute, functions that are inside 7452the scope of a @samp{#pragma no_long_calls} directive and functions whose 7453definitions have already been compiled within the current compilation 7454unit, will not be turned into long calls. The exception to this rule is 7455that weak function definitions, functions with the @samp{long-call} 7456attribute or the @samp{section} attribute, and functions that are within 7457the scope of a @samp{#pragma long_calls} directive, will always be 7458turned into long calls. 7459 7460This feature is not enabled by default. Specifying 7461@option{-mno-long-calls} will restore the default behavior, as will 7462placing the function calls within the scope of a @samp{#pragma 7463long_calls_off} directive. Note these switches have no effect on how 7464the compiler generates code to handle function calls via function 7465pointers. 7466 7467@item -mnop-fun-dllimport 7468@opindex mnop-fun-dllimport 7469Disable support for the @code{dllimport} attribute. 7470 7471@item -msingle-pic-base 7472@opindex msingle-pic-base 7473Treat the register used for PIC addressing as read-only, rather than 7474loading it in the prologue for each function. The run-time system is 7475responsible for initializing this register with an appropriate value 7476before execution begins. 7477 7478@item -mpic-register=@var{reg} 7479@opindex mpic-register 7480Specify the register to be used for PIC addressing. The default is R10 7481unless stack-checking is enabled, when R9 is used. 7482 7483@item -mcirrus-fix-invalid-insns 7484@opindex mcirrus-fix-invalid-insns 7485@opindex mno-cirrus-fix-invalid-insns 7486Insert NOPs into the instruction stream to in order to work around 7487problems with invalid Maverick instruction combinations. This option 7488is only valid if the @option{-mcpu=ep9312} option has been used to 7489enable generation of instructions for the Cirrus Maverick floating 7490point co-processor. This option is not enabled by default, since the 7491problem is only present in older Maverick implementations. The default 7492can be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns} 7493switch. 7494 7495@item -mpoke-function-name 7496@opindex mpoke-function-name 7497Write the name of each function into the text section, directly 7498preceding the function prologue. The generated code is similar to this: 7499 7500@smallexample 7501 t0 7502 .ascii "arm_poke_function_name", 0 7503 .align 7504 t1 7505 .word 0xff000000 + (t1 - t0) 7506 arm_poke_function_name 7507 mov ip, sp 7508 stmfd sp!, @{fp, ip, lr, pc@} 7509 sub fp, ip, #4 7510@end smallexample 7511 7512When performing a stack backtrace, code can inspect the value of 7513@code{pc} stored at @code{fp + 0}. If the trace function then looks at 7514location @code{pc - 12} and the top 8 bits are set, then we know that 7515there is a function name embedded immediately preceding this location 7516and has length @code{((pc[-3]) & 0xff000000)}. 7517 7518@item -mthumb 7519@opindex mthumb 7520Generate code for the 16-bit Thumb instruction set. The default is to 7521use the 32-bit ARM instruction set. 7522 7523@item -mtpcs-frame 7524@opindex mtpcs-frame 7525Generate a stack frame that is compliant with the Thumb Procedure Call 7526Standard for all non-leaf functions. (A leaf function is one that does 7527not call any other functions.) The default is @option{-mno-tpcs-frame}. 7528 7529@item -mtpcs-leaf-frame 7530@opindex mtpcs-leaf-frame 7531Generate a stack frame that is compliant with the Thumb Procedure Call 7532Standard for all leaf functions. (A leaf function is one that does 7533not call any other functions.) The default is @option{-mno-apcs-leaf-frame}. 7534 7535@item -mcallee-super-interworking 7536@opindex mcallee-super-interworking 7537Gives all externally visible functions in the file being compiled an ARM 7538instruction set header which switches to Thumb mode before executing the 7539rest of the function. This allows these functions to be called from 7540non-interworking code. 7541 7542@item -mcaller-super-interworking 7543@opindex mcaller-super-interworking 7544Allows calls via function pointers (including virtual functions) to 7545execute correctly regardless of whether the target code has been 7546compiled for interworking or not. There is a small overhead in the cost 7547of executing a function pointer if this option is enabled. 7548 7549@item -mtp=@var{name} 7550@opindex mtp 7551Specify the access model for the thread local storage pointer. The valid 7552models are @option{soft}, which generates calls to @code{__aeabi_read_tp}, 7553@option{cp15}, which fetches the thread pointer from @code{cp15} directly 7554(supported in the arm6k architecture), and @option{auto}, which uses the 7555best available method for the selected processor. The default setting is 7556@option{auto}. 7557 7558@end table 7559 7560@node AVR Options 7561@subsection AVR Options 7562@cindex AVR Options 7563 7564These options are defined for AVR implementations: 7565 7566@table @gcctabopt 7567@item -mmcu=@var{mcu} 7568@opindex mmcu 7569Specify ATMEL AVR instruction set or MCU type. 7570 7571Instruction set avr1 is for the minimal AVR core, not supported by the C 7572compiler, only for assembler programs (MCU types: at90s1200, attiny10, 7573attiny11, attiny12, attiny15, attiny28). 7574 7575Instruction set avr2 (default) is for the classic AVR core with up to 75768K program memory space (MCU types: at90s2313, at90s2323, attiny22, 7577at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515, 7578at90c8534, at90s8535). 7579 7580Instruction set avr3 is for the classic AVR core with up to 128K program 7581memory space (MCU types: atmega103, atmega603, at43usb320, at76c711). 7582 7583Instruction set avr4 is for the enhanced AVR core with up to 8K program 7584memory space (MCU types: atmega8, atmega83, atmega85). 7585 7586Instruction set avr5 is for the enhanced AVR core with up to 128K program 7587memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323, 7588atmega64, atmega128, at43usb355, at94k). 7589 7590@item -msize 7591@opindex msize 7592Output instruction sizes to the asm file. 7593 7594@item -minit-stack=@var{N} 7595@opindex minit-stack 7596Specify the initial stack address, which may be a symbol or numeric value, 7597@samp{__stack} is the default. 7598 7599@item -mno-interrupts 7600@opindex mno-interrupts 7601Generated code is not compatible with hardware interrupts. 7602Code size will be smaller. 7603 7604@item -mcall-prologues 7605@opindex mcall-prologues 7606Functions prologues/epilogues expanded as call to appropriate 7607subroutines. Code size will be smaller. 7608 7609@item -mno-tablejump 7610@opindex mno-tablejump 7611Do not generate tablejump insns which sometimes increase code size. 7612 7613@item -mtiny-stack 7614@opindex mtiny-stack 7615Change only the low 8 bits of the stack pointer. 7616 7617@item -mint8 7618@opindex mint8 7619Assume int to be 8 bit integer. This affects the sizes of all types: A 7620char will be 1 byte, an int will be 1 byte, an long will be 2 bytes 7621and long long will be 4 bytes. Please note that this option does not 7622comply to the C standards, but it will provide you with smaller code 7623size. 7624@end table 7625 7626@node Blackfin Options 7627@subsection Blackfin Options 7628@cindex Blackfin Options 7629 7630@table @gcctabopt 7631@item -momit-leaf-frame-pointer 7632@opindex momit-leaf-frame-pointer 7633Don't keep the frame pointer in a register for leaf functions. This 7634avoids the instructions to save, set up and restore frame pointers and 7635makes an extra register available in leaf functions. The option 7636@option{-fomit-frame-pointer} removes the frame pointer for all functions 7637which might make debugging harder. 7638 7639@item -mspecld-anomaly 7640@opindex mspecld-anomaly 7641When enabled, the compiler will ensure that the generated code does not 7642contain speculative loads after jump instructions. This option is enabled 7643by default. 7644 7645@item -mno-specld-anomaly 7646@opindex mno-specld-anomaly 7647Don't generate extra code to prevent speculative loads from occurring. 7648 7649@item -mcsync-anomaly 7650@opindex mcsync-anomaly 7651When enabled, the compiler will ensure that the generated code does not 7652contain CSYNC or SSYNC instructions too soon after conditional branches. 7653This option is enabled by default. 7654 7655@item -mno-csync-anomaly 7656@opindex mno-csync-anomaly 7657Don't generate extra code to prevent CSYNC or SSYNC instructions from 7658occurring too soon after a conditional branch. 7659 7660@item -mlow-64k 7661@opindex mlow-64k 7662When enabled, the compiler is free to take advantage of the knowledge that 7663the entire program fits into the low 64k of memory. 7664 7665@item -mno-low-64k 7666@opindex mno-low-64k 7667Assume that the program is arbitrarily large. This is the default. 7668 7669@item -mid-shared-library 7670@opindex mid-shared-library 7671Generate code that supports shared libraries via the library ID method. 7672This allows for execute in place and shared libraries in an environment 7673without virtual memory management. This option implies @option{-fPIC}. 7674 7675@item -mno-id-shared-library 7676@opindex mno-id-shared-library 7677Generate code that doesn't assume ID based shared libraries are being used. 7678This is the default. 7679 7680@item -mshared-library-id=n 7681@opindex mshared-library-id 7682Specified the identification number of the ID based shared library being 7683compiled. Specifying a value of 0 will generate more compact code, specifying 7684other values will force the allocation of that number to the current 7685library but is no more space or time efficient than omitting this option. 7686 7687@item -mlong-calls 7688@itemx -mno-long-calls 7689@opindex mlong-calls 7690@opindex mno-long-calls 7691Tells the compiler to perform function calls by first loading the 7692address of the function into a register and then performing a subroutine 7693call on this register. This switch is needed if the target function 7694will lie outside of the 24 bit addressing range of the offset based 7695version of subroutine call instruction. 7696 7697This feature is not enabled by default. Specifying 7698@option{-mno-long-calls} will restore the default behavior. Note these 7699switches have no effect on how the compiler generates code to handle 7700function calls via function pointers. 7701@end table 7702 7703@node CRIS Options 7704@subsection CRIS Options 7705@cindex CRIS Options 7706 7707These options are defined specifically for the CRIS ports. 7708 7709@table @gcctabopt 7710@item -march=@var{architecture-type} 7711@itemx -mcpu=@var{architecture-type} 7712@opindex march 7713@opindex mcpu 7714Generate code for the specified architecture. The choices for 7715@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for 7716respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@. 7717Default is @samp{v0} except for cris-axis-linux-gnu, where the default is 7718@samp{v10}. 7719 7720@item -mtune=@var{architecture-type} 7721@opindex mtune 7722Tune to @var{architecture-type} everything applicable about the generated 7723code, except for the ABI and the set of available instructions. The 7724choices for @var{architecture-type} are the same as for 7725@option{-march=@var{architecture-type}}. 7726 7727@item -mmax-stack-frame=@var{n} 7728@opindex mmax-stack-frame 7729Warn when the stack frame of a function exceeds @var{n} bytes. 7730 7731@item -melinux-stacksize=@var{n} 7732@opindex melinux-stacksize 7733Only available with the @samp{cris-axis-aout} target. Arranges for 7734indications in the program to the kernel loader that the stack of the 7735program should be set to @var{n} bytes. 7736 7737@item -metrax4 7738@itemx -metrax100 7739@opindex metrax4 7740@opindex metrax100 7741The options @option{-metrax4} and @option{-metrax100} are synonyms for 7742@option{-march=v3} and @option{-march=v8} respectively. 7743 7744@item -mmul-bug-workaround 7745@itemx -mno-mul-bug-workaround 7746@opindex mmul-bug-workaround 7747@opindex mno-mul-bug-workaround 7748Work around a bug in the @code{muls} and @code{mulu} instructions for CPU 7749models where it applies. This option is active by default. 7750 7751@item -mpdebug 7752@opindex mpdebug 7753Enable CRIS-specific verbose debug-related information in the assembly 7754code. This option also has the effect to turn off the @samp{#NO_APP} 7755formatted-code indicator to the assembler at the beginning of the 7756assembly file. 7757 7758@item -mcc-init 7759@opindex mcc-init 7760Do not use condition-code results from previous instruction; always emit 7761compare and test instructions before use of condition codes. 7762 7763@item -mno-side-effects 7764@opindex mno-side-effects 7765Do not emit instructions with side-effects in addressing modes other than 7766post-increment. 7767 7768@item -mstack-align 7769@itemx -mno-stack-align 7770@itemx -mdata-align 7771@itemx -mno-data-align 7772@itemx -mconst-align 7773@itemx -mno-const-align 7774@opindex mstack-align 7775@opindex mno-stack-align 7776@opindex mdata-align 7777@opindex mno-data-align 7778@opindex mconst-align 7779@opindex mno-const-align 7780These options (no-options) arranges (eliminate arrangements) for the 7781stack-frame, individual data and constants to be aligned for the maximum 7782single data access size for the chosen CPU model. The default is to 7783arrange for 32-bit alignment. ABI details such as structure layout are 7784not affected by these options. 7785 7786@item -m32-bit 7787@itemx -m16-bit 7788@itemx -m8-bit 7789@opindex m32-bit 7790@opindex m16-bit 7791@opindex m8-bit 7792Similar to the stack- data- and const-align options above, these options 7793arrange for stack-frame, writable data and constants to all be 32-bit, 779416-bit or 8-bit aligned. The default is 32-bit alignment. 7795 7796@item -mno-prologue-epilogue 7797@itemx -mprologue-epilogue 7798@opindex mno-prologue-epilogue 7799@opindex mprologue-epilogue 7800With @option{-mno-prologue-epilogue}, the normal function prologue and 7801epilogue that sets up the stack-frame are omitted and no return 7802instructions or return sequences are generated in the code. Use this 7803option only together with visual inspection of the compiled code: no 7804warnings or errors are generated when call-saved registers must be saved, 7805or storage for local variable needs to be allocated. 7806 7807@item -mno-gotplt 7808@itemx -mgotplt 7809@opindex mno-gotplt 7810@opindex mgotplt 7811With @option{-fpic} and @option{-fPIC}, don't generate (do generate) 7812instruction sequences that load addresses for functions from the PLT part 7813of the GOT rather than (traditional on other architectures) calls to the 7814PLT@. The default is @option{-mgotplt}. 7815 7816@item -maout 7817@opindex maout 7818Legacy no-op option only recognized with the cris-axis-aout target. 7819 7820@item -melf 7821@opindex melf 7822Legacy no-op option only recognized with the cris-axis-elf and 7823cris-axis-linux-gnu targets. 7824 7825@item -melinux 7826@opindex melinux 7827Only recognized with the cris-axis-aout target, where it selects a 7828GNU/linux-like multilib, include files and instruction set for 7829@option{-march=v8}. 7830 7831@item -mlinux 7832@opindex mlinux 7833Legacy no-op option only recognized with the cris-axis-linux-gnu target. 7834 7835@item -sim 7836@opindex sim 7837This option, recognized for the cris-axis-aout and cris-axis-elf arranges 7838to link with input-output functions from a simulator library. Code, 7839initialized data and zero-initialized data are allocated consecutively. 7840 7841@item -sim2 7842@opindex sim2 7843Like @option{-sim}, but pass linker options to locate initialized data at 78440x40000000 and zero-initialized data at 0x80000000. 7845@end table 7846 7847@node CRX Options 7848@subsection CRX Options 7849@cindex CRX Options 7850 7851These options are defined specifically for the CRX ports. 7852 7853@table @gcctabopt 7854 7855@item -mmac 7856@opindex mmac 7857Enable the use of multiply-accumulate instructions. Disabled by default. 7858 7859@item -mpush-args 7860@opindex mpush-args 7861Push instructions will be used to pass outgoing arguments when functions 7862are called. Enabled by default. 7863@end table 7864 7865@node Darwin Options 7866@subsection Darwin Options 7867@cindex Darwin options 7868 7869These options are defined for all architectures running the Darwin operating 7870system. 7871 7872FSF GCC on Darwin does not create ``fat'' object files; it will create 7873an object file for the single architecture that it was built to 7874target. Apple's GCC on Darwin does create ``fat'' files if multiple 7875@option{-arch} options are used; it does so by running the compiler or 7876linker multiple times and joining the results together with 7877@file{lipo}. 7878 7879The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or 7880@samp{i686}) is determined by the flags that specify the ISA 7881that GCC is targetting, like @option{-mcpu} or @option{-march}. The 7882@option{-force_cpusubtype_ALL} option can be used to override this. 7883 7884The Darwin tools vary in their behavior when presented with an ISA 7885mismatch. The assembler, @file{as}, will only permit instructions to 7886be used that are valid for the subtype of the file it is generating, 7887so you cannot put 64-bit instructions in an @samp{ppc750} object file. 7888The linker for shared libraries, @file{/usr/bin/libtool}, will fail 7889and print an error if asked to create a shared library with a less 7890restrictive subtype than its input files (for instance, trying to put 7891a @samp{ppc970} object file in a @samp{ppc7400} library). The linker 7892for executables, @file{ld}, will quietly give the executable the most 7893restrictive subtype of any of its input files. 7894 7895@table @gcctabopt 7896@item -F@var{dir} 7897@opindex F 7898Add the framework directory @var{dir} to the head of the list of 7899directories to be searched for header files. These directories are 7900interleaved with those specified by @option{-I} options and are 7901scanned in a left-to-right order. 7902 7903A framework directory is a directory with frameworks in it. A 7904framework is a directory with a @samp{"Headers"} and/or 7905@samp{"PrivateHeaders"} directory contained directly in it that ends 7906in @samp{".framework"}. The name of a framework is the name of this 7907directory excluding the @samp{".framework"}. Headers associated with 7908the framework are found in one of those two directories, with 7909@samp{"Headers"} being searched first. A subframework is a framework 7910directory that is in a framework's @samp{"Frameworks"} directory. 7911Includes of subframework headers can only appear in a header of a 7912framework that contains the subframework, or in a sibling subframework 7913header. Two subframeworks are siblings if they occur in the same 7914framework. A subframework should not have the same name as a 7915framework, a warning will be issued if this is violated. Currently a 7916subframework cannot have subframeworks, in the future, the mechanism 7917may be extended to support this. The standard frameworks can be found 7918in @samp{"/System/Library/Frameworks"} and 7919@samp{"/Library/Frameworks"}. An example include looks like 7920@code{#include <Framework/header.h>}, where @samp{Framework} denotes 7921the name of the framework and header.h is found in the 7922@samp{"PrivateHeaders"} or @samp{"Headers"} directory. 7923 7924@item -gused 7925@opindex gused 7926Emit debugging information for symbols that are used. For STABS 7927debugging format, this enables @option{-feliminate-unused-debug-symbols}. 7928This is by default ON@. 7929 7930@item -gfull 7931@opindex gfull 7932Emit debugging information for all symbols and types. 7933 7934@item -mmacosx-version-min=@var{version} 7935The earliest version of MacOS X that this executable will run on 7936is @var{version}. Typical values of @var{version} include @code{10.1}, 7937@code{10.2}, and @code{10.3.9}. 7938 7939The default for this option is to make choices that seem to be most 7940useful. 7941 7942@item -mkernel 7943@opindex mkernel 7944Enable kernel development mode. The @option{-mkernel} option sets 7945@option{-static}, @option{-fno-common}, @option{-fno-cxa-atexit}, 7946@option{-fno-exceptions}, @option{-fno-non-call-exceptions}, 7947@option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where 7948applicable. This mode also sets @option{-mno-altivec}, 7949@option{-msoft-float}, @option{-fno-builtin} and 7950@option{-mlong-branch} for PowerPC targets. 7951 7952@item -mone-byte-bool 7953@opindex mone-byte-bool 7954Override the defaults for @samp{bool} so that @samp{sizeof(bool)==1}. 7955By default @samp{sizeof(bool)} is @samp{4} when compiling for 7956Darwin/PowerPC and @samp{1} when compiling for Darwin/x86, so this 7957option has no effect on x86. 7958 7959@strong{Warning:} The @option{-mone-byte-bool} switch causes GCC 7960to generate code that is not binary compatible with code generated 7961without that switch. Using this switch may require recompiling all 7962other modules in a program, including system libraries. Use this 7963switch to conform to a non-default data model. 7964 7965@item -mfix-and-continue 7966@itemx -ffix-and-continue 7967@itemx -findirect-data 7968@opindex mfix-and-continue 7969@opindex ffix-and-continue 7970@opindex findirect-data 7971Generate code suitable for fast turn around development. Needed to 7972enable gdb to dynamically load @code{.o} files into already running 7973programs. @option{-findirect-data} and @option{-ffix-and-continue} 7974are provided for backwards compatibility. 7975 7976@item -all_load 7977@opindex all_load 7978Loads all members of static archive libraries. 7979See man ld(1) for more information. 7980 7981@item -arch_errors_fatal 7982@opindex arch_errors_fatal 7983Cause the errors having to do with files that have the wrong architecture 7984to be fatal. 7985 7986@item -bind_at_load 7987@opindex bind_at_load 7988Causes the output file to be marked such that the dynamic linker will 7989bind all undefined references when the file is loaded or launched. 7990 7991@item -bundle 7992@opindex bundle 7993Produce a Mach-o bundle format file. 7994See man ld(1) for more information. 7995 7996@item -bundle_loader @var{executable} 7997@opindex bundle_loader 7998This option specifies the @var{executable} that will be loading the build 7999output file being linked. See man ld(1) for more information. 8000 8001@item -dynamiclib 8002@opindex dynamiclib 8003When passed this option, GCC will produce a dynamic library instead of 8004an executable when linking, using the Darwin @file{libtool} command. 8005 8006@item -force_cpusubtype_ALL 8007@opindex force_cpusubtype_ALL 8008This causes GCC's output file to have the @var{ALL} subtype, instead of 8009one controlled by the @option{-mcpu} or @option{-march} option. 8010 8011@item -allowable_client @var{client_name} 8012@itemx -client_name 8013@itemx -compatibility_version 8014@itemx -current_version 8015@itemx -dead_strip 8016@itemx -dependency-file 8017@itemx -dylib_file 8018@itemx -dylinker_install_name 8019@itemx -dynamic 8020@itemx -exported_symbols_list 8021@itemx -filelist 8022@itemx -flat_namespace 8023@itemx -force_flat_namespace 8024@itemx -headerpad_max_install_names 8025@itemx -image_base 8026@itemx -init 8027@itemx -install_name 8028@itemx -keep_private_externs 8029@itemx -multi_module 8030@itemx -multiply_defined 8031@itemx -multiply_defined_unused 8032@itemx -noall_load 8033@itemx -no_dead_strip_inits_and_terms 8034@itemx -nofixprebinding 8035@itemx -nomultidefs 8036@itemx -noprebind 8037@itemx -noseglinkedit 8038@itemx -pagezero_size 8039@itemx -prebind 8040@itemx -prebind_all_twolevel_modules 8041@itemx -private_bundle 8042@itemx -read_only_relocs 8043@itemx -sectalign 8044@itemx -sectobjectsymbols 8045@itemx -whyload 8046@itemx -seg1addr 8047@itemx -sectcreate 8048@itemx -sectobjectsymbols 8049@itemx -sectorder 8050@itemx -segaddr 8051@itemx -segs_read_only_addr 8052@itemx -segs_read_write_addr 8053@itemx -seg_addr_table 8054@itemx -seg_addr_table_filename 8055@itemx -seglinkedit 8056@itemx -segprot 8057@itemx -segs_read_only_addr 8058@itemx -segs_read_write_addr 8059@itemx -single_module 8060@itemx -static 8061@itemx -sub_library 8062@itemx -sub_umbrella 8063@itemx -twolevel_namespace 8064@itemx -umbrella 8065@itemx -undefined 8066@itemx -unexported_symbols_list 8067@itemx -weak_reference_mismatches 8068@itemx -whatsloaded 8069 8070@opindex allowable_client 8071@opindex client_name 8072@opindex compatibility_version 8073@opindex current_version 8074@opindex dead_strip 8075@opindex dependency-file 8076@opindex dylib_file 8077@opindex dylinker_install_name 8078@opindex dynamic 8079@opindex exported_symbols_list 8080@opindex filelist 8081@opindex flat_namespace 8082@opindex force_flat_namespace 8083@opindex headerpad_max_install_names 8084@opindex image_base 8085@opindex init 8086@opindex install_name 8087@opindex keep_private_externs 8088@opindex multi_module 8089@opindex multiply_defined 8090@opindex multiply_defined_unused 8091@opindex noall_load 8092@opindex no_dead_strip_inits_and_terms 8093@opindex nofixprebinding 8094@opindex nomultidefs 8095@opindex noprebind 8096@opindex noseglinkedit 8097@opindex pagezero_size 8098@opindex prebind 8099@opindex prebind_all_twolevel_modules 8100@opindex private_bundle 8101@opindex read_only_relocs 8102@opindex sectalign 8103@opindex sectobjectsymbols 8104@opindex whyload 8105@opindex seg1addr 8106@opindex sectcreate 8107@opindex sectobjectsymbols 8108@opindex sectorder 8109@opindex segaddr 8110@opindex segs_read_only_addr 8111@opindex segs_read_write_addr 8112@opindex seg_addr_table 8113@opindex seg_addr_table_filename 8114@opindex seglinkedit 8115@opindex segprot 8116@opindex segs_read_only_addr 8117@opindex segs_read_write_addr 8118@opindex single_module 8119@opindex static 8120@opindex sub_library 8121@opindex sub_umbrella 8122@opindex twolevel_namespace 8123@opindex umbrella 8124@opindex undefined 8125@opindex unexported_symbols_list 8126@opindex weak_reference_mismatches 8127@opindex whatsloaded 8128 8129These options are passed to the Darwin linker. The Darwin linker man page 8130describes them in detail. 8131@end table 8132 8133@node DEC Alpha Options 8134@subsection DEC Alpha Options 8135 8136These @samp{-m} options are defined for the DEC Alpha implementations: 8137 8138@table @gcctabopt 8139@item -mno-soft-float 8140@itemx -msoft-float 8141@opindex mno-soft-float 8142@opindex msoft-float 8143Use (do not use) the hardware floating-point instructions for 8144floating-point operations. When @option{-msoft-float} is specified, 8145functions in @file{libgcc.a} will be used to perform floating-point 8146operations. Unless they are replaced by routines that emulate the 8147floating-point operations, or compiled in such a way as to call such 8148emulations routines, these routines will issue floating-point 8149operations. If you are compiling for an Alpha without floating-point 8150operations, you must ensure that the library is built so as not to call 8151them. 8152 8153Note that Alpha implementations without floating-point operations are 8154required to have floating-point registers. 8155 8156@item -mfp-reg 8157@itemx -mno-fp-regs 8158@opindex mfp-reg 8159@opindex mno-fp-regs 8160Generate code that uses (does not use) the floating-point register set. 8161@option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point 8162register set is not used, floating point operands are passed in integer 8163registers as if they were integers and floating-point results are passed 8164in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence, 8165so any function with a floating-point argument or return value called by code 8166compiled with @option{-mno-fp-regs} must also be compiled with that 8167option. 8168 8169A typical use of this option is building a kernel that does not use, 8170and hence need not save and restore, any floating-point registers. 8171 8172@item -mieee 8173@opindex mieee 8174The Alpha architecture implements floating-point hardware optimized for 8175maximum performance. It is mostly compliant with the IEEE floating 8176point standard. However, for full compliance, software assistance is 8177required. This option generates code fully IEEE compliant code 8178@emph{except} that the @var{inexact-flag} is not maintained (see below). 8179If this option is turned on, the preprocessor macro @code{_IEEE_FP} is 8180defined during compilation. The resulting code is less efficient but is 8181able to correctly support denormalized numbers and exceptional IEEE 8182values such as not-a-number and plus/minus infinity. Other Alpha 8183compilers call this option @option{-ieee_with_no_inexact}. 8184 8185@item -mieee-with-inexact 8186@opindex mieee-with-inexact 8187This is like @option{-mieee} except the generated code also maintains 8188the IEEE @var{inexact-flag}. Turning on this option causes the 8189generated code to implement fully-compliant IEEE math. In addition to 8190@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor 8191macro. On some Alpha implementations the resulting code may execute 8192significantly slower than the code generated by default. Since there is 8193very little code that depends on the @var{inexact-flag}, you should 8194normally not specify this option. Other Alpha compilers call this 8195option @option{-ieee_with_inexact}. 8196 8197@item -mfp-trap-mode=@var{trap-mode} 8198@opindex mfp-trap-mode 8199This option controls what floating-point related traps are enabled. 8200Other Alpha compilers call this option @option{-fptm @var{trap-mode}}. 8201The trap mode can be set to one of four values: 8202 8203@table @samp 8204@item n 8205This is the default (normal) setting. The only traps that are enabled 8206are the ones that cannot be disabled in software (e.g., division by zero 8207trap). 8208 8209@item u 8210In addition to the traps enabled by @samp{n}, underflow traps are enabled 8211as well. 8212 8213@item su 8214Like @samp{u}, but the instructions are marked to be safe for software 8215completion (see Alpha architecture manual for details). 8216 8217@item sui 8218Like @samp{su}, but inexact traps are enabled as well. 8219@end table 8220 8221@item -mfp-rounding-mode=@var{rounding-mode} 8222@opindex mfp-rounding-mode 8223Selects the IEEE rounding mode. Other Alpha compilers call this option 8224@option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one 8225of: 8226 8227@table @samp 8228@item n 8229Normal IEEE rounding mode. Floating point numbers are rounded towards 8230the nearest machine number or towards the even machine number in case 8231of a tie. 8232 8233@item m 8234Round towards minus infinity. 8235 8236@item c 8237Chopped rounding mode. Floating point numbers are rounded towards zero. 8238 8239@item d 8240Dynamic rounding mode. A field in the floating point control register 8241(@var{fpcr}, see Alpha architecture reference manual) controls the 8242rounding mode in effect. The C library initializes this register for 8243rounding towards plus infinity. Thus, unless your program modifies the 8244@var{fpcr}, @samp{d} corresponds to round towards plus infinity. 8245@end table 8246 8247@item -mtrap-precision=@var{trap-precision} 8248@opindex mtrap-precision 8249In the Alpha architecture, floating point traps are imprecise. This 8250means without software assistance it is impossible to recover from a 8251floating trap and program execution normally needs to be terminated. 8252GCC can generate code that can assist operating system trap handlers 8253in determining the exact location that caused a floating point trap. 8254Depending on the requirements of an application, different levels of 8255precisions can be selected: 8256 8257@table @samp 8258@item p 8259Program precision. This option is the default and means a trap handler 8260can only identify which program caused a floating point exception. 8261 8262@item f 8263Function precision. The trap handler can determine the function that 8264caused a floating point exception. 8265 8266@item i 8267Instruction precision. The trap handler can determine the exact 8268instruction that caused a floating point exception. 8269@end table 8270 8271Other Alpha compilers provide the equivalent options called 8272@option{-scope_safe} and @option{-resumption_safe}. 8273 8274@item -mieee-conformant 8275@opindex mieee-conformant 8276This option marks the generated code as IEEE conformant. You must not 8277use this option unless you also specify @option{-mtrap-precision=i} and either 8278@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect 8279is to emit the line @samp{.eflag 48} in the function prologue of the 8280generated assembly file. Under DEC Unix, this has the effect that 8281IEEE-conformant math library routines will be linked in. 8282 8283@item -mbuild-constants 8284@opindex mbuild-constants 8285Normally GCC examines a 32- or 64-bit integer constant to 8286see if it can construct it from smaller constants in two or three 8287instructions. If it cannot, it will output the constant as a literal and 8288generate code to load it from the data segment at runtime. 8289 8290Use this option to require GCC to construct @emph{all} integer constants 8291using code, even if it takes more instructions (the maximum is six). 8292 8293You would typically use this option to build a shared library dynamic 8294loader. Itself a shared library, it must relocate itself in memory 8295before it can find the variables and constants in its own data segment. 8296 8297@item -malpha-as 8298@itemx -mgas 8299@opindex malpha-as 8300@opindex mgas 8301Select whether to generate code to be assembled by the vendor-supplied 8302assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}. 8303 8304@item -mbwx 8305@itemx -mno-bwx 8306@itemx -mcix 8307@itemx -mno-cix 8308@itemx -mfix 8309@itemx -mno-fix 8310@itemx -mmax 8311@itemx -mno-max 8312@opindex mbwx 8313@opindex mno-bwx 8314@opindex mcix 8315@opindex mno-cix 8316@opindex mfix 8317@opindex mno-fix 8318@opindex mmax 8319@opindex mno-max 8320Indicate whether GCC should generate code to use the optional BWX, 8321CIX, FIX and MAX instruction sets. The default is to use the instruction 8322sets supported by the CPU type specified via @option{-mcpu=} option or that 8323of the CPU on which GCC was built if none was specified. 8324 8325@item -mfloat-vax 8326@itemx -mfloat-ieee 8327@opindex mfloat-vax 8328@opindex mfloat-ieee 8329Generate code that uses (does not use) VAX F and G floating point 8330arithmetic instead of IEEE single and double precision. 8331 8332@item -mexplicit-relocs 8333@itemx -mno-explicit-relocs 8334@opindex mexplicit-relocs 8335@opindex mno-explicit-relocs 8336Older Alpha assemblers provided no way to generate symbol relocations 8337except via assembler macros. Use of these macros does not allow 8338optimal instruction scheduling. GNU binutils as of version 2.12 8339supports a new syntax that allows the compiler to explicitly mark 8340which relocations should apply to which instructions. This option 8341is mostly useful for debugging, as GCC detects the capabilities of 8342the assembler when it is built and sets the default accordingly. 8343 8344@item -msmall-data 8345@itemx -mlarge-data 8346@opindex msmall-data 8347@opindex mlarge-data 8348When @option{-mexplicit-relocs} is in effect, static data is 8349accessed via @dfn{gp-relative} relocations. When @option{-msmall-data} 8350is used, objects 8 bytes long or smaller are placed in a @dfn{small data area} 8351(the @code{.sdata} and @code{.sbss} sections) and are accessed via 835216-bit relocations off of the @code{$gp} register. This limits the 8353size of the small data area to 64KB, but allows the variables to be 8354directly accessed via a single instruction. 8355 8356The default is @option{-mlarge-data}. With this option the data area 8357is limited to just below 2GB@. Programs that require more than 2GB of 8358data must use @code{malloc} or @code{mmap} to allocate the data in the 8359heap instead of in the program's data segment. 8360 8361When generating code for shared libraries, @option{-fpic} implies 8362@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}. 8363 8364@item -msmall-text 8365@itemx -mlarge-text 8366@opindex msmall-text 8367@opindex mlarge-text 8368When @option{-msmall-text} is used, the compiler assumes that the 8369code of the entire program (or shared library) fits in 4MB, and is 8370thus reachable with a branch instruction. When @option{-msmall-data} 8371is used, the compiler can assume that all local symbols share the 8372same @code{$gp} value, and thus reduce the number of instructions 8373required for a function call from 4 to 1. 8374 8375The default is @option{-mlarge-text}. 8376 8377@item -mcpu=@var{cpu_type} 8378@opindex mcpu 8379Set the instruction set and instruction scheduling parameters for 8380machine type @var{cpu_type}. You can specify either the @samp{EV} 8381style name or the corresponding chip number. GCC supports scheduling 8382parameters for the EV4, EV5 and EV6 family of processors and will 8383choose the default values for the instruction set from the processor 8384you specify. If you do not specify a processor type, GCC will default 8385to the processor on which the compiler was built. 8386 8387Supported values for @var{cpu_type} are 8388 8389@table @samp 8390@item ev4 8391@itemx ev45 8392@itemx 21064 8393Schedules as an EV4 and has no instruction set extensions. 8394 8395@item ev5 8396@itemx 21164 8397Schedules as an EV5 and has no instruction set extensions. 8398 8399@item ev56 8400@itemx 21164a 8401Schedules as an EV5 and supports the BWX extension. 8402 8403@item pca56 8404@itemx 21164pc 8405@itemx 21164PC 8406Schedules as an EV5 and supports the BWX and MAX extensions. 8407 8408@item ev6 8409@itemx 21264 8410Schedules as an EV6 and supports the BWX, FIX, and MAX extensions. 8411 8412@item ev67 8413@itemx 21264a 8414Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions. 8415@end table 8416 8417@item -mtune=@var{cpu_type} 8418@opindex mtune 8419Set only the instruction scheduling parameters for machine type 8420@var{cpu_type}. The instruction set is not changed. 8421 8422@item -mmemory-latency=@var{time} 8423@opindex mmemory-latency 8424Sets the latency the scheduler should assume for typical memory 8425references as seen by the application. This number is highly 8426dependent on the memory access patterns used by the application 8427and the size of the external cache on the machine. 8428 8429Valid options for @var{time} are 8430 8431@table @samp 8432@item @var{number} 8433A decimal number representing clock cycles. 8434 8435@item L1 8436@itemx L2 8437@itemx L3 8438@itemx main 8439The compiler contains estimates of the number of clock cycles for 8440``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches 8441(also called Dcache, Scache, and Bcache), as well as to main memory. 8442Note that L3 is only valid for EV5. 8443 8444@end table 8445@end table 8446 8447@node DEC Alpha/VMS Options 8448@subsection DEC Alpha/VMS Options 8449 8450These @samp{-m} options are defined for the DEC Alpha/VMS implementations: 8451 8452@table @gcctabopt 8453@item -mvms-return-codes 8454@opindex mvms-return-codes 8455Return VMS condition codes from main. The default is to return POSIX 8456style condition (e.g.@ error) codes. 8457@end table 8458 8459@node FRV Options 8460@subsection FRV Options 8461@cindex FRV Options 8462 8463@table @gcctabopt 8464@item -mgpr-32 8465@opindex mgpr-32 8466 8467Only use the first 32 general purpose registers. 8468 8469@item -mgpr-64 8470@opindex mgpr-64 8471 8472Use all 64 general purpose registers. 8473 8474@item -mfpr-32 8475@opindex mfpr-32 8476 8477Use only the first 32 floating point registers. 8478 8479@item -mfpr-64 8480@opindex mfpr-64 8481 8482Use all 64 floating point registers 8483 8484@item -mhard-float 8485@opindex mhard-float 8486 8487Use hardware instructions for floating point operations. 8488 8489@item -msoft-float 8490@opindex msoft-float 8491 8492Use library routines for floating point operations. 8493 8494@item -malloc-cc 8495@opindex malloc-cc 8496 8497Dynamically allocate condition code registers. 8498 8499@item -mfixed-cc 8500@opindex mfixed-cc 8501 8502Do not try to dynamically allocate condition code registers, only 8503use @code{icc0} and @code{fcc0}. 8504 8505@item -mdword 8506@opindex mdword 8507 8508Change ABI to use double word insns. 8509 8510@item -mno-dword 8511@opindex mno-dword 8512 8513Do not use double word instructions. 8514 8515@item -mdouble 8516@opindex mdouble 8517 8518Use floating point double instructions. 8519 8520@item -mno-double 8521@opindex mno-double 8522 8523Do not use floating point double instructions. 8524 8525@item -mmedia 8526@opindex mmedia 8527 8528Use media instructions. 8529 8530@item -mno-media 8531@opindex mno-media 8532 8533Do not use media instructions. 8534 8535@item -mmuladd 8536@opindex mmuladd 8537 8538Use multiply and add/subtract instructions. 8539 8540@item -mno-muladd 8541@opindex mno-muladd 8542 8543Do not use multiply and add/subtract instructions. 8544 8545@item -mfdpic 8546@opindex mfdpic 8547 8548Select the FDPIC ABI, that uses function descriptors to represent 8549pointers to functions. Without any PIC/PIE-related options, it 8550implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it 8551assumes GOT entries and small data are within a 12-bit range from the 8552GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets 8553are computed with 32 bits. 8554 8555@item -minline-plt 8556@opindex minline-plt 8557 8558Enable inlining of PLT entries in function calls to functions that are 8559not known to bind locally. It has no effect without @option{-mfdpic}. 8560It's enabled by default if optimizing for speed and compiling for 8561shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an 8562optimization option such as @option{-O3} or above is present in the 8563command line. 8564 8565@item -mTLS 8566@opindex TLS 8567 8568Assume a large TLS segment when generating thread-local code. 8569 8570@item -mtls 8571@opindex tls 8572 8573Do not assume a large TLS segment when generating thread-local code. 8574 8575@item -mgprel-ro 8576@opindex mgprel-ro 8577 8578Enable the use of @code{GPREL} relocations in the FDPIC ABI for data 8579that is known to be in read-only sections. It's enabled by default, 8580except for @option{-fpic} or @option{-fpie}: even though it may help 8581make the global offset table smaller, it trades 1 instruction for 4. 8582With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4, 8583one of which may be shared by multiple symbols, and it avoids the need 8584for a GOT entry for the referenced symbol, so it's more likely to be a 8585win. If it is not, @option{-mno-gprel-ro} can be used to disable it. 8586 8587@item -multilib-library-pic 8588@opindex multilib-library-pic 8589 8590Link with the (library, not FD) pic libraries. It's implied by 8591@option{-mlibrary-pic}, as well as by @option{-fPIC} and 8592@option{-fpic} without @option{-mfdpic}. You should never have to use 8593it explicitly. 8594 8595@item -mlinked-fp 8596@opindex mlinked-fp 8597 8598Follow the EABI requirement of always creating a frame pointer whenever 8599a stack frame is allocated. This option is enabled by default and can 8600be disabled with @option{-mno-linked-fp}. 8601 8602@item -mlong-calls 8603@opindex mlong-calls 8604 8605Use indirect addressing to call functions outside the current 8606compilation unit. This allows the functions to be placed anywhere 8607within the 32-bit address space. 8608 8609@item -malign-labels 8610@opindex malign-labels 8611 8612Try to align labels to an 8-byte boundary by inserting nops into the 8613previous packet. This option only has an effect when VLIW packing 8614is enabled. It doesn't create new packets; it merely adds nops to 8615existing ones. 8616 8617@item -mlibrary-pic 8618@opindex mlibrary-pic 8619 8620Generate position-independent EABI code. 8621 8622@item -macc-4 8623@opindex macc-4 8624 8625Use only the first four media accumulator registers. 8626 8627@item -macc-8 8628@opindex macc-8 8629 8630Use all eight media accumulator registers. 8631 8632@item -mpack 8633@opindex mpack 8634 8635Pack VLIW instructions. 8636 8637@item -mno-pack 8638@opindex mno-pack 8639 8640Do not pack VLIW instructions. 8641 8642@item -mno-eflags 8643@opindex mno-eflags 8644 8645Do not mark ABI switches in e_flags. 8646 8647@item -mcond-move 8648@opindex mcond-move 8649 8650Enable the use of conditional-move instructions (default). 8651 8652This switch is mainly for debugging the compiler and will likely be removed 8653in a future version. 8654 8655@item -mno-cond-move 8656@opindex mno-cond-move 8657 8658Disable the use of conditional-move instructions. 8659 8660This switch is mainly for debugging the compiler and will likely be removed 8661in a future version. 8662 8663@item -mscc 8664@opindex mscc 8665 8666Enable the use of conditional set instructions (default). 8667 8668This switch is mainly for debugging the compiler and will likely be removed 8669in a future version. 8670 8671@item -mno-scc 8672@opindex mno-scc 8673 8674Disable the use of conditional set instructions. 8675 8676This switch is mainly for debugging the compiler and will likely be removed 8677in a future version. 8678 8679@item -mcond-exec 8680@opindex mcond-exec 8681 8682Enable the use of conditional execution (default). 8683 8684This switch is mainly for debugging the compiler and will likely be removed 8685in a future version. 8686 8687@item -mno-cond-exec 8688@opindex mno-cond-exec 8689 8690Disable the use of conditional execution. 8691 8692This switch is mainly for debugging the compiler and will likely be removed 8693in a future version. 8694 8695@item -mvliw-branch 8696@opindex mvliw-branch 8697 8698Run a pass to pack branches into VLIW instructions (default). 8699 8700This switch is mainly for debugging the compiler and will likely be removed 8701in a future version. 8702 8703@item -mno-vliw-branch 8704@opindex mno-vliw-branch 8705 8706Do not run a pass to pack branches into VLIW instructions. 8707 8708This switch is mainly for debugging the compiler and will likely be removed 8709in a future version. 8710 8711@item -mmulti-cond-exec 8712@opindex mmulti-cond-exec 8713 8714Enable optimization of @code{&&} and @code{||} in conditional execution 8715(default). 8716 8717This switch is mainly for debugging the compiler and will likely be removed 8718in a future version. 8719 8720@item -mno-multi-cond-exec 8721@opindex mno-multi-cond-exec 8722 8723Disable optimization of @code{&&} and @code{||} in conditional execution. 8724 8725This switch is mainly for debugging the compiler and will likely be removed 8726in a future version. 8727 8728@item -mnested-cond-exec 8729@opindex mnested-cond-exec 8730 8731Enable nested conditional execution optimizations (default). 8732 8733This switch is mainly for debugging the compiler and will likely be removed 8734in a future version. 8735 8736@item -mno-nested-cond-exec 8737@opindex mno-nested-cond-exec 8738 8739Disable nested conditional execution optimizations. 8740 8741This switch is mainly for debugging the compiler and will likely be removed 8742in a future version. 8743 8744@item -moptimize-membar 8745@opindex moptimize-membar 8746 8747This switch removes redundant @code{membar} instructions from the 8748compiler generated code. It is enabled by default. 8749 8750@item -mno-optimize-membar 8751@opindex mno-optimize-membar 8752 8753This switch disables the automatic removal of redundant @code{membar} 8754instructions from the generated code. 8755 8756@item -mtomcat-stats 8757@opindex mtomcat-stats 8758 8759Cause gas to print out tomcat statistics. 8760 8761@item -mcpu=@var{cpu} 8762@opindex mcpu 8763 8764Select the processor type for which to generate code. Possible values are 8765@samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450}, 8766@samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}. 8767 8768@end table 8769 8770@node GNU/Linux Options 8771@subsection GNU/Linux Options 8772 8773These @samp{-m} options are defined for GNU/Linux targets: 8774 8775@table @gcctabopt 8776@item -mglibc 8777@opindex mglibc 8778Use the GNU C library instead of uClibc. This is the default except 8779on @samp{*-*-linux-*uclibc*} targets. 8780 8781@item -muclibc 8782@opindex muclibc 8783Use uClibc instead of the GNU C library. This is the default on 8784@samp{*-*-linux-*uclibc*} targets. 8785@end table 8786 8787@node H8/300 Options 8788@subsection H8/300 Options 8789 8790These @samp{-m} options are defined for the H8/300 implementations: 8791 8792@table @gcctabopt 8793@item -mrelax 8794@opindex mrelax 8795Shorten some address references at link time, when possible; uses the 8796linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300, 8797ld, Using ld}, for a fuller description. 8798 8799@item -mh 8800@opindex mh 8801Generate code for the H8/300H@. 8802 8803@item -ms 8804@opindex ms 8805Generate code for the H8S@. 8806 8807@item -mn 8808@opindex mn 8809Generate code for the H8S and H8/300H in the normal mode. This switch 8810must be used either with @option{-mh} or @option{-ms}. 8811 8812@item -ms2600 8813@opindex ms2600 8814Generate code for the H8S/2600. This switch must be used with @option{-ms}. 8815 8816@item -mint32 8817@opindex mint32 8818Make @code{int} data 32 bits by default. 8819 8820@item -malign-300 8821@opindex malign-300 8822On the H8/300H and H8S, use the same alignment rules as for the H8/300. 8823The default for the H8/300H and H8S is to align longs and floats on 4 8824byte boundaries. 8825@option{-malign-300} causes them to be aligned on 2 byte boundaries. 8826This option has no effect on the H8/300. 8827@end table 8828 8829@node HPPA Options 8830@subsection HPPA Options 8831@cindex HPPA Options 8832 8833These @samp{-m} options are defined for the HPPA family of computers: 8834 8835@table @gcctabopt 8836@item -march=@var{architecture-type} 8837@opindex march 8838Generate code for the specified architecture. The choices for 8839@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA 88401.1, and @samp{2.0} for PA 2.0 processors. Refer to 8841@file{/usr/lib/sched.models} on an HP-UX system to determine the proper 8842architecture option for your machine. Code compiled for lower numbered 8843architectures will run on higher numbered architectures, but not the 8844other way around. 8845 8846@item -mpa-risc-1-0 8847@itemx -mpa-risc-1-1 8848@itemx -mpa-risc-2-0 8849@opindex mpa-risc-1-0 8850@opindex mpa-risc-1-1 8851@opindex mpa-risc-2-0 8852Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively. 8853 8854@item -mbig-switch 8855@opindex mbig-switch 8856Generate code suitable for big switch tables. Use this option only if 8857the assembler/linker complain about out of range branches within a switch 8858table. 8859 8860@item -mjump-in-delay 8861@opindex mjump-in-delay 8862Fill delay slots of function calls with unconditional jump instructions 8863by modifying the return pointer for the function call to be the target 8864of the conditional jump. 8865 8866@item -mdisable-fpregs 8867@opindex mdisable-fpregs 8868Prevent floating point registers from being used in any manner. This is 8869necessary for compiling kernels which perform lazy context switching of 8870floating point registers. If you use this option and attempt to perform 8871floating point operations, the compiler will abort. 8872 8873@item -mdisable-indexing 8874@opindex mdisable-indexing 8875Prevent the compiler from using indexing address modes. This avoids some 8876rather obscure problems when compiling MIG generated code under MACH@. 8877 8878@item -mno-space-regs 8879@opindex mno-space-regs 8880Generate code that assumes the target has no space registers. This allows 8881GCC to generate faster indirect calls and use unscaled index address modes. 8882 8883Such code is suitable for level 0 PA systems and kernels. 8884 8885@item -mfast-indirect-calls 8886@opindex mfast-indirect-calls 8887Generate code that assumes calls never cross space boundaries. This 8888allows GCC to emit code which performs faster indirect calls. 8889 8890This option will not work in the presence of shared libraries or nested 8891functions. 8892 8893@item -mfixed-range=@var{register-range} 8894@opindex mfixed-range 8895Generate code treating the given register range as fixed registers. 8896A fixed register is one that the register allocator can not use. This is 8897useful when compiling kernel code. A register range is specified as 8898two registers separated by a dash. Multiple register ranges can be 8899specified separated by a comma. 8900 8901@item -mlong-load-store 8902@opindex mlong-load-store 8903Generate 3-instruction load and store sequences as sometimes required by 8904the HP-UX 10 linker. This is equivalent to the @samp{+k} option to 8905the HP compilers. 8906 8907@item -mportable-runtime 8908@opindex mportable-runtime 8909Use the portable calling conventions proposed by HP for ELF systems. 8910 8911@item -mgas 8912@opindex mgas 8913Enable the use of assembler directives only GAS understands. 8914 8915@item -mschedule=@var{cpu-type} 8916@opindex mschedule 8917Schedule code according to the constraints for the machine type 8918@var{cpu-type}. The choices for @var{cpu-type} are @samp{700} 8919@samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer 8920to @file{/usr/lib/sched.models} on an HP-UX system to determine the 8921proper scheduling option for your machine. The default scheduling is 8922@samp{8000}. 8923 8924@item -mlinker-opt 8925@opindex mlinker-opt 8926Enable the optimization pass in the HP-UX linker. Note this makes symbolic 8927debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9 8928linkers in which they give bogus error messages when linking some programs. 8929 8930@item -msoft-float 8931@opindex msoft-float 8932Generate output containing library calls for floating point. 8933@strong{Warning:} the requisite libraries are not available for all HPPA 8934targets. Normally the facilities of the machine's usual C compiler are 8935used, but this cannot be done directly in cross-compilation. You must make 8936your own arrangements to provide suitable library functions for 8937cross-compilation. The embedded target @samp{hppa1.1-*-pro} 8938does provide software floating point support. 8939 8940@option{-msoft-float} changes the calling convention in the output file; 8941therefore, it is only useful if you compile @emph{all} of a program with 8942this option. In particular, you need to compile @file{libgcc.a}, the 8943library that comes with GCC, with @option{-msoft-float} in order for 8944this to work. 8945 8946@item -msio 8947@opindex msio 8948Generate the predefine, @code{_SIO}, for server IO@. The default is 8949@option{-mwsio}. This generates the predefines, @code{__hp9000s700}, 8950@code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These 8951options are available under HP-UX and HI-UX@. 8952 8953@item -mgnu-ld 8954@opindex gnu-ld 8955Use GNU ld specific options. This passes @option{-shared} to ld when 8956building a shared library. It is the default when GCC is configured, 8957explicitly or implicitly, with the GNU linker. This option does not 8958have any affect on which ld is called, it only changes what parameters 8959are passed to that ld. The ld that is called is determined by the 8960@option{--with-ld} configure option, GCC's program search path, and 8961finally by the user's @env{PATH}. The linker used by GCC can be printed 8962using @samp{which `gcc -print-prog-name=ld`}. This option is only available 8963on the 64 bit HP-UX GCC, i.e. configured with @samp{hppa*64*-*-hpux*}. 8964 8965@item -mhp-ld 8966@opindex hp-ld 8967Use HP ld specific options. This passes @option{-b} to ld when building 8968a shared library and passes @option{+Accept TypeMismatch} to ld on all 8969links. It is the default when GCC is configured, explicitly or 8970implicitly, with the HP linker. This option does not have any affect on 8971which ld is called, it only changes what parameters are passed to that 8972ld. The ld that is called is determined by the @option{--with-ld} 8973configure option, GCC's program search path, and finally by the user's 8974@env{PATH}. The linker used by GCC can be printed using @samp{which 8975`gcc -print-prog-name=ld`}. This option is only available on the 64 bit 8976HP-UX GCC, i.e. configured with @samp{hppa*64*-*-hpux*}. 8977 8978@item -mlong-calls 8979@opindex mno-long-calls 8980Generate code that uses long call sequences. This ensures that a call 8981is always able to reach linker generated stubs. The default is to generate 8982long calls only when the distance from the call site to the beginning 8983of the function or translation unit, as the case may be, exceeds a 8984predefined limit set by the branch type being used. The limits for 8985normal calls are 7,600,000 and 240,000 bytes, respectively for the 8986PA 2.0 and PA 1.X architectures. Sibcalls are always limited at 8987240,000 bytes. 8988 8989Distances are measured from the beginning of functions when using the 8990@option{-ffunction-sections} option, or when using the @option{-mgas} 8991and @option{-mno-portable-runtime} options together under HP-UX with 8992the SOM linker. 8993 8994It is normally not desirable to use this option as it will degrade 8995performance. However, it may be useful in large applications, 8996particularly when partial linking is used to build the application. 8997 8998The types of long calls used depends on the capabilities of the 8999assembler and linker, and the type of code being generated. The 9000impact on systems that support long absolute calls, and long pic 9001symbol-difference or pc-relative calls should be relatively small. 9002However, an indirect call is used on 32-bit ELF systems in pic code 9003and it is quite long. 9004 9005@item -munix=@var{unix-std} 9006@opindex march 9007Generate compiler predefines and select a startfile for the specified 9008UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95} 9009and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95} 9010is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX 901111.11 and later. The default values are @samp{93} for HP-UX 10.00, 9012@samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11 9013and later. 9014 9015@option{-munix=93} provides the same predefines as GCC 3.3 and 3.4. 9016@option{-munix=95} provides additional predefines for @code{XOPEN_UNIX} 9017and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}. 9018@option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX}, 9019@code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and 9020@code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}. 9021 9022It is @emph{important} to note that this option changes the interfaces 9023for various library routines. It also affects the operational behavior 9024of the C library. Thus, @emph{extreme} care is needed in using this 9025option. 9026 9027Library code that is intended to operate with more than one UNIX 9028standard must test, set and restore the variable @var{__xpg4_extended_mask} 9029as appropriate. Most GNU software doesn't provide this capability. 9030 9031@item -nolibdld 9032@opindex nolibdld 9033Suppress the generation of link options to search libdld.sl when the 9034@option{-static} option is specified on HP-UX 10 and later. 9035 9036@item -static 9037@opindex static 9038The HP-UX implementation of setlocale in libc has a dependency on 9039libdld.sl. There isn't an archive version of libdld.sl. Thus, 9040when the @option{-static} option is specified, special link options 9041are needed to resolve this dependency. 9042 9043On HP-UX 10 and later, the GCC driver adds the necessary options to 9044link with libdld.sl when the @option{-static} option is specified. 9045This causes the resulting binary to be dynamic. On the 64-bit port, 9046the linkers generate dynamic binaries by default in any case. The 9047@option{-nolibdld} option can be used to prevent the GCC driver from 9048adding these link options. 9049 9050@item -threads 9051@opindex threads 9052Add support for multithreading with the @dfn{dce thread} library 9053under HP-UX@. This option sets flags for both the preprocessor and 9054linker. 9055@end table 9056 9057@node i386 and x86-64 Options 9058@subsection Intel 386 and AMD x86-64 Options 9059@cindex i386 Options 9060@cindex x86-64 Options 9061@cindex Intel 386 Options 9062@cindex AMD x86-64 Options 9063 9064These @samp{-m} options are defined for the i386 and x86-64 family of 9065computers: 9066 9067@table @gcctabopt 9068@item -mtune=@var{cpu-type} 9069@opindex mtune 9070Tune to @var{cpu-type} everything applicable about the generated code, except 9071for the ABI and the set of available instructions. The choices for 9072@var{cpu-type} are: 9073@table @emph 9074@item generic 9075Produce code optimized for the most common IA32/AMD64/EM64T processors. 9076If you know the CPU on which your code will run, then you should use 9077the corresponding @option{-mtune} option instead of 9078@option{-mtune=generic}. But, if you do not know exactly what CPU users 9079of your application will have, then you should use this option. 9080 9081As new processors are deployed in the marketplace, the behavior of this 9082option will change. Therefore, if you upgrade to a newer version of 9083GCC, the code generated option will change to reflect the processors 9084that were most common when that version of GCC was released. 9085 9086There is no @option{-march=generic} option because @option{-march} 9087indicates the instruction set the compiler can use, and there is no 9088generic instruction set applicable to all processors. In contrast, 9089@option{-mtune} indicates the processor (or, in this case, collection of 9090processors) for which the code is optimized. 9091@item native 9092This selects the CPU to tune for at compilation time by determining 9093the processor type of the compiling machine. Using @option{-mtune=native} 9094will produce code optimized for the local machine under the constraints 9095of the selected instruction set. Using @option{-march=native} will 9096enable all instruction subsets supported by the local machine (hence 9097the result might not run on different machines). 9098@item i386 9099Original Intel's i386 CPU@. 9100@item i486 9101Intel's i486 CPU@. (No scheduling is implemented for this chip.) 9102@item i586, pentium 9103Intel Pentium CPU with no MMX support. 9104@item pentium-mmx 9105Intel PentiumMMX CPU based on Pentium core with MMX instruction set support. 9106@item pentiumpro 9107Intel PentiumPro CPU@. 9108@item i686 9109Same as @code{generic}, but when used as @code{march} option, PentiumPro 9110instruction set will be used, so the code will run on all i686 family chips. 9111@item pentium2 9112Intel Pentium2 CPU based on PentiumPro core with MMX instruction set support. 9113@item pentium3, pentium3m 9114Intel Pentium3 CPU based on PentiumPro core with MMX and SSE instruction set 9115support. 9116@item pentium-m 9117Low power version of Intel Pentium3 CPU with MMX, SSE and SSE2 instruction set 9118support. Used by Centrino notebooks. 9119@item pentium4, pentium4m 9120Intel Pentium4 CPU with MMX, SSE and SSE2 instruction set support. 9121@item prescott 9122Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction 9123set support. 9124@item nocona 9125Improved version of Intel Pentium4 CPU with 64-bit extensions, MMX, SSE, 9126SSE2 and SSE3 instruction set support. 9127@item core2 9128Intel Core2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3 9129instruction set support. 9130@item k6 9131AMD K6 CPU with MMX instruction set support. 9132@item k6-2, k6-3 9133Improved versions of AMD K6 CPU with MMX and 3dNOW! instruction set support. 9134@item athlon, athlon-tbird 9135AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and SSE prefetch instructions 9136support. 9137@item athlon-4, athlon-xp, athlon-mp 9138Improved AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and full SSE 9139instruction set support. 9140@item k8, opteron, athlon64, athlon-fx 9141AMD K8 core based CPUs with x86-64 instruction set support. (This supersets 9142MMX, SSE, SSE2, 3dNOW!, enhanced 3dNOW! and 64-bit instruction set extensions.) 9143@item k8-sse3, opteron-sse3, athlon64-sse3 9144Improved versions of k8, opteron and athlon64 with SSE3 instruction set support. 9145@item amdfam10, barcelona 9146AMD Family 10h core based CPUs with x86-64 instruction set support. (This 9147supersets MMX, SSE, SSE2, SSE3, SSE4A, 3dNOW!, enhanced 3dNOW!, ABM and 64-bit 9148instruction set extensions.) 9149@item winchip-c6 9150IDT Winchip C6 CPU, dealt in same way as i486 with additional MMX instruction 9151set support. 9152@item winchip2 9153IDT Winchip2 CPU, dealt in same way as i486 with additional MMX and 3dNOW! 9154instruction set support. 9155@item c3 9156Via C3 CPU with MMX and 3dNOW! instruction set support. (No scheduling is 9157implemented for this chip.) 9158@item c3-2 9159Via C3-2 CPU with MMX and SSE instruction set support. (No scheduling is 9160implemented for this chip.) 9161@item geode 9162Embedded AMD CPU with MMX and 3dNOW! instruction set support. 9163@end table 9164 9165While picking a specific @var{cpu-type} will schedule things appropriately 9166for that particular chip, the compiler will not generate any code that 9167does not run on the i386 without the @option{-march=@var{cpu-type}} option 9168being used. 9169 9170@item -march=@var{cpu-type} 9171@opindex march 9172Generate instructions for the machine type @var{cpu-type}. The choices 9173for @var{cpu-type} are the same as for @option{-mtune}. Moreover, 9174specifying @option{-march=@var{cpu-type}} implies @option{-mtune=@var{cpu-type}}. 9175 9176@item -mcpu=@var{cpu-type} 9177@opindex mcpu 9178A deprecated synonym for @option{-mtune}. 9179 9180@item -m386 9181@itemx -m486 9182@itemx -mpentium 9183@itemx -mpentiumpro 9184@opindex m386 9185@opindex m486 9186@opindex mpentium 9187@opindex mpentiumpro 9188These options are synonyms for @option{-mtune=i386}, @option{-mtune=i486}, 9189@option{-mtune=pentium}, and @option{-mtune=pentiumpro} respectively. 9190These synonyms are deprecated. 9191 9192@item -mfpmath=@var{unit} 9193@opindex march 9194Generate floating point arithmetics for selected unit @var{unit}. The choices 9195for @var{unit} are: 9196 9197@table @samp 9198@item 387 9199Use the standard 387 floating point coprocessor present majority of chips and 9200emulated otherwise. Code compiled with this option will run almost everywhere. 9201The temporary results are computed in 80bit precision instead of precision 9202specified by the type resulting in slightly different results compared to most 9203of other chips. See @option{-ffloat-store} for more detailed description. 9204 9205This is the default choice for i386 compiler. 9206 9207@item sse 9208Use scalar floating point instructions present in the SSE instruction set. 9209This instruction set is supported by Pentium3 and newer chips, in the AMD line 9210by Athlon-4, Athlon-xp and Athlon-mp chips. The earlier version of SSE 9211instruction set supports only single precision arithmetics, thus the double and 9212extended precision arithmetics is still done using 387. Later version, present 9213only in Pentium4 and the future AMD x86-64 chips supports double precision 9214arithmetics too. 9215 9216For the i386 compiler, you need to use @option{-march=@var{cpu-type}}, @option{-msse} 9217or @option{-msse2} switches to enable SSE extensions and make this option 9218effective. For the x86-64 compiler, these extensions are enabled by default. 9219 9220The resulting code should be considerably faster in the majority of cases and avoid 9221the numerical instability problems of 387 code, but may break some existing 9222code that expects temporaries to be 80bit. 9223 9224This is the default choice for the x86-64 compiler. 9225 9226@item sse,387 9227Attempt to utilize both instruction sets at once. This effectively double the 9228amount of available registers and on chips with separate execution units for 9229387 and SSE the execution resources too. Use this option with care, as it is 9230still experimental, because the GCC register allocator does not model separate 9231functional units well resulting in instable performance. 9232@end table 9233 9234@item -masm=@var{dialect} 9235@opindex masm=@var{dialect} 9236Output asm instructions using selected @var{dialect}. Supported 9237choices are @samp{intel} or @samp{att} (the default one). Darwin does 9238not support @samp{intel}. 9239 9240@item -mieee-fp 9241@itemx -mno-ieee-fp 9242@opindex mieee-fp 9243@opindex mno-ieee-fp 9244Control whether or not the compiler uses IEEE floating point 9245comparisons. These handle correctly the case where the result of a 9246comparison is unordered. 9247 9248@item -msoft-float 9249@opindex msoft-float 9250Generate output containing library calls for floating point. 9251@strong{Warning:} the requisite libraries are not part of GCC@. 9252Normally the facilities of the machine's usual C compiler are used, but 9253this can't be done directly in cross-compilation. You must make your 9254own arrangements to provide suitable library functions for 9255cross-compilation. 9256 9257On machines where a function returns floating point results in the 80387 9258register stack, some floating point opcodes may be emitted even if 9259@option{-msoft-float} is used. 9260 9261@item -mno-fp-ret-in-387 9262@opindex mno-fp-ret-in-387 9263Do not use the FPU registers for return values of functions. 9264 9265The usual calling convention has functions return values of types 9266@code{float} and @code{double} in an FPU register, even if there 9267is no FPU@. The idea is that the operating system should emulate 9268an FPU@. 9269 9270The option @option{-mno-fp-ret-in-387} causes such values to be returned 9271in ordinary CPU registers instead. 9272 9273@item -mno-fancy-math-387 9274@opindex mno-fancy-math-387 9275Some 387 emulators do not support the @code{sin}, @code{cos} and 9276@code{sqrt} instructions for the 387. Specify this option to avoid 9277generating those instructions. This option is the default on 9278OpenBSD and NetBSD@. This option is overridden when @option{-march} 9279indicates that the target cpu will always have an FPU and so the 9280instruction will not need emulation. As of revision 2.6.1, these 9281instructions are not generated unless you also use the 9282@option{-funsafe-math-optimizations} switch. 9283 9284@item -malign-double 9285@itemx -mno-align-double 9286@opindex malign-double 9287@opindex mno-align-double 9288Control whether GCC aligns @code{double}, @code{long double}, and 9289@code{long long} variables on a two word boundary or a one word 9290boundary. Aligning @code{double} variables on a two word boundary will 9291produce code that runs somewhat faster on a @samp{Pentium} at the 9292expense of more memory. 9293 9294On x86-64, @option{-malign-double} is enabled by default. 9295 9296@strong{Warning:} if you use the @option{-malign-double} switch, 9297structures containing the above types will be aligned differently than 9298the published application binary interface specifications for the 386 9299and will not be binary compatible with structures in code compiled 9300without that switch. 9301 9302@item -m96bit-long-double 9303@itemx -m128bit-long-double 9304@opindex m96bit-long-double 9305@opindex m128bit-long-double 9306These switches control the size of @code{long double} type. The i386 9307application binary interface specifies the size to be 96 bits, 9308so @option{-m96bit-long-double} is the default in 32 bit mode. 9309 9310Modern architectures (Pentium and newer) would prefer @code{long double} 9311to be aligned to an 8 or 16 byte boundary. In arrays or structures 9312conforming to the ABI, this would not be possible. So specifying a 9313@option{-m128bit-long-double} will align @code{long double} 9314to a 16 byte boundary by padding the @code{long double} with an additional 931532 bit zero. 9316 9317In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as 9318its ABI specifies that @code{long double} is to be aligned on 16 byte boundary. 9319 9320Notice that neither of these options enable any extra precision over the x87 9321standard of 80 bits for a @code{long double}. 9322 9323@strong{Warning:} if you override the default value for your target ABI, the 9324structures and arrays containing @code{long double} variables will change 9325their size as well as function calling convention for function taking 9326@code{long double} will be modified. Hence they will not be binary 9327compatible with arrays or structures in code compiled without that switch. 9328 9329@item -mmlarge-data-threshold=@var{number} 9330@opindex mlarge-data-threshold=@var{number} 9331When @option{-mcmodel=medium} is specified, the data greater than 9332@var{threshold} are placed in large data section. This value must be the 9333same across all object linked into the binary and defaults to 65535. 9334 9335@item -msvr3-shlib 9336@itemx -mno-svr3-shlib 9337@opindex msvr3-shlib 9338@opindex mno-svr3-shlib 9339Control whether GCC places uninitialized local variables into the 9340@code{bss} or @code{data} segments. @option{-msvr3-shlib} places them 9341into @code{bss}. These options are meaningful only on System V Release 3. 9342 9343@item -mrtd 9344@opindex mrtd 9345Use a different function-calling convention, in which functions that 9346take a fixed number of arguments return with the @code{ret} @var{num} 9347instruction, which pops their arguments while returning. This saves one 9348instruction in the caller since there is no need to pop the arguments 9349there. 9350 9351You can specify that an individual function is called with this calling 9352sequence with the function attribute @samp{stdcall}. You can also 9353override the @option{-mrtd} option by using the function attribute 9354@samp{cdecl}. @xref{Function Attributes}. 9355 9356@strong{Warning:} this calling convention is incompatible with the one 9357normally used on Unix, so you cannot use it if you need to call 9358libraries compiled with the Unix compiler. 9359 9360Also, you must provide function prototypes for all functions that 9361take variable numbers of arguments (including @code{printf}); 9362otherwise incorrect code will be generated for calls to those 9363functions. 9364 9365In addition, seriously incorrect code will result if you call a 9366function with too many arguments. (Normally, extra arguments are 9367harmlessly ignored.) 9368 9369@item -mregparm=@var{num} 9370@opindex mregparm 9371Control how many registers are used to pass integer arguments. By 9372default, no registers are used to pass arguments, and at most 3 9373registers can be used. You can control this behavior for a specific 9374function by using the function attribute @samp{regparm}. 9375@xref{Function Attributes}. 9376 9377@strong{Warning:} if you use this switch, and 9378@var{num} is nonzero, then you must build all modules with the same 9379value, including any libraries. This includes the system libraries and 9380startup modules. 9381 9382@item -msseregparm 9383@opindex msseregparm 9384Use SSE register passing conventions for float and double arguments 9385and return values. You can control this behavior for a specific 9386function by using the function attribute @samp{sseregparm}. 9387@xref{Function Attributes}. 9388 9389@strong{Warning:} if you use this switch then you must build all 9390modules with the same value, including any libraries. This includes 9391the system libraries and startup modules. 9392 9393@item -mstackrealign 9394@opindex mstackrealign 9395Realign the stack at entry. On the Intel x86, the 9396@option{-mstackrealign} option will generate an alternate prologue and 9397epilogue that realigns the runtime stack. This supports mixing legacy 9398codes that keep a 4-byte aligned stack with modern codes that keep a 939916-byte stack for SSE compatibility. The alternate prologue and 9400epilogue are slower and bigger than the regular ones, and the 9401alternate prologue requires an extra scratch register; this lowers the 9402number of registers available if used in conjunction with the 9403@code{regparm} attribute. The @option{-mstackrealign} option is 9404incompatible with the nested function prologue; this is considered a 9405hard error. See also the attribute @code{force_align_arg_pointer}, 9406applicable to individual functions. 9407 9408@item -mpreferred-stack-boundary=@var{num} 9409@opindex mpreferred-stack-boundary 9410Attempt to keep the stack boundary aligned to a 2 raised to @var{num} 9411byte boundary. If @option{-mpreferred-stack-boundary} is not specified, 9412the default is 4 (16 bytes or 128 bits). 9413 9414On Pentium and PentiumPro, @code{double} and @code{long double} values 9415should be aligned to an 8 byte boundary (see @option{-malign-double}) or 9416suffer significant run time performance penalties. On Pentium III, the 9417Streaming SIMD Extension (SSE) data type @code{__m128} may not work 9418properly if it is not 16 byte aligned. 9419 9420To ensure proper alignment of this values on the stack, the stack boundary 9421must be as aligned as that required by any value stored on the stack. 9422Further, every function must be generated such that it keeps the stack 9423aligned. Thus calling a function compiled with a higher preferred 9424stack boundary from a function compiled with a lower preferred stack 9425boundary will most likely misalign the stack. It is recommended that 9426libraries that use callbacks always use the default setting. 9427 9428This extra alignment does consume extra stack space, and generally 9429increases code size. Code that is sensitive to stack space usage, such 9430as embedded systems and operating system kernels, may want to reduce the 9431preferred alignment to @option{-mpreferred-stack-boundary=2}. 9432 9433@item -mmmx 9434@itemx -mno-mmx 9435@item -msse 9436@itemx -mno-sse 9437@item -msse2 9438@itemx -mno-sse2 9439@item -msse3 9440@itemx -mno-sse3 9441@item -mssse3 9442@itemx -mno-ssse3 9443@item -msse4a 9444@item -mno-sse4a 9445@item -m3dnow 9446@itemx -mno-3dnow 9447@item -mpopcnt 9448@itemx -mno-popcnt 9449@item -mabm 9450@itemx -mno-abm 9451@item -maes 9452@itemx -mno-aes 9453@opindex mmmx 9454@opindex mno-mmx 9455@opindex msse 9456@opindex mno-sse 9457@opindex m3dnow 9458@opindex mno-3dnow 9459These switches enable or disable the use of instructions in the MMX, 9460SSE, SSE2, SSE3, SSSE3, SSE4A, ABM, AES or 3DNow! extended 9461instruction sets. These extensions are also available as built-in 9462functions: see @ref{X86 Built-in Functions}, for details of the functions 9463enabled and disabled by these switches. 9464 9465To have SSE/SSE2 instructions generated automatically from floating-point 9466code (as opposed to 387 instructions), see @option{-mfpmath=sse}. 9467 9468These options will enable GCC to use these extended instructions in 9469generated code, even without @option{-mfpmath=sse}. Applications which 9470perform runtime CPU detection must compile separate files for each 9471supported architecture, using the appropriate flags. In particular, 9472the file containing the CPU detection code should be compiled without 9473these options. 9474 9475@item -mpush-args 9476@itemx -mno-push-args 9477@opindex mpush-args 9478@opindex mno-push-args 9479Use PUSH operations to store outgoing parameters. This method is shorter 9480and usually equally fast as method using SUB/MOV operations and is enabled 9481by default. In some cases disabling it may improve performance because of 9482improved scheduling and reduced dependencies. 9483 9484@item -maccumulate-outgoing-args 9485@opindex maccumulate-outgoing-args 9486If enabled, the maximum amount of space required for outgoing arguments will be 9487computed in the function prologue. This is faster on most modern CPUs 9488because of reduced dependencies, improved scheduling and reduced stack usage 9489when preferred stack boundary is not equal to 2. The drawback is a notable 9490increase in code size. This switch implies @option{-mno-push-args}. 9491 9492@item -mthreads 9493@opindex mthreads 9494Support thread-safe exception handling on @samp{Mingw32}. Code that relies 9495on thread-safe exception handling must compile and link all code with the 9496@option{-mthreads} option. When compiling, @option{-mthreads} defines 9497@option{-D_MT}; when linking, it links in a special thread helper library 9498@option{-lmingwthrd} which cleans up per thread exception handling data. 9499 9500@item -mno-align-stringops 9501@opindex mno-align-stringops 9502Do not align destination of inlined string operations. This switch reduces 9503code size and improves performance in case the destination is already aligned, 9504but GCC doesn't know about it. 9505 9506@item -minline-all-stringops 9507@opindex minline-all-stringops 9508By default GCC inlines string operations only when destination is known to be 9509aligned at least to 4 byte boundary. This enables more inlining, increase code 9510size, but may improve performance of code that depends on fast memcpy, strlen 9511and memset for short lengths. 9512 9513@item -momit-leaf-frame-pointer 9514@opindex momit-leaf-frame-pointer 9515Don't keep the frame pointer in a register for leaf functions. This 9516avoids the instructions to save, set up and restore frame pointers and 9517makes an extra register available in leaf functions. The option 9518@option{-fomit-frame-pointer} removes the frame pointer for all functions 9519which might make debugging harder. 9520 9521@item -mtls-direct-seg-refs 9522@itemx -mno-tls-direct-seg-refs 9523@opindex mtls-direct-seg-refs 9524Controls whether TLS variables may be accessed with offsets from the 9525TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit), 9526or whether the thread base pointer must be added. Whether or not this 9527is legal depends on the operating system, and whether it maps the 9528segment to cover the entire TLS area. 9529 9530For systems that use GNU libc, the default is on. 9531@end table 9532 9533These @samp{-m} switches are supported in addition to the above 9534on AMD x86-64 processors in 64-bit environments. 9535 9536@table @gcctabopt 9537@item -m32 9538@itemx -m64 9539@opindex m32 9540@opindex m64 9541Generate code for a 32-bit or 64-bit environment. 9542The 32-bit environment sets int, long and pointer to 32 bits and 9543generates code that runs on any i386 system. 9544The 64-bit environment sets int to 32 bits and long and pointer 9545to 64 bits and generates code for AMD's x86-64 architecture. For 9546darwin only the -m64 option turns off the @option{-fno-pic} and 9547@option{-mdynamic-no-pic} options. 9548 9549@item -mno-red-zone 9550@opindex no-red-zone 9551Do not use a so called red zone for x86-64 code. The red zone is mandated 9552by the x86-64 ABI, it is a 128-byte area beyond the location of the 9553stack pointer that will not be modified by signal or interrupt handlers 9554and therefore can be used for temporary data without adjusting the stack 9555pointer. The flag @option{-mno-red-zone} disables this red zone. 9556 9557@item -mcmodel=small 9558@opindex mcmodel=small 9559Generate code for the small code model: the program and its symbols must 9560be linked in the lower 2 GB of the address space. Pointers are 64 bits. 9561Programs can be statically or dynamically linked. This is the default 9562code model. 9563 9564@item -mcmodel=kernel 9565@opindex mcmodel=kernel 9566Generate code for the kernel code model. The kernel runs in the 9567negative 2 GB of the address space. 9568This model has to be used for Linux kernel code. 9569 9570@item -mcmodel=medium 9571@opindex mcmodel=medium 9572Generate code for the medium model: The program is linked in the lower 2 9573GB of the address space but symbols can be located anywhere in the 9574address space. Programs can be statically or dynamically linked, but 9575building of shared libraries are not supported with the medium model. 9576 9577@item -mcmodel=large 9578@opindex mcmodel=large 9579Generate code for the large model: This model makes no assumptions 9580about addresses and sizes of sections. Currently GCC does not implement 9581this model. 9582@end table 9583 9584@node IA-64 Options 9585@subsection IA-64 Options 9586@cindex IA-64 Options 9587 9588These are the @samp{-m} options defined for the Intel IA-64 architecture. 9589 9590@table @gcctabopt 9591@item -mbig-endian 9592@opindex mbig-endian 9593Generate code for a big endian target. This is the default for HP-UX@. 9594 9595@item -mlittle-endian 9596@opindex mlittle-endian 9597Generate code for a little endian target. This is the default for AIX5 9598and GNU/Linux. 9599 9600@item -mgnu-as 9601@itemx -mno-gnu-as 9602@opindex mgnu-as 9603@opindex mno-gnu-as 9604Generate (or don't) code for the GNU assembler. This is the default. 9605@c Also, this is the default if the configure option @option{--with-gnu-as} 9606@c is used. 9607 9608@item -mgnu-ld 9609@itemx -mno-gnu-ld 9610@opindex mgnu-ld 9611@opindex mno-gnu-ld 9612Generate (or don't) code for the GNU linker. This is the default. 9613@c Also, this is the default if the configure option @option{--with-gnu-ld} 9614@c is used. 9615 9616@item -mno-pic 9617@opindex mno-pic 9618Generate code that does not use a global pointer register. The result 9619is not position independent code, and violates the IA-64 ABI@. 9620 9621@item -mvolatile-asm-stop 9622@itemx -mno-volatile-asm-stop 9623@opindex mvolatile-asm-stop 9624@opindex mno-volatile-asm-stop 9625Generate (or don't) a stop bit immediately before and after volatile asm 9626statements. 9627 9628@item -mregister-names 9629@itemx -mno-register-names 9630@opindex mregister-names 9631@opindex mno-register-names 9632Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for 9633the stacked registers. This may make assembler output more readable. 9634 9635@item -mno-sdata 9636@itemx -msdata 9637@opindex mno-sdata 9638@opindex msdata 9639Disable (or enable) optimizations that use the small data section. This may 9640be useful for working around optimizer bugs. 9641 9642@item -mconstant-gp 9643@opindex mconstant-gp 9644Generate code that uses a single constant global pointer value. This is 9645useful when compiling kernel code. 9646 9647@item -mauto-pic 9648@opindex mauto-pic 9649Generate code that is self-relocatable. This implies @option{-mconstant-gp}. 9650This is useful when compiling firmware code. 9651 9652@item -minline-float-divide-min-latency 9653@opindex minline-float-divide-min-latency 9654Generate code for inline divides of floating point values 9655using the minimum latency algorithm. 9656 9657@item -minline-float-divide-max-throughput 9658@opindex minline-float-divide-max-throughput 9659Generate code for inline divides of floating point values 9660using the maximum throughput algorithm. 9661 9662@item -minline-int-divide-min-latency 9663@opindex minline-int-divide-min-latency 9664Generate code for inline divides of integer values 9665using the minimum latency algorithm. 9666 9667@item -minline-int-divide-max-throughput 9668@opindex minline-int-divide-max-throughput 9669Generate code for inline divides of integer values 9670using the maximum throughput algorithm. 9671 9672@item -minline-sqrt-min-latency 9673@opindex minline-sqrt-min-latency 9674Generate code for inline square roots 9675using the minimum latency algorithm. 9676 9677@item -minline-sqrt-max-throughput 9678@opindex minline-sqrt-max-throughput 9679Generate code for inline square roots 9680using the maximum throughput algorithm. 9681 9682@item -mno-dwarf2-asm 9683@itemx -mdwarf2-asm 9684@opindex mno-dwarf2-asm 9685@opindex mdwarf2-asm 9686Don't (or do) generate assembler code for the DWARF2 line number debugging 9687info. This may be useful when not using the GNU assembler. 9688 9689@item -mearly-stop-bits 9690@itemx -mno-early-stop-bits 9691@opindex mearly-stop-bits 9692@opindex mno-early-stop-bits 9693Allow stop bits to be placed earlier than immediately preceding the 9694instruction that triggered the stop bit. This can improve instruction 9695scheduling, but does not always do so. 9696 9697@item -mfixed-range=@var{register-range} 9698@opindex mfixed-range 9699Generate code treating the given register range as fixed registers. 9700A fixed register is one that the register allocator can not use. This is 9701useful when compiling kernel code. A register range is specified as 9702two registers separated by a dash. Multiple register ranges can be 9703specified separated by a comma. 9704 9705@item -mtls-size=@var{tls-size} 9706@opindex mtls-size 9707Specify bit size of immediate TLS offsets. Valid values are 14, 22, and 970864. 9709 9710@item -mtune=@var{cpu-type} 9711@opindex mtune 9712Tune the instruction scheduling for a particular CPU, Valid values are 9713itanium, itanium1, merced, itanium2, and mckinley. 9714 9715@item -mt 9716@itemx -pthread 9717@opindex mt 9718@opindex pthread 9719Add support for multithreading using the POSIX threads library. This 9720option sets flags for both the preprocessor and linker. It does 9721not affect the thread safety of object code produced by the compiler or 9722that of libraries supplied with it. These are HP-UX specific flags. 9723 9724@item -milp32 9725@itemx -mlp64 9726@opindex milp32 9727@opindex mlp64 9728Generate code for a 32-bit or 64-bit environment. 9729The 32-bit environment sets int, long and pointer to 32 bits. 9730The 64-bit environment sets int to 32 bits and long and pointer 9731to 64 bits. These are HP-UX specific flags. 9732 9733@item -mno-sched-br-data-spec 9734@itemx -msched-br-data-spec 9735@opindex mno-sched-br-data-spec 9736@opindex msched-br-data-spec 9737(Dis/En)able data speculative scheduling before reload. 9738This will result in generation of the ld.a instructions and 9739the corresponding check instructions (ld.c / chk.a). 9740The default is 'disable'. 9741 9742@item -msched-ar-data-spec 9743@itemx -mno-sched-ar-data-spec 9744@opindex msched-ar-data-spec 9745@opindex mno-sched-ar-data-spec 9746(En/Dis)able data speculative scheduling after reload. 9747This will result in generation of the ld.a instructions and 9748the corresponding check instructions (ld.c / chk.a). 9749The default is 'enable'. 9750 9751@item -mno-sched-control-spec 9752@itemx -msched-control-spec 9753@opindex mno-sched-control-spec 9754@opindex msched-control-spec 9755(Dis/En)able control speculative scheduling. This feature is 9756available only during region scheduling (i.e. before reload). 9757This will result in generation of the ld.s instructions and 9758the corresponding check instructions chk.s . 9759The default is 'disable'. 9760 9761@item -msched-br-in-data-spec 9762@itemx -mno-sched-br-in-data-spec 9763@opindex msched-br-in-data-spec 9764@opindex mno-sched-br-in-data-spec 9765(En/Dis)able speculative scheduling of the instructions that 9766are dependent on the data speculative loads before reload. 9767This is effective only with @option{-msched-br-data-spec} enabled. 9768The default is 'enable'. 9769 9770@item -msched-ar-in-data-spec 9771@itemx -mno-sched-ar-in-data-spec 9772@opindex msched-ar-in-data-spec 9773@opindex mno-sched-ar-in-data-spec 9774(En/Dis)able speculative scheduling of the instructions that 9775are dependent on the data speculative loads after reload. 9776This is effective only with @option{-msched-ar-data-spec} enabled. 9777The default is 'enable'. 9778 9779@item -msched-in-control-spec 9780@itemx -mno-sched-in-control-spec 9781@opindex msched-in-control-spec 9782@opindex mno-sched-in-control-spec 9783(En/Dis)able speculative scheduling of the instructions that 9784are dependent on the control speculative loads. 9785This is effective only with @option{-msched-control-spec} enabled. 9786The default is 'enable'. 9787 9788@item -msched-ldc 9789@itemx -mno-sched-ldc 9790@opindex msched-ldc 9791@opindex mno-sched-ldc 9792(En/Dis)able use of simple data speculation checks ld.c . 9793If disabled, only chk.a instructions will be emitted to check 9794data speculative loads. 9795The default is 'enable'. 9796 9797@item -mno-sched-control-ldc 9798@itemx -msched-control-ldc 9799@opindex mno-sched-control-ldc 9800@opindex msched-control-ldc 9801(Dis/En)able use of ld.c instructions to check control speculative loads. 9802If enabled, in case of control speculative load with no speculatively 9803scheduled dependent instructions this load will be emitted as ld.sa and 9804ld.c will be used to check it. 9805The default is 'disable'. 9806 9807@item -mno-sched-spec-verbose 9808@itemx -msched-spec-verbose 9809@opindex mno-sched-spec-verbose 9810@opindex msched-spec-verbose 9811(Dis/En)able printing of the information about speculative motions. 9812 9813@item -mno-sched-prefer-non-data-spec-insns 9814@itemx -msched-prefer-non-data-spec-insns 9815@opindex mno-sched-prefer-non-data-spec-insns 9816@opindex msched-prefer-non-data-spec-insns 9817If enabled, data speculative instructions will be chosen for schedule 9818only if there are no other choices at the moment. This will make 9819the use of the data speculation much more conservative. 9820The default is 'disable'. 9821 9822@item -mno-sched-prefer-non-control-spec-insns 9823@itemx -msched-prefer-non-control-spec-insns 9824@opindex mno-sched-prefer-non-control-spec-insns 9825@opindex msched-prefer-non-control-spec-insns 9826If enabled, control speculative instructions will be chosen for schedule 9827only if there are no other choices at the moment. This will make 9828the use of the control speculation much more conservative. 9829The default is 'disable'. 9830 9831@item -mno-sched-count-spec-in-critical-path 9832@itemx -msched-count-spec-in-critical-path 9833@opindex mno-sched-count-spec-in-critical-path 9834@opindex msched-count-spec-in-critical-path 9835If enabled, speculative dependencies will be considered during 9836computation of the instructions priorities. This will make the use of the 9837speculation a bit more conservative. 9838The default is 'disable'. 9839 9840@end table 9841 9842@node M32C Options 9843@subsection M32C Options 9844@cindex M32C options 9845 9846@table @gcctabopt 9847@item -mcpu=@var{name} 9848@opindex mcpu= 9849Select the CPU for which code is generated. @var{name} may be one of 9850@samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to 9851/60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for 9852the M32C/80 series. 9853 9854@item -msim 9855@opindex msim 9856Specifies that the program will be run on the simulator. This causes 9857an alternate runtime library to be linked in which supports, for 9858example, file I/O. You must not use this option when generating 9859programs that will run on real hardware; you must provide your own 9860runtime library for whatever I/O functions are needed. 9861 9862@item -memregs=@var{number} 9863@opindex memregs= 9864Specifies the number of memory-based pseudo-registers GCC will use 9865during code generation. These pseudo-registers will be used like real 9866registers, so there is a tradeoff between GCC's ability to fit the 9867code into available registers, and the performance penalty of using 9868memory instead of registers. Note that all modules in a program must 9869be compiled with the same value for this option. Because of that, you 9870must not use this option with the default runtime libraries gcc 9871builds. 9872 9873@end table 9874 9875@node M32R/D Options 9876@subsection M32R/D Options 9877@cindex M32R/D options 9878 9879These @option{-m} options are defined for Renesas M32R/D architectures: 9880 9881@table @gcctabopt 9882@item -m32r2 9883@opindex m32r2 9884Generate code for the M32R/2@. 9885 9886@item -m32rx 9887@opindex m32rx 9888Generate code for the M32R/X@. 9889 9890@item -m32r 9891@opindex m32r 9892Generate code for the M32R@. This is the default. 9893 9894@item -mmodel=small 9895@opindex mmodel=small 9896Assume all objects live in the lower 16MB of memory (so that their addresses 9897can be loaded with the @code{ld24} instruction), and assume all subroutines 9898are reachable with the @code{bl} instruction. 9899This is the default. 9900 9901The addressability of a particular object can be set with the 9902@code{model} attribute. 9903 9904@item -mmodel=medium 9905@opindex mmodel=medium 9906Assume objects may be anywhere in the 32-bit address space (the compiler 9907will generate @code{seth/add3} instructions to load their addresses), and 9908assume all subroutines are reachable with the @code{bl} instruction. 9909 9910@item -mmodel=large 9911@opindex mmodel=large 9912Assume objects may be anywhere in the 32-bit address space (the compiler 9913will generate @code{seth/add3} instructions to load their addresses), and 9914assume subroutines may not be reachable with the @code{bl} instruction 9915(the compiler will generate the much slower @code{seth/add3/jl} 9916instruction sequence). 9917 9918@item -msdata=none 9919@opindex msdata=none 9920Disable use of the small data area. Variables will be put into 9921one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the 9922@code{section} attribute has been specified). 9923This is the default. 9924 9925The small data area consists of sections @samp{.sdata} and @samp{.sbss}. 9926Objects may be explicitly put in the small data area with the 9927@code{section} attribute using one of these sections. 9928 9929@item -msdata=sdata 9930@opindex msdata=sdata 9931Put small global and static data in the small data area, but do not 9932generate special code to reference them. 9933 9934@item -msdata=use 9935@opindex msdata=use 9936Put small global and static data in the small data area, and generate 9937special instructions to reference them. 9938 9939@item -G @var{num} 9940@opindex G 9941@cindex smaller data references 9942Put global and static objects less than or equal to @var{num} bytes 9943into the small data or bss sections instead of the normal data or bss 9944sections. The default value of @var{num} is 8. 9945The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use} 9946for this option to have any effect. 9947 9948All modules should be compiled with the same @option{-G @var{num}} value. 9949Compiling with different values of @var{num} may or may not work; if it 9950doesn't the linker will give an error message---incorrect code will not be 9951generated. 9952 9953@item -mdebug 9954@opindex mdebug 9955Makes the M32R specific code in the compiler display some statistics 9956that might help in debugging programs. 9957 9958@item -malign-loops 9959@opindex malign-loops 9960Align all loops to a 32-byte boundary. 9961 9962@item -mno-align-loops 9963@opindex mno-align-loops 9964Do not enforce a 32-byte alignment for loops. This is the default. 9965 9966@item -missue-rate=@var{number} 9967@opindex missue-rate=@var{number} 9968Issue @var{number} instructions per cycle. @var{number} can only be 1 9969or 2. 9970 9971@item -mbranch-cost=@var{number} 9972@opindex mbranch-cost=@var{number} 9973@var{number} can only be 1 or 2. If it is 1 then branches will be 9974preferred over conditional code, if it is 2, then the opposite will 9975apply. 9976 9977@item -mflush-trap=@var{number} 9978@opindex mflush-trap=@var{number} 9979Specifies the trap number to use to flush the cache. The default is 998012. Valid numbers are between 0 and 15 inclusive. 9981 9982@item -mno-flush-trap 9983@opindex mno-flush-trap 9984Specifies that the cache cannot be flushed by using a trap. 9985 9986@item -mflush-func=@var{name} 9987@opindex mflush-func=@var{name} 9988Specifies the name of the operating system function to call to flush 9989the cache. The default is @emph{_flush_cache}, but a function call 9990will only be used if a trap is not available. 9991 9992@item -mno-flush-func 9993@opindex mno-flush-func 9994Indicates that there is no OS function for flushing the cache. 9995 9996@end table 9997 9998@node M680x0 Options 9999@subsection M680x0 Options 10000@cindex M680x0 options 10001 10002These are the @samp{-m} options defined for the 68000 series. The default 10003values for these options depends on which style of 68000 was selected when 10004the compiler was configured; the defaults for the most common choices are 10005given below. 10006 10007@table @gcctabopt 10008@item -m68000 10009@itemx -mc68000 10010@opindex m68000 10011@opindex mc68000 10012Generate output for a 68000. This is the default 10013when the compiler is configured for 68000-based systems. 10014 10015Use this option for microcontrollers with a 68000 or EC000 core, 10016including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356. 10017 10018@item -m68020 10019@itemx -mc68020 10020@opindex m68020 10021@opindex mc68020 10022Generate output for a 68020. This is the default 10023when the compiler is configured for 68020-based systems. 10024 10025@item -m68881 10026@opindex m68881 10027Generate output containing 68881 instructions for floating point. 10028This is the default for most 68020 systems unless @option{--nfp} was 10029specified when the compiler was configured. 10030 10031@item -m68030 10032@opindex m68030 10033Generate output for a 68030. This is the default when the compiler is 10034configured for 68030-based systems. 10035 10036@item -m68040 10037@opindex m68040 10038Generate output for a 68040. This is the default when the compiler is 10039configured for 68040-based systems. 10040 10041This option inhibits the use of 68881/68882 instructions that have to be 10042emulated by software on the 68040. Use this option if your 68040 does not 10043have code to emulate those instructions. 10044 10045@item -m68060 10046@opindex m68060 10047Generate output for a 68060. This is the default when the compiler is 10048configured for 68060-based systems. 10049 10050This option inhibits the use of 68020 and 68881/68882 instructions that 10051have to be emulated by software on the 68060. Use this option if your 68060 10052does not have code to emulate those instructions. 10053 10054@item -mcpu32 10055@opindex mcpu32 10056Generate output for a CPU32. This is the default 10057when the compiler is configured for CPU32-based systems. 10058 10059Use this option for microcontrollers with a 10060CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334, 1006168336, 68340, 68341, 68349 and 68360. 10062 10063@item -m5200 10064@opindex m5200 10065Generate output for a 520X ``coldfire'' family cpu. This is the default 10066when the compiler is configured for 520X-based systems. 10067 10068Use this option for microcontroller with a 5200 core, including 10069the MCF5202, MCF5203, MCF5204 and MCF5202. 10070 10071@item -mcfv4e 10072@opindex mcfv4e 10073Generate output for a ColdFire V4e family cpu (e.g.@: 547x/548x). 10074This includes use of hardware floating point instructions. 10075 10076@item -m68020-40 10077@opindex m68020-40 10078Generate output for a 68040, without using any of the new instructions. 10079This results in code which can run relatively efficiently on either a 1008068020/68881 or a 68030 or a 68040. The generated code does use the 1008168881 instructions that are emulated on the 68040. 10082 10083@item -m68020-60 10084@opindex m68020-60 10085Generate output for a 68060, without using any of the new instructions. 10086This results in code which can run relatively efficiently on either a 1008768020/68881 or a 68030 or a 68040. The generated code does use the 1008868881 instructions that are emulated on the 68060. 10089 10090@item -msoft-float 10091@opindex msoft-float 10092Generate output containing library calls for floating point. 10093@strong{Warning:} the requisite libraries are not available for all m68k 10094targets. Normally the facilities of the machine's usual C compiler are 10095used, but this can't be done directly in cross-compilation. You must 10096make your own arrangements to provide suitable library functions for 10097cross-compilation. The embedded targets @samp{m68k-*-aout} and 10098@samp{m68k-*-coff} do provide software floating point support. 10099 10100@item -mshort 10101@opindex mshort 10102Consider type @code{int} to be 16 bits wide, like @code{short int}. 10103Additionally, parameters passed on the stack are also aligned to a 1010416-bit boundary even on targets whose API mandates promotion to 32-bit. 10105 10106@item -mnobitfield 10107@opindex mnobitfield 10108Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32} 10109and @option{-m5200} options imply @w{@option{-mnobitfield}}. 10110 10111@item -mbitfield 10112@opindex mbitfield 10113Do use the bit-field instructions. The @option{-m68020} option implies 10114@option{-mbitfield}. This is the default if you use a configuration 10115designed for a 68020. 10116 10117@item -mrtd 10118@opindex mrtd 10119Use a different function-calling convention, in which functions 10120that take a fixed number of arguments return with the @code{rtd} 10121instruction, which pops their arguments while returning. This 10122saves one instruction in the caller since there is no need to pop 10123the arguments there. 10124 10125This calling convention is incompatible with the one normally 10126used on Unix, so you cannot use it if you need to call libraries 10127compiled with the Unix compiler. 10128 10129Also, you must provide function prototypes for all functions that 10130take variable numbers of arguments (including @code{printf}); 10131otherwise incorrect code will be generated for calls to those 10132functions. 10133 10134In addition, seriously incorrect code will result if you call a 10135function with too many arguments. (Normally, extra arguments are 10136harmlessly ignored.) 10137 10138The @code{rtd} instruction is supported by the 68010, 68020, 68030, 1013968040, 68060 and CPU32 processors, but not by the 68000 or 5200. 10140 10141@item -malign-int 10142@itemx -mno-align-int 10143@opindex malign-int 10144@opindex mno-align-int 10145Control whether GCC aligns @code{int}, @code{long}, @code{long long}, 10146@code{float}, @code{double}, and @code{long double} variables on a 32-bit 10147boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}). 10148Aligning variables on 32-bit boundaries produces code that runs somewhat 10149faster on processors with 32-bit busses at the expense of more memory. 10150 10151@strong{Warning:} if you use the @option{-malign-int} switch, GCC will 10152align structures containing the above types differently than 10153most published application binary interface specifications for the m68k. 10154 10155@item -mpcrel 10156@opindex mpcrel 10157Use the pc-relative addressing mode of the 68000 directly, instead of 10158using a global offset table. At present, this option implies @option{-fpic}, 10159allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is 10160not presently supported with @option{-mpcrel}, though this could be supported for 1016168020 and higher processors. 10162 10163@item -mno-strict-align 10164@itemx -mstrict-align 10165@opindex mno-strict-align 10166@opindex mstrict-align 10167Do not (do) assume that unaligned memory references will be handled by 10168the system. 10169 10170@item -msep-data 10171Generate code that allows the data segment to be located in a different 10172area of memory from the text segment. This allows for execute in place in 10173an environment without virtual memory management. This option implies 10174@option{-fPIC}. 10175 10176@item -mno-sep-data 10177Generate code that assumes that the data segment follows the text segment. 10178This is the default. 10179 10180@item -mid-shared-library 10181Generate code that supports shared libraries via the library ID method. 10182This allows for execute in place and shared libraries in an environment 10183without virtual memory management. This option implies @option{-fPIC}. 10184 10185@item -mno-id-shared-library 10186Generate code that doesn't assume ID based shared libraries are being used. 10187This is the default. 10188 10189@item -mshared-library-id=n 10190Specified the identification number of the ID based shared library being 10191compiled. Specifying a value of 0 will generate more compact code, specifying 10192other values will force the allocation of that number to the current 10193library but is no more space or time efficient than omitting this option. 10194 10195@end table 10196 10197@node M68hc1x Options 10198@subsection M68hc1x Options 10199@cindex M68hc1x options 10200 10201These are the @samp{-m} options defined for the 68hc11 and 68hc12 10202microcontrollers. The default values for these options depends on 10203which style of microcontroller was selected when the compiler was configured; 10204the defaults for the most common choices are given below. 10205 10206@table @gcctabopt 10207@item -m6811 10208@itemx -m68hc11 10209@opindex m6811 10210@opindex m68hc11 10211Generate output for a 68HC11. This is the default 10212when the compiler is configured for 68HC11-based systems. 10213 10214@item -m6812 10215@itemx -m68hc12 10216@opindex m6812 10217@opindex m68hc12 10218Generate output for a 68HC12. This is the default 10219when the compiler is configured for 68HC12-based systems. 10220 10221@item -m68S12 10222@itemx -m68hcs12 10223@opindex m68S12 10224@opindex m68hcs12 10225Generate output for a 68HCS12. 10226 10227@item -mauto-incdec 10228@opindex mauto-incdec 10229Enable the use of 68HC12 pre and post auto-increment and auto-decrement 10230addressing modes. 10231 10232@item -minmax 10233@itemx -nominmax 10234@opindex minmax 10235@opindex mnominmax 10236Enable the use of 68HC12 min and max instructions. 10237 10238@item -mlong-calls 10239@itemx -mno-long-calls 10240@opindex mlong-calls 10241@opindex mno-long-calls 10242Treat all calls as being far away (near). If calls are assumed to be 10243far away, the compiler will use the @code{call} instruction to 10244call a function and the @code{rtc} instruction for returning. 10245 10246@item -mshort 10247@opindex mshort 10248Consider type @code{int} to be 16 bits wide, like @code{short int}. 10249 10250@item -msoft-reg-count=@var{count} 10251@opindex msoft-reg-count 10252Specify the number of pseudo-soft registers which are used for the 10253code generation. The maximum number is 32. Using more pseudo-soft 10254register may or may not result in better code depending on the program. 10255The default is 4 for 68HC11 and 2 for 68HC12. 10256 10257@end table 10258 10259@node MCore Options 10260@subsection MCore Options 10261@cindex MCore options 10262 10263These are the @samp{-m} options defined for the Motorola M*Core 10264processors. 10265 10266@table @gcctabopt 10267 10268@item -mhardlit 10269@itemx -mno-hardlit 10270@opindex mhardlit 10271@opindex mno-hardlit 10272Inline constants into the code stream if it can be done in two 10273instructions or less. 10274 10275@item -mdiv 10276@itemx -mno-div 10277@opindex mdiv 10278@opindex mno-div 10279Use the divide instruction. (Enabled by default). 10280 10281@item -mrelax-immediate 10282@itemx -mno-relax-immediate 10283@opindex mrelax-immediate 10284@opindex mno-relax-immediate 10285Allow arbitrary sized immediates in bit operations. 10286 10287@item -mwide-bitfields 10288@itemx -mno-wide-bitfields 10289@opindex mwide-bitfields 10290@opindex mno-wide-bitfields 10291Always treat bit-fields as int-sized. 10292 10293@item -m4byte-functions 10294@itemx -mno-4byte-functions 10295@opindex m4byte-functions 10296@opindex mno-4byte-functions 10297Force all functions to be aligned to a four byte boundary. 10298 10299@item -mcallgraph-data 10300@itemx -mno-callgraph-data 10301@opindex mcallgraph-data 10302@opindex mno-callgraph-data 10303Emit callgraph information. 10304 10305@item -mslow-bytes 10306@itemx -mno-slow-bytes 10307@opindex mslow-bytes 10308@opindex mno-slow-bytes 10309Prefer word access when reading byte quantities. 10310 10311@item -mlittle-endian 10312@itemx -mbig-endian 10313@opindex mlittle-endian 10314@opindex mbig-endian 10315Generate code for a little endian target. 10316 10317@item -m210 10318@itemx -m340 10319@opindex m210 10320@opindex m340 10321Generate code for the 210 processor. 10322@end table 10323 10324@node MIPS Options 10325@subsection MIPS Options 10326@cindex MIPS options 10327 10328@table @gcctabopt 10329 10330@item -EB 10331@opindex EB 10332Generate big-endian code. 10333 10334@item -EL 10335@opindex EL 10336Generate little-endian code. This is the default for @samp{mips*el-*-*} 10337configurations. 10338 10339@item -march=@var{arch} 10340@opindex march 10341Generate code that will run on @var{arch}, which can be the name of a 10342generic MIPS ISA, or the name of a particular processor. 10343The ISA names are: 10344@samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4}, 10345@samp{mips32}, @samp{mips32r2}, and @samp{mips64}. 10346The processor names are: 10347@samp{4kc}, @samp{4km}, @samp{4kp}, 10348@samp{5kc}, @samp{5kf}, 10349@samp{20kc}, 10350@samp{24k}, @samp{24kc}, @samp{24kf}, @samp{24kx}, 10351@samp{m4k}, 10352@samp{orion}, 10353@samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400}, 10354@samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000}, 10355@samp{rm7000}, @samp{rm9000}, 10356@samp{sb1}, 10357@samp{sr71000}, 10358@samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300}, 10359@samp{vr5000}, @samp{vr5400} and @samp{vr5500}. 10360The special value @samp{from-abi} selects the 10361most compatible architecture for the selected ABI (that is, 10362@samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@. 10363 10364In processor names, a final @samp{000} can be abbreviated as @samp{k} 10365(for example, @samp{-march=r2k}). Prefixes are optional, and 10366@samp{vr} may be written @samp{r}. 10367 10368GCC defines two macros based on the value of this option. The first 10369is @samp{_MIPS_ARCH}, which gives the name of target architecture, as 10370a string. The second has the form @samp{_MIPS_ARCH_@var{foo}}, 10371where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@. 10372For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH} 10373to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}. 10374 10375Note that the @samp{_MIPS_ARCH} macro uses the processor names given 10376above. In other words, it will have the full prefix and will not 10377abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi}, 10378the macro names the resolved architecture (either @samp{"mips1"} or 10379@samp{"mips3"}). It names the default architecture when no 10380@option{-march} option is given. 10381 10382@item -mtune=@var{arch} 10383@opindex mtune 10384Optimize for @var{arch}. Among other things, this option controls 10385the way instructions are scheduled, and the perceived cost of arithmetic 10386operations. The list of @var{arch} values is the same as for 10387@option{-march}. 10388 10389When this option is not used, GCC will optimize for the processor 10390specified by @option{-march}. By using @option{-march} and 10391@option{-mtune} together, it is possible to generate code that will 10392run on a family of processors, but optimize the code for one 10393particular member of that family. 10394 10395@samp{-mtune} defines the macros @samp{_MIPS_TUNE} and 10396@samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the 10397@samp{-march} ones described above. 10398 10399@item -mips1 10400@opindex mips1 10401Equivalent to @samp{-march=mips1}. 10402 10403@item -mips2 10404@opindex mips2 10405Equivalent to @samp{-march=mips2}. 10406 10407@item -mips3 10408@opindex mips3 10409Equivalent to @samp{-march=mips3}. 10410 10411@item -mips4 10412@opindex mips4 10413Equivalent to @samp{-march=mips4}. 10414 10415@item -mips32 10416@opindex mips32 10417Equivalent to @samp{-march=mips32}. 10418 10419@item -mips32r2 10420@opindex mips32r2 10421Equivalent to @samp{-march=mips32r2}. 10422 10423@item -mips64 10424@opindex mips64 10425Equivalent to @samp{-march=mips64}. 10426 10427@item -mips16 10428@itemx -mno-mips16 10429@opindex mips16 10430@opindex mno-mips16 10431Generate (do not generate) MIPS16 code. If GCC is targetting a 10432MIPS32 or MIPS64 architecture, it will make use of the MIPS16e ASE@. 10433 10434@item -mabi=32 10435@itemx -mabi=o64 10436@itemx -mabi=n32 10437@itemx -mabi=64 10438@itemx -mabi=eabi 10439@opindex mabi=32 10440@opindex mabi=o64 10441@opindex mabi=n32 10442@opindex mabi=64 10443@opindex mabi=eabi 10444Generate code for the given ABI@. 10445 10446Note that the EABI has a 32-bit and a 64-bit variant. GCC normally 10447generates 64-bit code when you select a 64-bit architecture, but you 10448can use @option{-mgp32} to get 32-bit code instead. 10449 10450For information about the O64 ABI, see 10451@w{@uref{http://gcc.gnu.org/projects/mipso64-abi.html}}. 10452 10453@item -mabicalls 10454@itemx -mno-abicalls 10455@opindex mabicalls 10456@opindex mno-abicalls 10457Generate (do not generate) code that is suitable for SVR4-style 10458dynamic objects. @option{-mabicalls} is the default for SVR4-based 10459systems. 10460 10461@item -mshared 10462@itemx -mno-shared 10463Generate (do not generate) code that is fully position-independent, 10464and that can therefore be linked into shared libraries. This option 10465only affects @option{-mabicalls}. 10466 10467All @option{-mabicalls} code has traditionally been position-independent, 10468regardless of options like @option{-fPIC} and @option{-fpic}. However, 10469as an extension, the GNU toolchain allows executables to use absolute 10470accesses for locally-binding symbols. It can also use shorter GP 10471initialization sequences and generate direct calls to locally-defined 10472functions. This mode is selected by @option{-mno-shared}. 10473 10474@option{-mno-shared} depends on binutils 2.16 or higher and generates 10475objects that can only be linked by the GNU linker. However, the option 10476does not affect the ABI of the final executable; it only affects the ABI 10477of relocatable objects. Using @option{-mno-shared} will generally make 10478executables both smaller and quicker. 10479 10480@option{-mshared} is the default. 10481 10482@item -mxgot 10483@itemx -mno-xgot 10484@opindex mxgot 10485@opindex mno-xgot 10486Lift (do not lift) the usual restrictions on the size of the global 10487offset table. 10488 10489GCC normally uses a single instruction to load values from the GOT@. 10490While this is relatively efficient, it will only work if the GOT 10491is smaller than about 64k. Anything larger will cause the linker 10492to report an error such as: 10493 10494@cindex relocation truncated to fit (MIPS) 10495@smallexample 10496relocation truncated to fit: R_MIPS_GOT16 foobar 10497@end smallexample 10498 10499If this happens, you should recompile your code with @option{-mxgot}. 10500It should then work with very large GOTs, although it will also be 10501less efficient, since it will take three instructions to fetch the 10502value of a global symbol. 10503 10504Note that some linkers can create multiple GOTs. If you have such a 10505linker, you should only need to use @option{-mxgot} when a single object 10506file accesses more than 64k's worth of GOT entries. Very few do. 10507 10508These options have no effect unless GCC is generating position 10509independent code. 10510 10511@item -mgp32 10512@opindex mgp32 10513Assume that general-purpose registers are 32 bits wide. 10514 10515@item -mgp64 10516@opindex mgp64 10517Assume that general-purpose registers are 64 bits wide. 10518 10519@item -mfp32 10520@opindex mfp32 10521Assume that floating-point registers are 32 bits wide. 10522 10523@item -mfp64 10524@opindex mfp64 10525Assume that floating-point registers are 64 bits wide. 10526 10527@item -mhard-float 10528@opindex mhard-float 10529Use floating-point coprocessor instructions. 10530 10531@item -msoft-float 10532@opindex msoft-float 10533Do not use floating-point coprocessor instructions. Implement 10534floating-point calculations using library calls instead. 10535 10536@item -msingle-float 10537@opindex msingle-float 10538Assume that the floating-point coprocessor only supports single-precision 10539operations. 10540 10541@itemx -mdouble-float 10542@opindex mdouble-float 10543Assume that the floating-point coprocessor supports double-precision 10544operations. This is the default. 10545 10546@itemx -mdsp 10547@itemx -mno-dsp 10548@opindex mdsp 10549@opindex mno-dsp 10550Use (do not use) the MIPS DSP ASE. @xref{MIPS DSP Built-in Functions}. 10551 10552@itemx -mpaired-single 10553@itemx -mno-paired-single 10554@opindex mpaired-single 10555@opindex mno-paired-single 10556Use (do not use) paired-single floating-point instructions. 10557@xref{MIPS Paired-Single Support}. This option can only be used 10558when generating 64-bit code and requires hardware floating-point 10559support to be enabled. 10560 10561@itemx -mips3d 10562@itemx -mno-mips3d 10563@opindex mips3d 10564@opindex mno-mips3d 10565Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}. 10566The option @option{-mips3d} implies @option{-mpaired-single}. 10567 10568@item -mlong64 10569@opindex mlong64 10570Force @code{long} types to be 64 bits wide. See @option{-mlong32} for 10571an explanation of the default and the way that the pointer size is 10572determined. 10573 10574@item -mlong32 10575@opindex mlong32 10576Force @code{long}, @code{int}, and pointer types to be 32 bits wide. 10577 10578The default size of @code{int}s, @code{long}s and pointers depends on 10579the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI 10580uses 64-bit @code{long}s, as does the 64-bit EABI; the others use 1058132-bit @code{long}s. Pointers are the same size as @code{long}s, 10582or the same size as integer registers, whichever is smaller. 10583 10584@item -msym32 10585@itemx -mno-sym32 10586@opindex msym32 10587@opindex mno-sym32 10588Assume (do not assume) that all symbols have 32-bit values, regardless 10589of the selected ABI@. This option is useful in combination with 10590@option{-mabi=64} and @option{-mno-abicalls} because it allows GCC 10591to generate shorter and faster references to symbolic addresses. 10592 10593@item -G @var{num} 10594@opindex G 10595@cindex smaller data references (MIPS) 10596@cindex gp-relative references (MIPS) 10597Put global and static items less than or equal to @var{num} bytes into 10598the small data or bss section instead of the normal data or bss section. 10599This allows the data to be accessed using a single instruction. 10600 10601All modules should be compiled with the same @option{-G @var{num}} 10602value. 10603 10604@item -membedded-data 10605@itemx -mno-embedded-data 10606@opindex membedded-data 10607@opindex mno-embedded-data 10608Allocate variables to the read-only data section first if possible, then 10609next in the small data section if possible, otherwise in data. This gives 10610slightly slower code than the default, but reduces the amount of RAM required 10611when executing, and thus may be preferred for some embedded systems. 10612 10613@item -muninit-const-in-rodata 10614@itemx -mno-uninit-const-in-rodata 10615@opindex muninit-const-in-rodata 10616@opindex mno-uninit-const-in-rodata 10617Put uninitialized @code{const} variables in the read-only data section. 10618This option is only meaningful in conjunction with @option{-membedded-data}. 10619 10620@item -msplit-addresses 10621@itemx -mno-split-addresses 10622@opindex msplit-addresses 10623@opindex mno-split-addresses 10624Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler 10625relocation operators. This option has been superseded by 10626@option{-mexplicit-relocs} but is retained for backwards compatibility. 10627 10628@item -mexplicit-relocs 10629@itemx -mno-explicit-relocs 10630@opindex mexplicit-relocs 10631@opindex mno-explicit-relocs 10632Use (do not use) assembler relocation operators when dealing with symbolic 10633addresses. The alternative, selected by @option{-mno-explicit-relocs}, 10634is to use assembler macros instead. 10635 10636@option{-mexplicit-relocs} is the default if GCC was configured 10637to use an assembler that supports relocation operators. 10638 10639@item -mcheck-zero-division 10640@itemx -mno-check-zero-division 10641@opindex mcheck-zero-division 10642@opindex mno-check-zero-division 10643Trap (do not trap) on integer division by zero. The default is 10644@option{-mcheck-zero-division}. 10645 10646@item -mdivide-traps 10647@itemx -mdivide-breaks 10648@opindex mdivide-traps 10649@opindex mdivide-breaks 10650MIPS systems check for division by zero by generating either a 10651conditional trap or a break instruction. Using traps results in 10652smaller code, but is only supported on MIPS II and later. Also, some 10653versions of the Linux kernel have a bug that prevents trap from 10654generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to 10655allow conditional traps on architectures that support them and 10656@option{-mdivide-breaks} to force the use of breaks. 10657 10658The default is usually @option{-mdivide-traps}, but this can be 10659overridden at configure time using @option{--with-divide=breaks}. 10660Divide-by-zero checks can be completely disabled using 10661@option{-mno-check-zero-division}. 10662 10663@item -mmemcpy 10664@itemx -mno-memcpy 10665@opindex mmemcpy 10666@opindex mno-memcpy 10667Force (do not force) the use of @code{memcpy()} for non-trivial block 10668moves. The default is @option{-mno-memcpy}, which allows GCC to inline 10669most constant-sized copies. 10670 10671@item -mlong-calls 10672@itemx -mno-long-calls 10673@opindex mlong-calls 10674@opindex mno-long-calls 10675Disable (do not disable) use of the @code{jal} instruction. Calling 10676functions using @code{jal} is more efficient but requires the caller 10677and callee to be in the same 256 megabyte segment. 10678 10679This option has no effect on abicalls code. The default is 10680@option{-mno-long-calls}. 10681 10682@item -mmad 10683@itemx -mno-mad 10684@opindex mmad 10685@opindex mno-mad 10686Enable (disable) use of the @code{mad}, @code{madu} and @code{mul} 10687instructions, as provided by the R4650 ISA@. 10688 10689@item -mfused-madd 10690@itemx -mno-fused-madd 10691@opindex mfused-madd 10692@opindex mno-fused-madd 10693Enable (disable) use of the floating point multiply-accumulate 10694instructions, when they are available. The default is 10695@option{-mfused-madd}. 10696 10697When multiply-accumulate instructions are used, the intermediate 10698product is calculated to infinite precision and is not subject to 10699the FCSR Flush to Zero bit. This may be undesirable in some 10700circumstances. 10701 10702@item -nocpp 10703@opindex nocpp 10704Tell the MIPS assembler to not run its preprocessor over user 10705assembler files (with a @samp{.s} suffix) when assembling them. 10706 10707@item -mfix-r4000 10708@itemx -mno-fix-r4000 10709@opindex mfix-r4000 10710@opindex mno-fix-r4000 10711Work around certain R4000 CPU errata: 10712@itemize @minus 10713@item 10714A double-word or a variable shift may give an incorrect result if executed 10715immediately after starting an integer division. 10716@item 10717A double-word or a variable shift may give an incorrect result if executed 10718while an integer multiplication is in progress. 10719@item 10720An integer division may give an incorrect result if started in a delay slot 10721of a taken branch or a jump. 10722@end itemize 10723 10724@item -mfix-r4400 10725@itemx -mno-fix-r4400 10726@opindex mfix-r4400 10727@opindex mno-fix-r4400 10728Work around certain R4400 CPU errata: 10729@itemize @minus 10730@item 10731A double-word or a variable shift may give an incorrect result if executed 10732immediately after starting an integer division. 10733@end itemize 10734 10735@item -mfix-vr4120 10736@itemx -mno-fix-vr4120 10737@opindex mfix-vr4120 10738Work around certain VR4120 errata: 10739@itemize @minus 10740@item 10741@code{dmultu} does not always produce the correct result. 10742@item 10743@code{div} and @code{ddiv} do not always produce the correct result if one 10744of the operands is negative. 10745@end itemize 10746The workarounds for the division errata rely on special functions in 10747@file{libgcc.a}. At present, these functions are only provided by 10748the @code{mips64vr*-elf} configurations. 10749 10750Other VR4120 errata require a nop to be inserted between certain pairs of 10751instructions. These errata are handled by the assembler, not by GCC itself. 10752 10753@item -mfix-vr4130 10754@opindex mfix-vr4130 10755Work around the VR4130 @code{mflo}/@code{mfhi} errata. The 10756workarounds are implemented by the assembler rather than by GCC, 10757although GCC will avoid using @code{mflo} and @code{mfhi} if the 10758VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi} 10759instructions are available instead. 10760 10761@item -mfix-sb1 10762@itemx -mno-fix-sb1 10763@opindex mfix-sb1 10764Work around certain SB-1 CPU core errata. 10765(This flag currently works around the SB-1 revision 2 10766``F1'' and ``F2'' floating point errata.) 10767 10768@item -mflush-func=@var{func} 10769@itemx -mno-flush-func 10770@opindex mflush-func 10771Specifies the function to call to flush the I and D caches, or to not 10772call any such function. If called, the function must take the same 10773arguments as the common @code{_flush_func()}, that is, the address of the 10774memory range for which the cache is being flushed, the size of the 10775memory range, and the number 3 (to flush both caches). The default 10776depends on the target GCC was configured for, but commonly is either 10777@samp{_flush_func} or @samp{__cpu_flush}. 10778 10779@item -mbranch-likely 10780@itemx -mno-branch-likely 10781@opindex mbranch-likely 10782@opindex mno-branch-likely 10783Enable or disable use of Branch Likely instructions, regardless of the 10784default for the selected architecture. By default, Branch Likely 10785instructions may be generated if they are supported by the selected 10786architecture. An exception is for the MIPS32 and MIPS64 architectures 10787and processors which implement those architectures; for those, Branch 10788Likely instructions will not be generated by default because the MIPS32 10789and MIPS64 architectures specifically deprecate their use. 10790 10791@item -mfp-exceptions 10792@itemx -mno-fp-exceptions 10793@opindex mfp-exceptions 10794Specifies whether FP exceptions are enabled. This affects how we schedule 10795FP instructions for some processors. The default is that FP exceptions are 10796enabled. 10797 10798For instance, on the SB-1, if FP exceptions are disabled, and we are emitting 1079964-bit code, then we can use both FP pipes. Otherwise, we can only use one 10800FP pipe. 10801 10802@item -mvr4130-align 10803@itemx -mno-vr4130-align 10804@opindex mvr4130-align 10805The VR4130 pipeline is two-way superscalar, but can only issue two 10806instructions together if the first one is 8-byte aligned. When this 10807option is enabled, GCC will align pairs of instructions that it 10808thinks should execute in parallel. 10809 10810This option only has an effect when optimizing for the VR4130. 10811It normally makes code faster, but at the expense of making it bigger. 10812It is enabled by default at optimization level @option{-O3}. 10813@end table 10814 10815@node MMIX Options 10816@subsection MMIX Options 10817@cindex MMIX Options 10818 10819These options are defined for the MMIX: 10820 10821@table @gcctabopt 10822@item -mlibfuncs 10823@itemx -mno-libfuncs 10824@opindex mlibfuncs 10825@opindex mno-libfuncs 10826Specify that intrinsic library functions are being compiled, passing all 10827values in registers, no matter the size. 10828 10829@item -mepsilon 10830@itemx -mno-epsilon 10831@opindex mepsilon 10832@opindex mno-epsilon 10833Generate floating-point comparison instructions that compare with respect 10834to the @code{rE} epsilon register. 10835 10836@item -mabi=mmixware 10837@itemx -mabi=gnu 10838@opindex mabi-mmixware 10839@opindex mabi=gnu 10840Generate code that passes function parameters and return values that (in 10841the called function) are seen as registers @code{$0} and up, as opposed to 10842the GNU ABI which uses global registers @code{$231} and up. 10843 10844@item -mzero-extend 10845@itemx -mno-zero-extend 10846@opindex mzero-extend 10847@opindex mno-zero-extend 10848When reading data from memory in sizes shorter than 64 bits, use (do not 10849use) zero-extending load instructions by default, rather than 10850sign-extending ones. 10851 10852@item -mknuthdiv 10853@itemx -mno-knuthdiv 10854@opindex mknuthdiv 10855@opindex mno-knuthdiv 10856Make the result of a division yielding a remainder have the same sign as 10857the divisor. With the default, @option{-mno-knuthdiv}, the sign of the 10858remainder follows the sign of the dividend. Both methods are 10859arithmetically valid, the latter being almost exclusively used. 10860 10861@item -mtoplevel-symbols 10862@itemx -mno-toplevel-symbols 10863@opindex mtoplevel-symbols 10864@opindex mno-toplevel-symbols 10865Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly 10866code can be used with the @code{PREFIX} assembly directive. 10867 10868@item -melf 10869@opindex melf 10870Generate an executable in the ELF format, rather than the default 10871@samp{mmo} format used by the @command{mmix} simulator. 10872 10873@item -mbranch-predict 10874@itemx -mno-branch-predict 10875@opindex mbranch-predict 10876@opindex mno-branch-predict 10877Use (do not use) the probable-branch instructions, when static branch 10878prediction indicates a probable branch. 10879 10880@item -mbase-addresses 10881@itemx -mno-base-addresses 10882@opindex mbase-addresses 10883@opindex mno-base-addresses 10884Generate (do not generate) code that uses @emph{base addresses}. Using a 10885base address automatically generates a request (handled by the assembler 10886and the linker) for a constant to be set up in a global register. The 10887register is used for one or more base address requests within the range 0 10888to 255 from the value held in the register. The generally leads to short 10889and fast code, but the number of different data items that can be 10890addressed is limited. This means that a program that uses lots of static 10891data may require @option{-mno-base-addresses}. 10892 10893@item -msingle-exit 10894@itemx -mno-single-exit 10895@opindex msingle-exit 10896@opindex mno-single-exit 10897Force (do not force) generated code to have a single exit point in each 10898function. 10899@end table 10900 10901@node MN10300 Options 10902@subsection MN10300 Options 10903@cindex MN10300 options 10904 10905These @option{-m} options are defined for Matsushita MN10300 architectures: 10906 10907@table @gcctabopt 10908@item -mmult-bug 10909@opindex mmult-bug 10910Generate code to avoid bugs in the multiply instructions for the MN10300 10911processors. This is the default. 10912 10913@item -mno-mult-bug 10914@opindex mno-mult-bug 10915Do not generate code to avoid bugs in the multiply instructions for the 10916MN10300 processors. 10917 10918@item -mam33 10919@opindex mam33 10920Generate code which uses features specific to the AM33 processor. 10921 10922@item -mno-am33 10923@opindex mno-am33 10924Do not generate code which uses features specific to the AM33 processor. This 10925is the default. 10926 10927@item -mreturn-pointer-on-d0 10928@opindex mreturn-pointer-on-d0 10929When generating a function which returns a pointer, return the pointer 10930in both @code{a0} and @code{d0}. Otherwise, the pointer is returned 10931only in a0, and attempts to call such functions without a prototype 10932would result in errors. Note that this option is on by default; use 10933@option{-mno-return-pointer-on-d0} to disable it. 10934 10935@item -mno-crt0 10936@opindex mno-crt0 10937Do not link in the C run-time initialization object file. 10938 10939@item -mrelax 10940@opindex mrelax 10941Indicate to the linker that it should perform a relaxation optimization pass 10942to shorten branches, calls and absolute memory addresses. This option only 10943has an effect when used on the command line for the final link step. 10944 10945This option makes symbolic debugging impossible. 10946@end table 10947 10948@node MT Options 10949@subsection MT Options 10950@cindex MT options 10951 10952These @option{-m} options are defined for Morpho MT architectures: 10953 10954@table @gcctabopt 10955 10956@item -march=@var{cpu-type} 10957@opindex march 10958Generate code that will run on @var{cpu-type}, which is the name of a system 10959representing a certain processor type. Possible values for 10960@var{cpu-type} are @samp{ms1-64-001}, @samp{ms1-16-002}, 10961@samp{ms1-16-003} and @samp{ms2}. 10962 10963When this option is not used, the default is @option{-march=ms1-16-002}. 10964 10965@item -mbacc 10966@opindex mbacc 10967Use byte loads and stores when generating code. 10968 10969@item -mno-bacc 10970@opindex mno-bacc 10971Do not use byte loads and stores when generating code. 10972 10973@item -msim 10974@opindex msim 10975Use simulator runtime 10976 10977@item -mno-crt0 10978@opindex mno-crt0 10979Do not link in the C run-time initialization object file 10980@file{crti.o}. Other run-time initialization and termination files 10981such as @file{startup.o} and @file{exit.o} are still included on the 10982linker command line. 10983 10984@end table 10985 10986@node PDP-11 Options 10987@subsection PDP-11 Options 10988@cindex PDP-11 Options 10989 10990These options are defined for the PDP-11: 10991 10992@table @gcctabopt 10993@item -mfpu 10994@opindex mfpu 10995Use hardware FPP floating point. This is the default. (FIS floating 10996point on the PDP-11/40 is not supported.) 10997 10998@item -msoft-float 10999@opindex msoft-float 11000Do not use hardware floating point. 11001 11002@item -mac0 11003@opindex mac0 11004Return floating-point results in ac0 (fr0 in Unix assembler syntax). 11005 11006@item -mno-ac0 11007@opindex mno-ac0 11008Return floating-point results in memory. This is the default. 11009 11010@item -m40 11011@opindex m40 11012Generate code for a PDP-11/40. 11013 11014@item -m45 11015@opindex m45 11016Generate code for a PDP-11/45. This is the default. 11017 11018@item -m10 11019@opindex m10 11020Generate code for a PDP-11/10. 11021 11022@item -mbcopy-builtin 11023@opindex bcopy-builtin 11024Use inline @code{movmemhi} patterns for copying memory. This is the 11025default. 11026 11027@item -mbcopy 11028@opindex mbcopy 11029Do not use inline @code{movmemhi} patterns for copying memory. 11030 11031@item -mint16 11032@itemx -mno-int32 11033@opindex mint16 11034@opindex mno-int32 11035Use 16-bit @code{int}. This is the default. 11036 11037@item -mint32 11038@itemx -mno-int16 11039@opindex mint32 11040@opindex mno-int16 11041Use 32-bit @code{int}. 11042 11043@item -mfloat64 11044@itemx -mno-float32 11045@opindex mfloat64 11046@opindex mno-float32 11047Use 64-bit @code{float}. This is the default. 11048 11049@item -mfloat32 11050@itemx -mno-float64 11051@opindex mfloat32 11052@opindex mno-float64 11053Use 32-bit @code{float}. 11054 11055@item -mabshi 11056@opindex mabshi 11057Use @code{abshi2} pattern. This is the default. 11058 11059@item -mno-abshi 11060@opindex mno-abshi 11061Do not use @code{abshi2} pattern. 11062 11063@item -mbranch-expensive 11064@opindex mbranch-expensive 11065Pretend that branches are expensive. This is for experimenting with 11066code generation only. 11067 11068@item -mbranch-cheap 11069@opindex mbranch-cheap 11070Do not pretend that branches are expensive. This is the default. 11071 11072@item -msplit 11073@opindex msplit 11074Generate code for a system with split I&D@. 11075 11076@item -mno-split 11077@opindex mno-split 11078Generate code for a system without split I&D@. This is the default. 11079 11080@item -munix-asm 11081@opindex munix-asm 11082Use Unix assembler syntax. This is the default when configured for 11083@samp{pdp11-*-bsd}. 11084 11085@item -mdec-asm 11086@opindex mdec-asm 11087Use DEC assembler syntax. This is the default when configured for any 11088PDP-11 target other than @samp{pdp11-*-bsd}. 11089@end table 11090 11091@node PowerPC Options 11092@subsection PowerPC Options 11093@cindex PowerPC options 11094 11095These are listed under @xref{RS/6000 and PowerPC Options}. 11096 11097@node RS/6000 and PowerPC Options 11098@subsection IBM RS/6000 and PowerPC Options 11099@cindex RS/6000 and PowerPC Options 11100@cindex IBM RS/6000 and PowerPC Options 11101 11102These @samp{-m} options are defined for the IBM RS/6000 and PowerPC: 11103@table @gcctabopt 11104@item -mpower 11105@itemx -mno-power 11106@itemx -mpower2 11107@itemx -mno-power2 11108@itemx -mpowerpc 11109@itemx -mno-powerpc 11110@itemx -mpowerpc-gpopt 11111@itemx -mno-powerpc-gpopt 11112@itemx -mpowerpc-gfxopt 11113@itemx -mno-powerpc-gfxopt 11114@itemx -mpowerpc64 11115@itemx -mno-powerpc64 11116@itemx -mmfcrf 11117@itemx -mno-mfcrf 11118@itemx -mpopcntb 11119@itemx -mno-popcntb 11120@itemx -mfprnd 11121@itemx -mno-fprnd 11122@opindex mpower 11123@opindex mno-power 11124@opindex mpower2 11125@opindex mno-power2 11126@opindex mpowerpc 11127@opindex mno-powerpc 11128@opindex mpowerpc-gpopt 11129@opindex mno-powerpc-gpopt 11130@opindex mpowerpc-gfxopt 11131@opindex mno-powerpc-gfxopt 11132@opindex mpowerpc64 11133@opindex mno-powerpc64 11134@opindex mmfcrf 11135@opindex mno-mfcrf 11136@opindex mpopcntb 11137@opindex mno-popcntb 11138@opindex mfprnd 11139@opindex mno-fprnd 11140GCC supports two related instruction set architectures for the 11141RS/6000 and PowerPC@. The @dfn{POWER} instruction set are those 11142instructions supported by the @samp{rios} chip set used in the original 11143RS/6000 systems and the @dfn{PowerPC} instruction set is the 11144architecture of the Freescale MPC5xx, MPC6xx, MPC8xx microprocessors, and 11145the IBM 4xx, 6xx, and follow-on microprocessors. 11146 11147Neither architecture is a subset of the other. However there is a 11148large common subset of instructions supported by both. An MQ 11149register is included in processors supporting the POWER architecture. 11150 11151You use these options to specify which instructions are available on the 11152processor you are using. The default value of these options is 11153determined when configuring GCC@. Specifying the 11154@option{-mcpu=@var{cpu_type}} overrides the specification of these 11155options. We recommend you use the @option{-mcpu=@var{cpu_type}} option 11156rather than the options listed above. 11157 11158The @option{-mpower} option allows GCC to generate instructions that 11159are found only in the POWER architecture and to use the MQ register. 11160Specifying @option{-mpower2} implies @option{-power} and also allows GCC 11161to generate instructions that are present in the POWER2 architecture but 11162not the original POWER architecture. 11163 11164The @option{-mpowerpc} option allows GCC to generate instructions that 11165are found only in the 32-bit subset of the PowerPC architecture. 11166Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows 11167GCC to use the optional PowerPC architecture instructions in the 11168General Purpose group, including floating-point square root. Specifying 11169@option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to 11170use the optional PowerPC architecture instructions in the Graphics 11171group, including floating-point select. 11172 11173The @option{-mmfcrf} option allows GCC to generate the move from 11174condition register field instruction implemented on the POWER4 11175processor and other processors that support the PowerPC V2.01 11176architecture. 11177The @option{-mpopcntb} option allows GCC to generate the popcount and 11178double precision FP reciprocal estimate instruction implemented on the 11179POWER5 processor and other processors that support the PowerPC V2.02 11180architecture. 11181The @option{-mfprnd} option allows GCC to generate the FP round to 11182integer instructions implemented on the POWER5+ processor and other 11183processors that support the PowerPC V2.03 architecture. 11184 11185The @option{-mpowerpc64} option allows GCC to generate the additional 1118664-bit instructions that are found in the full PowerPC64 architecture 11187and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to 11188@option{-mno-powerpc64}. 11189 11190If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC 11191will use only the instructions in the common subset of both 11192architectures plus some special AIX common-mode calls, and will not use 11193the MQ register. Specifying both @option{-mpower} and @option{-mpowerpc} 11194permits GCC to use any instruction from either architecture and to 11195allow use of the MQ register; specify this for the Motorola MPC601. 11196 11197@item -mnew-mnemonics 11198@itemx -mold-mnemonics 11199@opindex mnew-mnemonics 11200@opindex mold-mnemonics 11201Select which mnemonics to use in the generated assembler code. With 11202@option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for 11203the PowerPC architecture. With @option{-mold-mnemonics} it uses the 11204assembler mnemonics defined for the POWER architecture. Instructions 11205defined in only one architecture have only one mnemonic; GCC uses that 11206mnemonic irrespective of which of these options is specified. 11207 11208GCC defaults to the mnemonics appropriate for the architecture in 11209use. Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the 11210value of these option. Unless you are building a cross-compiler, you 11211should normally not specify either @option{-mnew-mnemonics} or 11212@option{-mold-mnemonics}, but should instead accept the default. 11213 11214@item -mcpu=@var{cpu_type} 11215@opindex mcpu 11216Set architecture type, register usage, choice of mnemonics, and 11217instruction scheduling parameters for machine type @var{cpu_type}. 11218Supported values for @var{cpu_type} are @samp{401}, @samp{403}, 11219@samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{505}, 11220@samp{601}, @samp{602}, @samp{603}, @samp{603e}, @samp{604}, 11221@samp{604e}, @samp{620}, @samp{630}, @samp{740}, @samp{7400}, 11222@samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823}, 11223@samp{860}, @samp{970}, @samp{8540}, @samp{ec603e}, @samp{G3}, 11224@samp{G4}, @samp{G5}, @samp{power}, @samp{power2}, @samp{power3}, 11225@samp{power4}, @samp{power5}, @samp{power5+}, @samp{power6}, 11226@samp{common}, @samp{powerpc}, @samp{powerpc64}, 11227@samp{rios}, @samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64}. 11228 11229@option{-mcpu=common} selects a completely generic processor. Code 11230generated under this option will run on any POWER or PowerPC processor. 11231GCC will use only the instructions in the common subset of both 11232architectures, and will not use the MQ register. GCC assumes a generic 11233processor model for scheduling purposes. 11234 11235@option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and 11236@option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit 11237PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine 11238types, with an appropriate, generic processor model assumed for 11239scheduling purposes. 11240 11241The other options specify a specific processor. Code generated under 11242those options will run best on that processor, and may not run at all on 11243others. 11244 11245The @option{-mcpu} options automatically enable or disable the 11246following options: @option{-maltivec}, @option{-mfprnd}, 11247@option{-mhard-float}, @option{-mmfcrf}, @option{-mmultiple}, 11248@option{-mnew-mnemonics}, @option{-mpopcntb}, @option{-mpower}, 11249@option{-mpower2}, @option{-mpowerpc64}, @option{-mpowerpc-gpopt}, 11250@option{-mpowerpc-gfxopt}, @option{-mstring}, @option{-mmulhw}, @option{-mdlmzb}. 11251The particular options 11252set for any particular CPU will vary between compiler versions, 11253depending on what setting seems to produce optimal code for that CPU; 11254it doesn't necessarily reflect the actual hardware's capabilities. If 11255you wish to set an individual option to a particular value, you may 11256specify it after the @option{-mcpu} option, like @samp{-mcpu=970 11257-mno-altivec}. 11258 11259On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are 11260not enabled or disabled by the @option{-mcpu} option at present because 11261AIX does not have full support for these options. You may still 11262enable or disable them individually if you're sure it'll work in your 11263environment. 11264 11265@item -mtune=@var{cpu_type} 11266@opindex mtune 11267Set the instruction scheduling parameters for machine type 11268@var{cpu_type}, but do not set the architecture type, register usage, or 11269choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would. The same 11270values for @var{cpu_type} are used for @option{-mtune} as for 11271@option{-mcpu}. If both are specified, the code generated will use the 11272architecture, registers, and mnemonics set by @option{-mcpu}, but the 11273scheduling parameters set by @option{-mtune}. 11274 11275@item -mswdiv 11276@itemx -mno-swdiv 11277@opindex mswdiv 11278@opindex mno-swdiv 11279Generate code to compute division as reciprocal estimate and iterative 11280refinement, creating opportunities for increased throughput. This 11281feature requires: optional PowerPC Graphics instruction set for single 11282precision and FRE instruction for double precision, assuming divides 11283cannot generate user-visible traps, and the domain values not include 11284Infinities, denormals or zero denominator. 11285 11286@item -maltivec 11287@itemx -mno-altivec 11288@opindex maltivec 11289@opindex mno-altivec 11290Generate code that uses (does not use) AltiVec instructions, and also 11291enable the use of built-in functions that allow more direct access to 11292the AltiVec instruction set. You may also need to set 11293@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI 11294enhancements. 11295 11296@item -mvrsave 11297@item -mno-vrsave 11298@opindex mvrsave 11299@opindex mno-vrsave 11300Generate VRSAVE instructions when generating AltiVec code. 11301 11302@item -msecure-plt 11303@opindex msecure-plt 11304Generate code that allows ld and ld.so to build executables and shared 11305libraries with non-exec .plt and .got sections. This is a PowerPC 1130632-bit SYSV ABI option. 11307 11308@item -mbss-plt 11309@opindex mbss-plt 11310Generate code that uses a BSS .plt section that ld.so fills in, and 11311requires .plt and .got sections that are both writable and executable. 11312This is a PowerPC 32-bit SYSV ABI option. 11313 11314@item -misel 11315@itemx -mno-isel 11316@opindex misel 11317@opindex mno-isel 11318This switch enables or disables the generation of ISEL instructions. 11319 11320@item -misel=@var{yes/no} 11321This switch has been deprecated. Use @option{-misel} and 11322@option{-mno-isel} instead. 11323 11324@item -mspe 11325@itemx -mno-spe 11326@opindex mspe 11327@opindex mno-spe 11328This switch enables or disables the generation of SPE simd 11329instructions. 11330 11331@item -mspe=@var{yes/no} 11332This option has been deprecated. Use @option{-mspe} and 11333@option{-mno-spe} instead. 11334 11335@item -mfloat-gprs=@var{yes/single/double/no} 11336@itemx -mfloat-gprs 11337@opindex mfloat-gprs 11338This switch enables or disables the generation of floating point 11339operations on the general purpose registers for architectures that 11340support it. 11341 11342The argument @var{yes} or @var{single} enables the use of 11343single-precision floating point operations. 11344 11345The argument @var{double} enables the use of single and 11346double-precision floating point operations. 11347 11348The argument @var{no} disables floating point operations on the 11349general purpose registers. 11350 11351This option is currently only available on the MPC854x. 11352 11353@item -m32 11354@itemx -m64 11355@opindex m32 11356@opindex m64 11357Generate code for 32-bit or 64-bit environments of Darwin and SVR4 11358targets (including GNU/Linux). The 32-bit environment sets int, long 11359and pointer to 32 bits and generates code that runs on any PowerPC 11360variant. The 64-bit environment sets int to 32 bits and long and 11361pointer to 64 bits, and generates code for PowerPC64, as for 11362@option{-mpowerpc64}. 11363 11364@item -mfull-toc 11365@itemx -mno-fp-in-toc 11366@itemx -mno-sum-in-toc 11367@itemx -mminimal-toc 11368@opindex mfull-toc 11369@opindex mno-fp-in-toc 11370@opindex mno-sum-in-toc 11371@opindex mminimal-toc 11372Modify generation of the TOC (Table Of Contents), which is created for 11373every executable file. The @option{-mfull-toc} option is selected by 11374default. In that case, GCC will allocate at least one TOC entry for 11375each unique non-automatic variable reference in your program. GCC 11376will also place floating-point constants in the TOC@. However, only 1137716,384 entries are available in the TOC@. 11378 11379If you receive a linker error message that saying you have overflowed 11380the available TOC space, you can reduce the amount of TOC space used 11381with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options. 11382@option{-mno-fp-in-toc} prevents GCC from putting floating-point 11383constants in the TOC and @option{-mno-sum-in-toc} forces GCC to 11384generate code to calculate the sum of an address and a constant at 11385run-time instead of putting that sum into the TOC@. You may specify one 11386or both of these options. Each causes GCC to produce very slightly 11387slower and larger code at the expense of conserving TOC space. 11388 11389If you still run out of space in the TOC even when you specify both of 11390these options, specify @option{-mminimal-toc} instead. This option causes 11391GCC to make only one TOC entry for every file. When you specify this 11392option, GCC will produce code that is slower and larger but which 11393uses extremely little TOC space. You may wish to use this option 11394only on files that contain less frequently executed code. 11395 11396@item -maix64 11397@itemx -maix32 11398@opindex maix64 11399@opindex maix32 11400Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit 11401@code{long} type, and the infrastructure needed to support them. 11402Specifying @option{-maix64} implies @option{-mpowerpc64} and 11403@option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and 11404implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}. 11405 11406@item -mxl-compat 11407@itemx -mno-xl-compat 11408@opindex mxl-compat 11409@opindex mno-xl-compat 11410Produce code that conforms more closely to IBM XL compiler semantics 11411when using AIX-compatible ABI. Pass floating-point arguments to 11412prototyped functions beyond the register save area (RSA) on the stack 11413in addition to argument FPRs. Do not assume that most significant 11414double in 128-bit long double value is properly rounded when comparing 11415values and converting to double. Use XL symbol names for long double 11416support routines. 11417 11418The AIX calling convention was extended but not initially documented to 11419handle an obscure K&R C case of calling a function that takes the 11420address of its arguments with fewer arguments than declared. IBM XL 11421compilers access floating point arguments which do not fit in the 11422RSA from the stack when a subroutine is compiled without 11423optimization. Because always storing floating-point arguments on the 11424stack is inefficient and rarely needed, this option is not enabled by 11425default and only is necessary when calling subroutines compiled by IBM 11426XL compilers without optimization. 11427 11428@item -mpe 11429@opindex mpe 11430Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an 11431application written to use message passing with special startup code to 11432enable the application to run. The system must have PE installed in the 11433standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file 11434must be overridden with the @option{-specs=} option to specify the 11435appropriate directory location. The Parallel Environment does not 11436support threads, so the @option{-mpe} option and the @option{-pthread} 11437option are incompatible. 11438 11439@item -malign-natural 11440@itemx -malign-power 11441@opindex malign-natural 11442@opindex malign-power 11443On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option 11444@option{-malign-natural} overrides the ABI-defined alignment of larger 11445types, such as floating-point doubles, on their natural size-based boundary. 11446The option @option{-malign-power} instructs GCC to follow the ABI-specified 11447alignment rules. GCC defaults to the standard alignment defined in the ABI@. 11448 11449On 64-bit Darwin, natural alignment is the default, and @option{-malign-power} 11450is not supported. 11451 11452@item -msoft-float 11453@itemx -mhard-float 11454@opindex msoft-float 11455@opindex mhard-float 11456Generate code that does not use (uses) the floating-point register set. 11457Software floating point emulation is provided if you use the 11458@option{-msoft-float} option, and pass the option to GCC when linking. 11459 11460@item -mmultiple 11461@itemx -mno-multiple 11462@opindex mmultiple 11463@opindex mno-multiple 11464Generate code that uses (does not use) the load multiple word 11465instructions and the store multiple word instructions. These 11466instructions are generated by default on POWER systems, and not 11467generated on PowerPC systems. Do not use @option{-mmultiple} on little 11468endian PowerPC systems, since those instructions do not work when the 11469processor is in little endian mode. The exceptions are PPC740 and 11470PPC750 which permit the instructions usage in little endian mode. 11471 11472@item -mstring 11473@itemx -mno-string 11474@opindex mstring 11475@opindex mno-string 11476Generate code that uses (does not use) the load string instructions 11477and the store string word instructions to save multiple registers and 11478do small block moves. These instructions are generated by default on 11479POWER systems, and not generated on PowerPC systems. Do not use 11480@option{-mstring} on little endian PowerPC systems, since those 11481instructions do not work when the processor is in little endian mode. 11482The exceptions are PPC740 and PPC750 which permit the instructions 11483usage in little endian mode. 11484 11485@item -mupdate 11486@itemx -mno-update 11487@opindex mupdate 11488@opindex mno-update 11489Generate code that uses (does not use) the load or store instructions 11490that update the base register to the address of the calculated memory 11491location. These instructions are generated by default. If you use 11492@option{-mno-update}, there is a small window between the time that the 11493stack pointer is updated and the address of the previous frame is 11494stored, which means code that walks the stack frame across interrupts or 11495signals may get corrupted data. 11496 11497@item -mfused-madd 11498@itemx -mno-fused-madd 11499@opindex mfused-madd 11500@opindex mno-fused-madd 11501Generate code that uses (does not use) the floating point multiply and 11502accumulate instructions. These instructions are generated by default if 11503hardware floating is used. 11504 11505@item -mmulhw 11506@itemx -mno-mulhw 11507@opindex mmulhw 11508@opindex mno-mulhw 11509Generate code that uses (does not use) the half-word multiply and 11510multiply-accumulate instructions on the IBM 405 and 440 processors. 11511These instructions are generated by default when targetting those 11512processors. 11513 11514@item -mdlmzb 11515@itemx -mno-dlmzb 11516@opindex mdlmzb 11517@opindex mno-dlmzb 11518Generate code that uses (does not use) the string-search @samp{dlmzb} 11519instruction on the IBM 405 and 440 processors. This instruction is 11520generated by default when targetting those processors. 11521 11522@item -mno-bit-align 11523@itemx -mbit-align 11524@opindex mno-bit-align 11525@opindex mbit-align 11526On System V.4 and embedded PowerPC systems do not (do) force structures 11527and unions that contain bit-fields to be aligned to the base type of the 11528bit-field. 11529 11530For example, by default a structure containing nothing but 8 11531@code{unsigned} bit-fields of length 1 would be aligned to a 4 byte 11532boundary and have a size of 4 bytes. By using @option{-mno-bit-align}, 11533the structure would be aligned to a 1 byte boundary and be one byte in 11534size. 11535 11536@item -mno-strict-align 11537@itemx -mstrict-align 11538@opindex mno-strict-align 11539@opindex mstrict-align 11540On System V.4 and embedded PowerPC systems do not (do) assume that 11541unaligned memory references will be handled by the system. 11542 11543@item -mrelocatable 11544@itemx -mno-relocatable 11545@opindex mrelocatable 11546@opindex mno-relocatable 11547On embedded PowerPC systems generate code that allows (does not allow) 11548the program to be relocated to a different address at runtime. If you 11549use @option{-mrelocatable} on any module, all objects linked together must 11550be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}. 11551 11552@item -mrelocatable-lib 11553@itemx -mno-relocatable-lib 11554@opindex mrelocatable-lib 11555@opindex mno-relocatable-lib 11556On embedded PowerPC systems generate code that allows (does not allow) 11557the program to be relocated to a different address at runtime. Modules 11558compiled with @option{-mrelocatable-lib} can be linked with either modules 11559compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or 11560with modules compiled with the @option{-mrelocatable} options. 11561 11562@item -mno-toc 11563@itemx -mtoc 11564@opindex mno-toc 11565@opindex mtoc 11566On System V.4 and embedded PowerPC systems do not (do) assume that 11567register 2 contains a pointer to a global area pointing to the addresses 11568used in the program. 11569 11570@item -mlittle 11571@itemx -mlittle-endian 11572@opindex mlittle 11573@opindex mlittle-endian 11574On System V.4 and embedded PowerPC systems compile code for the 11575processor in little endian mode. The @option{-mlittle-endian} option is 11576the same as @option{-mlittle}. 11577 11578@item -mbig 11579@itemx -mbig-endian 11580@opindex mbig 11581@opindex mbig-endian 11582On System V.4 and embedded PowerPC systems compile code for the 11583processor in big endian mode. The @option{-mbig-endian} option is 11584the same as @option{-mbig}. 11585 11586@item -mdynamic-no-pic 11587@opindex mdynamic-no-pic 11588On Darwin and Mac OS X systems, compile code so that it is not 11589relocatable, but that its external references are relocatable. The 11590resulting code is suitable for applications, but not shared 11591libraries. 11592 11593@item -mprioritize-restricted-insns=@var{priority} 11594@opindex mprioritize-restricted-insns 11595This option controls the priority that is assigned to 11596dispatch-slot restricted instructions during the second scheduling 11597pass. The argument @var{priority} takes the value @var{0/1/2} to assign 11598@var{no/highest/second-highest} priority to dispatch slot restricted 11599instructions. 11600 11601@item -msched-costly-dep=@var{dependence_type} 11602@opindex msched-costly-dep 11603This option controls which dependences are considered costly 11604by the target during instruction scheduling. The argument 11605@var{dependence_type} takes one of the following values: 11606@var{no}: no dependence is costly, 11607@var{all}: all dependences are costly, 11608@var{true_store_to_load}: a true dependence from store to load is costly, 11609@var{store_to_load}: any dependence from store to load is costly, 11610@var{number}: any dependence which latency >= @var{number} is costly. 11611 11612@item -minsert-sched-nops=@var{scheme} 11613@opindex minsert-sched-nops 11614This option controls which nop insertion scheme will be used during 11615the second scheduling pass. The argument @var{scheme} takes one of the 11616following values: 11617@var{no}: Don't insert nops. 11618@var{pad}: Pad with nops any dispatch group which has vacant issue slots, 11619according to the scheduler's grouping. 11620@var{regroup_exact}: Insert nops to force costly dependent insns into 11621separate groups. Insert exactly as many nops as needed to force an insn 11622to a new group, according to the estimated processor grouping. 11623@var{number}: Insert nops to force costly dependent insns into 11624separate groups. Insert @var{number} nops to force an insn to a new group. 11625 11626@item -mcall-sysv 11627@opindex mcall-sysv 11628On System V.4 and embedded PowerPC systems compile code using calling 11629conventions that adheres to the March 1995 draft of the System V 11630Application Binary Interface, PowerPC processor supplement. This is the 11631default unless you configured GCC using @samp{powerpc-*-eabiaix}. 11632 11633@item -mcall-sysv-eabi 11634@opindex mcall-sysv-eabi 11635Specify both @option{-mcall-sysv} and @option{-meabi} options. 11636 11637@item -mcall-sysv-noeabi 11638@opindex mcall-sysv-noeabi 11639Specify both @option{-mcall-sysv} and @option{-mno-eabi} options. 11640 11641@item -mcall-solaris 11642@opindex mcall-solaris 11643On System V.4 and embedded PowerPC systems compile code for the Solaris 11644operating system. 11645 11646@item -mcall-linux 11647@opindex mcall-linux 11648On System V.4 and embedded PowerPC systems compile code for the 11649Linux-based GNU system. 11650 11651@item -mcall-gnu 11652@opindex mcall-gnu 11653On System V.4 and embedded PowerPC systems compile code for the 11654Hurd-based GNU system. 11655 11656@item -mcall-netbsd 11657@opindex mcall-netbsd 11658On System V.4 and embedded PowerPC systems compile code for the 11659NetBSD operating system. 11660 11661@item -maix-struct-return 11662@opindex maix-struct-return 11663Return all structures in memory (as specified by the AIX ABI)@. 11664 11665@item -msvr4-struct-return 11666@opindex msvr4-struct-return 11667Return structures smaller than 8 bytes in registers (as specified by the 11668SVR4 ABI)@. 11669 11670@item -mabi=@var{abi-type} 11671@opindex mabi 11672Extend the current ABI with a particular extension, or remove such extension. 11673Valid values are @var{altivec}, @var{no-altivec}, @var{spe}, 11674@var{no-spe}, @var{ibmlongdouble}, @var{ieeelongdouble}@. 11675 11676@item -mabi=spe 11677@opindex mabi=spe 11678Extend the current ABI with SPE ABI extensions. This does not change 11679the default ABI, instead it adds the SPE ABI extensions to the current 11680ABI@. 11681 11682@item -mabi=no-spe 11683@opindex mabi=no-spe 11684Disable Booke SPE ABI extensions for the current ABI@. 11685 11686@item -mabi=ibmlongdouble 11687@opindex mabi=ibmlongdouble 11688Change the current ABI to use IBM extended precision long double. 11689This is a PowerPC 32-bit SYSV ABI option. 11690 11691@item -mabi=ieeelongdouble 11692@opindex mabi=ieeelongdouble 11693Change the current ABI to use IEEE extended precision long double. 11694This is a PowerPC 32-bit Linux ABI option. 11695 11696@item -mprototype 11697@itemx -mno-prototype 11698@opindex mprototype 11699@opindex mno-prototype 11700On System V.4 and embedded PowerPC systems assume that all calls to 11701variable argument functions are properly prototyped. Otherwise, the 11702compiler must insert an instruction before every non prototyped call to 11703set or clear bit 6 of the condition code register (@var{CR}) to 11704indicate whether floating point values were passed in the floating point 11705registers in case the function takes a variable arguments. With 11706@option{-mprototype}, only calls to prototyped variable argument functions 11707will set or clear the bit. 11708 11709@item -msim 11710@opindex msim 11711On embedded PowerPC systems, assume that the startup module is called 11712@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and 11713@file{libc.a}. This is the default for @samp{powerpc-*-eabisim}. 11714configurations. 11715 11716@item -mmvme 11717@opindex mmvme 11718On embedded PowerPC systems, assume that the startup module is called 11719@file{crt0.o} and the standard C libraries are @file{libmvme.a} and 11720@file{libc.a}. 11721 11722@item -mads 11723@opindex mads 11724On embedded PowerPC systems, assume that the startup module is called 11725@file{crt0.o} and the standard C libraries are @file{libads.a} and 11726@file{libc.a}. 11727 11728@item -myellowknife 11729@opindex myellowknife 11730On embedded PowerPC systems, assume that the startup module is called 11731@file{crt0.o} and the standard C libraries are @file{libyk.a} and 11732@file{libc.a}. 11733 11734@item -mvxworks 11735@opindex mvxworks 11736On System V.4 and embedded PowerPC systems, specify that you are 11737compiling for a VxWorks system. 11738 11739@item -mwindiss 11740@opindex mwindiss 11741Specify that you are compiling for the WindISS simulation environment. 11742 11743@item -memb 11744@opindex memb 11745On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags 11746header to indicate that @samp{eabi} extended relocations are used. 11747 11748@item -meabi 11749@itemx -mno-eabi 11750@opindex meabi 11751@opindex mno-eabi 11752On System V.4 and embedded PowerPC systems do (do not) adhere to the 11753Embedded Applications Binary Interface (eabi) which is a set of 11754modifications to the System V.4 specifications. Selecting @option{-meabi} 11755means that the stack is aligned to an 8 byte boundary, a function 11756@code{__eabi} is called to from @code{main} to set up the eabi 11757environment, and the @option{-msdata} option can use both @code{r2} and 11758@code{r13} to point to two separate small data areas. Selecting 11759@option{-mno-eabi} means that the stack is aligned to a 16 byte boundary, 11760do not call an initialization function from @code{main}, and the 11761@option{-msdata} option will only use @code{r13} to point to a single 11762small data area. The @option{-meabi} option is on by default if you 11763configured GCC using one of the @samp{powerpc*-*-eabi*} options. 11764 11765@item -msdata=eabi 11766@opindex msdata=eabi 11767On System V.4 and embedded PowerPC systems, put small initialized 11768@code{const} global and static data in the @samp{.sdata2} section, which 11769is pointed to by register @code{r2}. Put small initialized 11770non-@code{const} global and static data in the @samp{.sdata} section, 11771which is pointed to by register @code{r13}. Put small uninitialized 11772global and static data in the @samp{.sbss} section, which is adjacent to 11773the @samp{.sdata} section. The @option{-msdata=eabi} option is 11774incompatible with the @option{-mrelocatable} option. The 11775@option{-msdata=eabi} option also sets the @option{-memb} option. 11776 11777@item -msdata=sysv 11778@opindex msdata=sysv 11779On System V.4 and embedded PowerPC systems, put small global and static 11780data in the @samp{.sdata} section, which is pointed to by register 11781@code{r13}. Put small uninitialized global and static data in the 11782@samp{.sbss} section, which is adjacent to the @samp{.sdata} section. 11783The @option{-msdata=sysv} option is incompatible with the 11784@option{-mrelocatable} option. 11785 11786@item -msdata=default 11787@itemx -msdata 11788@opindex msdata=default 11789@opindex msdata 11790On System V.4 and embedded PowerPC systems, if @option{-meabi} is used, 11791compile code the same as @option{-msdata=eabi}, otherwise compile code the 11792same as @option{-msdata=sysv}. 11793 11794@item -msdata-data 11795@opindex msdata-data 11796On System V.4 and embedded PowerPC systems, put small global 11797data in the @samp{.sdata} section. Put small uninitialized global 11798data in the @samp{.sbss} section. Do not use register @code{r13} 11799to address small data however. This is the default behavior unless 11800other @option{-msdata} options are used. 11801 11802@item -msdata=none 11803@itemx -mno-sdata 11804@opindex msdata=none 11805@opindex mno-sdata 11806On embedded PowerPC systems, put all initialized global and static data 11807in the @samp{.data} section, and all uninitialized data in the 11808@samp{.bss} section. 11809 11810@item -G @var{num} 11811@opindex G 11812@cindex smaller data references (PowerPC) 11813@cindex .sdata/.sdata2 references (PowerPC) 11814On embedded PowerPC systems, put global and static items less than or 11815equal to @var{num} bytes into the small data or bss sections instead of 11816the normal data or bss section. By default, @var{num} is 8. The 11817@option{-G @var{num}} switch is also passed to the linker. 11818All modules should be compiled with the same @option{-G @var{num}} value. 11819 11820@item -mregnames 11821@itemx -mno-regnames 11822@opindex mregnames 11823@opindex mno-regnames 11824On System V.4 and embedded PowerPC systems do (do not) emit register 11825names in the assembly language output using symbolic forms. 11826 11827@item -mlongcall 11828@itemx -mno-longcall 11829@opindex mlongcall 11830@opindex mno-longcall 11831By default assume that all calls are far away so that a longer more 11832expensive calling sequence is required. This is required for calls 11833further than 32 megabytes (33,554,432 bytes) from the current location. 11834A short call will be generated if the compiler knows 11835the call cannot be that far away. This setting can be overridden by 11836the @code{shortcall} function attribute, or by @code{#pragma 11837longcall(0)}. 11838 11839Some linkers are capable of detecting out-of-range calls and generating 11840glue code on the fly. On these systems, long calls are unnecessary and 11841generate slower code. As of this writing, the AIX linker can do this, 11842as can the GNU linker for PowerPC/64. It is planned to add this feature 11843to the GNU linker for 32-bit PowerPC systems as well. 11844 11845On Darwin/PPC systems, @code{#pragma longcall} will generate ``jbsr 11846callee, L42'', plus a ``branch island'' (glue code). The two target 11847addresses represent the callee and the ``branch island''. The 11848Darwin/PPC linker will prefer the first address and generate a ``bl 11849callee'' if the PPC ``bl'' instruction will reach the callee directly; 11850otherwise, the linker will generate ``bl L42'' to call the ``branch 11851island''. The ``branch island'' is appended to the body of the 11852calling function; it computes the full 32-bit address of the callee 11853and jumps to it. 11854 11855On Mach-O (Darwin) systems, this option directs the compiler emit to 11856the glue for every direct call, and the Darwin linker decides whether 11857to use or discard it. 11858 11859In the future, we may cause GCC to ignore all longcall specifications 11860when the linker is known to generate glue. 11861 11862@item -pthread 11863@opindex pthread 11864Adds support for multithreading with the @dfn{pthreads} library. 11865This option sets flags for both the preprocessor and linker. 11866 11867@end table 11868 11869@node S/390 and zSeries Options 11870@subsection S/390 and zSeries Options 11871@cindex S/390 and zSeries Options 11872 11873These are the @samp{-m} options defined for the S/390 and zSeries architecture. 11874 11875@table @gcctabopt 11876@item -mhard-float 11877@itemx -msoft-float 11878@opindex mhard-float 11879@opindex msoft-float 11880Use (do not use) the hardware floating-point instructions and registers 11881for floating-point operations. When @option{-msoft-float} is specified, 11882functions in @file{libgcc.a} will be used to perform floating-point 11883operations. When @option{-mhard-float} is specified, the compiler 11884generates IEEE floating-point instructions. This is the default. 11885 11886@item -mlong-double-64 11887@itemx -mlong-double-128 11888@opindex mlong-double-64 11889@opindex mlong-double-128 11890These switches control the size of @code{long double} type. A size 11891of 64bit makes the @code{long double} type equivalent to the @code{double} 11892type. This is the default. 11893 11894@item -mbackchain 11895@itemx -mno-backchain 11896@opindex mbackchain 11897@opindex mno-backchain 11898Store (do not store) the address of the caller's frame as backchain pointer 11899into the callee's stack frame. 11900A backchain may be needed to allow debugging using tools that do not understand 11901DWARF-2 call frame information. 11902When @option{-mno-packed-stack} is in effect, the backchain pointer is stored 11903at the bottom of the stack frame; when @option{-mpacked-stack} is in effect, 11904the backchain is placed into the topmost word of the 96/160 byte register 11905save area. 11906 11907In general, code compiled with @option{-mbackchain} is call-compatible with 11908code compiled with @option{-mmo-backchain}; however, use of the backchain 11909for debugging purposes usually requires that the whole binary is built with 11910@option{-mbackchain}. Note that the combination of @option{-mbackchain}, 11911@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order 11912to build a linux kernel use @option{-msoft-float}. 11913 11914The default is to not maintain the backchain. 11915 11916@item -mpacked-stack 11917@item -mno-packed-stack 11918@opindex mpacked-stack 11919@opindex mno-packed-stack 11920Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is 11921specified, the compiler uses the all fields of the 96/160 byte register save 11922area only for their default purpose; unused fields still take up stack space. 11923When @option{-mpacked-stack} is specified, register save slots are densely 11924packed at the top of the register save area; unused space is reused for other 11925purposes, allowing for more efficient use of the available stack space. 11926However, when @option{-mbackchain} is also in effect, the topmost word of 11927the save area is always used to store the backchain, and the return address 11928register is always saved two words below the backchain. 11929 11930As long as the stack frame backchain is not used, code generated with 11931@option{-mpacked-stack} is call-compatible with code generated with 11932@option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for 11933S/390 or zSeries generated code that uses the stack frame backchain at run 11934time, not just for debugging purposes. Such code is not call-compatible 11935with code compiled with @option{-mpacked-stack}. Also, note that the 11936combination of @option{-mbackchain}, 11937@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order 11938to build a linux kernel use @option{-msoft-float}. 11939 11940The default is to not use the packed stack layout. 11941 11942@item -msmall-exec 11943@itemx -mno-small-exec 11944@opindex msmall-exec 11945@opindex mno-small-exec 11946Generate (or do not generate) code using the @code{bras} instruction 11947to do subroutine calls. 11948This only works reliably if the total executable size does not 11949exceed 64k. The default is to use the @code{basr} instruction instead, 11950which does not have this limitation. 11951 11952@item -m64 11953@itemx -m31 11954@opindex m64 11955@opindex m31 11956When @option{-m31} is specified, generate code compliant to the 11957GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate 11958code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in 11959particular to generate 64-bit instructions. For the @samp{s390} 11960targets, the default is @option{-m31}, while the @samp{s390x} 11961targets default to @option{-m64}. 11962 11963@item -mzarch 11964@itemx -mesa 11965@opindex mzarch 11966@opindex mesa 11967When @option{-mzarch} is specified, generate code using the 11968instructions available on z/Architecture. 11969When @option{-mesa} is specified, generate code using the 11970instructions available on ESA/390. Note that @option{-mesa} is 11971not possible with @option{-m64}. 11972When generating code compliant to the GNU/Linux for S/390 ABI, 11973the default is @option{-mesa}. When generating code compliant 11974to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}. 11975 11976@item -mmvcle 11977@itemx -mno-mvcle 11978@opindex mmvcle 11979@opindex mno-mvcle 11980Generate (or do not generate) code using the @code{mvcle} instruction 11981to perform block moves. When @option{-mno-mvcle} is specified, 11982use a @code{mvc} loop instead. This is the default unless optimizing for 11983size. 11984 11985@item -mdebug 11986@itemx -mno-debug 11987@opindex mdebug 11988@opindex mno-debug 11989Print (or do not print) additional debug information when compiling. 11990The default is to not print debug information. 11991 11992@item -march=@var{cpu-type} 11993@opindex march 11994Generate code that will run on @var{cpu-type}, which is the name of a system 11995representing a certain processor type. Possible values for 11996@var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, and @samp{z990}. 11997When generating code using the instructions available on z/Architecture, 11998the default is @option{-march=z900}. Otherwise, the default is 11999@option{-march=g5}. 12000 12001@item -mtune=@var{cpu-type} 12002@opindex mtune 12003Tune to @var{cpu-type} everything applicable about the generated code, 12004except for the ABI and the set of available instructions. 12005The list of @var{cpu-type} values is the same as for @option{-march}. 12006The default is the value used for @option{-march}. 12007 12008@item -mtpf-trace 12009@itemx -mno-tpf-trace 12010@opindex mtpf-trace 12011@opindex mno-tpf-trace 12012Generate code that adds (does not add) in TPF OS specific branches to trace 12013routines in the operating system. This option is off by default, even 12014when compiling for the TPF OS@. 12015 12016@item -mfused-madd 12017@itemx -mno-fused-madd 12018@opindex mfused-madd 12019@opindex mno-fused-madd 12020Generate code that uses (does not use) the floating point multiply and 12021accumulate instructions. These instructions are generated by default if 12022hardware floating point is used. 12023 12024@item -mwarn-framesize=@var{framesize} 12025@opindex mwarn-framesize 12026Emit a warning if the current function exceeds the given frame size. Because 12027this is a compile time check it doesn't need to be a real problem when the program 12028runs. It is intended to identify functions which most probably cause 12029a stack overflow. It is useful to be used in an environment with limited stack 12030size e.g.@: the linux kernel. 12031 12032@item -mwarn-dynamicstack 12033@opindex mwarn-dynamicstack 12034Emit a warning if the function calls alloca or uses dynamically 12035sized arrays. This is generally a bad idea with a limited stack size. 12036 12037@item -mstack-guard=@var{stack-guard} 12038@item -mstack-size=@var{stack-size} 12039@opindex mstack-guard 12040@opindex mstack-size 12041These arguments always have to be used in conjunction. If they are present the s390 12042back end emits additional instructions in the function prologue which trigger a trap 12043if the stack size is @var{stack-guard} bytes above the @var{stack-size} 12044(remember that the stack on s390 grows downward). These options are intended to 12045be used to help debugging stack overflow problems. The additionally emitted code 12046causes only little overhead and hence can also be used in production like systems 12047without greater performance degradation. The given values have to be exact 12048powers of 2 and @var{stack-size} has to be greater than @var{stack-guard} without 12049exceeding 64k. 12050In order to be efficient the extra code makes the assumption that the stack starts 12051at an address aligned to the value given by @var{stack-size}. 12052@end table 12053 12054@node Score Options 12055@subsection Score Options 12056@cindex Score Options 12057 12058These options are defined for Score implementations: 12059 12060@table @gcctabopt 12061@item -meb 12062@opindex meb 12063Compile code for big endian mode. This is the default. 12064 12065@item -mel 12066@opindex mel 12067Compile code for little endian mode. 12068 12069@item -mnhwloop 12070@opindex mnhwloop 12071Disable generate bcnz instruction. 12072 12073@item -muls 12074@opindex muls 12075Enable generate unaligned load and store instruction. 12076 12077@item -mmac 12078@opindex mmac 12079Enable the use of multiply-accumulate instructions. Disabled by default. 12080 12081@item -mscore5 12082@opindex mscore5 12083Specify the SCORE5 as the target architecture. 12084 12085@item -mscore5u 12086@opindex mscore5u 12087Specify the SCORE5U of the target architecture. 12088 12089@item -mscore7 12090@opindex mscore7 12091Specify the SCORE7 as the target architecture. This is the default. 12092 12093@item -mscore7d 12094@opindex mscore7d 12095Specify the SCORE7D as the target architecture. 12096@end table 12097 12098@node SH Options 12099@subsection SH Options 12100 12101These @samp{-m} options are defined for the SH implementations: 12102 12103@table @gcctabopt 12104@item -m1 12105@opindex m1 12106Generate code for the SH1. 12107 12108@item -m2 12109@opindex m2 12110Generate code for the SH2. 12111 12112@item -m2e 12113Generate code for the SH2e. 12114 12115@item -m3 12116@opindex m3 12117Generate code for the SH3. 12118 12119@item -m3e 12120@opindex m3e 12121Generate code for the SH3e. 12122 12123@item -m4-nofpu 12124@opindex m4-nofpu 12125Generate code for the SH4 without a floating-point unit. 12126 12127@item -m4-single-only 12128@opindex m4-single-only 12129Generate code for the SH4 with a floating-point unit that only 12130supports single-precision arithmetic. 12131 12132@item -m4-single 12133@opindex m4-single 12134Generate code for the SH4 assuming the floating-point unit is in 12135single-precision mode by default. 12136 12137@item -m4 12138@opindex m4 12139Generate code for the SH4. 12140 12141@item -m4a-nofpu 12142@opindex m4a-nofpu 12143Generate code for the SH4al-dsp, or for a SH4a in such a way that the 12144floating-point unit is not used. 12145 12146@item -m4a-single-only 12147@opindex m4a-single-only 12148Generate code for the SH4a, in such a way that no double-precision 12149floating point operations are used. 12150 12151@item -m4a-single 12152@opindex m4a-single 12153Generate code for the SH4a assuming the floating-point unit is in 12154single-precision mode by default. 12155 12156@item -m4a 12157@opindex m4a 12158Generate code for the SH4a. 12159 12160@item -m4al 12161@opindex m4al 12162Same as @option{-m4a-nofpu}, except that it implicitly passes 12163@option{-dsp} to the assembler. GCC doesn't generate any DSP 12164instructions at the moment. 12165 12166@item -mb 12167@opindex mb 12168Compile code for the processor in big endian mode. 12169 12170@item -ml 12171@opindex ml 12172Compile code for the processor in little endian mode. 12173 12174@item -mdalign 12175@opindex mdalign 12176Align doubles at 64-bit boundaries. Note that this changes the calling 12177conventions, and thus some functions from the standard C library will 12178not work unless you recompile it first with @option{-mdalign}. 12179 12180@item -mrelax 12181@opindex mrelax 12182Shorten some address references at link time, when possible; uses the 12183linker option @option{-relax}. 12184 12185@item -mbigtable 12186@opindex mbigtable 12187Use 32-bit offsets in @code{switch} tables. The default is to use 1218816-bit offsets. 12189 12190@item -mfmovd 12191@opindex mfmovd 12192Enable the use of the instruction @code{fmovd}. 12193 12194@item -mhitachi 12195@opindex mhitachi 12196Comply with the calling conventions defined by Renesas. 12197 12198@item -mrenesas 12199@opindex mhitachi 12200Comply with the calling conventions defined by Renesas. 12201 12202@item -mno-renesas 12203@opindex mhitachi 12204Comply with the calling conventions defined for GCC before the Renesas 12205conventions were available. This option is the default for all 12206targets of the SH toolchain except for @samp{sh-symbianelf}. 12207 12208@item -mnomacsave 12209@opindex mnomacsave 12210Mark the @code{MAC} register as call-clobbered, even if 12211@option{-mhitachi} is given. 12212 12213@item -mieee 12214@opindex mieee 12215Increase IEEE-compliance of floating-point code. 12216At the moment, this is equivalent to @option{-fno-finite-math-only}. 12217When generating 16 bit SH opcodes, getting IEEE-conforming results for 12218comparisons of NANs / infinities incurs extra overhead in every 12219floating point comparison, therefore the default is set to 12220@option{-ffinite-math-only}. 12221 12222@item -misize 12223@opindex misize 12224Dump instruction size and location in the assembly code. 12225 12226@item -mpadstruct 12227@opindex mpadstruct 12228This option is deprecated. It pads structures to multiple of 4 bytes, 12229which is incompatible with the SH ABI@. 12230 12231@item -mspace 12232@opindex mspace 12233Optimize for space instead of speed. Implied by @option{-Os}. 12234 12235@item -mprefergot 12236@opindex mprefergot 12237When generating position-independent code, emit function calls using 12238the Global Offset Table instead of the Procedure Linkage Table. 12239 12240@item -musermode 12241@opindex musermode 12242Generate a library function call to invalidate instruction cache 12243entries, after fixing up a trampoline. This library function call 12244doesn't assume it can write to the whole memory address space. This 12245is the default when the target is @code{sh-*-linux*}. 12246 12247@item -multcost=@var{number} 12248@opindex multcost=@var{number} 12249Set the cost to assume for a multiply insn. 12250 12251@item -mdiv=@var{strategy} 12252@opindex mdiv=@var{strategy} 12253Set the division strategy to use for SHmedia code. @var{strategy} must be 12254one of: call, call2, fp, inv, inv:minlat, inv20u, inv20l, inv:call, 12255inv:call2, inv:fp . 12256"fp" performs the operation in floating point. This has a very high latency, 12257but needs only a few instructions, so it might be a good choice if 12258your code has enough easily exploitable ILP to allow the compiler to 12259schedule the floating point instructions together with other instructions. 12260Division by zero causes a floating point exception. 12261"inv" uses integer operations to calculate the inverse of the divisor, 12262and then multiplies the dividend with the inverse. This strategy allows 12263cse and hoisting of the inverse calculation. Division by zero calculates 12264an unspecified result, but does not trap. 12265"inv:minlat" is a variant of "inv" where if no cse / hoisting opportunities 12266have been found, or if the entire operation has been hoisted to the same 12267place, the last stages of the inverse calculation are intertwined with the 12268final multiply to reduce the overall latency, at the expense of using a few 12269more instructions, and thus offering fewer scheduling opportunities with 12270other code. 12271"call" calls a library function that usually implements the inv:minlat 12272strategy. 12273This gives high code density for m5-*media-nofpu compilations. 12274"call2" uses a different entry point of the same library function, where it 12275assumes that a pointer to a lookup table has already been set up, which 12276exposes the pointer load to cse / code hoisting optimizations. 12277"inv:call", "inv:call2" and "inv:fp" all use the "inv" algorithm for initial 12278code generation, but if the code stays unoptimized, revert to the "call", 12279"call2", or "fp" strategies, respectively. Note that the 12280potentially-trapping side effect of division by zero is carried by a 12281separate instruction, so it is possible that all the integer instructions 12282are hoisted out, but the marker for the side effect stays where it is. 12283A recombination to fp operations or a call is not possible in that case. 12284"inv20u" and "inv20l" are variants of the "inv:minlat" strategy. In the case 12285that the inverse calculation was nor separated from the multiply, they speed 12286up division where the dividend fits into 20 bits (plus sign where applicable), 12287by inserting a test to skip a number of operations in this case; this test 12288slows down the case of larger dividends. inv20u assumes the case of a such 12289a small dividend to be unlikely, and inv20l assumes it to be likely. 12290 12291@item -mdivsi3_libfunc=@var{name} 12292@opindex mdivsi3_libfunc=@var{name} 12293Set the name of the library function used for 32 bit signed division to 12294@var{name}. This only affect the name used in the call and inv:call 12295division strategies, and the compiler will still expect the same 12296sets of input/output/clobbered registers as if this option was not present. 12297 12298@item -madjust-unroll 12299@opindex madjust-unroll 12300Throttle unrolling to avoid thrashing target registers. 12301This option only has an effect if the gcc code base supports the 12302TARGET_ADJUST_UNROLL_MAX target hook. 12303 12304@item -mindexed-addressing 12305@opindex mindexed-addressing 12306Enable the use of the indexed addressing mode for SHmedia32/SHcompact. 12307This is only safe if the hardware and/or OS implement 32 bit wrap-around 12308semantics for the indexed addressing mode. The architecture allows the 12309implementation of processors with 64 bit MMU, which the OS could use to 12310get 32 bit addressing, but since no current hardware implementation supports 12311this or any other way to make the indexed addressing mode safe to use in 12312the 32 bit ABI, the default is -mno-indexed-addressing. 12313 12314@item -mgettrcost=@var{number} 12315@opindex mgettrcost=@var{number} 12316Set the cost assumed for the gettr instruction to @var{number}. 12317The default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise. 12318 12319@item -mpt-fixed 12320@opindex mpt-fixed 12321Assume pt* instructions won't trap. This will generally generate better 12322scheduled code, but is unsafe on current hardware. The current architecture 12323definition says that ptabs and ptrel trap when the target anded with 3 is 3. 12324This has the unintentional effect of making it unsafe to schedule ptabs / 12325ptrel before a branch, or hoist it out of a loop. For example, 12326__do_global_ctors, a part of libgcc that runs constructors at program 12327startup, calls functions in a list which is delimited by -1. With the 12328-mpt-fixed option, the ptabs will be done before testing against -1. 12329That means that all the constructors will be run a bit quicker, but when 12330the loop comes to the end of the list, the program crashes because ptabs 12331loads -1 into a target register. Since this option is unsafe for any 12332hardware implementing the current architecture specification, the default 12333is -mno-pt-fixed. Unless the user specifies a specific cost with 12334@option{-mgettrcost}, -mno-pt-fixed also implies @option{-mgettrcost=100}; 12335this deters register allocation using target registers for storing 12336ordinary integers. 12337 12338@item -minvalid-symbols 12339@opindex minvalid-symbols 12340Assume symbols might be invalid. Ordinary function symbols generated by 12341the compiler will always be valid to load with movi/shori/ptabs or 12342movi/shori/ptrel, but with assembler and/or linker tricks it is possible 12343to generate symbols that will cause ptabs / ptrel to trap. 12344This option is only meaningful when @option{-mno-pt-fixed} is in effect. 12345It will then prevent cross-basic-block cse, hoisting and most scheduling 12346of symbol loads. The default is @option{-mno-invalid-symbols}. 12347@end table 12348 12349@node SPARC Options 12350@subsection SPARC Options 12351@cindex SPARC options 12352 12353These @samp{-m} options are supported on the SPARC: 12354 12355@table @gcctabopt 12356@item -mno-app-regs 12357@itemx -mapp-regs 12358@opindex mno-app-regs 12359@opindex mapp-regs 12360Specify @option{-mapp-regs} to generate output using the global registers 123612 through 4, which the SPARC SVR4 ABI reserves for applications. This 12362is the default. 12363 12364To be fully SVR4 ABI compliant at the cost of some performance loss, 12365specify @option{-mno-app-regs}. You should compile libraries and system 12366software with this option. 12367 12368@item -mfpu 12369@itemx -mhard-float 12370@opindex mfpu 12371@opindex mhard-float 12372Generate output containing floating point instructions. This is the 12373default. 12374 12375@item -mno-fpu 12376@itemx -msoft-float 12377@opindex mno-fpu 12378@opindex msoft-float 12379Generate output containing library calls for floating point. 12380@strong{Warning:} the requisite libraries are not available for all SPARC 12381targets. Normally the facilities of the machine's usual C compiler are 12382used, but this cannot be done directly in cross-compilation. You must make 12383your own arrangements to provide suitable library functions for 12384cross-compilation. The embedded targets @samp{sparc-*-aout} and 12385@samp{sparclite-*-*} do provide software floating point support. 12386 12387@option{-msoft-float} changes the calling convention in the output file; 12388therefore, it is only useful if you compile @emph{all} of a program with 12389this option. In particular, you need to compile @file{libgcc.a}, the 12390library that comes with GCC, with @option{-msoft-float} in order for 12391this to work. 12392 12393@item -mhard-quad-float 12394@opindex mhard-quad-float 12395Generate output containing quad-word (long double) floating point 12396instructions. 12397 12398@item -msoft-quad-float 12399@opindex msoft-quad-float 12400Generate output containing library calls for quad-word (long double) 12401floating point instructions. The functions called are those specified 12402in the SPARC ABI@. This is the default. 12403 12404As of this writing, there are no SPARC implementations that have hardware 12405support for the quad-word floating point instructions. They all invoke 12406a trap handler for one of these instructions, and then the trap handler 12407emulates the effect of the instruction. Because of the trap handler overhead, 12408this is much slower than calling the ABI library routines. Thus the 12409@option{-msoft-quad-float} option is the default. 12410 12411@item -mno-unaligned-doubles 12412@itemx -munaligned-doubles 12413@opindex mno-unaligned-doubles 12414@opindex munaligned-doubles 12415Assume that doubles have 8 byte alignment. This is the default. 12416 12417With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte 12418alignment only if they are contained in another type, or if they have an 12419absolute address. Otherwise, it assumes they have 4 byte alignment. 12420Specifying this option avoids some rare compatibility problems with code 12421generated by other compilers. It is not the default because it results 12422in a performance loss, especially for floating point code. 12423 12424@item -mno-faster-structs 12425@itemx -mfaster-structs 12426@opindex mno-faster-structs 12427@opindex mfaster-structs 12428With @option{-mfaster-structs}, the compiler assumes that structures 12429should have 8 byte alignment. This enables the use of pairs of 12430@code{ldd} and @code{std} instructions for copies in structure 12431assignment, in place of twice as many @code{ld} and @code{st} pairs. 12432However, the use of this changed alignment directly violates the SPARC 12433ABI@. Thus, it's intended only for use on targets where the developer 12434acknowledges that their resulting code will not be directly in line with 12435the rules of the ABI@. 12436 12437@item -mimpure-text 12438@opindex mimpure-text 12439@option{-mimpure-text}, used in addition to @option{-shared}, tells 12440the compiler to not pass @option{-z text} to the linker when linking a 12441shared object. Using this option, you can link position-dependent 12442code into a shared object. 12443 12444@option{-mimpure-text} suppresses the ``relocations remain against 12445allocatable but non-writable sections'' linker error message. 12446However, the necessary relocations will trigger copy-on-write, and the 12447shared object is not actually shared across processes. Instead of 12448using @option{-mimpure-text}, you should compile all source code with 12449@option{-fpic} or @option{-fPIC}. 12450 12451This option is only available on SunOS and Solaris. 12452 12453@item -mcpu=@var{cpu_type} 12454@opindex mcpu 12455Set the instruction set, register set, and instruction scheduling parameters 12456for machine type @var{cpu_type}. Supported values for @var{cpu_type} are 12457@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite}, 12458@samp{f930}, @samp{f934}, @samp{hypersparc}, @samp{sparclite86x}, 12459@samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc}, 12460@samp{ultrasparc3}, and @samp{niagara}. 12461 12462Default instruction scheduling parameters are used for values that select 12463an architecture and not an implementation. These are @samp{v7}, @samp{v8}, 12464@samp{sparclite}, @samp{sparclet}, @samp{v9}. 12465 12466Here is a list of each supported architecture and their supported 12467implementations. 12468 12469@smallexample 12470 v7: cypress 12471 v8: supersparc, hypersparc 12472 sparclite: f930, f934, sparclite86x 12473 sparclet: tsc701 12474 v9: ultrasparc, ultrasparc3, niagara 12475@end smallexample 12476 12477By default (unless configured otherwise), GCC generates code for the V7 12478variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler 12479additionally optimizes it for the Cypress CY7C602 chip, as used in the 12480SPARCStation/SPARCServer 3xx series. This is also appropriate for the older 12481SPARCStation 1, 2, IPX etc. 12482 12483With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC 12484architecture. The only difference from V7 code is that the compiler emits 12485the integer multiply and integer divide instructions which exist in SPARC-V8 12486but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally 12487optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and 124882000 series. 12489 12490With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of 12491the SPARC architecture. This adds the integer multiply, integer divide step 12492and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7. 12493With @option{-mcpu=f930}, the compiler additionally optimizes it for the 12494Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With 12495@option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu 12496MB86934 chip, which is the more recent SPARClite with FPU@. 12497 12498With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of 12499the SPARC architecture. This adds the integer multiply, multiply/accumulate, 12500integer divide step and scan (@code{ffs}) instructions which exist in SPARClet 12501but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally 12502optimizes it for the TEMIC SPARClet chip. 12503 12504With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC 12505architecture. This adds 64-bit integer and floating-point move instructions, 125063 additional floating-point condition code registers and conditional move 12507instructions. With @option{-mcpu=ultrasparc}, the compiler additionally 12508optimizes it for the Sun UltraSPARC I/II/IIi chips. With 12509@option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the 12510Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With 12511@option{-mcpu=niagara}, the compiler additionally optimizes it for 12512Sun UltraSPARC T1 chips. 12513 12514@item -mtune=@var{cpu_type} 12515@opindex mtune 12516Set the instruction scheduling parameters for machine type 12517@var{cpu_type}, but do not set the instruction set or register set that the 12518option @option{-mcpu=@var{cpu_type}} would. 12519 12520The same values for @option{-mcpu=@var{cpu_type}} can be used for 12521@option{-mtune=@var{cpu_type}}, but the only useful values are those 12522that select a particular cpu implementation. Those are @samp{cypress}, 12523@samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934}, 12524@samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc}, 12525@samp{ultrasparc3}, and @samp{niagara}. 12526 12527@item -mv8plus 12528@itemx -mno-v8plus 12529@opindex mv8plus 12530@opindex mno-v8plus 12531With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The 12532difference from the V8 ABI is that the global and out registers are 12533considered 64-bit wide. This is enabled by default on Solaris in 32-bit 12534mode for all SPARC-V9 processors. 12535 12536@item -mvis 12537@itemx -mno-vis 12538@opindex mvis 12539@opindex mno-vis 12540With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC 12541Visual Instruction Set extensions. The default is @option{-mno-vis}. 12542@end table 12543 12544These @samp{-m} options are supported in addition to the above 12545on SPARC-V9 processors in 64-bit environments: 12546 12547@table @gcctabopt 12548@item -mlittle-endian 12549@opindex mlittle-endian 12550Generate code for a processor running in little-endian mode. It is only 12551available for a few configurations and most notably not on Solaris and Linux. 12552 12553@item -m32 12554@itemx -m64 12555@opindex m32 12556@opindex m64 12557Generate code for a 32-bit or 64-bit environment. 12558The 32-bit environment sets int, long and pointer to 32 bits. 12559The 64-bit environment sets int to 32 bits and long and pointer 12560to 64 bits. 12561 12562@item -mcmodel=medlow 12563@opindex mcmodel=medlow 12564Generate code for the Medium/Low code model: 64-bit addresses, programs 12565must be linked in the low 32 bits of memory. Programs can be statically 12566or dynamically linked. 12567 12568@item -mcmodel=medmid 12569@opindex mcmodel=medmid 12570Generate code for the Medium/Middle code model: 64-bit addresses, programs 12571must be linked in the low 44 bits of memory, the text and data segments must 12572be less than 2GB in size and the data segment must be located within 2GB of 12573the text segment. 12574 12575@item -mcmodel=medany 12576@opindex mcmodel=medany 12577Generate code for the Medium/Anywhere code model: 64-bit addresses, programs 12578may be linked anywhere in memory, the text and data segments must be less 12579than 2GB in size and the data segment must be located within 2GB of the 12580text segment. 12581 12582@item -mcmodel=embmedany 12583@opindex mcmodel=embmedany 12584Generate code for the Medium/Anywhere code model for embedded systems: 1258564-bit addresses, the text and data segments must be less than 2GB in 12586size, both starting anywhere in memory (determined at link time). The 12587global register %g4 points to the base of the data segment. Programs 12588are statically linked and PIC is not supported. 12589 12590@item -mstack-bias 12591@itemx -mno-stack-bias 12592@opindex mstack-bias 12593@opindex mno-stack-bias 12594With @option{-mstack-bias}, GCC assumes that the stack pointer, and 12595frame pointer if present, are offset by @minus{}2047 which must be added back 12596when making stack frame references. This is the default in 64-bit mode. 12597Otherwise, assume no such offset is present. 12598@end table 12599 12600These switches are supported in addition to the above on Solaris: 12601 12602@table @gcctabopt 12603@item -threads 12604@opindex threads 12605Add support for multithreading using the Solaris threads library. This 12606option sets flags for both the preprocessor and linker. This option does 12607not affect the thread safety of object code produced by the compiler or 12608that of libraries supplied with it. 12609 12610@item -pthreads 12611@opindex pthreads 12612Add support for multithreading using the POSIX threads library. This 12613option sets flags for both the preprocessor and linker. This option does 12614not affect the thread safety of object code produced by the compiler or 12615that of libraries supplied with it. 12616 12617@item -pthread 12618@opindex pthread 12619This is a synonym for @option{-pthreads}. 12620@end table 12621 12622@node System V Options 12623@subsection Options for System V 12624 12625These additional options are available on System V Release 4 for 12626compatibility with other compilers on those systems: 12627 12628@table @gcctabopt 12629@item -G 12630@opindex G 12631Create a shared object. 12632It is recommended that @option{-symbolic} or @option{-shared} be used instead. 12633 12634@item -Qy 12635@opindex Qy 12636Identify the versions of each tool used by the compiler, in a 12637@code{.ident} assembler directive in the output. 12638 12639@item -Qn 12640@opindex Qn 12641Refrain from adding @code{.ident} directives to the output file (this is 12642the default). 12643 12644@item -YP,@var{dirs} 12645@opindex YP 12646Search the directories @var{dirs}, and no others, for libraries 12647specified with @option{-l}. 12648 12649@item -Ym,@var{dir} 12650@opindex Ym 12651Look in the directory @var{dir} to find the M4 preprocessor. 12652The assembler uses this option. 12653@c This is supposed to go with a -Yd for predefined M4 macro files, but 12654@c the generic assembler that comes with Solaris takes just -Ym. 12655@end table 12656 12657@node TMS320C3x/C4x Options 12658@subsection TMS320C3x/C4x Options 12659@cindex TMS320C3x/C4x Options 12660 12661These @samp{-m} options are defined for TMS320C3x/C4x implementations: 12662 12663@table @gcctabopt 12664 12665@item -mcpu=@var{cpu_type} 12666@opindex mcpu 12667Set the instruction set, register set, and instruction scheduling 12668parameters for machine type @var{cpu_type}. Supported values for 12669@var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and 12670@samp{c44}. The default is @samp{c40} to generate code for the 12671TMS320C40. 12672 12673@item -mbig-memory 12674@itemx -mbig 12675@itemx -msmall-memory 12676@itemx -msmall 12677@opindex mbig-memory 12678@opindex mbig 12679@opindex msmall-memory 12680@opindex msmall 12681Generates code for the big or small memory model. The small memory 12682model assumed that all data fits into one 64K word page. At run-time 12683the data page (DP) register must be set to point to the 64K page 12684containing the .bss and .data program sections. The big memory model is 12685the default and requires reloading of the DP register for every direct 12686memory access. 12687 12688@item -mbk 12689@itemx -mno-bk 12690@opindex mbk 12691@opindex mno-bk 12692Allow (disallow) allocation of general integer operands into the block 12693count register BK@. 12694 12695@item -mdb 12696@itemx -mno-db 12697@opindex mdb 12698@opindex mno-db 12699Enable (disable) generation of code using decrement and branch, 12700DBcond(D), instructions. This is enabled by default for the C4x. To be 12701on the safe side, this is disabled for the C3x, since the maximum 12702iteration count on the C3x is @math{2^{23} + 1} (but who iterates loops more than 12703@math{2^{23}} times on the C3x?). Note that GCC will try to reverse a loop so 12704that it can utilize the decrement and branch instruction, but will give 12705up if there is more than one memory reference in the loop. Thus a loop 12706where the loop counter is decremented can generate slightly more 12707efficient code, in cases where the RPTB instruction cannot be utilized. 12708 12709@item -mdp-isr-reload 12710@itemx -mparanoid 12711@opindex mdp-isr-reload 12712@opindex mparanoid 12713Force the DP register to be saved on entry to an interrupt service 12714routine (ISR), reloaded to point to the data section, and restored on 12715exit from the ISR@. This should not be required unless someone has 12716violated the small memory model by modifying the DP register, say within 12717an object library. 12718 12719@item -mmpyi 12720@itemx -mno-mpyi 12721@opindex mmpyi 12722@opindex mno-mpyi 12723For the C3x use the 24-bit MPYI instruction for integer multiplies 12724instead of a library call to guarantee 32-bit results. Note that if one 12725of the operands is a constant, then the multiplication will be performed 12726using shifts and adds. If the @option{-mmpyi} option is not specified for the C3x, 12727then squaring operations are performed inline instead of a library call. 12728 12729@item -mfast-fix 12730@itemx -mno-fast-fix 12731@opindex mfast-fix 12732@opindex mno-fast-fix 12733The C3x/C4x FIX instruction to convert a floating point value to an 12734integer value chooses the nearest integer less than or equal to the 12735floating point value rather than to the nearest integer. Thus if the 12736floating point number is negative, the result will be incorrectly 12737truncated an additional code is necessary to detect and correct this 12738case. This option can be used to disable generation of the additional 12739code required to correct the result. 12740 12741@item -mrptb 12742@itemx -mno-rptb 12743@opindex mrptb 12744@opindex mno-rptb 12745Enable (disable) generation of repeat block sequences using the RPTB 12746instruction for zero overhead looping. The RPTB construct is only used 12747for innermost loops that do not call functions or jump across the loop 12748boundaries. There is no advantage having nested RPTB loops due to the 12749overhead required to save and restore the RC, RS, and RE registers. 12750This is enabled by default with @option{-O2}. 12751 12752@item -mrpts=@var{count} 12753@itemx -mno-rpts 12754@opindex mrpts 12755@opindex mno-rpts 12756Enable (disable) the use of the single instruction repeat instruction 12757RPTS@. If a repeat block contains a single instruction, and the loop 12758count can be guaranteed to be less than the value @var{count}, GCC will 12759emit a RPTS instruction instead of a RPTB@. If no value is specified, 12760then a RPTS will be emitted even if the loop count cannot be determined 12761at compile time. Note that the repeated instruction following RPTS does 12762not have to be reloaded from memory each iteration, thus freeing up the 12763CPU buses for operands. However, since interrupts are blocked by this 12764instruction, it is disabled by default. 12765 12766@item -mloop-unsigned 12767@itemx -mno-loop-unsigned 12768@opindex mloop-unsigned 12769@opindex mno-loop-unsigned 12770The maximum iteration count when using RPTS and RPTB (and DB on the C40) 12771is @math{2^{31} + 1} since these instructions test if the iteration count is 12772negative to terminate the loop. If the iteration count is unsigned 12773there is a possibility than the @math{2^{31} + 1} maximum iteration count may be 12774exceeded. This switch allows an unsigned iteration count. 12775 12776@item -mti 12777@opindex mti 12778Try to emit an assembler syntax that the TI assembler (asm30) is happy 12779with. This also enforces compatibility with the API employed by the TI 12780C3x C compiler. For example, long doubles are passed as structures 12781rather than in floating point registers. 12782 12783@item -mregparm 12784@itemx -mmemparm 12785@opindex mregparm 12786@opindex mmemparm 12787Generate code that uses registers (stack) for passing arguments to functions. 12788By default, arguments are passed in registers where possible rather 12789than by pushing arguments on to the stack. 12790 12791@item -mparallel-insns 12792@itemx -mno-parallel-insns 12793@opindex mparallel-insns 12794@opindex mno-parallel-insns 12795Allow the generation of parallel instructions. This is enabled by 12796default with @option{-O2}. 12797 12798@item -mparallel-mpy 12799@itemx -mno-parallel-mpy 12800@opindex mparallel-mpy 12801@opindex mno-parallel-mpy 12802Allow the generation of MPY||ADD and MPY||SUB parallel instructions, 12803provided @option{-mparallel-insns} is also specified. These instructions have 12804tight register constraints which can pessimize the code generation 12805of large functions. 12806 12807@end table 12808 12809@node V850 Options 12810@subsection V850 Options 12811@cindex V850 Options 12812 12813These @samp{-m} options are defined for V850 implementations: 12814 12815@table @gcctabopt 12816@item -mlong-calls 12817@itemx -mno-long-calls 12818@opindex mlong-calls 12819@opindex mno-long-calls 12820Treat all calls as being far away (near). If calls are assumed to be 12821far away, the compiler will always load the functions address up into a 12822register, and call indirect through the pointer. 12823 12824@item -mno-ep 12825@itemx -mep 12826@opindex mno-ep 12827@opindex mep 12828Do not optimize (do optimize) basic blocks that use the same index 12829pointer 4 or more times to copy pointer into the @code{ep} register, and 12830use the shorter @code{sld} and @code{sst} instructions. The @option{-mep} 12831option is on by default if you optimize. 12832 12833@item -mno-prolog-function 12834@itemx -mprolog-function 12835@opindex mno-prolog-function 12836@opindex mprolog-function 12837Do not use (do use) external functions to save and restore registers 12838at the prologue and epilogue of a function. The external functions 12839are slower, but use less code space if more than one function saves 12840the same number of registers. The @option{-mprolog-function} option 12841is on by default if you optimize. 12842 12843@item -mspace 12844@opindex mspace 12845Try to make the code as small as possible. At present, this just turns 12846on the @option{-mep} and @option{-mprolog-function} options. 12847 12848@item -mtda=@var{n} 12849@opindex mtda 12850Put static or global variables whose size is @var{n} bytes or less into 12851the tiny data area that register @code{ep} points to. The tiny data 12852area can hold up to 256 bytes in total (128 bytes for byte references). 12853 12854@item -msda=@var{n} 12855@opindex msda 12856Put static or global variables whose size is @var{n} bytes or less into 12857the small data area that register @code{gp} points to. The small data 12858area can hold up to 64 kilobytes. 12859 12860@item -mzda=@var{n} 12861@opindex mzda 12862Put static or global variables whose size is @var{n} bytes or less into 12863the first 32 kilobytes of memory. 12864 12865@item -mv850 12866@opindex mv850 12867Specify that the target processor is the V850. 12868 12869@item -mbig-switch 12870@opindex mbig-switch 12871Generate code suitable for big switch tables. Use this option only if 12872the assembler/linker complain about out of range branches within a switch 12873table. 12874 12875@item -mapp-regs 12876@opindex mapp-regs 12877This option will cause r2 and r5 to be used in the code generated by 12878the compiler. This setting is the default. 12879 12880@item -mno-app-regs 12881@opindex mno-app-regs 12882This option will cause r2 and r5 to be treated as fixed registers. 12883 12884@item -mv850e1 12885@opindex mv850e1 12886Specify that the target processor is the V850E1. The preprocessor 12887constants @samp{__v850e1__} and @samp{__v850e__} will be defined if 12888this option is used. 12889 12890@item -mv850e 12891@opindex mv850e 12892Specify that the target processor is the V850E@. The preprocessor 12893constant @samp{__v850e__} will be defined if this option is used. 12894 12895If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1} 12896are defined then a default target processor will be chosen and the 12897relevant @samp{__v850*__} preprocessor constant will be defined. 12898 12899The preprocessor constants @samp{__v850} and @samp{__v851__} are always 12900defined, regardless of which processor variant is the target. 12901 12902@item -mdisable-callt 12903@opindex mdisable-callt 12904This option will suppress generation of the CALLT instruction for the 12905v850e and v850e1 flavors of the v850 architecture. The default is 12906@option{-mno-disable-callt} which allows the CALLT instruction to be used. 12907 12908@end table 12909 12910@node VAX Options 12911@subsection VAX Options 12912@cindex VAX options 12913 12914These @samp{-m} options are defined for the VAX: 12915 12916@table @gcctabopt 12917@item -munix 12918@opindex munix 12919Do not output certain jump instructions (@code{aobleq} and so on) 12920that the Unix assembler for the VAX cannot handle across long 12921ranges. 12922 12923@item -mgnu 12924@opindex mgnu 12925Do output those jump instructions, on the assumption that you 12926will assemble with the GNU assembler. 12927 12928@item -mg 12929@opindex mg 12930Output code for g-format floating point numbers instead of d-format. 12931@end table 12932 12933@node x86-64 Options 12934@subsection x86-64 Options 12935@cindex x86-64 options 12936 12937These are listed under @xref{i386 and x86-64 Options}. 12938 12939@node Xstormy16 Options 12940@subsection Xstormy16 Options 12941@cindex Xstormy16 Options 12942 12943These options are defined for Xstormy16: 12944 12945@table @gcctabopt 12946@item -msim 12947@opindex msim 12948Choose startup files and linker script suitable for the simulator. 12949@end table 12950 12951@node Xtensa Options 12952@subsection Xtensa Options 12953@cindex Xtensa Options 12954 12955These options are supported for Xtensa targets: 12956 12957@table @gcctabopt 12958@item -mconst16 12959@itemx -mno-const16 12960@opindex mconst16 12961@opindex mno-const16 12962Enable or disable use of @code{CONST16} instructions for loading 12963constant values. The @code{CONST16} instruction is currently not a 12964standard option from Tensilica. When enabled, @code{CONST16} 12965instructions are always used in place of the standard @code{L32R} 12966instructions. The use of @code{CONST16} is enabled by default only if 12967the @code{L32R} instruction is not available. 12968 12969@item -mfused-madd 12970@itemx -mno-fused-madd 12971@opindex mfused-madd 12972@opindex mno-fused-madd 12973Enable or disable use of fused multiply/add and multiply/subtract 12974instructions in the floating-point option. This has no effect if the 12975floating-point option is not also enabled. Disabling fused multiply/add 12976and multiply/subtract instructions forces the compiler to use separate 12977instructions for the multiply and add/subtract operations. This may be 12978desirable in some cases where strict IEEE 754-compliant results are 12979required: the fused multiply add/subtract instructions do not round the 12980intermediate result, thereby producing results with @emph{more} bits of 12981precision than specified by the IEEE standard. Disabling fused multiply 12982add/subtract instructions also ensures that the program output is not 12983sensitive to the compiler's ability to combine multiply and add/subtract 12984operations. 12985 12986@item -mtext-section-literals 12987@itemx -mno-text-section-literals 12988@opindex mtext-section-literals 12989@opindex mno-text-section-literals 12990Control the treatment of literal pools. The default is 12991@option{-mno-text-section-literals}, which places literals in a separate 12992section in the output file. This allows the literal pool to be placed 12993in a data RAM/ROM, and it also allows the linker to combine literal 12994pools from separate object files to remove redundant literals and 12995improve code size. With @option{-mtext-section-literals}, the literals 12996are interspersed in the text section in order to keep them as close as 12997possible to their references. This may be necessary for large assembly 12998files. 12999 13000@item -mtarget-align 13001@itemx -mno-target-align 13002@opindex mtarget-align 13003@opindex mno-target-align 13004When this option is enabled, GCC instructs the assembler to 13005automatically align instructions to reduce branch penalties at the 13006expense of some code density. The assembler attempts to widen density 13007instructions to align branch targets and the instructions following call 13008instructions. If there are not enough preceding safe density 13009instructions to align a target, no widening will be performed. The 13010default is @option{-mtarget-align}. These options do not affect the 13011treatment of auto-aligned instructions like @code{LOOP}, which the 13012assembler will always align, either by widening density instructions or 13013by inserting no-op instructions. 13014 13015@item -mlongcalls 13016@itemx -mno-longcalls 13017@opindex mlongcalls 13018@opindex mno-longcalls 13019When this option is enabled, GCC instructs the assembler to translate 13020direct calls to indirect calls unless it can determine that the target 13021of a direct call is in the range allowed by the call instruction. This 13022translation typically occurs for calls to functions in other source 13023files. Specifically, the assembler translates a direct @code{CALL} 13024instruction into an @code{L32R} followed by a @code{CALLX} instruction. 13025The default is @option{-mno-longcalls}. This option should be used in 13026programs where the call target can potentially be out of range. This 13027option is implemented in the assembler, not the compiler, so the 13028assembly code generated by GCC will still show direct call 13029instructions---look at the disassembled object code to see the actual 13030instructions. Note that the assembler will use an indirect call for 13031every cross-file call, not just those that really will be out of range. 13032@end table 13033 13034@node zSeries Options 13035@subsection zSeries Options 13036@cindex zSeries options 13037 13038These are listed under @xref{S/390 and zSeries Options}. 13039 13040@node Code Gen Options 13041@section Options for Code Generation Conventions 13042@cindex code generation conventions 13043@cindex options, code generation 13044@cindex run-time options 13045 13046These machine-independent options control the interface conventions 13047used in code generation. 13048 13049Most of them have both positive and negative forms; the negative form 13050of @option{-ffoo} would be @option{-fno-foo}. In the table below, only 13051one of the forms is listed---the one which is not the default. You 13052can figure out the other form by either removing @samp{no-} or adding 13053it. 13054 13055@table @gcctabopt 13056@item -fbounds-check 13057@opindex fbounds-check 13058For front-ends that support it, generate additional code to check that 13059indices used to access arrays are within the declared range. This is 13060currently only supported by the Java and Fortran front-ends, where 13061this option defaults to true and false respectively. 13062 13063@item -ftrapv 13064@opindex ftrapv 13065This option generates traps for signed overflow on addition, subtraction, 13066multiplication operations. 13067 13068@item -fwrapv 13069@opindex fwrapv 13070This option instructs the compiler to assume that signed arithmetic 13071overflow of addition, subtraction and multiplication wraps around 13072using twos-complement representation. This flag enables some optimizations 13073and disables others. This option is enabled by default for the Java 13074front-end, as required by the Java language specification. 13075 13076@item -fexceptions 13077@opindex fexceptions 13078Enable exception handling. Generates extra code needed to propagate 13079exceptions. For some targets, this implies GCC will generate frame 13080unwind information for all functions, which can produce significant data 13081size overhead, although it does not affect execution. If you do not 13082specify this option, GCC will enable it by default for languages like 13083C++ which normally require exception handling, and disable it for 13084languages like C that do not normally require it. However, you may need 13085to enable this option when compiling C code that needs to interoperate 13086properly with exception handlers written in C++. You may also wish to 13087disable this option if you are compiling older C++ programs that don't 13088use exception handling. 13089 13090@item -fnon-call-exceptions 13091@opindex fnon-call-exceptions 13092Generate code that allows trapping instructions to throw exceptions. 13093Note that this requires platform-specific runtime support that does 13094not exist everywhere. Moreover, it only allows @emph{trapping} 13095instructions to throw exceptions, i.e.@: memory references or floating 13096point instructions. It does not allow exceptions to be thrown from 13097arbitrary signal handlers such as @code{SIGALRM}. 13098 13099@item -funwind-tables 13100@opindex funwind-tables 13101Similar to @option{-fexceptions}, except that it will just generate any needed 13102static data, but will not affect the generated code in any other way. 13103You will normally not enable this option; instead, a language processor 13104that needs this handling would enable it on your behalf. 13105 13106@item -fasynchronous-unwind-tables 13107@opindex fasynchronous-unwind-tables 13108Generate unwind table in dwarf2 format, if supported by target machine. The 13109table is exact at each instruction boundary, so it can be used for stack 13110unwinding from asynchronous events (such as debugger or garbage collector). 13111 13112@item -fpcc-struct-return 13113@opindex fpcc-struct-return 13114Return ``short'' @code{struct} and @code{union} values in memory like 13115longer ones, rather than in registers. This convention is less 13116efficient, but it has the advantage of allowing intercallability between 13117GCC-compiled files and files compiled with other compilers, particularly 13118the Portable C Compiler (pcc). 13119 13120The precise convention for returning structures in memory depends 13121on the target configuration macros. 13122 13123Short structures and unions are those whose size and alignment match 13124that of some integer type. 13125 13126@strong{Warning:} code compiled with the @option{-fpcc-struct-return} 13127switch is not binary compatible with code compiled with the 13128@option{-freg-struct-return} switch. 13129Use it to conform to a non-default application binary interface. 13130 13131@item -freg-struct-return 13132@opindex freg-struct-return 13133Return @code{struct} and @code{union} values in registers when possible. 13134This is more efficient for small structures than 13135@option{-fpcc-struct-return}. 13136 13137If you specify neither @option{-fpcc-struct-return} nor 13138@option{-freg-struct-return}, GCC defaults to whichever convention is 13139standard for the target. If there is no standard convention, GCC 13140defaults to @option{-fpcc-struct-return}, except on targets where GCC is 13141the principal compiler. In those cases, we can choose the standard, and 13142we chose the more efficient register return alternative. 13143 13144@strong{Warning:} code compiled with the @option{-freg-struct-return} 13145switch is not binary compatible with code compiled with the 13146@option{-fpcc-struct-return} switch. 13147Use it to conform to a non-default application binary interface. 13148 13149@item -fshort-enums 13150@opindex fshort-enums 13151Allocate to an @code{enum} type only as many bytes as it needs for the 13152declared range of possible values. Specifically, the @code{enum} type 13153will be equivalent to the smallest integer type which has enough room. 13154 13155@strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate 13156code that is not binary compatible with code generated without that switch. 13157Use it to conform to a non-default application binary interface. 13158 13159@item -fshort-double 13160@opindex fshort-double 13161Use the same size for @code{double} as for @code{float}. 13162 13163@strong{Warning:} the @option{-fshort-double} switch causes GCC to generate 13164code that is not binary compatible with code generated without that switch. 13165Use it to conform to a non-default application binary interface. 13166 13167@item -fshort-wchar 13168@opindex fshort-wchar 13169Override the underlying type for @samp{wchar_t} to be @samp{short 13170unsigned int} instead of the default for the target. This option is 13171useful for building programs to run under WINE@. 13172 13173@strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate 13174code that is not binary compatible with code generated without that switch. 13175Use it to conform to a non-default application binary interface. 13176 13177@item -fno-common 13178@opindex fno-common 13179In C, allocate even uninitialized global variables in the data section of the 13180object file, rather than generating them as common blocks. This has the 13181effect that if the same variable is declared (without @code{extern}) in 13182two different compilations, you will get an error when you link them. 13183The only reason this might be useful is if you wish to verify that the 13184program will work on other systems which always work this way. 13185 13186@item -fno-ident 13187@opindex fno-ident 13188Ignore the @samp{#ident} directive. 13189 13190@item -finhibit-size-directive 13191@opindex finhibit-size-directive 13192Don't output a @code{.size} assembler directive, or anything else that 13193would cause trouble if the function is split in the middle, and the 13194two halves are placed at locations far apart in memory. This option is 13195used when compiling @file{crtstuff.c}; you should not need to use it 13196for anything else. 13197 13198@item -fverbose-asm 13199@opindex fverbose-asm 13200Put extra commentary information in the generated assembly code to 13201make it more readable. This option is generally only of use to those 13202who actually need to read the generated assembly code (perhaps while 13203debugging the compiler itself). 13204 13205@option{-fno-verbose-asm}, the default, causes the 13206extra information to be omitted and is useful when comparing two assembler 13207files. 13208 13209@item -fpic 13210@opindex fpic 13211@cindex global offset table 13212@cindex PIC 13213Generate position-independent code (PIC) suitable for use in a shared 13214library, if supported for the target machine. Such code accesses all 13215constant addresses through a global offset table (GOT)@. The dynamic 13216loader resolves the GOT entries when the program starts (the dynamic 13217loader is not part of GCC; it is part of the operating system). If 13218the GOT size for the linked executable exceeds a machine-specific 13219maximum size, you get an error message from the linker indicating that 13220@option{-fpic} does not work; in that case, recompile with @option{-fPIC} 13221instead. (These maximums are 8k on the SPARC and 32k 13222on the m68k and RS/6000. The 386 has no such limit.) 13223 13224Position-independent code requires special support, and therefore works 13225only on certain machines. For the 386, GCC supports PIC for System V 13226but not for the Sun 386i. Code generated for the IBM RS/6000 is always 13227position-independent. 13228 13229When this flag is set, the macros @code{__pic__} and @code{__PIC__} 13230are defined to 1. 13231 13232@item -fPIC 13233@opindex fPIC 13234If supported for the target machine, emit position-independent code, 13235suitable for dynamic linking and avoiding any limit on the size of the 13236global offset table. This option makes a difference on the m68k, 13237PowerPC and SPARC@. 13238 13239Position-independent code requires special support, and therefore works 13240only on certain machines. 13241 13242When this flag is set, the macros @code{__pic__} and @code{__PIC__} 13243are defined to 2. 13244 13245@item -fpie 13246@itemx -fPIE 13247@opindex fpie 13248@opindex fPIE 13249These options are similar to @option{-fpic} and @option{-fPIC}, but 13250generated position independent code can be only linked into executables. 13251Usually these options are used when @option{-pie} GCC option will be 13252used during linking. 13253 13254@item -fno-jump-tables 13255@opindex fno-jump-tables 13256Do not use jump tables for switch statements even where it would be 13257more efficient than other code generation strategies. This option is 13258of use in conjunction with @option{-fpic} or @option{-fPIC} for 13259building code which forms part of a dynamic linker and cannot 13260reference the address of a jump table. On some targets, jump tables 13261do not require a GOT and this option is not needed. 13262 13263@item -ffixed-@var{reg} 13264@opindex ffixed 13265Treat the register named @var{reg} as a fixed register; generated code 13266should never refer to it (except perhaps as a stack pointer, frame 13267pointer or in some other fixed role). 13268 13269@var{reg} must be the name of a register. The register names accepted 13270are machine-specific and are defined in the @code{REGISTER_NAMES} 13271macro in the machine description macro file. 13272 13273This flag does not have a negative form, because it specifies a 13274three-way choice. 13275 13276@item -fcall-used-@var{reg} 13277@opindex fcall-used 13278Treat the register named @var{reg} as an allocable register that is 13279clobbered by function calls. It may be allocated for temporaries or 13280variables that do not live across a call. Functions compiled this way 13281will not save and restore the register @var{reg}. 13282 13283It is an error to used this flag with the frame pointer or stack pointer. 13284Use of this flag for other registers that have fixed pervasive roles in 13285the machine's execution model will produce disastrous results. 13286 13287This flag does not have a negative form, because it specifies a 13288three-way choice. 13289 13290@item -fcall-saved-@var{reg} 13291@opindex fcall-saved 13292Treat the register named @var{reg} as an allocable register saved by 13293functions. It may be allocated even for temporaries or variables that 13294live across a call. Functions compiled this way will save and restore 13295the register @var{reg} if they use it. 13296 13297It is an error to used this flag with the frame pointer or stack pointer. 13298Use of this flag for other registers that have fixed pervasive roles in 13299the machine's execution model will produce disastrous results. 13300 13301A different sort of disaster will result from the use of this flag for 13302a register in which function values may be returned. 13303 13304This flag does not have a negative form, because it specifies a 13305three-way choice. 13306 13307@item -fpack-struct[=@var{n}] 13308@opindex fpack-struct 13309Without a value specified, pack all structure members together without 13310holes. When a value is specified (which must be a small power of two), pack 13311structure members according to this value, representing the maximum 13312alignment (that is, objects with default alignment requirements larger than 13313this will be output potentially unaligned at the next fitting location. 13314 13315@strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate 13316code that is not binary compatible with code generated without that switch. 13317Additionally, it makes the code suboptimal. 13318Use it to conform to a non-default application binary interface. 13319 13320@item -finstrument-functions 13321@opindex finstrument-functions 13322Generate instrumentation calls for entry and exit to functions. Just 13323after function entry and just before function exit, the following 13324profiling functions will be called with the address of the current 13325function and its call site. (On some platforms, 13326@code{__builtin_return_address} does not work beyond the current 13327function, so the call site information may not be available to the 13328profiling functions otherwise.) 13329 13330@smallexample 13331void __cyg_profile_func_enter (void *this_fn, 13332 void *call_site); 13333void __cyg_profile_func_exit (void *this_fn, 13334 void *call_site); 13335@end smallexample 13336 13337The first argument is the address of the start of the current function, 13338which may be looked up exactly in the symbol table. 13339 13340This instrumentation is also done for functions expanded inline in other 13341functions. The profiling calls will indicate where, conceptually, the 13342inline function is entered and exited. This means that addressable 13343versions of such functions must be available. If all your uses of a 13344function are expanded inline, this may mean an additional expansion of 13345code size. If you use @samp{extern inline} in your C code, an 13346addressable version of such functions must be provided. (This is 13347normally the case anyways, but if you get lucky and the optimizer always 13348expands the functions inline, you might have gotten away without 13349providing static copies.) 13350 13351A function may be given the attribute @code{no_instrument_function}, in 13352which case this instrumentation will not be done. This can be used, for 13353example, for the profiling functions listed above, high-priority 13354interrupt routines, and any functions from which the profiling functions 13355cannot safely be called (perhaps signal handlers, if the profiling 13356routines generate output or allocate memory). 13357 13358@item -fstack-check 13359@opindex fstack-check 13360Generate code to verify that you do not go beyond the boundary of the 13361stack. You should specify this flag if you are running in an 13362environment with multiple threads, but only rarely need to specify it in 13363a single-threaded environment since stack overflow is automatically 13364detected on nearly all systems if there is only one stack. 13365 13366Note that this switch does not actually cause checking to be done; the 13367operating system must do that. The switch causes generation of code 13368to ensure that the operating system sees the stack being extended. 13369 13370@item -fstack-limit-register=@var{reg} 13371@itemx -fstack-limit-symbol=@var{sym} 13372@itemx -fno-stack-limit 13373@opindex fstack-limit-register 13374@opindex fstack-limit-symbol 13375@opindex fno-stack-limit 13376Generate code to ensure that the stack does not grow beyond a certain value, 13377either the value of a register or the address of a symbol. If the stack 13378would grow beyond the value, a signal is raised. For most targets, 13379the signal is raised before the stack overruns the boundary, so 13380it is possible to catch the signal without taking special precautions. 13381 13382For instance, if the stack starts at absolute address @samp{0x80000000} 13383and grows downwards, you can use the flags 13384@option{-fstack-limit-symbol=__stack_limit} and 13385@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit 13386of 128KB@. Note that this may only work with the GNU linker. 13387 13388@cindex aliasing of parameters 13389@cindex parameters, aliased 13390@item -fargument-alias 13391@itemx -fargument-noalias 13392@itemx -fargument-noalias-global 13393@itemx -fargument-noalias-anything 13394@opindex fargument-alias 13395@opindex fargument-noalias 13396@opindex fargument-noalias-global 13397@opindex fargument-noalias-anything 13398Specify the possible relationships among parameters and between 13399parameters and global data. 13400 13401@option{-fargument-alias} specifies that arguments (parameters) may 13402alias each other and may alias global storage.@* 13403@option{-fargument-noalias} specifies that arguments do not alias 13404each other, but may alias global storage.@* 13405@option{-fargument-noalias-global} specifies that arguments do not 13406alias each other and do not alias global storage. 13407@option{-fargument-noalias-anything} specifies that arguments do not 13408alias any other storage. 13409 13410Each language will automatically use whatever option is required by 13411the language standard. You should not need to use these options yourself. 13412 13413@item -fleading-underscore 13414@opindex fleading-underscore 13415This option and its counterpart, @option{-fno-leading-underscore}, forcibly 13416change the way C symbols are represented in the object file. One use 13417is to help link with legacy assembly code. 13418 13419@strong{Warning:} the @option{-fleading-underscore} switch causes GCC to 13420generate code that is not binary compatible with code generated without that 13421switch. Use it to conform to a non-default application binary interface. 13422Not all targets provide complete support for this switch. 13423 13424@item -ftls-model=@var{model} 13425Alter the thread-local storage model to be used (@pxref{Thread-Local}). 13426The @var{model} argument should be one of @code{global-dynamic}, 13427@code{local-dynamic}, @code{initial-exec} or @code{local-exec}. 13428 13429The default without @option{-fpic} is @code{initial-exec}; with 13430@option{-fpic} the default is @code{global-dynamic}. 13431 13432@item -fvisibility=@var{default|internal|hidden|protected} 13433@opindex fvisibility 13434Set the default ELF image symbol visibility to the specified option---all 13435symbols will be marked with this unless overridden within the code. 13436Using this feature can very substantially improve linking and 13437load times of shared object libraries, produce more optimized 13438code, provide near-perfect API export and prevent symbol clashes. 13439It is @strong{strongly} recommended that you use this in any shared objects 13440you distribute. 13441 13442Despite the nomenclature, @code{default} always means public ie; 13443available to be linked against from outside the shared object. 13444@code{protected} and @code{internal} are pretty useless in real-world 13445usage so the only other commonly used option will be @code{hidden}. 13446The default if @option{-fvisibility} isn't specified is 13447@code{default}, i.e., make every 13448symbol public---this causes the same behavior as previous versions of 13449GCC@. 13450 13451A good explanation of the benefits offered by ensuring ELF 13452symbols have the correct visibility is given by ``How To Write 13453Shared Libraries'' by Ulrich Drepper (which can be found at 13454@w{@uref{http://people.redhat.com/~drepper/}})---however a superior 13455solution made possible by this option to marking things hidden when 13456the default is public is to make the default hidden and mark things 13457public. This is the norm with DLL's on Windows and with @option{-fvisibility=hidden} 13458and @code{__attribute__ ((visibility("default")))} instead of 13459@code{__declspec(dllexport)} you get almost identical semantics with 13460identical syntax. This is a great boon to those working with 13461cross-platform projects. 13462 13463For those adding visibility support to existing code, you may find 13464@samp{#pragma GCC visibility} of use. This works by you enclosing 13465the declarations you wish to set visibility for with (for example) 13466@samp{#pragma GCC visibility push(hidden)} and 13467@samp{#pragma GCC visibility pop}. 13468Bear in mind that symbol visibility should be viewed @strong{as 13469part of the API interface contract} and thus all new code should 13470always specify visibility when it is not the default ie; declarations 13471only for use within the local DSO should @strong{always} be marked explicitly 13472as hidden as so to avoid PLT indirection overheads---making this 13473abundantly clear also aids readability and self-documentation of the code. 13474Note that due to ISO C++ specification requirements, operator new and 13475operator delete must always be of default visibility. 13476 13477Be aware that headers from outside your project, in particular system 13478headers and headers from any other library you use, may not be 13479expecting to be compiled with visibility other than the default. You 13480may need to explicitly say @samp{#pragma GCC visibility push(default)} 13481before including any such headers. 13482 13483@samp{extern} declarations are not affected by @samp{-fvisibility}, so 13484a lot of code can be recompiled with @samp{-fvisibility=hidden} with 13485no modifications. However, this means that calls to @samp{extern} 13486functions with no explicit visibility will use the PLT, so it is more 13487effective to use @samp{__attribute ((visibility))} and/or 13488@samp{#pragma GCC visibility} to tell the compiler which @samp{extern} 13489declarations should be treated as hidden. 13490 13491Note that @samp{-fvisibility} does affect C++ vague linkage 13492entities. This means that, for instance, an exception class that will 13493be thrown between DSOs must be explicitly marked with default 13494visibility so that the @samp{type_info} nodes will be unified between 13495the DSOs. 13496 13497An overview of these techniques, their benefits and how to use them 13498is at @w{@uref{http://gcc.gnu.org/wiki/Visibility}}. 13499 13500@end table 13501 13502@c man end 13503 13504@node Environment Variables 13505@section Environment Variables Affecting GCC 13506@cindex environment variables 13507 13508@c man begin ENVIRONMENT 13509This section describes several environment variables that affect how GCC 13510operates. Some of them work by specifying directories or prefixes to use 13511when searching for various kinds of files. Some are used to specify other 13512aspects of the compilation environment. 13513 13514Note that you can also specify places to search using options such as 13515@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These 13516take precedence over places specified using environment variables, which 13517in turn take precedence over those specified by the configuration of GCC@. 13518@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint, 13519GNU Compiler Collection (GCC) Internals}. 13520 13521@table @env 13522@item LANG 13523@itemx LC_CTYPE 13524@c @itemx LC_COLLATE 13525@itemx LC_MESSAGES 13526@c @itemx LC_MONETARY 13527@c @itemx LC_NUMERIC 13528@c @itemx LC_TIME 13529@itemx LC_ALL 13530@findex LANG 13531@findex LC_CTYPE 13532@c @findex LC_COLLATE 13533@findex LC_MESSAGES 13534@c @findex LC_MONETARY 13535@c @findex LC_NUMERIC 13536@c @findex LC_TIME 13537@findex LC_ALL 13538@cindex locale 13539These environment variables control the way that GCC uses 13540localization information that allow GCC to work with different 13541national conventions. GCC inspects the locale categories 13542@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do 13543so. These locale categories can be set to any value supported by your 13544installation. A typical value is @samp{en_GB.UTF-8} for English in the United 13545Kingdom encoded in UTF-8. 13546 13547The @env{LC_CTYPE} environment variable specifies character 13548classification. GCC uses it to determine the character boundaries in 13549a string; this is needed for some multibyte encodings that contain quote 13550and escape characters that would otherwise be interpreted as a string 13551end or escape. 13552 13553The @env{LC_MESSAGES} environment variable specifies the language to 13554use in diagnostic messages. 13555 13556If the @env{LC_ALL} environment variable is set, it overrides the value 13557of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE} 13558and @env{LC_MESSAGES} default to the value of the @env{LANG} 13559environment variable. If none of these variables are set, GCC 13560defaults to traditional C English behavior. 13561 13562@item TMPDIR 13563@findex TMPDIR 13564If @env{TMPDIR} is set, it specifies the directory to use for temporary 13565files. GCC uses temporary files to hold the output of one stage of 13566compilation which is to be used as input to the next stage: for example, 13567the output of the preprocessor, which is the input to the compiler 13568proper. 13569 13570@item GCC_EXEC_PREFIX 13571@findex GCC_EXEC_PREFIX 13572If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the 13573names of the subprograms executed by the compiler. No slash is added 13574when this prefix is combined with the name of a subprogram, but you can 13575specify a prefix that ends with a slash if you wish. 13576 13577If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out 13578an appropriate prefix to use based on the pathname it was invoked with. 13579 13580If GCC cannot find the subprogram using the specified prefix, it 13581tries looking in the usual places for the subprogram. 13582 13583The default value of @env{GCC_EXEC_PREFIX} is 13584@file{@var{prefix}/lib/gcc/} where @var{prefix} is the value 13585of @code{prefix} when you ran the @file{configure} script. 13586 13587Other prefixes specified with @option{-B} take precedence over this prefix. 13588 13589This prefix is also used for finding files such as @file{crt0.o} that are 13590used for linking. 13591 13592In addition, the prefix is used in an unusual way in finding the 13593directories to search for header files. For each of the standard 13594directories whose name normally begins with @samp{/usr/local/lib/gcc} 13595(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries 13596replacing that beginning with the specified prefix to produce an 13597alternate directory name. Thus, with @option{-Bfoo/}, GCC will search 13598@file{foo/bar} where it would normally search @file{/usr/local/lib/bar}. 13599These alternate directories are searched first; the standard directories 13600come next. 13601 13602@item COMPILER_PATH 13603@findex COMPILER_PATH 13604The value of @env{COMPILER_PATH} is a colon-separated list of 13605directories, much like @env{PATH}. GCC tries the directories thus 13606specified when searching for subprograms, if it can't find the 13607subprograms using @env{GCC_EXEC_PREFIX}. 13608 13609@item LIBRARY_PATH 13610@findex LIBRARY_PATH 13611The value of @env{LIBRARY_PATH} is a colon-separated list of 13612directories, much like @env{PATH}. When configured as a native compiler, 13613GCC tries the directories thus specified when searching for special 13614linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking 13615using GCC also uses these directories when searching for ordinary 13616libraries for the @option{-l} option (but directories specified with 13617@option{-L} come first). 13618 13619@item LANG 13620@findex LANG 13621@cindex locale definition 13622This variable is used to pass locale information to the compiler. One way in 13623which this information is used is to determine the character set to be used 13624when character literals, string literals and comments are parsed in C and C++. 13625When the compiler is configured to allow multibyte characters, 13626the following values for @env{LANG} are recognized: 13627 13628@table @samp 13629@item C-JIS 13630Recognize JIS characters. 13631@item C-SJIS 13632Recognize SJIS characters. 13633@item C-EUCJP 13634Recognize EUCJP characters. 13635@end table 13636 13637If @env{LANG} is not defined, or if it has some other value, then the 13638compiler will use mblen and mbtowc as defined by the default locale to 13639recognize and translate multibyte characters. 13640@end table 13641 13642@noindent 13643Some additional environments variables affect the behavior of the 13644preprocessor. 13645 13646@include cppenv.texi 13647 13648@c man end 13649 13650@node Precompiled Headers 13651@section Using Precompiled Headers 13652@cindex precompiled headers 13653@cindex speed of compilation 13654 13655Often large projects have many header files that are included in every 13656source file. The time the compiler takes to process these header files 13657over and over again can account for nearly all of the time required to 13658build the project. To make builds faster, GCC allows users to 13659`precompile' a header file; then, if builds can use the precompiled 13660header file they will be much faster. 13661 13662To create a precompiled header file, simply compile it as you would any 13663other file, if necessary using the @option{-x} option to make the driver 13664treat it as a C or C++ header file. You will probably want to use a 13665tool like @command{make} to keep the precompiled header up-to-date when 13666the headers it contains change. 13667 13668A precompiled header file will be searched for when @code{#include} is 13669seen in the compilation. As it searches for the included file 13670(@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the 13671compiler looks for a precompiled header in each directory just before it 13672looks for the include file in that directory. The name searched for is 13673the name specified in the @code{#include} with @samp{.gch} appended. If 13674the precompiled header file can't be used, it is ignored. 13675 13676For instance, if you have @code{#include "all.h"}, and you have 13677@file{all.h.gch} in the same directory as @file{all.h}, then the 13678precompiled header file will be used if possible, and the original 13679header will be used otherwise. 13680 13681Alternatively, you might decide to put the precompiled header file in a 13682directory and use @option{-I} to ensure that directory is searched 13683before (or instead of) the directory containing the original header. 13684Then, if you want to check that the precompiled header file is always 13685used, you can put a file of the same name as the original header in this 13686directory containing an @code{#error} command. 13687 13688This also works with @option{-include}. So yet another way to use 13689precompiled headers, good for projects not designed with precompiled 13690header files in mind, is to simply take most of the header files used by 13691a project, include them from another header file, precompile that header 13692file, and @option{-include} the precompiled header. If the header files 13693have guards against multiple inclusion, they will be skipped because 13694they've already been included (in the precompiled header). 13695 13696If you need to precompile the same header file for different 13697languages, targets, or compiler options, you can instead make a 13698@emph{directory} named like @file{all.h.gch}, and put each precompiled 13699header in the directory, perhaps using @option{-o}. It doesn't matter 13700what you call the files in the directory, every precompiled header in 13701the directory will be considered. The first precompiled header 13702encountered in the directory that is valid for this compilation will 13703be used; they're searched in no particular order. 13704 13705There are many other possibilities, limited only by your imagination, 13706good sense, and the constraints of your build system. 13707 13708A precompiled header file can be used only when these conditions apply: 13709 13710@itemize 13711@item 13712Only one precompiled header can be used in a particular compilation. 13713 13714@item 13715A precompiled header can't be used once the first C token is seen. You 13716can have preprocessor directives before a precompiled header; you can 13717even include a precompiled header from inside another header, so long as 13718there are no C tokens before the @code{#include}. 13719 13720@item 13721The precompiled header file must be produced for the same language as 13722the current compilation. You can't use a C precompiled header for a C++ 13723compilation. 13724 13725@item 13726The precompiled header file must have been produced by the same compiler 13727binary as the current compilation is using. 13728 13729@item 13730Any macros defined before the precompiled header is included must 13731either be defined in the same way as when the precompiled header was 13732generated, or must not affect the precompiled header, which usually 13733means that they don't appear in the precompiled header at all. 13734 13735The @option{-D} option is one way to define a macro before a 13736precompiled header is included; using a @code{#define} can also do it. 13737There are also some options that define macros implicitly, like 13738@option{-O} and @option{-Wdeprecated}; the same rule applies to macros 13739defined this way. 13740 13741@item If debugging information is output when using the precompiled 13742header, using @option{-g} or similar, the same kind of debugging information 13743must have been output when building the precompiled header. However, 13744a precompiled header built using @option{-g} can be used in a compilation 13745when no debugging information is being output. 13746 13747@item The same @option{-m} options must generally be used when building 13748and using the precompiled header. @xref{Submodel Options}, 13749for any cases where this rule is relaxed. 13750 13751@item Each of the following options must be the same when building and using 13752the precompiled header: 13753 13754@gccoptlist{-fexceptions -funit-at-a-time} 13755 13756@item 13757Some other command-line options starting with @option{-f}, 13758@option{-p}, or @option{-O} must be defined in the same way as when 13759the precompiled header was generated. At present, it's not clear 13760which options are safe to change and which are not; the safest choice 13761is to use exactly the same options when generating and using the 13762precompiled header. The following are known to be safe: 13763 13764@gccoptlist{-fmessage-length= -fpreprocessed 13765-fsched-interblock -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous 13766-fsched-verbose=<number> -fschedule-insns -fvisibility= 13767-pedantic-errors} 13768 13769@end itemize 13770 13771For all of these except the last, the compiler will automatically 13772ignore the precompiled header if the conditions aren't met. If you 13773find an option combination that doesn't work and doesn't cause the 13774precompiled header to be ignored, please consider filing a bug report, 13775see @ref{Bugs}. 13776 13777If you do use differing options when generating and using the 13778precompiled header, the actual behavior will be a mixture of the 13779behavior for the options. For instance, if you use @option{-g} to 13780generate the precompiled header but not when using it, you may or may 13781not get debugging information for routines in the precompiled header. 13782 13783@node Running Protoize 13784@section Running Protoize 13785 13786The program @code{protoize} is an optional part of GCC@. You can use 13787it to add prototypes to a program, thus converting the program to ISO 13788C in one respect. The companion program @code{unprotoize} does the 13789reverse: it removes argument types from any prototypes that are found. 13790 13791When you run these programs, you must specify a set of source files as 13792command line arguments. The conversion programs start out by compiling 13793these files to see what functions they define. The information gathered 13794about a file @var{foo} is saved in a file named @file{@var{foo}.X}. 13795 13796After scanning comes actual conversion. The specified files are all 13797eligible to be converted; any files they include (whether sources or 13798just headers) are eligible as well. 13799 13800But not all the eligible files are converted. By default, 13801@code{protoize} and @code{unprotoize} convert only source and header 13802files in the current directory. You can specify additional directories 13803whose files should be converted with the @option{-d @var{directory}} 13804option. You can also specify particular files to exclude with the 13805@option{-x @var{file}} option. A file is converted if it is eligible, its 13806directory name matches one of the specified directory names, and its 13807name within the directory has not been excluded. 13808 13809Basic conversion with @code{protoize} consists of rewriting most 13810function definitions and function declarations to specify the types of 13811the arguments. The only ones not rewritten are those for varargs 13812functions. 13813 13814@code{protoize} optionally inserts prototype declarations at the 13815beginning of the source file, to make them available for any calls that 13816precede the function's definition. Or it can insert prototype 13817declarations with block scope in the blocks where undeclared functions 13818are called. 13819 13820Basic conversion with @code{unprotoize} consists of rewriting most 13821function declarations to remove any argument types, and rewriting 13822function definitions to the old-style pre-ISO form. 13823 13824Both conversion programs print a warning for any function declaration or 13825definition that they can't convert. You can suppress these warnings 13826with @option{-q}. 13827 13828The output from @code{protoize} or @code{unprotoize} replaces the 13829original source file. The original file is renamed to a name ending 13830with @samp{.save} (for DOS, the saved filename ends in @samp{.sav} 13831without the original @samp{.c} suffix). If the @samp{.save} (@samp{.sav} 13832for DOS) file already exists, then the source file is simply discarded. 13833 13834@code{protoize} and @code{unprotoize} both depend on GCC itself to 13835scan the program and collect information about the functions it uses. 13836So neither of these programs will work until GCC is installed. 13837 13838Here is a table of the options you can use with @code{protoize} and 13839@code{unprotoize}. Each option works with both programs unless 13840otherwise stated. 13841 13842@table @code 13843@item -B @var{directory} 13844Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the 13845usual directory (normally @file{/usr/local/lib}). This file contains 13846prototype information about standard system functions. This option 13847applies only to @code{protoize}. 13848 13849@item -c @var{compilation-options} 13850Use @var{compilation-options} as the options when running @command{gcc} to 13851produce the @samp{.X} files. The special option @option{-aux-info} is 13852always passed in addition, to tell @command{gcc} to write a @samp{.X} file. 13853 13854Note that the compilation options must be given as a single argument to 13855@code{protoize} or @code{unprotoize}. If you want to specify several 13856@command{gcc} options, you must quote the entire set of compilation options 13857to make them a single word in the shell. 13858 13859There are certain @command{gcc} arguments that you cannot use, because they 13860would produce the wrong kind of output. These include @option{-g}, 13861@option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in 13862the @var{compilation-options}, they are ignored. 13863 13864@item -C 13865Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file 13866systems) instead of @samp{.c}. This is convenient if you are converting 13867a C program to C++. This option applies only to @code{protoize}. 13868 13869@item -g 13870Add explicit global declarations. This means inserting explicit 13871declarations at the beginning of each source file for each function 13872that is called in the file and was not declared. These declarations 13873precede the first function definition that contains a call to an 13874undeclared function. This option applies only to @code{protoize}. 13875 13876@item -i @var{string} 13877Indent old-style parameter declarations with the string @var{string}. 13878This option applies only to @code{protoize}. 13879 13880@code{unprotoize} converts prototyped function definitions to old-style 13881function definitions, where the arguments are declared between the 13882argument list and the initial @samp{@{}. By default, @code{unprotoize} 13883uses five spaces as the indentation. If you want to indent with just 13884one space instead, use @option{-i " "}. 13885 13886@item -k 13887Keep the @samp{.X} files. Normally, they are deleted after conversion 13888is finished. 13889 13890@item -l 13891Add explicit local declarations. @code{protoize} with @option{-l} inserts 13892a prototype declaration for each function in each block which calls the 13893function without any declaration. This option applies only to 13894@code{protoize}. 13895 13896@item -n 13897Make no real changes. This mode just prints information about the conversions 13898that would have been done without @option{-n}. 13899 13900@item -N 13901Make no @samp{.save} files. The original files are simply deleted. 13902Use this option with caution. 13903 13904@item -p @var{program} 13905Use the program @var{program} as the compiler. Normally, the name 13906@file{gcc} is used. 13907 13908@item -q 13909Work quietly. Most warnings are suppressed. 13910 13911@item -v 13912Print the version number, just like @option{-v} for @command{gcc}. 13913@end table 13914 13915If you need special compiler options to compile one of your program's 13916source files, then you should generate that file's @samp{.X} file 13917specially, by running @command{gcc} on that source file with the 13918appropriate options and the option @option{-aux-info}. Then run 13919@code{protoize} on the entire set of files. @code{protoize} will use 13920the existing @samp{.X} file because it is newer than the source file. 13921For example: 13922 13923@smallexample 13924gcc -Dfoo=bar file1.c -aux-info file1.X 13925protoize *.c 13926@end smallexample 13927 13928@noindent 13929You need to include the special files along with the rest in the 13930@code{protoize} command, even though their @samp{.X} files already 13931exist, because otherwise they won't get converted. 13932 13933@xref{Protoize Caveats}, for more information on how to use 13934@code{protoize} successfully. 13935