invoke.texi revision 237021
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 -Wvariadic-macros @gol 234-Wvolatile-register-var -Wwrite-strings} 235 236@item C-only Warning Options 237@gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol 238-Wmissing-prototypes -Wnested-externs -Wold-style-definition @gol 239-Wstrict-prototypes -Wtraditional @gol 240-Wdeclaration-after-statement -Wpointer-sign} 241 242@item Debugging Options 243@xref{Debugging Options,,Options for Debugging Your Program or GCC}. 244@gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol 245-fdump-noaddr -fdump-unnumbered -fdump-translation-unit@r{[}-@var{n}@r{]} @gol 246-fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol 247-fdump-ipa-all -fdump-ipa-cgraph @gol 248-fdump-tree-all @gol 249-fdump-tree-original@r{[}-@var{n}@r{]} @gol 250-fdump-tree-optimized@r{[}-@var{n}@r{]} @gol 251-fdump-tree-inlined@r{[}-@var{n}@r{]} @gol 252-fdump-tree-cfg -fdump-tree-vcg -fdump-tree-alias @gol 253-fdump-tree-ch @gol 254-fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol 255-fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol 256-fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol 257-fdump-tree-dom@r{[}-@var{n}@r{]} @gol 258-fdump-tree-dse@r{[}-@var{n}@r{]} @gol 259-fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol 260-fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol 261-fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol 262-fdump-tree-nrv -fdump-tree-vect @gol 263-fdump-tree-sink @gol 264-fdump-tree-sra@r{[}-@var{n}@r{]} @gol 265-fdump-tree-salias @gol 266-fdump-tree-fre@r{[}-@var{n}@r{]} @gol 267-fdump-tree-vrp@r{[}-@var{n}@r{]} @gol 268-ftree-vectorizer-verbose=@var{n} @gol 269-fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol 270-feliminate-dwarf2-dups -feliminate-unused-debug-types @gol 271-feliminate-unused-debug-symbols -femit-class-debug-always @gol 272-fmem-report -fprofile-arcs @gol 273-frandom-seed=@var{string} -fsched-verbose=@var{n} @gol 274-ftest-coverage -ftime-report -fvar-tracking @gol 275-g -g@var{level} -gcoff -gdwarf-2 @gol 276-ggdb -gstabs -gstabs+ -gvms -gxcoff -gxcoff+ @gol 277-p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol 278-print-multi-directory -print-multi-lib @gol 279-print-prog-name=@var{program} -print-search-dirs -Q @gol 280-save-temps -time} 281 282@item Optimization Options 283@xref{Optimize Options,,Options that Control Optimization}. 284@gccoptlist{-falign-functions=@var{n} -falign-jumps=@var{n} @gol 285-falign-labels=@var{n} -falign-loops=@var{n} @gol 286-fbounds-check -fmudflap -fmudflapth -fmudflapir @gol 287-fbranch-probabilities -fprofile-values -fvpt -fbranch-target-load-optimize @gol 288-fbranch-target-load-optimize2 -fbtr-bb-exclusive @gol 289-fcaller-saves -fcprop-registers -fcse-follow-jumps @gol 290-fcse-skip-blocks -fcx-limited-range -fdata-sections @gol 291-fdelayed-branch -fdelete-null-pointer-checks -fearly-inlining @gol 292-fexpensive-optimizations -ffast-math -ffloat-store @gol 293-fforce-addr -ffunction-sections @gol 294-fgcse -fgcse-lm -fgcse-sm -fgcse-las -fgcse-after-reload @gol 295-fcrossjumping -fif-conversion -fif-conversion2 @gol 296-finline-functions -finline-functions-called-once @gol 297-finline-limit=@var{n} -fkeep-inline-functions @gol 298-fkeep-static-consts -fmerge-constants -fmerge-all-constants @gol 299-fmodulo-sched -fno-branch-count-reg @gol 300-fno-default-inline -fno-defer-pop -fmove-loop-invariants @gol 301-fno-function-cse -fno-guess-branch-probability @gol 302-fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol 303-funsafe-math-optimizations -funsafe-loop-optimizations -ffinite-math-only @gol 304-fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol 305-fomit-frame-pointer -foptimize-register-move @gol 306-foptimize-sibling-calls -fprefetch-loop-arrays @gol 307-fprofile-generate -fprofile-use @gol 308-fregmove -frename-registers @gol 309-freorder-blocks -freorder-blocks-and-partition -freorder-functions @gol 310-frerun-cse-after-loop @gol 311-frounding-math -frtl-abstract-sequences @gol 312-fschedule-insns -fschedule-insns2 @gol 313-fno-sched-interblock -fno-sched-spec -fsched-spec-load @gol 314-fsched-spec-load-dangerous @gol 315-fsched-stalled-insns=@var{n} -fsched-stalled-insns-dep=@var{n} @gol 316-fsched2-use-superblocks @gol 317-fsched2-use-traces -fsee -freschedule-modulo-scheduled-loops @gol 318-fsection-anchors -fsignaling-nans -fsingle-precision-constant @gol 319-fstack-protector -fstack-protector-all @gol 320-fstrict-aliasing -fstrict-overflow -ftracer -fthread-jumps @gol 321-funroll-all-loops -funroll-loops -fpeel-loops @gol 322-fsplit-ivs-in-unroller -funswitch-loops @gol 323-fvariable-expansion-in-unroller @gol 324-ftree-pre -ftree-ccp -ftree-dce -ftree-loop-optimize @gol 325-ftree-loop-linear -ftree-loop-im -ftree-loop-ivcanon -fivopts @gol 326-ftree-dominator-opts -ftree-dse -ftree-copyrename -ftree-sink @gol 327-ftree-ch -ftree-sra -ftree-ter -ftree-lrs -ftree-fre -ftree-vectorize @gol 328-ftree-vect-loop-version -ftree-salias -fipa-pta -fweb @gol 329-ftree-copy-prop -ftree-store-ccp -ftree-store-copy-prop -fwhole-program @gol 330--param @var{name}=@var{value} 331-O -O0 -O1 -O2 -O3 -Os} 332 333@item Preprocessor Options 334@xref{Preprocessor Options,,Options Controlling the Preprocessor}. 335@gccoptlist{-A@var{question}=@var{answer} @gol 336-A-@var{question}@r{[}=@var{answer}@r{]} @gol 337-C -dD -dI -dM -dN @gol 338-D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol 339-idirafter @var{dir} @gol 340-include @var{file} -imacros @var{file} @gol 341-iprefix @var{file} -iwithprefix @var{dir} @gol 342-iwithprefixbefore @var{dir} -isystem @var{dir} @gol 343-imultilib @var{dir} -isysroot @var{dir} @gol 344-M -MM -MF -MG -MP -MQ -MT -nostdinc @gol 345-P -fworking-directory -remap @gol 346-trigraphs -undef -U@var{macro} -Wp,@var{option} @gol 347-Xpreprocessor @var{option}} 348 349@item Assembler Option 350@xref{Assembler Options,,Passing Options to the Assembler}. 351@gccoptlist{-Wa,@var{option} -Xassembler @var{option}} 352 353@item Linker Options 354@xref{Link Options,,Options for Linking}. 355@gccoptlist{@var{object-file-name} -l@var{library} @gol 356-nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol 357-s -static -static-libgcc -shared -shared-libgcc -symbolic @gol 358-Wl,@var{option} -Xlinker @var{option} @gol 359-u @var{symbol}} 360 361@item Directory Options 362@xref{Directory Options,,Options for Directory Search}. 363@gccoptlist{-B@var{prefix} -I@var{dir} -iquote@var{dir} -L@var{dir} 364-specs=@var{file} -I- --sysroot=@var{dir}} 365 366@item Target Options 367@c I wrote this xref this way to avoid overfull hbox. -- rms 368@xref{Target Options}. 369@gccoptlist{-V @var{version} -b @var{machine}} 370 371@item Machine Dependent Options 372@xref{Submodel Options,,Hardware Models and Configurations}. 373@c This list is ordered alphanumerically by subsection name. 374@c Try and put the significant identifier (CPU or system) first, 375@c so users have a clue at guessing where the ones they want will be. 376 377@emph{ARC Options} 378@gccoptlist{-EB -EL @gol 379-mmangle-cpu -mcpu=@var{cpu} -mtext=@var{text-section} @gol 380-mdata=@var{data-section} -mrodata=@var{readonly-data-section}} 381 382@emph{ARM Options} 383@gccoptlist{-mapcs-frame -mno-apcs-frame @gol 384-mabi=@var{name} @gol 385-mapcs-stack-check -mno-apcs-stack-check @gol 386-mapcs-float -mno-apcs-float @gol 387-mapcs-reentrant -mno-apcs-reentrant @gol 388-msched-prolog -mno-sched-prolog @gol 389-mlittle-endian -mbig-endian -mwords-little-endian @gol 390-mfloat-abi=@var{name} -msoft-float -mhard-float -mfpe @gol 391-mthumb-interwork -mno-thumb-interwork @gol 392-mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol 393-mstructure-size-boundary=@var{n} @gol 394-mabort-on-noreturn @gol 395-mlong-calls -mno-long-calls @gol 396-msingle-pic-base -mno-single-pic-base @gol 397-mpic-register=@var{reg} @gol 398-mnop-fun-dllimport @gol 399-mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol 400-mpoke-function-name @gol 401-mthumb -marm @gol 402-mtpcs-frame -mtpcs-leaf-frame @gol 403-mcaller-super-interworking -mcallee-super-interworking @gol 404-mtp=@var{name}} 405 406@emph{AVR Options} 407@gccoptlist{-mmcu=@var{mcu} -msize -minit-stack=@var{n} -mno-interrupts @gol 408-mcall-prologues -mno-tablejump -mtiny-stack -mint8} 409 410@emph{Blackfin Options} 411@gccoptlist{-momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol 412-mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol 413-mlow-64k -mno-low64k -mid-shared-library @gol 414-mno-id-shared-library -mshared-library-id=@var{n} @gol 415-mlong-calls -mno-long-calls} 416 417@emph{CRIS Options} 418@gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol 419-mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol 420-metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol 421-mstack-align -mdata-align -mconst-align @gol 422-m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol 423-melf -maout -melinux -mlinux -sim -sim2 @gol 424-mmul-bug-workaround -mno-mul-bug-workaround} 425 426@emph{CRX Options} 427@gccoptlist{-mmac -mpush-args} 428 429@emph{Darwin Options} 430@gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol 431-arch_only -bind_at_load -bundle -bundle_loader @gol 432-client_name -compatibility_version -current_version @gol 433-dead_strip @gol 434-dependency-file -dylib_file -dylinker_install_name @gol 435-dynamic -dynamiclib -exported_symbols_list @gol 436-filelist -flat_namespace -force_cpusubtype_ALL @gol 437-force_flat_namespace -headerpad_max_install_names @gol 438-image_base -init -install_name -keep_private_externs @gol 439-multi_module -multiply_defined -multiply_defined_unused @gol 440-noall_load -no_dead_strip_inits_and_terms @gol 441-nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol 442-pagezero_size -prebind -prebind_all_twolevel_modules @gol 443-private_bundle -read_only_relocs -sectalign @gol 444-sectobjectsymbols -whyload -seg1addr @gol 445-sectcreate -sectobjectsymbols -sectorder @gol 446-segaddr -segs_read_only_addr -segs_read_write_addr @gol 447-seg_addr_table -seg_addr_table_filename -seglinkedit @gol 448-segprot -segs_read_only_addr -segs_read_write_addr @gol 449-single_module -static -sub_library -sub_umbrella @gol 450-twolevel_namespace -umbrella -undefined @gol 451-unexported_symbols_list -weak_reference_mismatches @gol 452-whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol 453-mkernel -mone-byte-bool} 454 455@emph{DEC Alpha Options} 456@gccoptlist{-mno-fp-regs -msoft-float -malpha-as -mgas @gol 457-mieee -mieee-with-inexact -mieee-conformant @gol 458-mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol 459-mtrap-precision=@var{mode} -mbuild-constants @gol 460-mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol 461-mbwx -mmax -mfix -mcix @gol 462-mfloat-vax -mfloat-ieee @gol 463-mexplicit-relocs -msmall-data -mlarge-data @gol 464-msmall-text -mlarge-text @gol 465-mmemory-latency=@var{time}} 466 467@emph{DEC Alpha/VMS Options} 468@gccoptlist{-mvms-return-codes} 469 470@emph{FRV Options} 471@gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol 472-mhard-float -msoft-float @gol 473-malloc-cc -mfixed-cc -mdword -mno-dword @gol 474-mdouble -mno-double @gol 475-mmedia -mno-media -mmuladd -mno-muladd @gol 476-mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol 477-mlinked-fp -mlong-calls -malign-labels @gol 478-mlibrary-pic -macc-4 -macc-8 @gol 479-mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol 480-moptimize-membar -mno-optimize-membar @gol 481-mscc -mno-scc -mcond-exec -mno-cond-exec @gol 482-mvliw-branch -mno-vliw-branch @gol 483-mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol 484-mno-nested-cond-exec -mtomcat-stats @gol 485-mTLS -mtls @gol 486-mcpu=@var{cpu}} 487 488@emph{GNU/Linux Options} 489@gccoptlist{-muclibc} 490 491@emph{H8/300 Options} 492@gccoptlist{-mrelax -mh -ms -mn -mint32 -malign-300} 493 494@emph{HPPA Options} 495@gccoptlist{-march=@var{architecture-type} @gol 496-mbig-switch -mdisable-fpregs -mdisable-indexing @gol 497-mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol 498-mfixed-range=@var{register-range} @gol 499-mjump-in-delay -mlinker-opt -mlong-calls @gol 500-mlong-load-store -mno-big-switch -mno-disable-fpregs @gol 501-mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol 502-mno-jump-in-delay -mno-long-load-store @gol 503-mno-portable-runtime -mno-soft-float @gol 504-mno-space-regs -msoft-float -mpa-risc-1-0 @gol 505-mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol 506-mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol 507-munix=@var{unix-std} -nolibdld -static -threads} 508 509@emph{i386 and x86-64 Options} 510@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol 511-mfpmath=@var{unit} @gol 512-masm=@var{dialect} -mno-fancy-math-387 @gol 513-mno-fp-ret-in-387 -msoft-float -msvr3-shlib @gol 514-mno-wide-multiply -mrtd -malign-double @gol 515-mpreferred-stack-boundary=@var{num} @gol 516-mmmx -msse -msse2 -msse3 -mssse3 -m3dnow @gol 517-mthreads -mno-align-stringops -minline-all-stringops @gol 518-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol 519-m96bit-long-double -mregparm=@var{num} -msseregparm @gol 520-mstackrealign @gol 521-momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol 522-mcmodel=@var{code-model} @gol 523-m32 -m64 -mlarge-data-threshold=@var{num}} 524 525@emph{IA-64 Options} 526@gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol 527-mvolatile-asm-stop -mregister-names -mno-sdata @gol 528-mconstant-gp -mauto-pic -minline-float-divide-min-latency @gol 529-minline-float-divide-max-throughput @gol 530-minline-int-divide-min-latency @gol 531-minline-int-divide-max-throughput @gol 532-minline-sqrt-min-latency -minline-sqrt-max-throughput @gol 533-mno-dwarf2-asm -mearly-stop-bits @gol 534-mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol 535-mtune=@var{cpu-type} -mt -pthread -milp32 -mlp64 @gol 536-mno-sched-br-data-spec -msched-ar-data-spec -mno-sched-control-spec @gol 537-msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol 538-msched-ldc -mno-sched-control-ldc -mno-sched-spec-verbose @gol 539-mno-sched-prefer-non-data-spec-insns @gol 540-mno-sched-prefer-non-control-spec-insns @gol 541-mno-sched-count-spec-in-critical-path} 542 543@emph{M32R/D Options} 544@gccoptlist{-m32r2 -m32rx -m32r @gol 545-mdebug @gol 546-malign-loops -mno-align-loops @gol 547-missue-rate=@var{number} @gol 548-mbranch-cost=@var{number} @gol 549-mmodel=@var{code-size-model-type} @gol 550-msdata=@var{sdata-type} @gol 551-mno-flush-func -mflush-func=@var{name} @gol 552-mno-flush-trap -mflush-trap=@var{number} @gol 553-G @var{num}} 554 555@emph{M32C Options} 556@gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}} 557 558@emph{M680x0 Options} 559@gccoptlist{-m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol 560-m68060 -mcpu32 -m5200 -mcfv4e -m68881 -mbitfield @gol 561-mc68000 -mc68020 @gol 562-mnobitfield -mrtd -mshort -msoft-float -mpcrel @gol 563-malign-int -mstrict-align -msep-data -mno-sep-data @gol 564-mshared-library-id=n -mid-shared-library -mno-id-shared-library} 565 566@emph{M68hc1x Options} 567@gccoptlist{-m6811 -m6812 -m68hc11 -m68hc12 -m68hcs12 @gol 568-mauto-incdec -minmax -mlong-calls -mshort @gol 569-msoft-reg-count=@var{count}} 570 571@emph{MCore Options} 572@gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol 573-mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol 574-m4byte-functions -mno-4byte-functions -mcallgraph-data @gol 575-mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol 576-mlittle-endian -mbig-endian -m210 -m340 -mstack-increment} 577 578@emph{MIPS Options} 579@gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol 580-mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips64 @gol 581-mips16 -mno-mips16 -mabi=@var{abi} -mabicalls -mno-abicalls @gol 582-mshared -mno-shared -mxgot -mno-xgot -mgp32 -mgp64 @gol 583-mfp32 -mfp64 -mhard-float -msoft-float @gol 584-msingle-float -mdouble-float -mdsp -mpaired-single -mips3d @gol 585-mlong64 -mlong32 -msym32 -mno-sym32 @gol 586-G@var{num} -membedded-data -mno-embedded-data @gol 587-muninit-const-in-rodata -mno-uninit-const-in-rodata @gol 588-msplit-addresses -mno-split-addresses @gol 589-mexplicit-relocs -mno-explicit-relocs @gol 590-mcheck-zero-division -mno-check-zero-division @gol 591-mdivide-traps -mdivide-breaks @gol 592-mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol 593-mmad -mno-mad -mfused-madd -mno-fused-madd -nocpp @gol 594-mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol 595-mfix-vr4120 -mno-fix-vr4120 -mfix-vr4130 @gol 596-mfix-sb1 -mno-fix-sb1 @gol 597-mflush-func=@var{func} -mno-flush-func @gol 598-mbranch-likely -mno-branch-likely @gol 599-mfp-exceptions -mno-fp-exceptions @gol 600-mvr4130-align -mno-vr4130-align} 601 602@emph{MMIX Options} 603@gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol 604-mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol 605-melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol 606-mno-base-addresses -msingle-exit -mno-single-exit} 607 608@emph{MN10300 Options} 609@gccoptlist{-mmult-bug -mno-mult-bug @gol 610-mam33 -mno-am33 @gol 611-mam33-2 -mno-am33-2 @gol 612-mreturn-pointer-on-d0 @gol 613-mno-crt0 -mrelax} 614 615@emph{MT Options} 616@gccoptlist{-mno-crt0 -mbacc -msim @gol 617-march=@var{cpu-type} } 618 619@emph{PDP-11 Options} 620@gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol 621-mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol 622-mint16 -mno-int32 -mfloat32 -mno-float64 @gol 623-mfloat64 -mno-float32 -mabshi -mno-abshi @gol 624-mbranch-expensive -mbranch-cheap @gol 625-msplit -mno-split -munix-asm -mdec-asm} 626 627@emph{PowerPC Options} 628See RS/6000 and PowerPC Options. 629 630@emph{RS/6000 and PowerPC Options} 631@gccoptlist{-mcpu=@var{cpu-type} @gol 632-mtune=@var{cpu-type} @gol 633-mpower -mno-power -mpower2 -mno-power2 @gol 634-mpowerpc -mpowerpc64 -mno-powerpc @gol 635-maltivec -mno-altivec @gol 636-mpowerpc-gpopt -mno-powerpc-gpopt @gol 637-mpowerpc-gfxopt -mno-powerpc-gfxopt @gol 638-mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mfprnd -mno-fprnd @gol 639-mnew-mnemonics -mold-mnemonics @gol 640-mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol 641-m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol 642-malign-power -malign-natural @gol 643-msoft-float -mhard-float -mmultiple -mno-multiple @gol 644-mstring -mno-string -mupdate -mno-update @gol 645-mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol 646-mstrict-align -mno-strict-align -mrelocatable @gol 647-mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol 648-mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol 649-mdynamic-no-pic -maltivec -mswdiv @gol 650-mprioritize-restricted-insns=@var{priority} @gol 651-msched-costly-dep=@var{dependence_type} @gol 652-minsert-sched-nops=@var{scheme} @gol 653-mcall-sysv -mcall-netbsd @gol 654-maix-struct-return -msvr4-struct-return @gol 655-mabi=@var{abi-type} -msecure-plt -mbss-plt @gol 656-misel -mno-isel @gol 657-misel=yes -misel=no @gol 658-mspe -mno-spe @gol 659-mspe=yes -mspe=no @gol 660-mvrsave -mno-vrsave @gol 661-mmulhw -mno-mulhw @gol 662-mdlmzb -mno-dlmzb @gol 663-mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol 664-mprototype -mno-prototype @gol 665-msim -mmvme -mads -myellowknife -memb -msdata @gol 666-msdata=@var{opt} -mvxworks -mwindiss -G @var{num} -pthread} 667 668@emph{S/390 and zSeries Options} 669@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol 670-mhard-float -msoft-float -mlong-double-64 -mlong-double-128 @gol 671-mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol 672-msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol 673-m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol 674-mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol 675-mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard} 676 677@emph{Score Options} 678@gccoptlist{-meb -mel @gol 679-mnhwloop @gol 680-muls @gol 681-mmac @gol 682-mscore5 -mscore5u -mscore7 -mscore7d} 683 684@emph{SH Options} 685@gccoptlist{-m1 -m2 -m2e -m3 -m3e @gol 686-m4-nofpu -m4-single-only -m4-single -m4 @gol 687-m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol 688-m5-64media -m5-64media-nofpu @gol 689-m5-32media -m5-32media-nofpu @gol 690-m5-compact -m5-compact-nofpu @gol 691-mb -ml -mdalign -mrelax @gol 692-mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol 693-mieee -misize -mpadstruct -mspace @gol 694-mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol 695-mdivsi3_libfunc=@var{name} @gol 696-madjust-unroll -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol 697 -minvalid-symbols} 698 699@emph{SPARC Options} 700@gccoptlist{-mcpu=@var{cpu-type} @gol 701-mtune=@var{cpu-type} @gol 702-mcmodel=@var{code-model} @gol 703-m32 -m64 -mapp-regs -mno-app-regs @gol 704-mfaster-structs -mno-faster-structs @gol 705-mfpu -mno-fpu -mhard-float -msoft-float @gol 706-mhard-quad-float -msoft-quad-float @gol 707-mimpure-text -mno-impure-text -mlittle-endian @gol 708-mstack-bias -mno-stack-bias @gol 709-munaligned-doubles -mno-unaligned-doubles @gol 710-mv8plus -mno-v8plus -mvis -mno-vis 711-threads -pthreads -pthread} 712 713@emph{System V Options} 714@gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}} 715 716@emph{TMS320C3x/C4x Options} 717@gccoptlist{-mcpu=@var{cpu} -mbig -msmall -mregparm -mmemparm @gol 718-mfast-fix -mmpyi -mbk -mti -mdp-isr-reload @gol 719-mrpts=@var{count} -mrptb -mdb -mloop-unsigned @gol 720-mparallel-insns -mparallel-mpy -mpreserve-float} 721 722@emph{V850 Options} 723@gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol 724-mprolog-function -mno-prolog-function -mspace @gol 725-mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol 726-mapp-regs -mno-app-regs @gol 727-mdisable-callt -mno-disable-callt @gol 728-mv850e1 @gol 729-mv850e @gol 730-mv850 -mbig-switch} 731 732@emph{VAX Options} 733@gccoptlist{-mg -mgnu -munix} 734 735@emph{x86-64 Options} 736See i386 and x86-64 Options. 737 738@emph{Xstormy16 Options} 739@gccoptlist{-msim} 740 741@emph{Xtensa Options} 742@gccoptlist{-mconst16 -mno-const16 @gol 743-mfused-madd -mno-fused-madd @gol 744-mtext-section-literals -mno-text-section-literals @gol 745-mtarget-align -mno-target-align @gol 746-mlongcalls -mno-longcalls} 747 748@emph{zSeries Options} 749See S/390 and zSeries Options. 750 751@item Code Generation Options 752@xref{Code Gen Options,,Options for Code Generation Conventions}. 753@gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol 754-ffixed-@var{reg} -fexceptions @gol 755-fnon-call-exceptions -funwind-tables @gol 756-fasynchronous-unwind-tables @gol 757-finhibit-size-directive -finstrument-functions @gol 758-fno-common -fno-ident @gol 759-fpcc-struct-return -fpic -fPIC -fpie -fPIE @gol 760-fno-jump-tables @gol 761-freg-struct-return -fshort-enums @gol 762-fshort-double -fshort-wchar @gol 763-fverbose-asm -fpack-struct[=@var{n}] -fstack-check @gol 764-fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol 765-fargument-alias -fargument-noalias @gol 766-fargument-noalias-global -fargument-noalias-anything 767-fleading-underscore -ftls-model=@var{model} @gol 768-ftrapv -fwrapv -fbounds-check @gol 769-fvisibility} 770@end table 771 772@menu 773* Overall Options:: Controlling the kind of output: 774 an executable, object files, assembler files, 775 or preprocessed source. 776* C Dialect Options:: Controlling the variant of C language compiled. 777* C++ Dialect Options:: Variations on C++. 778* Language Independent Options:: Controlling how diagnostics should be 779 formatted. 780* Warning Options:: How picky should the compiler be? 781* Debugging Options:: Symbol tables, measurements, and debugging dumps. 782* Optimize Options:: How much optimization? 783* Preprocessor Options:: Controlling header files and macro definitions. 784 Also, getting dependency information for Make. 785* Assembler Options:: Passing options to the assembler. 786* Link Options:: Specifying libraries and so on. 787* Directory Options:: Where to find header files and libraries. 788 Where to find the compiler executable files. 789* Spec Files:: How to pass switches to sub-processes. 790* Target Options:: Running a cross-compiler, or an old version of GCC. 791@end menu 792 793@node Overall Options 794@section Options Controlling the Kind of Output 795 796Compilation can involve up to four stages: preprocessing, compilation 797proper, assembly and linking, always in that order. GCC is capable of 798preprocessing and compiling several files either into several 799assembler input files, or into one assembler input file; then each 800assembler input file produces an object file, and linking combines all 801the object files (those newly compiled, and those specified as input) 802into an executable file. 803 804@cindex file name suffix 805For any given input file, the file name suffix determines what kind of 806compilation is done: 807 808@table @gcctabopt 809@item @var{file}.c 810C source code which must be preprocessed. 811 812@item @var{file}.i 813C source code which should not be preprocessed. 814 815@item @var{file}.ii 816C++ source code which should not be preprocessed. 817 818@item @var{file}.h 819C, or C++ header file to be turned into a precompiled header. 820 821@item @var{file}.cc 822@itemx @var{file}.cp 823@itemx @var{file}.cxx 824@itemx @var{file}.cpp 825@itemx @var{file}.CPP 826@itemx @var{file}.c++ 827@itemx @var{file}.C 828C++ source code which must be preprocessed. Note that in @samp{.cxx}, 829the last two letters must both be literally @samp{x}. Likewise, 830@samp{.C} refers to a literal capital C@. 831 832@item @var{file}.hh 833@itemx @var{file}.H 834C++ header file to be turned into a precompiled header. 835 836@item @var{file}.f 837@itemx @var{file}.for 838@itemx @var{file}.FOR 839Fixed form Fortran source code which should not be preprocessed. 840 841@item @var{file}.F 842@itemx @var{file}.fpp 843@itemx @var{file}.FPP 844Fixed form Fortran source code which must be preprocessed (with the traditional 845preprocessor). 846 847@item @var{file}.f90 848@itemx @var{file}.f95 849Free form Fortran source code which should not be preprocessed. 850 851@item @var{file}.F90 852@itemx @var{file}.F95 853Free form Fortran source code which must be preprocessed (with the 854traditional preprocessor). 855 856@c FIXME: Descriptions of Java file types. 857@c @var{file}.java 858@c @var{file}.class 859@c @var{file}.zip 860@c @var{file}.jar 861 862@item @var{file}.ads 863Ada source code file which contains a library unit declaration (a 864declaration of a package, subprogram, or generic, or a generic 865instantiation), or a library unit renaming declaration (a package, 866generic, or subprogram renaming declaration). Such files are also 867called @dfn{specs}. 868 869@itemx @var{file}.adb 870Ada source code file containing a library unit body (a subprogram or 871package body). Such files are also called @dfn{bodies}. 872 873@c GCC also knows about some suffixes for languages not yet included: 874@c Pascal: 875@c @var{file}.p 876@c @var{file}.pas 877@c Ratfor: 878@c @var{file}.r 879 880@item @var{file}.s 881Assembler code. 882 883@item @var{file}.S 884Assembler code which must be preprocessed. 885 886@item @var{other} 887An object file to be fed straight into linking. 888Any file name with no recognized suffix is treated this way. 889@end table 890 891@opindex x 892You can specify the input language explicitly with the @option{-x} option: 893 894@table @gcctabopt 895@item -x @var{language} 896Specify explicitly the @var{language} for the following input files 897(rather than letting the compiler choose a default based on the file 898name suffix). This option applies to all following input files until 899the next @option{-x} option. Possible values for @var{language} are: 900@smallexample 901c c-header c-cpp-output 902c++ c++-header c++-cpp-output 903assembler assembler-with-cpp 904ada 905f95 f95-cpp-input 906java 907treelang 908@end smallexample 909 910@item -x none 911Turn off any specification of a language, so that subsequent files are 912handled according to their file name suffixes (as they are if @option{-x} 913has not been used at all). 914 915@item -pass-exit-codes 916@opindex pass-exit-codes 917Normally the @command{gcc} program will exit with the code of 1 if any 918phase of the compiler returns a non-success return code. If you specify 919@option{-pass-exit-codes}, the @command{gcc} program will instead return with 920numerically highest error produced by any phase that returned an error 921indication. The C, C++, and Fortran frontends return 4, if an internal 922compiler error is encountered. 923@end table 924 925If you only want some of the stages of compilation, you can use 926@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and 927one of the options @option{-c}, @option{-S}, or @option{-E} to say where 928@command{gcc} is to stop. Note that some combinations (for example, 929@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all. 930 931@table @gcctabopt 932@item -c 933@opindex c 934Compile or assemble the source files, but do not link. The linking 935stage simply is not done. The ultimate output is in the form of an 936object file for each source file. 937 938By default, the object file name for a source file is made by replacing 939the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}. 940 941Unrecognized input files, not requiring compilation or assembly, are 942ignored. 943 944@item -S 945@opindex S 946Stop after the stage of compilation proper; do not assemble. The output 947is in the form of an assembler code file for each non-assembler input 948file specified. 949 950By default, the assembler file name for a source file is made by 951replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}. 952 953Input files that don't require compilation are ignored. 954 955@item -E 956@opindex E 957Stop after the preprocessing stage; do not run the compiler proper. The 958output is in the form of preprocessed source code, which is sent to the 959standard output. 960 961Input files which don't require preprocessing are ignored. 962 963@cindex output file option 964@item -o @var{file} 965@opindex o 966Place output in file @var{file}. This applies regardless to whatever 967sort of output is being produced, whether it be an executable file, 968an object file, an assembler file or preprocessed C code. 969 970If @option{-o} is not specified, the default is to put an executable 971file in @file{a.out}, the object file for 972@file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its 973assembler file in @file{@var{source}.s}, a precompiled header file in 974@file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on 975standard output. 976 977@item -v 978@opindex v 979Print (on standard error output) the commands executed to run the stages 980of compilation. Also print the version number of the compiler driver 981program and of the preprocessor and the compiler proper. 982 983@item -### 984@opindex ### 985Like @option{-v} except the commands are not executed and all command 986arguments are quoted. This is useful for shell scripts to capture the 987driver-generated command lines. 988 989@item -pipe 990@opindex pipe 991Use pipes rather than temporary files for communication between the 992various stages of compilation. This fails to work on some systems where 993the assembler is unable to read from a pipe; but the GNU assembler has 994no trouble. 995 996@item -combine 997@opindex combine 998If you are compiling multiple source files, this option tells the driver 999to pass all the source files to the compiler at once (for those 1000languages for which the compiler can handle this). This will allow 1001intermodule analysis (IMA) to be performed by the compiler. Currently the only 1002language for which this is supported is C@. If you pass source files for 1003multiple languages to the driver, using this option, the driver will invoke 1004the compiler(s) that support IMA once each, passing each compiler all the 1005source files appropriate for it. For those languages that do not support 1006IMA this option will be ignored, and the compiler will be invoked once for 1007each source file in that language. If you use this option in conjunction 1008with @option{-save-temps}, the compiler will generate multiple 1009pre-processed files 1010(one for each source file), but only one (combined) @file{.o} or 1011@file{.s} file. 1012 1013@item --help 1014@opindex help 1015Print (on the standard output) a description of the command line options 1016understood by @command{gcc}. If the @option{-v} option is also specified 1017then @option{--help} will also be passed on to the various processes 1018invoked by @command{gcc}, so that they can display the command line options 1019they accept. If the @option{-Wextra} option is also specified then command 1020line options which have no documentation associated with them will also 1021be displayed. 1022 1023@item --target-help 1024@opindex target-help 1025Print (on the standard output) a description of target specific command 1026line options for each tool. 1027 1028@item --version 1029@opindex version 1030Display the version number and copyrights of the invoked GCC@. 1031 1032@include @value{srcdir}/../libiberty/at-file.texi 1033@end table 1034 1035@node Invoking G++ 1036@section Compiling C++ Programs 1037 1038@cindex suffixes for C++ source 1039@cindex C++ source file suffixes 1040C++ source files conventionally use one of the suffixes @samp{.C}, 1041@samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or 1042@samp{.cxx}; C++ header files often use @samp{.hh} or @samp{.H}; and 1043preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes 1044files with these names and compiles them as C++ programs even if you 1045call the compiler the same way as for compiling C programs (usually 1046with the name @command{gcc}). 1047 1048@findex g++ 1049@findex c++ 1050However, the use of @command{gcc} does not add the C++ library. 1051@command{g++} is a program that calls GCC and treats @samp{.c}, 1052@samp{.h} and @samp{.i} files as C++ source files instead of C source 1053files unless @option{-x} is used, and automatically specifies linking 1054against the C++ library. This program is also useful when 1055precompiling a C header file with a @samp{.h} extension for use in C++ 1056compilations. On many systems, @command{g++} is also installed with 1057the name @command{c++}. 1058 1059@cindex invoking @command{g++} 1060When you compile C++ programs, you may specify many of the same 1061command-line options that you use for compiling programs in any 1062language; or command-line options meaningful for C and related 1063languages; or options that are meaningful only for C++ programs. 1064@xref{C Dialect Options,,Options Controlling C Dialect}, for 1065explanations of options for languages related to C@. 1066@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for 1067explanations of options that are meaningful only for C++ programs. 1068 1069@node C Dialect Options 1070@section Options Controlling C Dialect 1071@cindex dialect options 1072@cindex language dialect options 1073@cindex options, dialect 1074 1075The following options control the dialect of C (or languages derived 1076from C, such as C++) that the compiler accepts: 1077 1078@table @gcctabopt 1079@cindex ANSI support 1080@cindex ISO support 1081@item -ansi 1082@opindex ansi 1083In C mode, support all ISO C90 programs. In C++ mode, 1084remove GNU extensions that conflict with ISO C++. 1085 1086This turns off certain features of GCC that are incompatible with ISO 1087C90 (when compiling C code), or of standard C++ (when compiling C++ code), 1088such as the @code{asm} and @code{typeof} keywords, and 1089predefined macros such as @code{unix} and @code{vax} that identify the 1090type of system you are using. It also enables the undesirable and 1091rarely used ISO trigraph feature. For the C compiler, 1092it disables recognition of C++ style @samp{//} comments as well as 1093the @code{inline} keyword. 1094 1095The alternate keywords @code{__asm__}, @code{__extension__}, 1096@code{__inline__} and @code{__typeof__} continue to work despite 1097@option{-ansi}. You would not want to use them in an ISO C program, of 1098course, but it is useful to put them in header files that might be included 1099in compilations done with @option{-ansi}. Alternate predefined macros 1100such as @code{__unix__} and @code{__vax__} are also available, with or 1101without @option{-ansi}. 1102 1103The @option{-ansi} option does not cause non-ISO programs to be 1104rejected gratuitously. For that, @option{-pedantic} is required in 1105addition to @option{-ansi}. @xref{Warning Options}. 1106 1107The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi} 1108option is used. Some header files may notice this macro and refrain 1109from declaring certain functions or defining certain macros that the 1110ISO standard doesn't call for; this is to avoid interfering with any 1111programs that might use these names for other things. 1112 1113Functions which would normally be built in but do not have semantics 1114defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in 1115functions with @option{-ansi} is used. @xref{Other Builtins,,Other 1116built-in functions provided by GCC}, for details of the functions 1117affected. 1118 1119@item -std= 1120@opindex std 1121Determine the language standard. This option is currently only 1122supported when compiling C or C++. A value for this option must be 1123provided; possible values are 1124 1125@table @samp 1126@item c89 1127@itemx iso9899:1990 1128ISO C90 (same as @option{-ansi}). 1129 1130@item iso9899:199409 1131ISO C90 as modified in amendment 1. 1132 1133@item c99 1134@itemx c9x 1135@itemx iso9899:1999 1136@itemx iso9899:199x 1137ISO C99. Note that this standard is not yet fully supported; see 1138@w{@uref{http://gcc.gnu.org/gcc-4.2/c99status.html}} for more information. The 1139names @samp{c9x} and @samp{iso9899:199x} are deprecated. 1140 1141@item gnu89 1142Default, ISO C90 plus GNU extensions (including some C99 features). 1143 1144@item gnu99 1145@itemx gnu9x 1146ISO C99 plus GNU extensions. When ISO C99 is fully implemented in GCC, 1147this will become the default. The name @samp{gnu9x} is deprecated. 1148 1149@item c++98 1150The 1998 ISO C++ standard plus amendments. 1151 1152@item gnu++98 1153The same as @option{-std=c++98} plus GNU extensions. This is the 1154default for C++ code. 1155@end table 1156 1157Even when this option is not specified, you can still use some of the 1158features of newer standards in so far as they do not conflict with 1159previous C standards. For example, you may use @code{__restrict__} even 1160when @option{-std=c99} is not specified. 1161 1162The @option{-std} options specifying some version of ISO C have the same 1163effects as @option{-ansi}, except that features that were not in ISO C90 1164but are in the specified version (for example, @samp{//} comments and 1165the @code{inline} keyword in ISO C99) are not disabled. 1166 1167@xref{Standards,,Language Standards Supported by GCC}, for details of 1168these standard versions. 1169 1170@item -fgnu89-inline 1171@opindex fgnu89-inline 1172The option @option{-fgnu89-inline} tells GCC to use the traditional 1173GNU semantics for @code{inline} functions when in C99 mode. 1174@xref{Inline,,An Inline Function is As Fast As a Macro}. Using this 1175option is roughly equivalent to adding the @code{gnu_inline} function 1176attribute to all inline functions (@pxref{Function Attributes}). 1177 1178This option is accepted by GCC versions 4.1.3 and up. In GCC versions 1179prior to 4.3, C99 inline semantics are not supported, and thus this 1180option is effectively assumed to be present regardless of whether or not 1181it is specified; the only effect of specifying it explicitly is to 1182disable warnings about using inline functions in C99 mode. Likewise, 1183the option @option{-fno-gnu89-inline} is not supported in versions of 1184GCC before 4.3. It will be supported only in C99 or gnu99 mode, not in 1185C89 or gnu89 mode. 1186 1187The preprocesor macros @code{__GNUC_GNU_INLINE__} and 1188@code{__GNUC_STDC_INLINE__} may be used to check which semantics are 1189in effect for @code{inline} functions. @xref{Common Predefined 1190Macros,,,cpp,The C Preprocessor}. 1191 1192@item -aux-info @var{filename} 1193@opindex aux-info 1194Output to the given filename prototyped declarations for all functions 1195declared and/or defined in a translation unit, including those in header 1196files. This option is silently ignored in any language other than C@. 1197 1198Besides declarations, the file indicates, in comments, the origin of 1199each declaration (source file and line), whether the declaration was 1200implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or 1201@samp{O} for old, respectively, in the first character after the line 1202number and the colon), and whether it came from a declaration or a 1203definition (@samp{C} or @samp{F}, respectively, in the following 1204character). In the case of function definitions, a K&R-style list of 1205arguments followed by their declarations is also provided, inside 1206comments, after the declaration. 1207 1208@item -fno-asm 1209@opindex fno-asm 1210Do not recognize @code{asm}, @code{inline} or @code{typeof} as a 1211keyword, so that code can use these words as identifiers. You can use 1212the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__} 1213instead. @option{-ansi} implies @option{-fno-asm}. 1214 1215In C++, this switch only affects the @code{typeof} keyword, since 1216@code{asm} and @code{inline} are standard keywords. You may want to 1217use the @option{-fno-gnu-keywords} flag instead, which has the same 1218effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this 1219switch only affects the @code{asm} and @code{typeof} keywords, since 1220@code{inline} is a standard keyword in ISO C99. 1221 1222@item -fno-builtin 1223@itemx -fno-builtin-@var{function} 1224@opindex fno-builtin 1225@cindex built-in functions 1226Don't recognize built-in functions that do not begin with 1227@samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in 1228functions provided by GCC}, for details of the functions affected, 1229including those which are not built-in functions when @option{-ansi} or 1230@option{-std} options for strict ISO C conformance are used because they 1231do not have an ISO standard meaning. 1232 1233GCC normally generates special code to handle certain built-in functions 1234more efficiently; for instance, calls to @code{alloca} may become single 1235instructions that adjust the stack directly, and calls to @code{memcpy} 1236may become inline copy loops. The resulting code is often both smaller 1237and faster, but since the function calls no longer appear as such, you 1238cannot set a breakpoint on those calls, nor can you change the behavior 1239of the functions by linking with a different library. In addition, 1240when a function is recognized as a built-in function, GCC may use 1241information about that function to warn about problems with calls to 1242that function, or to generate more efficient code, even if the 1243resulting code still contains calls to that function. For example, 1244warnings are given with @option{-Wformat} for bad calls to 1245@code{printf}, when @code{printf} is built in, and @code{strlen} is 1246known not to modify global memory. 1247 1248With the @option{-fno-builtin-@var{function}} option 1249only the built-in function @var{function} is 1250disabled. @var{function} must not begin with @samp{__builtin_}. If a 1251function is named this is not built-in in this version of GCC, this 1252option is ignored. There is no corresponding 1253@option{-fbuiltin-@var{function}} option; if you wish to enable 1254built-in functions selectively when using @option{-fno-builtin} or 1255@option{-ffreestanding}, you may define macros such as: 1256 1257@smallexample 1258#define abs(n) __builtin_abs ((n)) 1259#define strcpy(d, s) __builtin_strcpy ((d), (s)) 1260@end smallexample 1261 1262@item -fhosted 1263@opindex fhosted 1264@cindex hosted environment 1265 1266Assert that compilation takes place in a hosted environment. This implies 1267@option{-fbuiltin}. A hosted environment is one in which the 1268entire standard library is available, and in which @code{main} has a return 1269type of @code{int}. Examples are nearly everything except a kernel. 1270This is equivalent to @option{-fno-freestanding}. 1271 1272@item -ffreestanding 1273@opindex ffreestanding 1274@cindex hosted environment 1275 1276Assert that compilation takes place in a freestanding environment. This 1277implies @option{-fno-builtin}. A freestanding environment 1278is one in which the standard library may not exist, and program startup may 1279not necessarily be at @code{main}. The most obvious example is an OS kernel. 1280This is equivalent to @option{-fno-hosted}. 1281 1282@xref{Standards,,Language Standards Supported by GCC}, for details of 1283freestanding and hosted environments. 1284 1285@item -fopenmp 1286@opindex fopenmp 1287@cindex openmp parallel 1288Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and 1289@code{!$omp} in Fortran. When @option{-fopenmp} is specified, the 1290compiler generates parallel code according to the OpenMP Application 1291Program Interface v2.5 @w{@uref{http://www.openmp.org/}}. 1292 1293@item -fms-extensions 1294@opindex fms-extensions 1295Accept some non-standard constructs used in Microsoft header files. 1296 1297Some cases of unnamed fields in structures and unions are only 1298accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union 1299fields within structs/unions}, for details. 1300 1301@item -trigraphs 1302@opindex trigraphs 1303Support ISO C trigraphs. The @option{-ansi} option (and @option{-std} 1304options for strict ISO C conformance) implies @option{-trigraphs}. 1305 1306@item -no-integrated-cpp 1307@opindex no-integrated-cpp 1308Performs a compilation in two passes: preprocessing and compiling. This 1309option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the 1310@option{-B} option. The user supplied compilation step can then add in 1311an additional preprocessing step after normal preprocessing but before 1312compiling. The default is to use the integrated cpp (internal cpp) 1313 1314The semantics of this option will change if "cc1", "cc1plus", and 1315"cc1obj" are merged. 1316 1317@cindex traditional C language 1318@cindex C language, traditional 1319@item -traditional 1320@itemx -traditional-cpp 1321@opindex traditional-cpp 1322@opindex traditional 1323Formerly, these options caused GCC to attempt to emulate a pre-standard 1324C compiler. They are now only supported with the @option{-E} switch. 1325The preprocessor continues to support a pre-standard mode. See the GNU 1326CPP manual for details. 1327 1328@item -fcond-mismatch 1329@opindex fcond-mismatch 1330Allow conditional expressions with mismatched types in the second and 1331third arguments. The value of such an expression is void. This option 1332is not supported for C++. 1333 1334@item -funsigned-char 1335@opindex funsigned-char 1336Let the type @code{char} be unsigned, like @code{unsigned char}. 1337 1338Each kind of machine has a default for what @code{char} should 1339be. It is either like @code{unsigned char} by default or like 1340@code{signed char} by default. 1341 1342Ideally, a portable program should always use @code{signed char} or 1343@code{unsigned char} when it depends on the signedness of an object. 1344But many programs have been written to use plain @code{char} and 1345expect it to be signed, or expect it to be unsigned, depending on the 1346machines they were written for. This option, and its inverse, let you 1347make such a program work with the opposite default. 1348 1349The type @code{char} is always a distinct type from each of 1350@code{signed char} or @code{unsigned char}, even though its behavior 1351is always just like one of those two. 1352 1353@item -fsigned-char 1354@opindex fsigned-char 1355Let the type @code{char} be signed, like @code{signed char}. 1356 1357Note that this is equivalent to @option{-fno-unsigned-char}, which is 1358the negative form of @option{-funsigned-char}. Likewise, the option 1359@option{-fno-signed-char} is equivalent to @option{-funsigned-char}. 1360 1361@item -fsigned-bitfields 1362@itemx -funsigned-bitfields 1363@itemx -fno-signed-bitfields 1364@itemx -fno-unsigned-bitfields 1365@opindex fsigned-bitfields 1366@opindex funsigned-bitfields 1367@opindex fno-signed-bitfields 1368@opindex fno-unsigned-bitfields 1369These options control whether a bit-field is signed or unsigned, when the 1370declaration does not use either @code{signed} or @code{unsigned}. By 1371default, such a bit-field is signed, because this is consistent: the 1372basic integer types such as @code{int} are signed types. 1373@end table 1374 1375@node C++ Dialect Options 1376@section Options Controlling C++ Dialect 1377 1378@cindex compiler options, C++ 1379@cindex C++ options, command line 1380@cindex options, C++ 1381This section describes the command-line options that are only meaningful 1382for C++ programs; but you can also use most of the GNU compiler options 1383regardless of what language your program is in. For example, you 1384might compile a file @code{firstClass.C} like this: 1385 1386@smallexample 1387g++ -g -frepo -O -c firstClass.C 1388@end smallexample 1389 1390@noindent 1391In this example, only @option{-frepo} is an option meant 1392only for C++ programs; you can use the other options with any 1393language supported by GCC@. 1394 1395Here is a list of options that are @emph{only} for compiling C++ programs: 1396 1397@table @gcctabopt 1398 1399@item -fabi-version=@var{n} 1400@opindex fabi-version 1401Use version @var{n} of the C++ ABI@. Version 2 is the version of the 1402C++ ABI that first appeared in G++ 3.4. Version 1 is the version of 1403the C++ ABI that first appeared in G++ 3.2. Version 0 will always be 1404the version that conforms most closely to the C++ ABI specification. 1405Therefore, the ABI obtained using version 0 will change as ABI bugs 1406are fixed. 1407 1408The default is version 2. 1409 1410@item -fno-access-control 1411@opindex fno-access-control 1412Turn off all access checking. This switch is mainly useful for working 1413around bugs in the access control code. 1414 1415@item -fcheck-new 1416@opindex fcheck-new 1417Check that the pointer returned by @code{operator new} is non-null 1418before attempting to modify the storage allocated. This check is 1419normally unnecessary because the C++ standard specifies that 1420@code{operator new} will only return @code{0} if it is declared 1421@samp{throw()}, in which case the compiler will always check the 1422return value even without this option. In all other cases, when 1423@code{operator new} has a non-empty exception specification, memory 1424exhaustion is signalled by throwing @code{std::bad_alloc}. See also 1425@samp{new (nothrow)}. 1426 1427@item -fconserve-space 1428@opindex fconserve-space 1429Put uninitialized or runtime-initialized global variables into the 1430common segment, as C does. This saves space in the executable at the 1431cost of not diagnosing duplicate definitions. If you compile with this 1432flag and your program mysteriously crashes after @code{main()} has 1433completed, you may have an object that is being destroyed twice because 1434two definitions were merged. 1435 1436This option is no longer useful on most targets, now that support has 1437been added for putting variables into BSS without making them common. 1438 1439@item -ffriend-injection 1440@opindex ffriend-injection 1441Inject friend functions into the enclosing namespace, so that they are 1442visible outside the scope of the class in which they are declared. 1443Friend functions were documented to work this way in the old Annotated 1444C++ Reference Manual, and versions of G++ before 4.1 always worked 1445that way. However, in ISO C++ a friend function which is not declared 1446in an enclosing scope can only be found using argument dependent 1447lookup. This option causes friends to be injected as they were in 1448earlier releases. 1449 1450This option is for compatibility, and may be removed in a future 1451release of G++. 1452 1453@item -fno-elide-constructors 1454@opindex fno-elide-constructors 1455The C++ standard allows an implementation to omit creating a temporary 1456which is only used to initialize another object of the same type. 1457Specifying this option disables that optimization, and forces G++ to 1458call the copy constructor in all cases. 1459 1460@item -fno-enforce-eh-specs 1461@opindex fno-enforce-eh-specs 1462Don't generate code to check for violation of exception specifications 1463at runtime. This option violates the C++ standard, but may be useful 1464for reducing code size in production builds, much like defining 1465@samp{NDEBUG}. This does not give user code permission to throw 1466exceptions in violation of the exception specifications; the compiler 1467will still optimize based on the specifications, so throwing an 1468unexpected exception will result in undefined behavior. 1469 1470@item -ffor-scope 1471@itemx -fno-for-scope 1472@opindex ffor-scope 1473@opindex fno-for-scope 1474If @option{-ffor-scope} is specified, the scope of variables declared in 1475a @i{for-init-statement} is limited to the @samp{for} loop itself, 1476as specified by the C++ standard. 1477If @option{-fno-for-scope} is specified, the scope of variables declared in 1478a @i{for-init-statement} extends to the end of the enclosing scope, 1479as was the case in old versions of G++, and other (traditional) 1480implementations of C++. 1481 1482The default if neither flag is given to follow the standard, 1483but to allow and give a warning for old-style code that would 1484otherwise be invalid, or have different behavior. 1485 1486@item -fno-gnu-keywords 1487@opindex fno-gnu-keywords 1488Do not recognize @code{typeof} as a keyword, so that code can use this 1489word as an identifier. You can use the keyword @code{__typeof__} instead. 1490@option{-ansi} implies @option{-fno-gnu-keywords}. 1491 1492@item -fno-implicit-templates 1493@opindex fno-implicit-templates 1494Never emit code for non-inline templates which are instantiated 1495implicitly (i.e.@: by use); only emit code for explicit instantiations. 1496@xref{Template Instantiation}, for more information. 1497 1498@item -fno-implicit-inline-templates 1499@opindex fno-implicit-inline-templates 1500Don't emit code for implicit instantiations of inline templates, either. 1501The default is to handle inlines differently so that compiles with and 1502without optimization will need the same set of explicit instantiations. 1503 1504@item -fno-implement-inlines 1505@opindex fno-implement-inlines 1506To save space, do not emit out-of-line copies of inline functions 1507controlled by @samp{#pragma implementation}. This will cause linker 1508errors if these functions are not inlined everywhere they are called. 1509 1510@item -fms-extensions 1511@opindex fms-extensions 1512Disable pedantic warnings about constructs used in MFC, such as implicit 1513int and getting a pointer to member function via non-standard syntax. 1514 1515@item -fno-nonansi-builtins 1516@opindex fno-nonansi-builtins 1517Disable built-in declarations of functions that are not mandated by 1518ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit}, 1519@code{index}, @code{bzero}, @code{conjf}, and other related functions. 1520 1521@item -fno-operator-names 1522@opindex fno-operator-names 1523Do not treat the operator name keywords @code{and}, @code{bitand}, 1524@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as 1525synonyms as keywords. 1526 1527@item -fno-optional-diags 1528@opindex fno-optional-diags 1529Disable diagnostics that the standard says a compiler does not need to 1530issue. Currently, the only such diagnostic issued by G++ is the one for 1531a name having multiple meanings within a class. 1532 1533@item -fpermissive 1534@opindex fpermissive 1535Downgrade some diagnostics about nonconformant code from errors to 1536warnings. Thus, using @option{-fpermissive} will allow some 1537nonconforming code to compile. 1538 1539@item -frepo 1540@opindex frepo 1541Enable automatic template instantiation at link time. This option also 1542implies @option{-fno-implicit-templates}. @xref{Template 1543Instantiation}, for more information. 1544 1545@item -fno-rtti 1546@opindex fno-rtti 1547Disable generation of information about every class with virtual 1548functions for use by the C++ runtime type identification features 1549(@samp{dynamic_cast} and @samp{typeid}). If you don't use those parts 1550of the language, you can save some space by using this flag. Note that 1551exception handling uses the same information, but it will generate it as 1552needed. The @samp{dynamic_cast} operator can still be used for casts that 1553do not require runtime type information, i.e. casts to @code{void *} or to 1554unambiguous base classes. 1555 1556@item -fstats 1557@opindex fstats 1558Emit statistics about front-end processing at the end of the compilation. 1559This information is generally only useful to the G++ development team. 1560 1561@item -ftemplate-depth-@var{n} 1562@opindex ftemplate-depth 1563Set the maximum instantiation depth for template classes to @var{n}. 1564A limit on the template instantiation depth is needed to detect 1565endless recursions during template class instantiation. ANSI/ISO C++ 1566conforming programs must not rely on a maximum depth greater than 17. 1567 1568@item -fno-threadsafe-statics 1569@opindex fno-threadsafe-statics 1570Do not emit the extra code to use the routines specified in the C++ 1571ABI for thread-safe initialization of local statics. You can use this 1572option to reduce code size slightly in code that doesn't need to be 1573thread-safe. 1574 1575@item -fuse-cxa-atexit 1576@opindex fuse-cxa-atexit 1577Register destructors for objects with static storage duration with the 1578@code{__cxa_atexit} function rather than the @code{atexit} function. 1579This option is required for fully standards-compliant handling of static 1580destructors, but will only work if your C library supports 1581@code{__cxa_atexit}. 1582 1583@item -fno-use-cxa-get-exception-ptr 1584@opindex fno-use-cxa-get-exception-ptr 1585Don't use the @code{__cxa_get_exception_ptr} runtime routine. This 1586will cause @code{std::uncaught_exception} to be incorrect, but is necessary 1587if the runtime routine is not available. 1588 1589@item -fvisibility-inlines-hidden 1590@opindex fvisibility-inlines-hidden 1591This switch declares that the user does not attempt to compare 1592pointers to inline methods where the addresses of the two functions 1593were taken in different shared objects. 1594 1595The effect of this is that GCC may, effectively, mark inline methods with 1596@code{__attribute__ ((visibility ("hidden")))} so that they do not 1597appear in the export table of a DSO and do not require a PLT indirection 1598when used within the DSO@. Enabling this option can have a dramatic effect 1599on load and link times of a DSO as it massively reduces the size of the 1600dynamic export table when the library makes heavy use of templates. 1601 1602The behaviour of this switch is not quite the same as marking the 1603methods as hidden directly, because it does not affect static variables 1604local to the function or cause the compiler to deduce that 1605the function is defined in only one shared object. 1606 1607You may mark a method as having a visibility explicitly to negate the 1608effect of the switch for that method. For example, if you do want to 1609compare pointers to a particular inline method, you might mark it as 1610having default visibility. Marking the enclosing class with explicit 1611visibility will have no effect. 1612 1613Explicitly instantiated inline methods are unaffected by this option 1614as their linkage might otherwise cross a shared library boundary. 1615@xref{Template Instantiation}. 1616 1617@item -fno-weak 1618@opindex fno-weak 1619Do not use weak symbol support, even if it is provided by the linker. 1620By default, G++ will use weak symbols if they are available. This 1621option exists only for testing, and should not be used by end-users; 1622it will result in inferior code and has no benefits. This option may 1623be removed in a future release of G++. 1624 1625@item -nostdinc++ 1626@opindex nostdinc++ 1627Do not search for header files in the standard directories specific to 1628C++, but do still search the other standard directories. (This option 1629is used when building the C++ library.) 1630@end table 1631 1632In addition, these optimization, warning, and code generation options 1633have meanings only for C++ programs: 1634 1635@table @gcctabopt 1636@item -fno-default-inline 1637@opindex fno-default-inline 1638Do not assume @samp{inline} for functions defined inside a class scope. 1639@xref{Optimize Options,,Options That Control Optimization}. Note that these 1640functions will have linkage like inline functions; they just won't be 1641inlined by default. 1642 1643@item -Wabi @r{(C++ only)} 1644@opindex Wabi 1645Warn when G++ generates code that is probably not compatible with the 1646vendor-neutral C++ ABI@. Although an effort has been made to warn about 1647all such cases, there are probably some cases that are not warned about, 1648even though G++ is generating incompatible code. There may also be 1649cases where warnings are emitted even though the code that is generated 1650will be compatible. 1651 1652You should rewrite your code to avoid these warnings if you are 1653concerned about the fact that code generated by G++ may not be binary 1654compatible with code generated by other compilers. 1655 1656The known incompatibilities at this point include: 1657 1658@itemize @bullet 1659 1660@item 1661Incorrect handling of tail-padding for bit-fields. G++ may attempt to 1662pack data into the same byte as a base class. For example: 1663 1664@smallexample 1665struct A @{ virtual void f(); int f1 : 1; @}; 1666struct B : public A @{ int f2 : 1; @}; 1667@end smallexample 1668 1669@noindent 1670In this case, G++ will place @code{B::f2} into the same byte 1671as@code{A::f1}; other compilers will not. You can avoid this problem 1672by explicitly padding @code{A} so that its size is a multiple of the 1673byte size on your platform; that will cause G++ and other compilers to 1674layout @code{B} identically. 1675 1676@item 1677Incorrect handling of tail-padding for virtual bases. G++ does not use 1678tail padding when laying out virtual bases. For example: 1679 1680@smallexample 1681struct A @{ virtual void f(); char c1; @}; 1682struct B @{ B(); char c2; @}; 1683struct C : public A, public virtual B @{@}; 1684@end smallexample 1685 1686@noindent 1687In this case, G++ will not place @code{B} into the tail-padding for 1688@code{A}; other compilers will. You can avoid this problem by 1689explicitly padding @code{A} so that its size is a multiple of its 1690alignment (ignoring virtual base classes); that will cause G++ and other 1691compilers to layout @code{C} identically. 1692 1693@item 1694Incorrect handling of bit-fields with declared widths greater than that 1695of their underlying types, when the bit-fields appear in a union. For 1696example: 1697 1698@smallexample 1699union U @{ int i : 4096; @}; 1700@end smallexample 1701 1702@noindent 1703Assuming that an @code{int} does not have 4096 bits, G++ will make the 1704union too small by the number of bits in an @code{int}. 1705 1706@item 1707Empty classes can be placed at incorrect offsets. For example: 1708 1709@smallexample 1710struct A @{@}; 1711 1712struct B @{ 1713 A a; 1714 virtual void f (); 1715@}; 1716 1717struct C : public B, public A @{@}; 1718@end smallexample 1719 1720@noindent 1721G++ will place the @code{A} base class of @code{C} at a nonzero offset; 1722it should be placed at offset zero. G++ mistakenly believes that the 1723@code{A} data member of @code{B} is already at offset zero. 1724 1725@item 1726Names of template functions whose types involve @code{typename} or 1727template template parameters can be mangled incorrectly. 1728 1729@smallexample 1730template <typename Q> 1731void f(typename Q::X) @{@} 1732 1733template <template <typename> class Q> 1734void f(typename Q<int>::X) @{@} 1735@end smallexample 1736 1737@noindent 1738Instantiations of these templates may be mangled incorrectly. 1739 1740@end itemize 1741 1742@item -Wctor-dtor-privacy @r{(C++ only)} 1743@opindex Wctor-dtor-privacy 1744Warn when a class seems unusable because all the constructors or 1745destructors in that class are private, and it has neither friends nor 1746public static member functions. 1747 1748@item -Wnon-virtual-dtor @r{(C++ only)} 1749@opindex Wnon-virtual-dtor 1750Warn when a class appears to be polymorphic, thereby requiring a virtual 1751destructor, yet it declares a non-virtual one. This warning is also 1752enabled if -Weffc++ is specified. 1753 1754@item -Wreorder @r{(C++ only)} 1755@opindex Wreorder 1756@cindex reordering, warning 1757@cindex warning for reordering of member initializers 1758Warn when the order of member initializers given in the code does not 1759match the order in which they must be executed. For instance: 1760 1761@smallexample 1762struct A @{ 1763 int i; 1764 int j; 1765 A(): j (0), i (1) @{ @} 1766@}; 1767@end smallexample 1768 1769The compiler will rearrange the member initializers for @samp{i} 1770and @samp{j} to match the declaration order of the members, emitting 1771a warning to that effect. This warning is enabled by @option{-Wall}. 1772@end table 1773 1774The following @option{-W@dots{}} options are not affected by @option{-Wall}. 1775 1776@table @gcctabopt 1777@item -Weffc++ @r{(C++ only)} 1778@opindex Weffc++ 1779Warn about violations of the following style guidelines from Scott Meyers' 1780@cite{Effective C++} book: 1781 1782@itemize @bullet 1783@item 1784Item 11: Define a copy constructor and an assignment operator for classes 1785with dynamically allocated memory. 1786 1787@item 1788Item 12: Prefer initialization to assignment in constructors. 1789 1790@item 1791Item 14: Make destructors virtual in base classes. 1792 1793@item 1794Item 15: Have @code{operator=} return a reference to @code{*this}. 1795 1796@item 1797Item 23: Don't try to return a reference when you must return an object. 1798 1799@end itemize 1800 1801Also warn about violations of the following style guidelines from 1802Scott Meyers' @cite{More Effective C++} book: 1803 1804@itemize @bullet 1805@item 1806Item 6: Distinguish between prefix and postfix forms of increment and 1807decrement operators. 1808 1809@item 1810Item 7: Never overload @code{&&}, @code{||}, or @code{,}. 1811 1812@end itemize 1813 1814When selecting this option, be aware that the standard library 1815headers do not obey all of these guidelines; use @samp{grep -v} 1816to filter out those warnings. 1817 1818@item -Wno-deprecated @r{(C++ only)} 1819@opindex Wno-deprecated 1820Do not warn about usage of deprecated features. @xref{Deprecated Features}. 1821 1822@item -Wstrict-null-sentinel @r{(C++ only)} 1823@opindex Wstrict-null-sentinel 1824Warn also about the use of an uncasted @code{NULL} as sentinel. When 1825compiling only with GCC this is a valid sentinel, as @code{NULL} is defined 1826to @code{__null}. Although it is a null pointer constant not a null pointer, 1827it is guaranteed to of the same size as a pointer. But this use is 1828not portable across different compilers. 1829 1830@item -Wno-non-template-friend @r{(C++ only)} 1831@opindex Wno-non-template-friend 1832Disable warnings when non-templatized friend functions are declared 1833within a template. Since the advent of explicit template specification 1834support in G++, if the name of the friend is an unqualified-id (i.e., 1835@samp{friend foo(int)}), the C++ language specification demands that the 1836friend declare or define an ordinary, nontemplate function. (Section 183714.5.3). Before G++ implemented explicit specification, unqualified-ids 1838could be interpreted as a particular specialization of a templatized 1839function. Because this non-conforming behavior is no longer the default 1840behavior for G++, @option{-Wnon-template-friend} allows the compiler to 1841check existing code for potential trouble spots and is on by default. 1842This new compiler behavior can be turned off with 1843@option{-Wno-non-template-friend} which keeps the conformant compiler code 1844but disables the helpful warning. 1845 1846@item -Wold-style-cast @r{(C++ only)} 1847@opindex Wold-style-cast 1848Warn if an old-style (C-style) cast to a non-void type is used within 1849a C++ program. The new-style casts (@samp{dynamic_cast}, 1850@samp{static_cast}, @samp{reinterpret_cast}, and @samp{const_cast}) are 1851less vulnerable to unintended effects and much easier to search for. 1852 1853@item -Woverloaded-virtual @r{(C++ only)} 1854@opindex Woverloaded-virtual 1855@cindex overloaded virtual fn, warning 1856@cindex warning for overloaded virtual fn 1857Warn when a function declaration hides virtual functions from a 1858base class. For example, in: 1859 1860@smallexample 1861struct A @{ 1862 virtual void f(); 1863@}; 1864 1865struct B: public A @{ 1866 void f(int); 1867@}; 1868@end smallexample 1869 1870the @code{A} class version of @code{f} is hidden in @code{B}, and code 1871like: 1872 1873@smallexample 1874B* b; 1875b->f(); 1876@end smallexample 1877 1878will fail to compile. 1879 1880@item -Wno-pmf-conversions @r{(C++ only)} 1881@opindex Wno-pmf-conversions 1882Disable the diagnostic for converting a bound pointer to member function 1883to a plain pointer. 1884 1885@item -Wsign-promo @r{(C++ only)} 1886@opindex Wsign-promo 1887Warn when overload resolution chooses a promotion from unsigned or 1888enumerated type to a signed type, over a conversion to an unsigned type of 1889the same size. Previous versions of G++ would try to preserve 1890unsignedness, but the standard mandates the current behavior. 1891 1892@smallexample 1893struct A @{ 1894 operator int (); 1895 A& operator = (int); 1896@}; 1897 1898main () 1899@{ 1900 A a,b; 1901 a = b; 1902@} 1903@end smallexample 1904 1905In this example, G++ will synthesize a default @samp{A& operator = 1906(const A&);}, while cfront will use the user-defined @samp{operator =}. 1907@end table 1908 1909@node Language Independent Options 1910@section Options to Control Diagnostic Messages Formatting 1911@cindex options to control diagnostics formatting 1912@cindex diagnostic messages 1913@cindex message formatting 1914 1915Traditionally, diagnostic messages have been formatted irrespective of 1916the output device's aspect (e.g.@: its width, @dots{}). The options described 1917below can be used to control the diagnostic messages formatting 1918algorithm, e.g.@: how many characters per line, how often source location 1919information should be reported. Right now, only the C++ front end can 1920honor these options. However it is expected, in the near future, that 1921the remaining front ends would be able to digest them correctly. 1922 1923@table @gcctabopt 1924@item -fmessage-length=@var{n} 1925@opindex fmessage-length 1926Try to format error messages so that they fit on lines of about @var{n} 1927characters. The default is 72 characters for @command{g++} and 0 for the rest of 1928the front ends supported by GCC@. If @var{n} is zero, then no 1929line-wrapping will be done; each error message will appear on a single 1930line. 1931 1932@opindex fdiagnostics-show-location 1933@item -fdiagnostics-show-location=once 1934Only meaningful in line-wrapping mode. Instructs the diagnostic messages 1935reporter to emit @emph{once} source location information; that is, in 1936case the message is too long to fit on a single physical line and has to 1937be wrapped, the source location won't be emitted (as prefix) again, 1938over and over, in subsequent continuation lines. This is the default 1939behavior. 1940 1941@item -fdiagnostics-show-location=every-line 1942Only meaningful in line-wrapping mode. Instructs the diagnostic 1943messages reporter to emit the same source location information (as 1944prefix) for physical lines that result from the process of breaking 1945a message which is too long to fit on a single line. 1946 1947@item -fdiagnostics-show-option 1948@opindex fdiagnostics-show-option 1949This option instructs the diagnostic machinery to add text to each 1950diagnostic emitted, which indicates which command line option directly 1951controls that diagnostic, when such an option is known to the 1952diagnostic machinery. 1953 1954@end table 1955 1956@node Warning Options 1957@section Options to Request or Suppress Warnings 1958@cindex options to control warnings 1959@cindex warning messages 1960@cindex messages, warning 1961@cindex suppressing warnings 1962 1963Warnings are diagnostic messages that report constructions which 1964are not inherently erroneous but which are risky or suggest there 1965may have been an error. 1966 1967You can request many specific warnings with options beginning @samp{-W}, 1968for example @option{-Wimplicit} to request warnings on implicit 1969declarations. Each of these specific warning options also has a 1970negative form beginning @samp{-Wno-} to turn off warnings; 1971for example, @option{-Wno-implicit}. This manual lists only one of the 1972two forms, whichever is not the default. 1973 1974The following options control the amount and kinds of warnings produced 1975by GCC; for further, language-specific options also refer to 1976@ref{C++ Dialect Options}. 1977 1978@table @gcctabopt 1979@cindex syntax checking 1980@item -fsyntax-only 1981@opindex fsyntax-only 1982Check the code for syntax errors, but don't do anything beyond that. 1983 1984@item -pedantic 1985@opindex pedantic 1986Issue all the warnings demanded by strict ISO C and ISO C++; 1987reject all programs that use forbidden extensions, and some other 1988programs that do not follow ISO C and ISO C++. For ISO C, follows the 1989version of the ISO C standard specified by any @option{-std} option used. 1990 1991Valid ISO C and ISO C++ programs should compile properly with or without 1992this option (though a rare few will require @option{-ansi} or a 1993@option{-std} option specifying the required version of ISO C)@. However, 1994without this option, certain GNU extensions and traditional C and C++ 1995features are supported as well. With this option, they are rejected. 1996 1997@option{-pedantic} does not cause warning messages for use of the 1998alternate keywords whose names begin and end with @samp{__}. Pedantic 1999warnings are also disabled in the expression that follows 2000@code{__extension__}. However, only system header files should use 2001these escape routes; application programs should avoid them. 2002@xref{Alternate Keywords}. 2003 2004Some users try to use @option{-pedantic} to check programs for strict ISO 2005C conformance. They soon find that it does not do quite what they want: 2006it finds some non-ISO practices, but not all---only those for which 2007ISO C @emph{requires} a diagnostic, and some others for which 2008diagnostics have been added. 2009 2010A feature to report any failure to conform to ISO C might be useful in 2011some instances, but would require considerable additional work and would 2012be quite different from @option{-pedantic}. We don't have plans to 2013support such a feature in the near future. 2014 2015Where the standard specified with @option{-std} represents a GNU 2016extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a 2017corresponding @dfn{base standard}, the version of ISO C on which the GNU 2018extended dialect is based. Warnings from @option{-pedantic} are given 2019where they are required by the base standard. (It would not make sense 2020for such warnings to be given only for features not in the specified GNU 2021C dialect, since by definition the GNU dialects of C include all 2022features the compiler supports with the given option, and there would be 2023nothing to warn about.) 2024 2025@item -pedantic-errors 2026@opindex pedantic-errors 2027Like @option{-pedantic}, except that errors are produced rather than 2028warnings. 2029 2030@item -w 2031@opindex w 2032Inhibit all warning messages. 2033 2034@item -Wno-import 2035@opindex Wno-import 2036Inhibit warning messages about the use of @samp{#import}. 2037 2038@item -Wchar-subscripts 2039@opindex Wchar-subscripts 2040Warn if an array subscript has type @code{char}. This is a common cause 2041of error, as programmers often forget that this type is signed on some 2042machines. 2043This warning is enabled by @option{-Wall}. 2044 2045@item -Wcomment 2046@opindex Wcomment 2047Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*} 2048comment, or whenever a Backslash-Newline appears in a @samp{//} comment. 2049This warning is enabled by @option{-Wall}. 2050 2051@item -Wfatal-errors 2052@opindex Wfatal-errors 2053This option causes the compiler to abort compilation on the first error 2054occurred rather than trying to keep going and printing further error 2055messages. 2056 2057@item -Wformat 2058@opindex Wformat 2059@opindex ffreestanding 2060@opindex fno-builtin 2061Check calls to @code{printf} and @code{scanf}, etc., to make sure that 2062the arguments supplied have types appropriate to the format string 2063specified, and that the conversions specified in the format string make 2064sense. This includes standard functions, and others specified by format 2065attributes (@pxref{Function Attributes}), in the @code{printf}, 2066@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension, 2067not in the C standard) families (or other target-specific families). 2068Which functions are checked without format attributes having been 2069specified depends on the standard version selected, and such checks of 2070functions without the attribute specified are disabled by 2071@option{-ffreestanding} or @option{-fno-builtin}. 2072 2073The formats are checked against the format features supported by GNU 2074libc version 2.2. These include all ISO C90 and C99 features, as well 2075as features from the Single Unix Specification and some BSD and GNU 2076extensions. Other library implementations may not support all these 2077features; GCC does not support warning about features that go beyond a 2078particular library's limitations. However, if @option{-pedantic} is used 2079with @option{-Wformat}, warnings will be given about format features not 2080in the selected standard version (but not for @code{strfmon} formats, 2081since those are not in any version of the C standard). @xref{C Dialect 2082Options,,Options Controlling C Dialect}. 2083 2084Since @option{-Wformat} also checks for null format arguments for 2085several functions, @option{-Wformat} also implies @option{-Wnonnull}. 2086 2087@option{-Wformat} is included in @option{-Wall}. For more control over some 2088aspects of format checking, the options @option{-Wformat-y2k}, 2089@option{-Wno-format-extra-args}, @option{-Wno-format-zero-length}, 2090@option{-Wformat-nonliteral}, @option{-Wformat-security}, and 2091@option{-Wformat=2} are available, but are not included in @option{-Wall}. 2092 2093@item -Wformat-y2k 2094@opindex Wformat-y2k 2095If @option{-Wformat} is specified, also warn about @code{strftime} 2096formats which may yield only a two-digit year. 2097 2098@item -Wno-format-extra-args 2099@opindex Wno-format-extra-args 2100If @option{-Wformat} is specified, do not warn about excess arguments to a 2101@code{printf} or @code{scanf} format function. The C standard specifies 2102that such arguments are ignored. 2103 2104Where the unused arguments lie between used arguments that are 2105specified with @samp{$} operand number specifications, normally 2106warnings are still given, since the implementation could not know what 2107type to pass to @code{va_arg} to skip the unused arguments. However, 2108in the case of @code{scanf} formats, this option will suppress the 2109warning if the unused arguments are all pointers, since the Single 2110Unix Specification says that such unused arguments are allowed. 2111 2112@item -Wno-format-zero-length 2113@opindex Wno-format-zero-length 2114If @option{-Wformat} is specified, do not warn about zero-length formats. 2115The C standard specifies that zero-length formats are allowed. 2116 2117@item -Wformat-nonliteral 2118@opindex Wformat-nonliteral 2119If @option{-Wformat} is specified, also warn if the format string is not a 2120string literal and so cannot be checked, unless the format function 2121takes its format arguments as a @code{va_list}. 2122 2123@item -Wformat-security 2124@opindex Wformat-security 2125If @option{-Wformat} is specified, also warn about uses of format 2126functions that represent possible security problems. At present, this 2127warns about calls to @code{printf} and @code{scanf} functions where the 2128format string is not a string literal and there are no format arguments, 2129as in @code{printf (foo);}. This may be a security hole if the format 2130string came from untrusted input and contains @samp{%n}. (This is 2131currently a subset of what @option{-Wformat-nonliteral} warns about, but 2132in future warnings may be added to @option{-Wformat-security} that are not 2133included in @option{-Wformat-nonliteral}.) 2134 2135@item -Wformat=2 2136@opindex Wformat=2 2137Enable @option{-Wformat} plus format checks not included in 2138@option{-Wformat}. Currently equivalent to @samp{-Wformat 2139-Wformat-nonliteral -Wformat-security -Wformat-y2k}. 2140 2141@item -Wnonnull 2142@opindex Wnonnull 2143Warn about passing a null pointer for arguments marked as 2144requiring a non-null value by the @code{nonnull} function attribute. 2145 2146@option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It 2147can be disabled with the @option{-Wno-nonnull} option. 2148 2149@item -Winit-self @r{(C and C++ only)} 2150@opindex Winit-self 2151Warn about uninitialized variables which are initialized with themselves. 2152Note this option can only be used with the @option{-Wuninitialized} option, 2153which in turn only works with @option{-O1} and above. 2154 2155For example, GCC will warn about @code{i} being uninitialized in the 2156following snippet only when @option{-Winit-self} has been specified: 2157@smallexample 2158@group 2159int f() 2160@{ 2161 int i = i; 2162 return i; 2163@} 2164@end group 2165@end smallexample 2166 2167@item -Wimplicit-int 2168@opindex Wimplicit-int 2169Warn when a declaration does not specify a type. 2170This warning is enabled by @option{-Wall}. 2171 2172@item -Wimplicit-function-declaration 2173@itemx -Werror-implicit-function-declaration 2174@opindex Wimplicit-function-declaration 2175@opindex Werror-implicit-function-declaration 2176Give a warning (or error) whenever a function is used before being 2177declared. The form @option{-Wno-error-implicit-function-declaration} 2178is not supported. 2179This warning is enabled by @option{-Wall} (as a warning, not an error). 2180 2181@item -Wimplicit 2182@opindex Wimplicit 2183Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}. 2184This warning is enabled by @option{-Wall}. 2185 2186@item -Wmain 2187@opindex Wmain 2188Warn if the type of @samp{main} is suspicious. @samp{main} should be a 2189function with external linkage, returning int, taking either zero 2190arguments, two, or three arguments of appropriate types. 2191This warning is enabled by @option{-Wall}. 2192 2193@item -Wmissing-braces 2194@opindex Wmissing-braces 2195Warn if an aggregate or union initializer is not fully bracketed. In 2196the following example, the initializer for @samp{a} is not fully 2197bracketed, but that for @samp{b} is fully bracketed. 2198 2199@smallexample 2200int a[2][2] = @{ 0, 1, 2, 3 @}; 2201int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @}; 2202@end smallexample 2203 2204This warning is enabled by @option{-Wall}. 2205 2206@item -Wmissing-include-dirs @r{(C and C++ only)} 2207@opindex Wmissing-include-dirs 2208Warn if a user-supplied include directory does not exist. 2209 2210@item -Wparentheses 2211@opindex Wparentheses 2212Warn if parentheses are omitted in certain contexts, such 2213as when there is an assignment in a context where a truth value 2214is expected, or when operators are nested whose precedence people 2215often get confused about. Only the warning for an assignment used as 2216a truth value is supported when compiling C++; the other warnings are 2217only supported when compiling C@. 2218 2219Also warn if a comparison like @samp{x<=y<=z} appears; this is 2220equivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different 2221interpretation from that of ordinary mathematical notation. 2222 2223Also warn about constructions where there may be confusion to which 2224@code{if} statement an @code{else} branch belongs. Here is an example of 2225such a case: 2226 2227@smallexample 2228@group 2229@{ 2230 if (a) 2231 if (b) 2232 foo (); 2233 else 2234 bar (); 2235@} 2236@end group 2237@end smallexample 2238 2239In C, every @code{else} branch belongs to the innermost possible @code{if} 2240statement, which in this example is @code{if (b)}. This is often not 2241what the programmer expected, as illustrated in the above example by 2242indentation the programmer chose. When there is the potential for this 2243confusion, GCC will issue a warning when this flag is specified. 2244To eliminate the warning, add explicit braces around the innermost 2245@code{if} statement so there is no way the @code{else} could belong to 2246the enclosing @code{if}. The resulting code would look like this: 2247 2248@smallexample 2249@group 2250@{ 2251 if (a) 2252 @{ 2253 if (b) 2254 foo (); 2255 else 2256 bar (); 2257 @} 2258@} 2259@end group 2260@end smallexample 2261 2262This warning is enabled by @option{-Wall}. 2263 2264@item -Wsequence-point 2265@opindex Wsequence-point 2266Warn about code that may have undefined semantics because of violations 2267of sequence point rules in the C and C++ standards. 2268 2269The C and C++ standards defines the order in which expressions in a C/C++ 2270program are evaluated in terms of @dfn{sequence points}, which represent 2271a partial ordering between the execution of parts of the program: those 2272executed before the sequence point, and those executed after it. These 2273occur after the evaluation of a full expression (one which is not part 2274of a larger expression), after the evaluation of the first operand of a 2275@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a 2276function is called (but after the evaluation of its arguments and the 2277expression denoting the called function), and in certain other places. 2278Other than as expressed by the sequence point rules, the order of 2279evaluation of subexpressions of an expression is not specified. All 2280these rules describe only a partial order rather than a total order, 2281since, for example, if two functions are called within one expression 2282with no sequence point between them, the order in which the functions 2283are called is not specified. However, the standards committee have 2284ruled that function calls do not overlap. 2285 2286It is not specified when between sequence points modifications to the 2287values of objects take effect. Programs whose behavior depends on this 2288have undefined behavior; the C and C++ standards specify that ``Between 2289the previous and next sequence point an object shall have its stored 2290value modified at most once by the evaluation of an expression. 2291Furthermore, the prior value shall be read only to determine the value 2292to be stored.''. If a program breaks these rules, the results on any 2293particular implementation are entirely unpredictable. 2294 2295Examples of code with undefined behavior are @code{a = a++;}, @code{a[n] 2296= b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not 2297diagnosed by this option, and it may give an occasional false positive 2298result, but in general it has been found fairly effective at detecting 2299this sort of problem in programs. 2300 2301The standard is worded confusingly, therefore there is some debate 2302over the precise meaning of the sequence point rules in subtle cases. 2303Links to discussions of the problem, including proposed formal 2304definitions, may be found on the GCC readings page, at 2305@w{@uref{http://gcc.gnu.org/readings.html}}. 2306 2307This warning is enabled by @option{-Wall} for C and C++. 2308 2309@item -Wreturn-type 2310@opindex Wreturn-type 2311Warn whenever a function is defined with a return-type that defaults to 2312@code{int}. Also warn about any @code{return} statement with no 2313return-value in a function whose return-type is not @code{void}. 2314 2315For C, also warn if the return type of a function has a type qualifier 2316such as @code{const}. Such a type qualifier has no effect, since the 2317value returned by a function is not an lvalue. ISO C prohibits 2318qualified @code{void} return types on function definitions, so such 2319return types always receive a warning even without this option. 2320 2321For C++, a function without return type always produces a diagnostic 2322message, even when @option{-Wno-return-type} is specified. The only 2323exceptions are @samp{main} and functions defined in system headers. 2324 2325This warning is enabled by @option{-Wall}. 2326 2327@item -Wswitch 2328@opindex Wswitch 2329Warn whenever a @code{switch} statement has an index of enumerated type 2330and lacks a @code{case} for one or more of the named codes of that 2331enumeration. (The presence of a @code{default} label prevents this 2332warning.) @code{case} labels outside the enumeration range also 2333provoke warnings when this option is used. 2334This warning is enabled by @option{-Wall}. 2335 2336@item -Wswitch-default 2337@opindex Wswitch-switch 2338Warn whenever a @code{switch} statement does not have a @code{default} 2339case. 2340 2341@item -Wswitch-enum 2342@opindex Wswitch-enum 2343Warn whenever a @code{switch} statement has an index of enumerated type 2344and lacks a @code{case} for one or more of the named codes of that 2345enumeration. @code{case} labels outside the enumeration range also 2346provoke warnings when this option is used. 2347 2348@item -Wtrigraphs 2349@opindex Wtrigraphs 2350Warn if any trigraphs are encountered that might change the meaning of 2351the program (trigraphs within comments are not warned about). 2352This warning is enabled by @option{-Wall}. 2353 2354@item -Wunused-function 2355@opindex Wunused-function 2356Warn whenever a static function is declared but not defined or a 2357non-inline static function is unused. 2358This warning is enabled by @option{-Wall}. 2359 2360@item -Wunused-label 2361@opindex Wunused-label 2362Warn whenever a label is declared but not used. 2363This warning is enabled by @option{-Wall}. 2364 2365To suppress this warning use the @samp{unused} attribute 2366(@pxref{Variable Attributes}). 2367 2368@item -Wunused-parameter 2369@opindex Wunused-parameter 2370Warn whenever a function parameter is unused aside from its declaration. 2371 2372To suppress this warning use the @samp{unused} attribute 2373(@pxref{Variable Attributes}). 2374 2375@item -Wunused-variable 2376@opindex Wunused-variable 2377Warn whenever a local variable or non-constant static variable is unused 2378aside from its declaration. 2379This warning is enabled by @option{-Wall}. 2380 2381To suppress this warning use the @samp{unused} attribute 2382(@pxref{Variable Attributes}). 2383 2384@item -Wunused-value 2385@opindex Wunused-value 2386Warn whenever a statement computes a result that is explicitly not used. 2387This warning is enabled by @option{-Wall}. 2388 2389To suppress this warning cast the expression to @samp{void}. 2390 2391@item -Wunused 2392@opindex Wunused 2393All the above @option{-Wunused} options combined. 2394 2395In order to get a warning about an unused function parameter, you must 2396either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies 2397@samp{-Wunused}), or separately specify @option{-Wunused-parameter}. 2398 2399@item -Wuninitialized 2400@opindex Wuninitialized 2401Warn if an automatic variable is used without first being initialized or 2402if a variable may be clobbered by a @code{setjmp} call. 2403 2404These warnings are possible only in optimizing compilation, 2405because they require data flow information that is computed only 2406when optimizing. If you do not specify @option{-O}, you will not get 2407these warnings. Instead, GCC will issue a warning about @option{-Wuninitialized} 2408requiring @option{-O}. 2409 2410If you want to warn about code which uses the uninitialized value of the 2411variable in its own initializer, use the @option{-Winit-self} option. 2412 2413These warnings occur for individual uninitialized or clobbered 2414elements of structure, union or array variables as well as for 2415variables which are uninitialized or clobbered as a whole. They do 2416not occur for variables or elements declared @code{volatile}. Because 2417these warnings depend on optimization, the exact variables or elements 2418for which there are warnings will depend on the precise optimization 2419options and version of GCC used. 2420 2421Note that there may be no warning about a variable that is used only 2422to compute a value that itself is never used, because such 2423computations may be deleted by data flow analysis before the warnings 2424are printed. 2425 2426These warnings are made optional because GCC is not smart 2427enough to see all the reasons why the code might be correct 2428despite appearing to have an error. Here is one example of how 2429this can happen: 2430 2431@smallexample 2432@group 2433@{ 2434 int x; 2435 switch (y) 2436 @{ 2437 case 1: x = 1; 2438 break; 2439 case 2: x = 4; 2440 break; 2441 case 3: x = 5; 2442 @} 2443 foo (x); 2444@} 2445@end group 2446@end smallexample 2447 2448@noindent 2449If the value of @code{y} is always 1, 2 or 3, then @code{x} is 2450always initialized, but GCC doesn't know this. Here is 2451another common case: 2452 2453@smallexample 2454@{ 2455 int save_y; 2456 if (change_y) save_y = y, y = new_y; 2457 @dots{} 2458 if (change_y) y = save_y; 2459@} 2460@end smallexample 2461 2462@noindent 2463This has no bug because @code{save_y} is used only if it is set. 2464 2465@cindex @code{longjmp} warnings 2466This option also warns when a non-volatile automatic variable might be 2467changed by a call to @code{longjmp}. These warnings as well are possible 2468only in optimizing compilation. 2469 2470The compiler sees only the calls to @code{setjmp}. It cannot know 2471where @code{longjmp} will be called; in fact, a signal handler could 2472call it at any point in the code. As a result, you may get a warning 2473even when there is in fact no problem because @code{longjmp} cannot 2474in fact be called at the place which would cause a problem. 2475 2476Some spurious warnings can be avoided if you declare all the functions 2477you use that never return as @code{noreturn}. @xref{Function 2478Attributes}. 2479 2480This warning is enabled by @option{-Wall}. 2481 2482@item -Wunknown-pragmas 2483@opindex Wunknown-pragmas 2484@cindex warning for unknown pragmas 2485@cindex unknown pragmas, warning 2486@cindex pragmas, warning of unknown 2487Warn when a #pragma directive is encountered which is not understood by 2488GCC@. If this command line option is used, warnings will even be issued 2489for unknown pragmas in system header files. This is not the case if 2490the warnings were only enabled by the @option{-Wall} command line option. 2491 2492@item -Wno-pragmas 2493@opindex Wno-pragmas 2494@opindex Wpragmas 2495Do not warn about misuses of pragmas, such as incorrect parameters, 2496invalid syntax, or conflicts between pragmas. See also 2497@samp{-Wunknown-pragmas}. 2498 2499@item -Wstrict-aliasing 2500@opindex Wstrict-aliasing 2501This option is only active when @option{-fstrict-aliasing} is active. 2502It warns about code which might break the strict aliasing rules that the 2503compiler is using for optimization. The warning does not catch all 2504cases, but does attempt to catch the more common pitfalls. It is 2505included in @option{-Wall}. 2506 2507@item -Wstrict-aliasing=2 2508@opindex Wstrict-aliasing=2 2509This option is only active when @option{-fstrict-aliasing} is active. 2510It warns about code which might break the strict aliasing rules that the 2511compiler is using for optimization. This warning catches more cases than 2512@option{-Wstrict-aliasing}, but it will also give a warning for some ambiguous 2513cases that are safe. 2514 2515@item -Wstrict-overflow 2516@item -Wstrict-overflow=@var{n} 2517@opindex Wstrict-overflow 2518This option is only active when @option{-fstrict-overflow} is active. 2519It warns about cases where the compiler optimizes based on the 2520assumption that signed overflow does not occur. Note that it does not 2521warn about all cases where the code might overflow: it only warns 2522about cases where the compiler implements some optimization. Thus 2523this warning depends on the optimization level. 2524 2525An optimization which assumes that signed overflow does not occur is 2526perfectly safe if the values of the variables involved are such that 2527overflow never does, in fact, occur. Therefore this warning can 2528easily give a false positive: a warning about code which is not 2529actually a problem. To help focus on important issues, several 2530warning levels are defined. No warnings are issued for the use of 2531undefined signed overflow when estimating how many iterations a loop 2532will require, in particular when determining whether a loop will be 2533executed at all. 2534 2535@table @option 2536@item -Wstrict-overflow=1 2537Warn about cases which are both questionable and easy to avoid. For 2538example: @code{x + 1 > x}; with @option{-fstrict-overflow}, the 2539compiler will simplify this to @code{1}. This level of 2540@option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels 2541are not, and must be explicitly requested. 2542 2543@item -Wstrict-overflow=2 2544Also warn about other cases where a comparison is simplified to a 2545constant. For example: @code{abs (x) >= 0}. This can only be 2546simplified when @option{-fstrict-overflow} is in effect, because 2547@code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than 2548zero. @option{-Wstrict-overflow} (with no level) is the same as 2549@option{-Wstrict-overflow=2}. 2550 2551@item -Wstrict-overflow=3 2552Also warn about other cases where a comparison is simplified. For 2553example: @code{x + 1 > 1} will be simplified to @code{x > 0}. 2554 2555@item -Wstrict-overflow=4 2556Also warn about other simplifications not covered by the above cases. 2557For example: @code{(x * 10) / 5} will be simplified to @code{x * 2}. 2558 2559@item -Wstrict-overflow=5 2560Also warn about cases where the compiler reduces the magnitude of a 2561constant involved in a comparison. For example: @code{x + 2 > y} will 2562be simplified to @code{x + 1 >= y}. This is reported only at the 2563highest warning level because this simplification applies to many 2564comparisons, so this warning level will give a very large number of 2565false positives. 2566@end table 2567 2568@item -Wall 2569@opindex Wall 2570All of the above @samp{-W} options combined. This enables all the 2571warnings about constructions that some users consider questionable, and 2572that are easy to avoid (or modify to prevent the warning), even in 2573conjunction with macros. This also enables some language-specific 2574warnings described in @ref{C++ Dialect Options}. 2575@end table 2576 2577The following @option{-W@dots{}} options are not implied by @option{-Wall}. 2578Some of them warn about constructions that users generally do not 2579consider questionable, but which occasionally you might wish to check 2580for; others warn about constructions that are necessary or hard to avoid 2581in some cases, and there is no simple way to modify the code to suppress 2582the warning. 2583 2584@table @gcctabopt 2585@item -Wextra 2586@opindex W 2587@opindex Wextra 2588(This option used to be called @option{-W}. The older name is still 2589supported, but the newer name is more descriptive.) Print extra warning 2590messages for these events: 2591 2592@itemize @bullet 2593@item 2594A function can return either with or without a value. (Falling 2595off the end of the function body is considered returning without 2596a value.) For example, this function would evoke such a 2597warning: 2598 2599@smallexample 2600@group 2601foo (a) 2602@{ 2603 if (a > 0) 2604 return a; 2605@} 2606@end group 2607@end smallexample 2608 2609@item 2610An expression-statement or the left-hand side of a comma expression 2611contains no side effects. 2612To suppress the warning, cast the unused expression to void. 2613For example, an expression such as @samp{x[i,j]} will cause a warning, 2614but @samp{x[(void)i,j]} will not. 2615 2616@item 2617An unsigned value is compared against zero with @samp{<} or @samp{>=}. 2618 2619@item 2620Storage-class specifiers like @code{static} are not the first things in 2621a declaration. According to the C Standard, this usage is obsolescent. 2622 2623@item 2624If @option{-Wall} or @option{-Wunused} is also specified, warn about unused 2625arguments. 2626 2627@item 2628A comparison between signed and unsigned values could produce an 2629incorrect result when the signed value is converted to unsigned. 2630(But don't warn if @option{-Wno-sign-compare} is also specified.) 2631 2632@item 2633An aggregate has an initializer which does not initialize all members. 2634This warning can be independently controlled by 2635@option{-Wmissing-field-initializers}. 2636 2637@item 2638An initialized field without side effects is overridden when using 2639designated initializers (@pxref{Designated Inits, , Designated 2640Initializers}). This warning can be independently controlled by 2641@option{-Woverride-init}. 2642 2643@item 2644A function parameter is declared without a type specifier in K&R-style 2645functions: 2646 2647@smallexample 2648void foo(bar) @{ @} 2649@end smallexample 2650 2651@item 2652An empty body occurs in an @samp{if} or @samp{else} statement. 2653 2654@item 2655A pointer is compared against integer zero with @samp{<}, @samp{<=}, 2656@samp{>}, or @samp{>=}. 2657 2658@item 2659A variable might be changed by @samp{longjmp} or @samp{vfork}. 2660 2661@item @r{(C++ only)} 2662An enumerator and a non-enumerator both appear in a conditional expression. 2663 2664@item @r{(C++ only)} 2665A non-static reference or non-static @samp{const} member appears in a 2666class without constructors. 2667 2668@item @r{(C++ only)} 2669Ambiguous virtual bases. 2670 2671@item @r{(C++ only)} 2672Subscripting an array which has been declared @samp{register}. 2673 2674@item @r{(C++ only)} 2675Taking the address of a variable which has been declared @samp{register}. 2676 2677@item @r{(C++ only)} 2678A base class is not initialized in a derived class' copy constructor. 2679@end itemize 2680 2681@item -Wno-div-by-zero 2682@opindex Wno-div-by-zero 2683@opindex Wdiv-by-zero 2684Do not warn about compile-time integer division by zero. Floating point 2685division by zero is not warned about, as it can be a legitimate way of 2686obtaining infinities and NaNs. 2687 2688@item -Wsystem-headers 2689@opindex Wsystem-headers 2690@cindex warnings from system headers 2691@cindex system headers, warnings from 2692Print warning messages for constructs found in system header files. 2693Warnings from system headers are normally suppressed, on the assumption 2694that they usually do not indicate real problems and would only make the 2695compiler output harder to read. Using this command line option tells 2696GCC to emit warnings from system headers as if they occurred in user 2697code. However, note that using @option{-Wall} in conjunction with this 2698option will @emph{not} warn about unknown pragmas in system 2699headers---for that, @option{-Wunknown-pragmas} must also be used. 2700 2701@item -Wfloat-equal 2702@opindex Wfloat-equal 2703Warn if floating point values are used in equality comparisons. 2704 2705The idea behind this is that sometimes it is convenient (for the 2706programmer) to consider floating-point values as approximations to 2707infinitely precise real numbers. If you are doing this, then you need 2708to compute (by analyzing the code, or in some other way) the maximum or 2709likely maximum error that the computation introduces, and allow for it 2710when performing comparisons (and when producing output, but that's a 2711different problem). In particular, instead of testing for equality, you 2712would check to see whether the two values have ranges that overlap; and 2713this is done with the relational operators, so equality comparisons are 2714probably mistaken. 2715 2716@item -Wtraditional @r{(C only)} 2717@opindex Wtraditional 2718Warn about certain constructs that behave differently in traditional and 2719ISO C@. Also warn about ISO C constructs that have no traditional C 2720equivalent, and/or problematic constructs which should be avoided. 2721 2722@itemize @bullet 2723@item 2724Macro parameters that appear within string literals in the macro body. 2725In traditional C macro replacement takes place within string literals, 2726but does not in ISO C@. 2727 2728@item 2729In traditional C, some preprocessor directives did not exist. 2730Traditional preprocessors would only consider a line to be a directive 2731if the @samp{#} appeared in column 1 on the line. Therefore 2732@option{-Wtraditional} warns about directives that traditional C 2733understands but would ignore because the @samp{#} does not appear as the 2734first character on the line. It also suggests you hide directives like 2735@samp{#pragma} not understood by traditional C by indenting them. Some 2736traditional implementations would not recognize @samp{#elif}, so it 2737suggests avoiding it altogether. 2738 2739@item 2740A function-like macro that appears without arguments. 2741 2742@item 2743The unary plus operator. 2744 2745@item 2746The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point 2747constant suffixes. (Traditional C does support the @samp{L} suffix on integer 2748constants.) Note, these suffixes appear in macros defined in the system 2749headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}. 2750Use of these macros in user code might normally lead to spurious 2751warnings, however GCC's integrated preprocessor has enough context to 2752avoid warning in these cases. 2753 2754@item 2755A function declared external in one block and then used after the end of 2756the block. 2757 2758@item 2759A @code{switch} statement has an operand of type @code{long}. 2760 2761@item 2762A non-@code{static} function declaration follows a @code{static} one. 2763This construct is not accepted by some traditional C compilers. 2764 2765@item 2766The ISO type of an integer constant has a different width or 2767signedness from its traditional type. This warning is only issued if 2768the base of the constant is ten. I.e.@: hexadecimal or octal values, which 2769typically represent bit patterns, are not warned about. 2770 2771@item 2772Usage of ISO string concatenation is detected. 2773 2774@item 2775Initialization of automatic aggregates. 2776 2777@item 2778Identifier conflicts with labels. Traditional C lacks a separate 2779namespace for labels. 2780 2781@item 2782Initialization of unions. If the initializer is zero, the warning is 2783omitted. This is done under the assumption that the zero initializer in 2784user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing 2785initializer warnings and relies on default initialization to zero in the 2786traditional C case. 2787 2788@item 2789Conversions by prototypes between fixed/floating point values and vice 2790versa. The absence of these prototypes when compiling with traditional 2791C would cause serious problems. This is a subset of the possible 2792conversion warnings, for the full set use @option{-Wconversion}. 2793 2794@item 2795Use of ISO C style function definitions. This warning intentionally is 2796@emph{not} issued for prototype declarations or variadic functions 2797because these ISO C features will appear in your code when using 2798libiberty's traditional C compatibility macros, @code{PARAMS} and 2799@code{VPARAMS}. This warning is also bypassed for nested functions 2800because that feature is already a GCC extension and thus not relevant to 2801traditional C compatibility. 2802@end itemize 2803 2804@item -Wdeclaration-after-statement @r{(C only)} 2805@opindex Wdeclaration-after-statement 2806Warn when a declaration is found after a statement in a block. This 2807construct, known from C++, was introduced with ISO C99 and is by default 2808allowed in GCC@. It is not supported by ISO C90 and was not supported by 2809GCC versions before GCC 3.0. @xref{Mixed Declarations}. 2810 2811@item -Wundef 2812@opindex Wundef 2813Warn if an undefined identifier is evaluated in an @samp{#if} directive. 2814 2815@item -Wno-endif-labels 2816@opindex Wno-endif-labels 2817@opindex Wendif-labels 2818Do not warn whenever an @samp{#else} or an @samp{#endif} are followed by text. 2819 2820@item -Wshadow 2821@opindex Wshadow 2822Warn whenever a local variable shadows another local variable, parameter or 2823global variable or whenever a built-in function is shadowed. 2824 2825@item -Wlarger-than-@var{len} 2826@opindex Wlarger-than 2827Warn whenever an object of larger than @var{len} bytes is defined. 2828 2829@item -Wunsafe-loop-optimizations 2830@opindex Wunsafe-loop-optimizations 2831Warn if the loop cannot be optimized because the compiler could not 2832assume anything on the bounds of the loop indices. With 2833@option{-funsafe-loop-optimizations} warn if the compiler made 2834such assumptions. 2835 2836@item -Wpointer-arith 2837@opindex Wpointer-arith 2838Warn about anything that depends on the ``size of'' a function type or 2839of @code{void}. GNU C assigns these types a size of 1, for 2840convenience in calculations with @code{void *} pointers and pointers 2841to functions. 2842 2843@item -Wbad-function-cast @r{(C only)} 2844@opindex Wbad-function-cast 2845Warn whenever a function call is cast to a non-matching type. 2846For example, warn if @code{int malloc()} is cast to @code{anything *}. 2847 2848@item -Wc++-compat 2849Warn about ISO C constructs that are outside of the common subset of 2850ISO C and ISO C++, e.g.@: request for implicit conversion from 2851@code{void *} to a pointer to non-@code{void} type. 2852 2853@item -Wcast-qual 2854@opindex Wcast-qual 2855Warn whenever a pointer is cast so as to remove a type qualifier from 2856the target type. For example, warn if a @code{const char *} is cast 2857to an ordinary @code{char *}. 2858 2859@item -Wcast-align 2860@opindex Wcast-align 2861Warn whenever a pointer is cast such that the required alignment of the 2862target is increased. For example, warn if a @code{char *} is cast to 2863an @code{int *} on machines where integers can only be accessed at 2864two- or four-byte boundaries. 2865 2866@item -Wwrite-strings 2867@opindex Wwrite-strings 2868When compiling C, give string constants the type @code{const 2869char[@var{length}]} so that 2870copying the address of one into a non-@code{const} @code{char *} 2871pointer will get a warning; when compiling C++, warn about the 2872deprecated conversion from string literals to @code{char *}. This 2873warning, by default, is enabled for C++ programs. 2874These warnings will help you find at 2875compile time code that can try to write into a string constant, but 2876only if you have been very careful about using @code{const} in 2877declarations and prototypes. Otherwise, it will just be a nuisance; 2878this is why we did not make @option{-Wall} request these warnings. 2879 2880@item -Wconversion 2881@opindex Wconversion 2882Warn if a prototype causes a type conversion that is different from what 2883would happen to the same argument in the absence of a prototype. This 2884includes conversions of fixed point to floating and vice versa, and 2885conversions changing the width or signedness of a fixed point argument 2886except when the same as the default promotion. 2887 2888Also, warn if a negative integer constant expression is implicitly 2889converted to an unsigned type. For example, warn about the assignment 2890@code{x = -1} if @code{x} is unsigned. But do not warn about explicit 2891casts like @code{(unsigned) -1}. 2892 2893@item -Wsign-compare 2894@opindex Wsign-compare 2895@cindex warning for comparison of signed and unsigned values 2896@cindex comparison of signed and unsigned values, warning 2897@cindex signed and unsigned values, comparison warning 2898Warn when a comparison between signed and unsigned values could produce 2899an incorrect result when the signed value is converted to unsigned. 2900This warning is also enabled by @option{-Wextra}; to get the other warnings 2901of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}. 2902 2903@item -Waddress 2904@opindex Waddress 2905@opindex Wno-address 2906Warn about suspicious uses of memory addresses. These include using 2907the address of a function in a conditional expression, such as 2908@code{void func(void); if (func)}, and comparisons against the memory 2909address of a string literal, such as @code{if (x == "abc")}. Such 2910uses typically indicate a programmer error: the address of a function 2911always evaluates to true, so their use in a conditional usually 2912indicate that the programmer forgot the parentheses in a function 2913call; and comparisons against string literals result in unspecified 2914behavior and are not portable in C, so they usually indicate that the 2915programmer intended to use @code{strcmp}. This warning is enabled by 2916@option{-Wall}. 2917 2918@item -Waggregate-return 2919@opindex Waggregate-return 2920Warn if any functions that return structures or unions are defined or 2921called. (In languages where you can return an array, this also elicits 2922a warning.) 2923 2924@item -Wno-attributes 2925@opindex Wno-attributes 2926@opindex Wattributes 2927Do not warn if an unexpected @code{__attribute__} is used, such as 2928unrecognized attributes, function attributes applied to variables, 2929etc. This will not stop errors for incorrect use of supported 2930attributes. 2931 2932@item -Wstrict-prototypes @r{(C only)} 2933@opindex Wstrict-prototypes 2934Warn if a function is declared or defined without specifying the 2935argument types. (An old-style function definition is permitted without 2936a warning if preceded by a declaration which specifies the argument 2937types.) 2938 2939@item -Wold-style-definition @r{(C only)} 2940@opindex Wold-style-definition 2941Warn if an old-style function definition is used. A warning is given 2942even if there is a previous prototype. 2943 2944@item -Wmissing-prototypes @r{(C only)} 2945@opindex Wmissing-prototypes 2946Warn if a global function is defined without a previous prototype 2947declaration. This warning is issued even if the definition itself 2948provides a prototype. The aim is to detect global functions that fail 2949to be declared in header files. 2950 2951@item -Wmissing-declarations @r{(C only)} 2952@opindex Wmissing-declarations 2953Warn if a global function is defined without a previous declaration. 2954Do so even if the definition itself provides a prototype. 2955Use this option to detect global functions that are not declared in 2956header files. 2957 2958@item -Wmissing-field-initializers 2959@opindex Wmissing-field-initializers 2960@opindex W 2961@opindex Wextra 2962Warn if a structure's initializer has some fields missing. For 2963example, the following code would cause such a warning, because 2964@code{x.h} is implicitly zero: 2965 2966@smallexample 2967struct s @{ int f, g, h; @}; 2968struct s x = @{ 3, 4 @}; 2969@end smallexample 2970 2971This option does not warn about designated initializers, so the following 2972modification would not trigger a warning: 2973 2974@smallexample 2975struct s @{ int f, g, h; @}; 2976struct s x = @{ .f = 3, .g = 4 @}; 2977@end smallexample 2978 2979This warning is included in @option{-Wextra}. To get other @option{-Wextra} 2980warnings without this one, use @samp{-Wextra -Wno-missing-field-initializers}. 2981 2982@item -Wmissing-noreturn 2983@opindex Wmissing-noreturn 2984Warn about functions which might be candidates for attribute @code{noreturn}. 2985Note these are only possible candidates, not absolute ones. Care should 2986be taken to manually verify functions actually do not ever return before 2987adding the @code{noreturn} attribute, otherwise subtle code generation 2988bugs could be introduced. You will not get a warning for @code{main} in 2989hosted C environments. 2990 2991@item -Wmissing-format-attribute 2992@opindex Wmissing-format-attribute 2993@opindex Wformat 2994Warn about function pointers which might be candidates for @code{format} 2995attributes. Note these are only possible candidates, not absolute ones. 2996GCC will guess that function pointers with @code{format} attributes that 2997are used in assignment, initialization, parameter passing or return 2998statements should have a corresponding @code{format} attribute in the 2999resulting type. I.e.@: the left-hand side of the assignment or 3000initialization, the type of the parameter variable, or the return type 3001of the containing function respectively should also have a @code{format} 3002attribute to avoid the warning. 3003 3004GCC will also warn about function definitions which might be 3005candidates for @code{format} attributes. Again, these are only 3006possible candidates. GCC will guess that @code{format} attributes 3007might be appropriate for any function that calls a function like 3008@code{vprintf} or @code{vscanf}, but this might not always be the 3009case, and some functions for which @code{format} attributes are 3010appropriate may not be detected. 3011 3012@item -Wno-multichar 3013@opindex Wno-multichar 3014@opindex Wmultichar 3015Do not warn if a multicharacter constant (@samp{'FOOF'}) is used. 3016Usually they indicate a typo in the user's code, as they have 3017implementation-defined values, and should not be used in portable code. 3018 3019@item -Wnormalized=<none|id|nfc|nfkc> 3020@opindex Wnormalized 3021@cindex NFC 3022@cindex NFKC 3023@cindex character set, input normalization 3024In ISO C and ISO C++, two identifiers are different if they are 3025different sequences of characters. However, sometimes when characters 3026outside the basic ASCII character set are used, you can have two 3027different character sequences that look the same. To avoid confusion, 3028the ISO 10646 standard sets out some @dfn{normalization rules} which 3029when applied ensure that two sequences that look the same are turned into 3030the same sequence. GCC can warn you if you are using identifiers which 3031have not been normalized; this option controls that warning. 3032 3033There are four levels of warning that GCC supports. The default is 3034@option{-Wnormalized=nfc}, which warns about any identifier which is 3035not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the 3036recommended form for most uses. 3037 3038Unfortunately, there are some characters which ISO C and ISO C++ allow 3039in identifiers that when turned into NFC aren't allowable as 3040identifiers. That is, there's no way to use these symbols in portable 3041ISO C or C++ and have all your identifiers in NFC. 3042@option{-Wnormalized=id} suppresses the warning for these characters. 3043It is hoped that future versions of the standards involved will correct 3044this, which is why this option is not the default. 3045 3046You can switch the warning off for all characters by writing 3047@option{-Wnormalized=none}. You would only want to do this if you 3048were using some other normalization scheme (like ``D''), because 3049otherwise you can easily create bugs that are literally impossible to see. 3050 3051Some characters in ISO 10646 have distinct meanings but look identical 3052in some fonts or display methodologies, especially once formatting has 3053been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL 3054LETTER N'', will display just like a regular @code{n} which has been 3055placed in a superscript. ISO 10646 defines the @dfn{NFKC} 3056normalization scheme to convert all these into a standard form as 3057well, and GCC will warn if your code is not in NFKC if you use 3058@option{-Wnormalized=nfkc}. This warning is comparable to warning 3059about every identifier that contains the letter O because it might be 3060confused with the digit 0, and so is not the default, but may be 3061useful as a local coding convention if the programming environment is 3062unable to be fixed to display these characters distinctly. 3063 3064@item -Wno-deprecated-declarations 3065@opindex Wno-deprecated-declarations 3066Do not warn about uses of functions (@pxref{Function Attributes}), 3067variables (@pxref{Variable Attributes}), and types (@pxref{Type 3068Attributes}) marked as deprecated by using the @code{deprecated} 3069attribute. 3070 3071@item -Wno-overflow 3072@opindex Wno-overflow 3073Do not warn about compile-time overflow in constant expressions. 3074 3075@item -Woverride-init 3076@opindex Woverride-init 3077@opindex W 3078@opindex Wextra 3079Warn if an initialized field without side effects is overridden when 3080using designated initializers (@pxref{Designated Inits, , Designated 3081Initializers}). 3082 3083This warning is included in @option{-Wextra}. To get other 3084@option{-Wextra} warnings without this one, use @samp{-Wextra 3085-Wno-override-init}. 3086 3087@item -Wpacked 3088@opindex Wpacked 3089Warn if a structure is given the packed attribute, but the packed 3090attribute has no effect on the layout or size of the structure. 3091Such structures may be mis-aligned for little benefit. For 3092instance, in this code, the variable @code{f.x} in @code{struct bar} 3093will be misaligned even though @code{struct bar} does not itself 3094have the packed attribute: 3095 3096@smallexample 3097@group 3098struct foo @{ 3099 int x; 3100 char a, b, c, d; 3101@} __attribute__((packed)); 3102struct bar @{ 3103 char z; 3104 struct foo f; 3105@}; 3106@end group 3107@end smallexample 3108 3109@item -Wpadded 3110@opindex Wpadded 3111Warn if padding is included in a structure, either to align an element 3112of the structure or to align the whole structure. Sometimes when this 3113happens it is possible to rearrange the fields of the structure to 3114reduce the padding and so make the structure smaller. 3115 3116@item -Wredundant-decls 3117@opindex Wredundant-decls 3118Warn if anything is declared more than once in the same scope, even in 3119cases where multiple declaration is valid and changes nothing. 3120 3121@item -Wnested-externs @r{(C only)} 3122@opindex Wnested-externs 3123Warn if an @code{extern} declaration is encountered within a function. 3124 3125@item -Wunreachable-code 3126@opindex Wunreachable-code 3127Warn if the compiler detects that code will never be executed. 3128 3129This option is intended to warn when the compiler detects that at 3130least a whole line of source code will never be executed, because 3131some condition is never satisfied or because it is after a 3132procedure that never returns. 3133 3134It is possible for this option to produce a warning even though there 3135are circumstances under which part of the affected line can be executed, 3136so care should be taken when removing apparently-unreachable code. 3137 3138For instance, when a function is inlined, a warning may mean that the 3139line is unreachable in only one inlined copy of the function. 3140 3141This option is not made part of @option{-Wall} because in a debugging 3142version of a program there is often substantial code which checks 3143correct functioning of the program and is, hopefully, unreachable 3144because the program does work. Another common use of unreachable 3145code is to provide behavior which is selectable at compile-time. 3146 3147@item -Winline 3148@opindex Winline 3149Warn if a function can not be inlined and it was declared as inline. 3150Even with this option, the compiler will not warn about failures to 3151inline functions declared in system headers. 3152 3153The compiler uses a variety of heuristics to determine whether or not 3154to inline a function. For example, the compiler takes into account 3155the size of the function being inlined and the amount of inlining 3156that has already been done in the current function. Therefore, 3157seemingly insignificant changes in the source program can cause the 3158warnings produced by @option{-Winline} to appear or disappear. 3159 3160@item -Wno-invalid-offsetof @r{(C++ only)} 3161@opindex Wno-invalid-offsetof 3162Suppress warnings from applying the @samp{offsetof} macro to a non-POD 3163type. According to the 1998 ISO C++ standard, applying @samp{offsetof} 3164to a non-POD type is undefined. In existing C++ implementations, 3165however, @samp{offsetof} typically gives meaningful results even when 3166applied to certain kinds of non-POD types. (Such as a simple 3167@samp{struct} that fails to be a POD type only by virtue of having a 3168constructor.) This flag is for users who are aware that they are 3169writing nonportable code and who have deliberately chosen to ignore the 3170warning about it. 3171 3172The restrictions on @samp{offsetof} may be relaxed in a future version 3173of the C++ standard. 3174 3175@item -Wno-int-to-pointer-cast @r{(C only)} 3176@opindex Wno-int-to-pointer-cast 3177Suppress warnings from casts to pointer type of an integer of a 3178different size. 3179 3180@item -Wno-pointer-to-int-cast @r{(C only)} 3181@opindex Wno-pointer-to-int-cast 3182Suppress warnings from casts from a pointer to an integer type of a 3183different size. 3184 3185@item -Winvalid-pch 3186@opindex Winvalid-pch 3187Warn if a precompiled header (@pxref{Precompiled Headers}) is found in 3188the search path but can't be used. 3189 3190@item -Wlong-long 3191@opindex Wlong-long 3192@opindex Wno-long-long 3193Warn if @samp{long long} type is used. This is default. To inhibit 3194the warning messages, use @option{-Wno-long-long}. Flags 3195@option{-Wlong-long} and @option{-Wno-long-long} are taken into account 3196only when @option{-pedantic} flag is used. 3197 3198@item -Wvariadic-macros 3199@opindex Wvariadic-macros 3200@opindex Wno-variadic-macros 3201Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU 3202alternate syntax when in pedantic ISO C99 mode. This is default. 3203To inhibit the warning messages, use @option{-Wno-variadic-macros}. 3204 3205@item -Wvolatile-register-var 3206@opindex Wvolatile-register-var 3207@opindex Wno-volatile-register-var 3208Warn if a register variable is declared volatile. The volatile 3209modifier does not inhibit all optimizations that may eliminate reads 3210and/or writes to register variables. 3211 3212@item -Wdisabled-optimization 3213@opindex Wdisabled-optimization 3214Warn if a requested optimization pass is disabled. This warning does 3215not generally indicate that there is anything wrong with your code; it 3216merely indicates that GCC's optimizers were unable to handle the code 3217effectively. Often, the problem is that your code is too big or too 3218complex; GCC will refuse to optimize programs when the optimization 3219itself is likely to take inordinate amounts of time. 3220 3221@item -Wpointer-sign 3222@opindex Wpointer-sign 3223@opindex Wno-pointer-sign 3224Warn for pointer argument passing or assignment with different signedness. 3225This option is only supported for C. It is implied by @option{-Wall} 3226and by @option{-pedantic}, which can be disabled with 3227@option{-Wno-pointer-sign}. 3228 3229@item -Werror 3230@opindex Werror 3231Make all warnings into errors. 3232 3233@item -Werror= 3234@opindex Werror= 3235Make the specified warning into an errors. The specifier for a 3236warning is appended, for example @option{-Werror=switch} turns the 3237warnings controlled by @option{-Wswitch} into errors. This switch 3238takes a negative form, to be used to negate @option{-Werror} for 3239specific warnings, for example @option{-Wno-error=switch} makes 3240@option{-Wswitch} warnings not be errors, even when @option{-Werror} 3241is in effect. You can use the @option{-fdiagnostics-show-option} 3242option to have each controllable warning amended with the option which 3243controls it, to determine what to use with this option. 3244 3245Note that specifying @option{-Werror=}@var{foo} automatically implies 3246@option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not 3247imply anything. 3248 3249@item -Wstack-protector 3250@opindex Wstack-protector 3251This option is only active when @option{-fstack-protector} is active. It 3252warns about functions that will not be protected against stack smashing. 3253 3254@item -Woverlength-strings 3255@opindex Woverlength-strings 3256Warn about string constants which are longer than the ``minimum 3257maximum'' length specified in the C standard. Modern compilers 3258generally allow string constants which are much longer than the 3259standard's minimum limit, but very portable programs should avoid 3260using longer strings. 3261 3262The limit applies @emph{after} string constant concatenation, and does 3263not count the trailing NUL@. In C89, the limit was 509 characters; in 3264C99, it was raised to 4095. C++98 does not specify a normative 3265minimum maximum, so we do not diagnose overlength strings in C++@. 3266 3267This option is implied by @option{-pedantic}, and can be disabled with 3268@option{-Wno-overlength-strings}. 3269@end table 3270 3271@node Debugging Options 3272@section Options for Debugging Your Program or GCC 3273@cindex options, debugging 3274@cindex debugging information options 3275 3276GCC has various special options that are used for debugging 3277either your program or GCC: 3278 3279@table @gcctabopt 3280@item -g 3281@opindex g 3282Produce debugging information in the operating system's native format 3283(stabs, COFF, XCOFF, or DWARF 2)@. GDB can work with this debugging 3284information. 3285 3286On most systems that use stabs format, @option{-g} enables use of extra 3287debugging information that only GDB can use; this extra information 3288makes debugging work better in GDB but will probably make other debuggers 3289crash or 3290refuse to read the program. If you want to control for certain whether 3291to generate the extra information, use @option{-gstabs+}, @option{-gstabs}, 3292@option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below). 3293 3294GCC allows you to use @option{-g} with 3295@option{-O}. The shortcuts taken by optimized code may occasionally 3296produce surprising results: some variables you declared may not exist 3297at all; flow of control may briefly move where you did not expect it; 3298some statements may not be executed because they compute constant 3299results or their values were already at hand; some statements may 3300execute in different places because they were moved out of loops. 3301 3302Nevertheless it proves possible to debug optimized output. This makes 3303it reasonable to use the optimizer for programs that might have bugs. 3304 3305The following options are useful when GCC is generated with the 3306capability for more than one debugging format. 3307 3308@item -ggdb 3309@opindex ggdb 3310Produce debugging information for use by GDB@. This means to use the 3311most expressive format available (DWARF 2, stabs, or the native format 3312if neither of those are supported), including GDB extensions if at all 3313possible. 3314 3315@item -gstabs 3316@opindex gstabs 3317Produce debugging information in stabs format (if that is supported), 3318without GDB extensions. This is the format used by DBX on most BSD 3319systems. On MIPS, Alpha and System V Release 4 systems this option 3320produces stabs debugging output which is not understood by DBX or SDB@. 3321On System V Release 4 systems this option requires the GNU assembler. 3322 3323@item -feliminate-unused-debug-symbols 3324@opindex feliminate-unused-debug-symbols 3325Produce debugging information in stabs format (if that is supported), 3326for only symbols that are actually used. 3327 3328@item -femit-class-debug-always 3329Instead of emitting debugging information for a C++ class in only one 3330object file, emit it in all object files using the class. This option 3331should be used only with debuggers that are unable to handle the way GCC 3332normally emits debugging information for classes because using this 3333option will increase the size of debugging information by as much as a 3334factor of two. 3335 3336@item -gstabs+ 3337@opindex gstabs+ 3338Produce debugging information in stabs format (if that is supported), 3339using GNU extensions understood only by the GNU debugger (GDB)@. The 3340use of these extensions is likely to make other debuggers crash or 3341refuse to read the program. 3342 3343@item -gcoff 3344@opindex gcoff 3345Produce debugging information in COFF format (if that is supported). 3346This is the format used by SDB on most System V systems prior to 3347System V Release 4. 3348 3349@item -gxcoff 3350@opindex gxcoff 3351Produce debugging information in XCOFF format (if that is supported). 3352This is the format used by the DBX debugger on IBM RS/6000 systems. 3353 3354@item -gxcoff+ 3355@opindex gxcoff+ 3356Produce debugging information in XCOFF format (if that is supported), 3357using GNU extensions understood only by the GNU debugger (GDB)@. The 3358use of these extensions is likely to make other debuggers crash or 3359refuse to read the program, and may cause assemblers other than the GNU 3360assembler (GAS) to fail with an error. 3361 3362@item -gdwarf-2 3363@opindex gdwarf-2 3364Produce debugging information in DWARF version 2 format (if that is 3365supported). This is the format used by DBX on IRIX 6. With this 3366option, GCC uses features of DWARF version 3 when they are useful; 3367version 3 is upward compatible with version 2, but may still cause 3368problems for older debuggers. 3369 3370@item -gvms 3371@opindex gvms 3372Produce debugging information in VMS debug format (if that is 3373supported). This is the format used by DEBUG on VMS systems. 3374 3375@item -g@var{level} 3376@itemx -ggdb@var{level} 3377@itemx -gstabs@var{level} 3378@itemx -gcoff@var{level} 3379@itemx -gxcoff@var{level} 3380@itemx -gvms@var{level} 3381Request debugging information and also use @var{level} to specify how 3382much information. The default level is 2. 3383 3384Level 1 produces minimal information, enough for making backtraces in 3385parts of the program that you don't plan to debug. This includes 3386descriptions of functions and external variables, but no information 3387about local variables and no line numbers. 3388 3389Level 3 includes extra information, such as all the macro definitions 3390present in the program. Some debuggers support macro expansion when 3391you use @option{-g3}. 3392 3393@option{-gdwarf-2} does not accept a concatenated debug level, because 3394GCC used to support an option @option{-gdwarf} that meant to generate 3395debug information in version 1 of the DWARF format (which is very 3396different from version 2), and it would have been too confusing. That 3397debug format is long obsolete, but the option cannot be changed now. 3398Instead use an additional @option{-g@var{level}} option to change the 3399debug level for DWARF2. 3400 3401@item -feliminate-dwarf2-dups 3402@opindex feliminate-dwarf2-dups 3403Compress DWARF2 debugging information by eliminating duplicated 3404information about each symbol. This option only makes sense when 3405generating DWARF2 debugging information with @option{-gdwarf-2}. 3406 3407@cindex @command{prof} 3408@item -p 3409@opindex p 3410Generate extra code to write profile information suitable for the 3411analysis program @command{prof}. You must use this option when compiling 3412the source files you want data about, and you must also use it when 3413linking. 3414 3415@cindex @command{gprof} 3416@item -pg 3417@opindex pg 3418Generate extra code to write profile information suitable for the 3419analysis program @command{gprof}. You must use this option when compiling 3420the source files you want data about, and you must also use it when 3421linking. 3422 3423@item -Q 3424@opindex Q 3425Makes the compiler print out each function name as it is compiled, and 3426print some statistics about each pass when it finishes. 3427 3428@item -ftime-report 3429@opindex ftime-report 3430Makes the compiler print some statistics about the time consumed by each 3431pass when it finishes. 3432 3433@item -fmem-report 3434@opindex fmem-report 3435Makes the compiler print some statistics about permanent memory 3436allocation when it finishes. 3437 3438@item -fprofile-arcs 3439@opindex fprofile-arcs 3440Add code so that program flow @dfn{arcs} are instrumented. During 3441execution the program records how many times each branch and call is 3442executed and how many times it is taken or returns. When the compiled 3443program exits it saves this data to a file called 3444@file{@var{auxname}.gcda} for each source file. The data may be used for 3445profile-directed optimizations (@option{-fbranch-probabilities}), or for 3446test coverage analysis (@option{-ftest-coverage}). Each object file's 3447@var{auxname} is generated from the name of the output file, if 3448explicitly specified and it is not the final executable, otherwise it is 3449the basename of the source file. In both cases any suffix is removed 3450(e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or 3451@file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}). 3452@xref{Cross-profiling}. 3453 3454@cindex @command{gcov} 3455@item --coverage 3456@opindex coverage 3457 3458This option is used to compile and link code instrumented for coverage 3459analysis. The option is a synonym for @option{-fprofile-arcs} 3460@option{-ftest-coverage} (when compiling) and @option{-lgcov} (when 3461linking). See the documentation for those options for more details. 3462 3463@itemize 3464 3465@item 3466Compile the source files with @option{-fprofile-arcs} plus optimization 3467and code generation options. For test coverage analysis, use the 3468additional @option{-ftest-coverage} option. You do not need to profile 3469every source file in a program. 3470 3471@item 3472Link your object files with @option{-lgcov} or @option{-fprofile-arcs} 3473(the latter implies the former). 3474 3475@item 3476Run the program on a representative workload to generate the arc profile 3477information. This may be repeated any number of times. You can run 3478concurrent instances of your program, and provided that the file system 3479supports locking, the data files will be correctly updated. Also 3480@code{fork} calls are detected and correctly handled (double counting 3481will not happen). 3482 3483@item 3484For profile-directed optimizations, compile the source files again with 3485the same optimization and code generation options plus 3486@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that 3487Control Optimization}). 3488 3489@item 3490For test coverage analysis, use @command{gcov} to produce human readable 3491information from the @file{.gcno} and @file{.gcda} files. Refer to the 3492@command{gcov} documentation for further information. 3493 3494@end itemize 3495 3496With @option{-fprofile-arcs}, for each function of your program GCC 3497creates a program flow graph, then finds a spanning tree for the graph. 3498Only arcs that are not on the spanning tree have to be instrumented: the 3499compiler adds code to count the number of times that these arcs are 3500executed. When an arc is the only exit or only entrance to a block, the 3501instrumentation code can be added to the block; otherwise, a new basic 3502block must be created to hold the instrumentation code. 3503 3504@need 2000 3505@item -ftest-coverage 3506@opindex ftest-coverage 3507Produce a notes file that the @command{gcov} code-coverage utility 3508(@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to 3509show program coverage. Each source file's note file is called 3510@file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option 3511above for a description of @var{auxname} and instructions on how to 3512generate test coverage data. Coverage data will match the source files 3513more closely, if you do not optimize. 3514 3515@item -d@var{letters} 3516@item -fdump-rtl-@var{pass} 3517@opindex d 3518Says to make debugging dumps during compilation at times specified by 3519@var{letters}. This is used for debugging the RTL-based passes of the 3520compiler. The file names for most of the dumps are made by appending a 3521pass number and a word to the @var{dumpname}. @var{dumpname} is generated 3522from the name of the output file, if explicitly specified and it is not 3523an executable, otherwise it is the basename of the source file. 3524 3525Most debug dumps can be enabled either passing a letter to the @option{-d} 3526option, or with a long @option{-fdump-rtl} switch; here are the possible 3527letters for use in @var{letters} and @var{pass}, and their meanings: 3528 3529@table @gcctabopt 3530@item -dA 3531@opindex dA 3532Annotate the assembler output with miscellaneous debugging information. 3533 3534@item -dB 3535@itemx -fdump-rtl-bbro 3536@opindex dB 3537@opindex fdump-rtl-bbro 3538Dump after block reordering, to @file{@var{file}.148r.bbro}. 3539 3540@item -dc 3541@itemx -fdump-rtl-combine 3542@opindex dc 3543@opindex fdump-rtl-combine 3544Dump after instruction combination, to the file @file{@var{file}.129r.combine}. 3545 3546@item -dC 3547@itemx -fdump-rtl-ce1 3548@itemx -fdump-rtl-ce2 3549@opindex dC 3550@opindex fdump-rtl-ce1 3551@opindex fdump-rtl-ce2 3552@option{-dC} and @option{-fdump-rtl-ce1} enable dumping after the 3553first if conversion, to the file @file{@var{file}.117r.ce1}. @option{-dC} 3554and @option{-fdump-rtl-ce2} enable dumping after the second if 3555conversion, to the file @file{@var{file}.130r.ce2}. 3556 3557@item -dd 3558@itemx -fdump-rtl-btl 3559@itemx -fdump-rtl-dbr 3560@opindex dd 3561@opindex fdump-rtl-btl 3562@opindex fdump-rtl-dbr 3563@option{-dd} and @option{-fdump-rtl-btl} enable dumping after branch 3564target load optimization, to @file{@var{file}.31.btl}. @option{-dd} 3565and @option{-fdump-rtl-dbr} enable dumping after delayed branch 3566scheduling, to @file{@var{file}.36.dbr}. 3567 3568@item -dD 3569@opindex dD 3570Dump all macro definitions, at the end of preprocessing, in addition to 3571normal output. 3572 3573@item -dE 3574@itemx -fdump-rtl-ce3 3575@opindex dE 3576@opindex fdump-rtl-ce3 3577Dump after the third if conversion, to @file{@var{file}.146r.ce3}. 3578 3579@item -df 3580@itemx -fdump-rtl-cfg 3581@itemx -fdump-rtl-life 3582@opindex df 3583@opindex fdump-rtl-cfg 3584@opindex fdump-rtl-life 3585@option{-df} and @option{-fdump-rtl-cfg} enable dumping after control 3586and data flow analysis, to @file{@var{file}.116r.cfg}. @option{-df} 3587and @option{-fdump-rtl-cfg} enable dumping dump after life analysis, 3588to @file{@var{file}.128r.life1} and @file{@var{file}.135r.life2}. 3589 3590@item -dg 3591@itemx -fdump-rtl-greg 3592@opindex dg 3593@opindex fdump-rtl-greg 3594Dump after global register allocation, to @file{@var{file}.139r.greg}. 3595 3596@item -dG 3597@itemx -fdump-rtl-gcse 3598@itemx -fdump-rtl-bypass 3599@opindex dG 3600@opindex fdump-rtl-gcse 3601@opindex fdump-rtl-bypass 3602@option{-dG} and @option{-fdump-rtl-gcse} enable dumping after GCSE, to 3603@file{@var{file}.114r.gcse}. @option{-dG} and @option{-fdump-rtl-bypass} 3604enable dumping after jump bypassing and control flow optimizations, to 3605@file{@var{file}.115r.bypass}. 3606 3607@item -dh 3608@itemx -fdump-rtl-eh 3609@opindex dh 3610@opindex fdump-rtl-eh 3611Dump after finalization of EH handling code, to @file{@var{file}.02.eh}. 3612 3613@item -di 3614@itemx -fdump-rtl-sibling 3615@opindex di 3616@opindex fdump-rtl-sibling 3617Dump after sibling call optimizations, to @file{@var{file}.106r.sibling}. 3618 3619@item -dj 3620@itemx -fdump-rtl-jump 3621@opindex dj 3622@opindex fdump-rtl-jump 3623Dump after the first jump optimization, to @file{@var{file}.112r.jump}. 3624 3625@item -dk 3626@itemx -fdump-rtl-stack 3627@opindex dk 3628@opindex fdump-rtl-stack 3629Dump after conversion from registers to stack, to @file{@var{file}.152r.stack}. 3630 3631@item -dl 3632@itemx -fdump-rtl-lreg 3633@opindex dl 3634@opindex fdump-rtl-lreg 3635Dump after local register allocation, to @file{@var{file}.138r.lreg}. 3636 3637@item -dL 3638@itemx -fdump-rtl-loop2 3639@opindex dL 3640@opindex fdump-rtl-loop2 3641@option{-dL} and @option{-fdump-rtl-loop2} enable dumping after the 3642loop optimization pass, to @file{@var{file}.119r.loop2}, 3643@file{@var{file}.120r.loop2_init}, 3644@file{@var{file}.121r.loop2_invariant}, and 3645@file{@var{file}.125r.loop2_done}. 3646 3647@item -dm 3648@itemx -fdump-rtl-sms 3649@opindex dm 3650@opindex fdump-rtl-sms 3651Dump after modulo scheduling, to @file{@var{file}.136r.sms}. 3652 3653@item -dM 3654@itemx -fdump-rtl-mach 3655@opindex dM 3656@opindex fdump-rtl-mach 3657Dump after performing the machine dependent reorganization pass, to 3658@file{@var{file}.155r.mach}. 3659 3660@item -dn 3661@itemx -fdump-rtl-rnreg 3662@opindex dn 3663@opindex fdump-rtl-rnreg 3664Dump after register renumbering, to @file{@var{file}.147r.rnreg}. 3665 3666@item -dN 3667@itemx -fdump-rtl-regmove 3668@opindex dN 3669@opindex fdump-rtl-regmove 3670Dump after the register move pass, to @file{@var{file}.132r.regmove}. 3671 3672@item -do 3673@itemx -fdump-rtl-postreload 3674@opindex do 3675@opindex fdump-rtl-postreload 3676Dump after post-reload optimizations, to @file{@var{file}.24.postreload}. 3677 3678@item -dr 3679@itemx -fdump-rtl-expand 3680@opindex dr 3681@opindex fdump-rtl-expand 3682Dump after RTL generation, to @file{@var{file}.104r.expand}. 3683 3684@item -dR 3685@itemx -fdump-rtl-sched2 3686@opindex dR 3687@opindex fdump-rtl-sched2 3688Dump after the second scheduling pass, to @file{@var{file}.150r.sched2}. 3689 3690@item -ds 3691@itemx -fdump-rtl-cse 3692@opindex ds 3693@opindex fdump-rtl-cse 3694Dump after CSE (including the jump optimization that sometimes follows 3695CSE), to @file{@var{file}.113r.cse}. 3696 3697@item -dS 3698@itemx -fdump-rtl-sched 3699@opindex dS 3700@opindex fdump-rtl-sched 3701Dump after the first scheduling pass, to @file{@var{file}.21.sched}. 3702 3703@item -dt 3704@itemx -fdump-rtl-cse2 3705@opindex dt 3706@opindex fdump-rtl-cse2 3707Dump after the second CSE pass (including the jump optimization that 3708sometimes follows CSE), to @file{@var{file}.127r.cse2}. 3709 3710@item -dT 3711@itemx -fdump-rtl-tracer 3712@opindex dT 3713@opindex fdump-rtl-tracer 3714Dump after running tracer, to @file{@var{file}.118r.tracer}. 3715 3716@item -dV 3717@itemx -fdump-rtl-vpt 3718@itemx -fdump-rtl-vartrack 3719@opindex dV 3720@opindex fdump-rtl-vpt 3721@opindex fdump-rtl-vartrack 3722@option{-dV} and @option{-fdump-rtl-vpt} enable dumping after the value 3723profile transformations, to @file{@var{file}.10.vpt}. @option{-dV} 3724and @option{-fdump-rtl-vartrack} enable dumping after variable tracking, 3725to @file{@var{file}.154r.vartrack}. 3726 3727@item -dw 3728@itemx -fdump-rtl-flow2 3729@opindex dw 3730@opindex fdump-rtl-flow2 3731Dump after the second flow pass, to @file{@var{file}.142r.flow2}. 3732 3733@item -dz 3734@itemx -fdump-rtl-peephole2 3735@opindex dz 3736@opindex fdump-rtl-peephole2 3737Dump after the peephole pass, to @file{@var{file}.145r.peephole2}. 3738 3739@item -dZ 3740@itemx -fdump-rtl-web 3741@opindex dZ 3742@opindex fdump-rtl-web 3743Dump after live range splitting, to @file{@var{file}.126r.web}. 3744 3745@item -da 3746@itemx -fdump-rtl-all 3747@opindex da 3748@opindex fdump-rtl-all 3749Produce all the dumps listed above. 3750 3751@item -dH 3752@opindex dH 3753Produce a core dump whenever an error occurs. 3754 3755@item -dm 3756@opindex dm 3757Print statistics on memory usage, at the end of the run, to 3758standard error. 3759 3760@item -dp 3761@opindex dp 3762Annotate the assembler output with a comment indicating which 3763pattern and alternative was used. The length of each instruction is 3764also printed. 3765 3766@item -dP 3767@opindex dP 3768Dump the RTL in the assembler output as a comment before each instruction. 3769Also turns on @option{-dp} annotation. 3770 3771@item -dv 3772@opindex dv 3773For each of the other indicated dump files (either with @option{-d} or 3774@option{-fdump-rtl-@var{pass}}), dump a representation of the control flow 3775graph suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}. 3776 3777@item -dx 3778@opindex dx 3779Just generate RTL for a function instead of compiling it. Usually used 3780with @samp{r} (@option{-fdump-rtl-expand}). 3781 3782@item -dy 3783@opindex dy 3784Dump debugging information during parsing, to standard error. 3785@end table 3786 3787@item -fdump-noaddr 3788@opindex fdump-noaddr 3789When doing debugging dumps (see @option{-d} option above), suppress 3790address output. This makes it more feasible to use diff on debugging 3791dumps for compiler invocations with different compiler binaries and/or 3792different text / bss / data / heap / stack / dso start locations. 3793 3794@item -fdump-unnumbered 3795@opindex fdump-unnumbered 3796When doing debugging dumps (see @option{-d} option above), suppress instruction 3797numbers, line number note and address output. This makes it more feasible to 3798use diff on debugging dumps for compiler invocations with different 3799options, in particular with and without @option{-g}. 3800 3801@item -fdump-translation-unit @r{(C++ only)} 3802@itemx -fdump-translation-unit-@var{options} @r{(C++ only)} 3803@opindex fdump-translation-unit 3804Dump a representation of the tree structure for the entire translation 3805unit to a file. The file name is made by appending @file{.tu} to the 3806source file name. If the @samp{-@var{options}} form is used, @var{options} 3807controls the details of the dump as described for the 3808@option{-fdump-tree} options. 3809 3810@item -fdump-class-hierarchy @r{(C++ only)} 3811@itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)} 3812@opindex fdump-class-hierarchy 3813Dump a representation of each class's hierarchy and virtual function 3814table layout to a file. The file name is made by appending @file{.class} 3815to the source file name. If the @samp{-@var{options}} form is used, 3816@var{options} controls the details of the dump as described for the 3817@option{-fdump-tree} options. 3818 3819@item -fdump-ipa-@var{switch} 3820@opindex fdump-ipa 3821Control the dumping at various stages of inter-procedural analysis 3822language tree to a file. The file name is generated by appending a switch 3823specific suffix to the source file name. The following dumps are possible: 3824 3825@table @samp 3826@item all 3827Enables all inter-procedural analysis dumps; currently the only produced 3828dump is the @samp{cgraph} dump. 3829 3830@item cgraph 3831Dumps information about call-graph optimization, unused function removal, 3832and inlining decisions. 3833@end table 3834 3835@item -fdump-tree-@var{switch} 3836@itemx -fdump-tree-@var{switch}-@var{options} 3837@opindex fdump-tree 3838Control the dumping at various stages of processing the intermediate 3839language tree to a file. The file name is generated by appending a switch 3840specific suffix to the source file name. If the @samp{-@var{options}} 3841form is used, @var{options} is a list of @samp{-} separated options that 3842control the details of the dump. Not all options are applicable to all 3843dumps, those which are not meaningful will be ignored. The following 3844options are available 3845 3846@table @samp 3847@item address 3848Print the address of each node. Usually this is not meaningful as it 3849changes according to the environment and source file. Its primary use 3850is for tying up a dump file with a debug environment. 3851@item slim 3852Inhibit dumping of members of a scope or body of a function merely 3853because that scope has been reached. Only dump such items when they 3854are directly reachable by some other path. When dumping pretty-printed 3855trees, this option inhibits dumping the bodies of control structures. 3856@item raw 3857Print a raw representation of the tree. By default, trees are 3858pretty-printed into a C-like representation. 3859@item details 3860Enable more detailed dumps (not honored by every dump option). 3861@item stats 3862Enable dumping various statistics about the pass (not honored by every dump 3863option). 3864@item blocks 3865Enable showing basic block boundaries (disabled in raw dumps). 3866@item vops 3867Enable showing virtual operands for every statement. 3868@item lineno 3869Enable showing line numbers for statements. 3870@item uid 3871Enable showing the unique ID (@code{DECL_UID}) for each variable. 3872@item all 3873Turn on all options, except @option{raw}, @option{slim} and @option{lineno}. 3874@end table 3875 3876The following tree dumps are possible: 3877@table @samp 3878 3879@item original 3880Dump before any tree based optimization, to @file{@var{file}.original}. 3881 3882@item optimized 3883Dump after all tree based optimization, to @file{@var{file}.optimized}. 3884 3885@item inlined 3886Dump after function inlining, to @file{@var{file}.inlined}. 3887 3888@item gimple 3889@opindex fdump-tree-gimple 3890Dump each function before and after the gimplification pass to a file. The 3891file name is made by appending @file{.gimple} to the source file name. 3892 3893@item cfg 3894@opindex fdump-tree-cfg 3895Dump the control flow graph of each function to a file. The file name is 3896made by appending @file{.cfg} to the source file name. 3897 3898@item vcg 3899@opindex fdump-tree-vcg 3900Dump the control flow graph of each function to a file in VCG format. The 3901file name is made by appending @file{.vcg} to the source file name. Note 3902that if the file contains more than one function, the generated file cannot 3903be used directly by VCG@. You will need to cut and paste each function's 3904graph into its own separate file first. 3905 3906@item ch 3907@opindex fdump-tree-ch 3908Dump each function after copying loop headers. The file name is made by 3909appending @file{.ch} to the source file name. 3910 3911@item ssa 3912@opindex fdump-tree-ssa 3913Dump SSA related information to a file. The file name is made by appending 3914@file{.ssa} to the source file name. 3915 3916@item salias 3917@opindex fdump-tree-salias 3918Dump structure aliasing variable information to a file. This file name 3919is made by appending @file{.salias} to the source file name. 3920 3921@item alias 3922@opindex fdump-tree-alias 3923Dump aliasing information for each function. The file name is made by 3924appending @file{.alias} to the source file name. 3925 3926@item ccp 3927@opindex fdump-tree-ccp 3928Dump each function after CCP@. The file name is made by appending 3929@file{.ccp} to the source file name. 3930 3931@item storeccp 3932@opindex fdump-tree-storeccp 3933Dump each function after STORE-CCP. The file name is made by appending 3934@file{.storeccp} to the source file name. 3935 3936@item pre 3937@opindex fdump-tree-pre 3938Dump trees after partial redundancy elimination. The file name is made 3939by appending @file{.pre} to the source file name. 3940 3941@item fre 3942@opindex fdump-tree-fre 3943Dump trees after full redundancy elimination. The file name is made 3944by appending @file{.fre} to the source file name. 3945 3946@item copyprop 3947@opindex fdump-tree-copyprop 3948Dump trees after copy propagation. The file name is made 3949by appending @file{.copyprop} to the source file name. 3950 3951@item store_copyprop 3952@opindex fdump-tree-store_copyprop 3953Dump trees after store copy-propagation. The file name is made 3954by appending @file{.store_copyprop} to the source file name. 3955 3956@item dce 3957@opindex fdump-tree-dce 3958Dump each function after dead code elimination. The file name is made by 3959appending @file{.dce} to the source file name. 3960 3961@item mudflap 3962@opindex fdump-tree-mudflap 3963Dump each function after adding mudflap instrumentation. The file name is 3964made by appending @file{.mudflap} to the source file name. 3965 3966@item sra 3967@opindex fdump-tree-sra 3968Dump each function after performing scalar replacement of aggregates. The 3969file name is made by appending @file{.sra} to the source file name. 3970 3971@item sink 3972@opindex fdump-tree-sink 3973Dump each function after performing code sinking. The file name is made 3974by appending @file{.sink} to the source file name. 3975 3976@item dom 3977@opindex fdump-tree-dom 3978Dump each function after applying dominator tree optimizations. The file 3979name is made by appending @file{.dom} to the source file name. 3980 3981@item dse 3982@opindex fdump-tree-dse 3983Dump each function after applying dead store elimination. The file 3984name is made by appending @file{.dse} to the source file name. 3985 3986@item phiopt 3987@opindex fdump-tree-phiopt 3988Dump each function after optimizing PHI nodes into straightline code. The file 3989name is made by appending @file{.phiopt} to the source file name. 3990 3991@item forwprop 3992@opindex fdump-tree-forwprop 3993Dump each function after forward propagating single use variables. The file 3994name is made by appending @file{.forwprop} to the source file name. 3995 3996@item copyrename 3997@opindex fdump-tree-copyrename 3998Dump each function after applying the copy rename optimization. The file 3999name is made by appending @file{.copyrename} to the source file name. 4000 4001@item nrv 4002@opindex fdump-tree-nrv 4003Dump each function after applying the named return value optimization on 4004generic trees. The file name is made by appending @file{.nrv} to the source 4005file name. 4006 4007@item vect 4008@opindex fdump-tree-vect 4009Dump each function after applying vectorization of loops. The file name is 4010made by appending @file{.vect} to the source file name. 4011 4012@item vrp 4013@opindex fdump-tree-vrp 4014Dump each function after Value Range Propagation (VRP). The file name 4015is made by appending @file{.vrp} to the source file name. 4016 4017@item all 4018@opindex fdump-tree-all 4019Enable all the available tree dumps with the flags provided in this option. 4020@end table 4021 4022@item -ftree-vectorizer-verbose=@var{n} 4023@opindex ftree-vectorizer-verbose 4024This option controls the amount of debugging output the vectorizer prints. 4025This information is written to standard error, unless 4026@option{-fdump-tree-all} or @option{-fdump-tree-vect} is specified, 4027in which case it is output to the usual dump listing file, @file{.vect}. 4028For @var{n}=0 no diagnostic information is reported. 4029If @var{n}=1 the vectorizer reports each loop that got vectorized, 4030and the total number of loops that got vectorized. 4031If @var{n}=2 the vectorizer also reports non-vectorized loops that passed 4032the first analysis phase (vect_analyze_loop_form) - i.e. countable, 4033inner-most, single-bb, single-entry/exit loops. This is the same verbosity 4034level that @option{-fdump-tree-vect-stats} uses. 4035Higher verbosity levels mean either more information dumped for each 4036reported loop, or same amount of information reported for more loops: 4037If @var{n}=3, alignment related information is added to the reports. 4038If @var{n}=4, data-references related information (e.g. memory dependences, 4039memory access-patterns) is added to the reports. 4040If @var{n}=5, the vectorizer reports also non-vectorized inner-most loops 4041that did not pass the first analysis phase (i.e. may not be countable, or 4042may have complicated control-flow). 4043If @var{n}=6, the vectorizer reports also non-vectorized nested loops. 4044For @var{n}=7, all the information the vectorizer generates during its 4045analysis and transformation is reported. This is the same verbosity level 4046that @option{-fdump-tree-vect-details} uses. 4047 4048@item -frandom-seed=@var{string} 4049@opindex frandom-string 4050This option provides a seed that GCC uses when it would otherwise use 4051random numbers. It is used to generate certain symbol names 4052that have to be different in every compiled file. It is also used to 4053place unique stamps in coverage data files and the object files that 4054produce them. You can use the @option{-frandom-seed} option to produce 4055reproducibly identical object files. 4056 4057The @var{string} should be different for every file you compile. 4058 4059@item -fsched-verbose=@var{n} 4060@opindex fsched-verbose 4061On targets that use instruction scheduling, this option controls the 4062amount of debugging output the scheduler prints. This information is 4063written to standard error, unless @option{-dS} or @option{-dR} is 4064specified, in which case it is output to the usual dump 4065listing file, @file{.sched} or @file{.sched2} respectively. However 4066for @var{n} greater than nine, the output is always printed to standard 4067error. 4068 4069For @var{n} greater than zero, @option{-fsched-verbose} outputs the 4070same information as @option{-dRS}. For @var{n} greater than one, it 4071also output basic block probabilities, detailed ready list information 4072and unit/insn info. For @var{n} greater than two, it includes RTL 4073at abort point, control-flow and regions info. And for @var{n} over 4074four, @option{-fsched-verbose} also includes dependence info. 4075 4076@item -save-temps 4077@opindex save-temps 4078Store the usual ``temporary'' intermediate files permanently; place them 4079in the current directory and name them based on the source file. Thus, 4080compiling @file{foo.c} with @samp{-c -save-temps} would produce files 4081@file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a 4082preprocessed @file{foo.i} output file even though the compiler now 4083normally uses an integrated preprocessor. 4084 4085When used in combination with the @option{-x} command line option, 4086@option{-save-temps} is sensible enough to avoid over writing an 4087input source file with the same extension as an intermediate file. 4088The corresponding intermediate file may be obtained by renaming the 4089source file before using @option{-save-temps}. 4090 4091@item -time 4092@opindex time 4093Report the CPU time taken by each subprocess in the compilation 4094sequence. For C source files, this is the compiler proper and assembler 4095(plus the linker if linking is done). The output looks like this: 4096 4097@smallexample 4098# cc1 0.12 0.01 4099# as 0.00 0.01 4100@end smallexample 4101 4102The first number on each line is the ``user time'', that is time spent 4103executing the program itself. The second number is ``system time'', 4104time spent executing operating system routines on behalf of the program. 4105Both numbers are in seconds. 4106 4107@item -fvar-tracking 4108@opindex fvar-tracking 4109Run variable tracking pass. It computes where variables are stored at each 4110position in code. Better debugging information is then generated 4111(if the debugging information format supports this information). 4112 4113It is enabled by default when compiling with optimization (@option{-Os}, 4114@option{-O}, @option{-O2}, ...), debugging information (@option{-g}) and 4115the debug info format supports it. 4116 4117@item -print-file-name=@var{library} 4118@opindex print-file-name 4119Print the full absolute name of the library file @var{library} that 4120would be used when linking---and don't do anything else. With this 4121option, GCC does not compile or link anything; it just prints the 4122file name. 4123 4124@item -print-multi-directory 4125@opindex print-multi-directory 4126Print the directory name corresponding to the multilib selected by any 4127other switches present in the command line. This directory is supposed 4128to exist in @env{GCC_EXEC_PREFIX}. 4129 4130@item -print-multi-lib 4131@opindex print-multi-lib 4132Print the mapping from multilib directory names to compiler switches 4133that enable them. The directory name is separated from the switches by 4134@samp{;}, and each switch starts with an @samp{@@} instead of the 4135@samp{-}, without spaces between multiple switches. This is supposed to 4136ease shell-processing. 4137 4138@item -print-prog-name=@var{program} 4139@opindex print-prog-name 4140Like @option{-print-file-name}, but searches for a program such as @samp{cpp}. 4141 4142@item -print-libgcc-file-name 4143@opindex print-libgcc-file-name 4144Same as @option{-print-file-name=libgcc.a}. 4145 4146This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs} 4147but you do want to link with @file{libgcc.a}. You can do 4148 4149@smallexample 4150gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name` 4151@end smallexample 4152 4153@item -print-search-dirs 4154@opindex print-search-dirs 4155Print the name of the configured installation directory and a list of 4156program and library directories @command{gcc} will search---and don't do anything else. 4157 4158This is useful when @command{gcc} prints the error message 4159@samp{installation problem, cannot exec cpp0: No such file or directory}. 4160To resolve this you either need to put @file{cpp0} and the other compiler 4161components where @command{gcc} expects to find them, or you can set the environment 4162variable @env{GCC_EXEC_PREFIX} to the directory where you installed them. 4163Don't forget the trailing @samp{/}. 4164@xref{Environment Variables}. 4165 4166@item -dumpmachine 4167@opindex dumpmachine 4168Print the compiler's target machine (for example, 4169@samp{i686-pc-linux-gnu})---and don't do anything else. 4170 4171@item -dumpversion 4172@opindex dumpversion 4173Print the compiler version (for example, @samp{3.0})---and don't do 4174anything else. 4175 4176@item -dumpspecs 4177@opindex dumpspecs 4178Print the compiler's built-in specs---and don't do anything else. (This 4179is used when GCC itself is being built.) @xref{Spec Files}. 4180 4181@item -feliminate-unused-debug-types 4182@opindex feliminate-unused-debug-types 4183Normally, when producing DWARF2 output, GCC will emit debugging 4184information for all types declared in a compilation 4185unit, regardless of whether or not they are actually used 4186in that compilation unit. Sometimes this is useful, such as 4187if, in the debugger, you want to cast a value to a type that is 4188not actually used in your program (but is declared). More often, 4189however, this results in a significant amount of wasted space. 4190With this option, GCC will avoid producing debug symbol output 4191for types that are nowhere used in the source file being compiled. 4192@end table 4193 4194@node Optimize Options 4195@section Options That Control Optimization 4196@cindex optimize options 4197@cindex options, optimization 4198 4199These options control various sorts of optimizations. 4200 4201Without any optimization option, the compiler's goal is to reduce the 4202cost of compilation and to make debugging produce the expected 4203results. Statements are independent: if you stop the program with a 4204breakpoint between statements, you can then assign a new value to any 4205variable or change the program counter to any other statement in the 4206function and get exactly the results you would expect from the source 4207code. 4208 4209Turning on optimization flags makes the compiler attempt to improve 4210the performance and/or code size at the expense of compilation time 4211and possibly the ability to debug the program. 4212 4213The compiler performs optimization based on the knowledge it has of 4214the program. Optimization levels @option{-O} and above, in 4215particular, enable @emph{unit-at-a-time} mode, which allows the 4216compiler to consider information gained from later functions in 4217the file when compiling a function. Compiling multiple files at 4218once to a single output file in @emph{unit-at-a-time} mode allows 4219the compiler to use information gained from all of the files when 4220compiling each of them. 4221 4222Not all optimizations are controlled directly by a flag. Only 4223optimizations that have a flag are listed. 4224 4225@table @gcctabopt 4226@item -O 4227@itemx -O1 4228@opindex O 4229@opindex O1 4230Optimize. Optimizing compilation takes somewhat more time, and a lot 4231more memory for a large function. 4232 4233With @option{-O}, the compiler tries to reduce code size and execution 4234time, without performing any optimizations that take a great deal of 4235compilation time. 4236 4237@option{-O} turns on the following optimization flags: 4238@gccoptlist{-fdefer-pop @gol 4239-fdelayed-branch @gol 4240-fguess-branch-probability @gol 4241-fcprop-registers @gol 4242-fif-conversion @gol 4243-fif-conversion2 @gol 4244-ftree-ccp @gol 4245-ftree-dce @gol 4246-ftree-dominator-opts @gol 4247-ftree-dse @gol 4248-ftree-ter @gol 4249-ftree-lrs @gol 4250-ftree-sra @gol 4251-ftree-copyrename @gol 4252-ftree-fre @gol 4253-ftree-ch @gol 4254-funit-at-a-time @gol 4255-fmerge-constants} 4256 4257@option{-O} also turns on @option{-fomit-frame-pointer} on machines 4258where doing so does not interfere with debugging. 4259 4260@item -O2 4261@opindex O2 4262Optimize even more. GCC performs nearly all supported optimizations 4263that do not involve a space-speed tradeoff. The compiler does not 4264perform loop unrolling or function inlining when you specify @option{-O2}. 4265As compared to @option{-O}, this option increases both compilation time 4266and the performance of the generated code. 4267 4268@option{-O2} turns on all optimization flags specified by @option{-O}. It 4269also turns on the following optimization flags: 4270@gccoptlist{-fthread-jumps @gol 4271-fcrossjumping @gol 4272-foptimize-sibling-calls @gol 4273-fcse-follow-jumps -fcse-skip-blocks @gol 4274-fgcse -fgcse-lm @gol 4275-fexpensive-optimizations @gol 4276-frerun-cse-after-loop @gol 4277-fcaller-saves @gol 4278-fpeephole2 @gol 4279-fschedule-insns -fschedule-insns2 @gol 4280-fsched-interblock -fsched-spec @gol 4281-fregmove @gol 4282-fstrict-aliasing -fstrict-overflow @gol 4283-fdelete-null-pointer-checks @gol 4284-freorder-blocks -freorder-functions @gol 4285-falign-functions -falign-jumps @gol 4286-falign-loops -falign-labels @gol 4287-ftree-vrp @gol 4288-ftree-pre} 4289 4290Please note the warning under @option{-fgcse} about 4291invoking @option{-O2} on programs that use computed gotos. 4292 4293@option{-O2} doesn't turn on @option{-ftree-vrp} for the Ada compiler. 4294This option must be explicitly specified on the command line to be 4295enabled for the Ada compiler. 4296 4297@item -O3 4298@opindex O3 4299Optimize yet more. @option{-O3} turns on all optimizations specified by 4300@option{-O2} and also turns on the @option{-finline-functions}, 4301@option{-funswitch-loops} and @option{-fgcse-after-reload} options. 4302 4303@item -O0 4304@opindex O0 4305Do not optimize. This is the default. 4306 4307@item -Os 4308@opindex Os 4309Optimize for size. @option{-Os} enables all @option{-O2} optimizations that 4310do not typically increase code size. It also performs further 4311optimizations designed to reduce code size. 4312 4313@option{-Os} disables the following optimization flags: 4314@gccoptlist{-falign-functions -falign-jumps -falign-loops @gol 4315-falign-labels -freorder-blocks -freorder-blocks-and-partition @gol 4316-fprefetch-loop-arrays -ftree-vect-loop-version} 4317 4318If you use multiple @option{-O} options, with or without level numbers, 4319the last such option is the one that is effective. 4320@end table 4321 4322Options of the form @option{-f@var{flag}} specify machine-independent 4323flags. Most flags have both positive and negative forms; the negative 4324form of @option{-ffoo} would be @option{-fno-foo}. In the table 4325below, only one of the forms is listed---the one you typically will 4326use. You can figure out the other form by either removing @samp{no-} 4327or adding it. 4328 4329The following options control specific optimizations. They are either 4330activated by @option{-O} options or are related to ones that are. You 4331can use the following flags in the rare cases when ``fine-tuning'' of 4332optimizations to be performed is desired. 4333 4334@table @gcctabopt 4335@item -fno-default-inline 4336@opindex fno-default-inline 4337Do not make member functions inline by default merely because they are 4338defined inside the class scope (C++ only). Otherwise, when you specify 4339@w{@option{-O}}, member functions defined inside class scope are compiled 4340inline by default; i.e., you don't need to add @samp{inline} in front of 4341the member function name. 4342 4343@item -fno-defer-pop 4344@opindex fno-defer-pop 4345Always pop the arguments to each function call as soon as that function 4346returns. For machines which must pop arguments after a function call, 4347the compiler normally lets arguments accumulate on the stack for several 4348function calls and pops them all at once. 4349 4350Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4351 4352@item -fforce-mem 4353@opindex fforce-mem 4354Force memory operands to be copied into registers before doing 4355arithmetic on them. This produces better code by making all memory 4356references potential common subexpressions. When they are not common 4357subexpressions, instruction combination should eliminate the separate 4358register-load. This option is now a nop and will be removed in 4.3. 4359 4360@item -fforce-addr 4361@opindex fforce-addr 4362Force memory address constants to be copied into registers before 4363doing arithmetic on them. 4364 4365@item -fomit-frame-pointer 4366@opindex fomit-frame-pointer 4367Don't keep the frame pointer in a register for functions that 4368don't need one. This avoids the instructions to save, set up and 4369restore frame pointers; it also makes an extra register available 4370in many functions. @strong{It also makes debugging impossible on 4371some machines.} 4372 4373On some machines, such as the VAX, this flag has no effect, because 4374the standard calling sequence automatically handles the frame pointer 4375and nothing is saved by pretending it doesn't exist. The 4376machine-description macro @code{FRAME_POINTER_REQUIRED} controls 4377whether a target machine supports this flag. @xref{Registers,,Register 4378Usage, gccint, GNU Compiler Collection (GCC) Internals}. 4379 4380Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4381 4382@item -foptimize-sibling-calls 4383@opindex foptimize-sibling-calls 4384Optimize sibling and tail recursive calls. 4385 4386Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4387 4388@item -fno-inline 4389@opindex fno-inline 4390Don't pay attention to the @code{inline} keyword. Normally this option 4391is used to keep the compiler from expanding any functions inline. 4392Note that if you are not optimizing, no functions can be expanded inline. 4393 4394@item -finline-functions 4395@opindex finline-functions 4396Integrate all simple functions into their callers. The compiler 4397heuristically decides which functions are simple enough to be worth 4398integrating in this way. 4399 4400If all calls to a given function are integrated, and the function is 4401declared @code{static}, then the function is normally not output as 4402assembler code in its own right. 4403 4404Enabled at level @option{-O3}. 4405 4406@item -finline-functions-called-once 4407@opindex finline-functions-called-once 4408Consider all @code{static} functions called once for inlining into their 4409caller even if they are not marked @code{inline}. If a call to a given 4410function is integrated, then the function is not output as assembler code 4411in its own right. 4412 4413Enabled if @option{-funit-at-a-time} is enabled. 4414 4415@item -fearly-inlining 4416@opindex fearly-inlining 4417Inline functions marked by @code{always_inline} and functions whose body seems 4418smaller than the function call overhead early before doing 4419@option{-fprofile-generate} instrumentation and real inlining pass. Doing so 4420makes profiling significantly cheaper and usually inlining faster on programs 4421having large chains of nested wrapper functions. 4422 4423Enabled by default. 4424 4425@item -finline-limit=@var{n} 4426@opindex finline-limit 4427By default, GCC limits the size of functions that can be inlined. This flag 4428allows the control of this limit for functions that are explicitly marked as 4429inline (i.e., marked with the inline keyword or defined within the class 4430definition in c++). @var{n} is the size of functions that can be inlined in 4431number of pseudo instructions (not counting parameter handling). The default 4432value of @var{n} is 600. 4433Increasing this value can result in more inlined code at 4434the cost of compilation time and memory consumption. Decreasing usually makes 4435the compilation faster and less code will be inlined (which presumably 4436means slower programs). This option is particularly useful for programs that 4437use inlining heavily such as those based on recursive templates with C++. 4438 4439Inlining is actually controlled by a number of parameters, which may be 4440specified individually by using @option{--param @var{name}=@var{value}}. 4441The @option{-finline-limit=@var{n}} option sets some of these parameters 4442as follows: 4443 4444@table @gcctabopt 4445@item max-inline-insns-single 4446 is set to @var{n}/2. 4447@item max-inline-insns-auto 4448 is set to @var{n}/2. 4449@item min-inline-insns 4450 is set to 130 or @var{n}/4, whichever is smaller. 4451@item max-inline-insns-rtl 4452 is set to @var{n}. 4453@end table 4454 4455See below for a documentation of the individual 4456parameters controlling inlining. 4457 4458@emph{Note:} pseudo instruction represents, in this particular context, an 4459abstract measurement of function's size. In no way does it represent a count 4460of assembly instructions and as such its exact meaning might change from one 4461release to an another. 4462 4463@item -fkeep-inline-functions 4464@opindex fkeep-inline-functions 4465In C, emit @code{static} functions that are declared @code{inline} 4466into the object file, even if the function has been inlined into all 4467of its callers. This switch does not affect functions using the 4468@code{extern inline} extension in GNU C@. In C++, emit any and all 4469inline functions into the object file. 4470 4471@item -fkeep-static-consts 4472@opindex fkeep-static-consts 4473Emit variables declared @code{static const} when optimization isn't turned 4474on, even if the variables aren't referenced. 4475 4476GCC enables this option by default. If you want to force the compiler to 4477check if the variable was referenced, regardless of whether or not 4478optimization is turned on, use the @option{-fno-keep-static-consts} option. 4479 4480@item -fmerge-constants 4481Attempt to merge identical constants (string constants and floating point 4482constants) across compilation units. 4483 4484This option is the default for optimized compilation if the assembler and 4485linker support it. Use @option{-fno-merge-constants} to inhibit this 4486behavior. 4487 4488Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4489 4490@item -fmerge-all-constants 4491Attempt to merge identical constants and identical variables. 4492 4493This option implies @option{-fmerge-constants}. In addition to 4494@option{-fmerge-constants} this considers e.g.@: even constant initialized 4495arrays or initialized constant variables with integral or floating point 4496types. Languages like C or C++ require each non-automatic variable to 4497have distinct location, so using this option will result in non-conforming 4498behavior. 4499 4500@item -fmodulo-sched 4501@opindex fmodulo-sched 4502Perform swing modulo scheduling immediately before the first scheduling 4503pass. This pass looks at innermost loops and reorders their 4504instructions by overlapping different iterations. 4505 4506@item -fno-branch-count-reg 4507@opindex fno-branch-count-reg 4508Do not use ``decrement and branch'' instructions on a count register, 4509but instead generate a sequence of instructions that decrement a 4510register, compare it against zero, then branch based upon the result. 4511This option is only meaningful on architectures that support such 4512instructions, which include x86, PowerPC, IA-64 and S/390. 4513 4514The default is @option{-fbranch-count-reg}. 4515 4516@item -fno-function-cse 4517@opindex fno-function-cse 4518Do not put function addresses in registers; make each instruction that 4519calls a constant function contain the function's address explicitly. 4520 4521This option results in less efficient code, but some strange hacks 4522that alter the assembler output may be confused by the optimizations 4523performed when this option is not used. 4524 4525The default is @option{-ffunction-cse} 4526 4527@item -fno-zero-initialized-in-bss 4528@opindex fno-zero-initialized-in-bss 4529If the target supports a BSS section, GCC by default puts variables that 4530are initialized to zero into BSS@. This can save space in the resulting 4531code. 4532 4533This option turns off this behavior because some programs explicitly 4534rely on variables going to the data section. E.g., so that the 4535resulting executable can find the beginning of that section and/or make 4536assumptions based on that. 4537 4538The default is @option{-fzero-initialized-in-bss}. 4539 4540@item -fbounds-check 4541@opindex fbounds-check 4542For front-ends that support it, generate additional code to check that 4543indices used to access arrays are within the declared range. This is 4544currently only supported by the Java and Fortran front-ends, where 4545this option defaults to true and false respectively. 4546 4547@item -fmudflap -fmudflapth -fmudflapir 4548@opindex fmudflap 4549@opindex fmudflapth 4550@opindex fmudflapir 4551@cindex bounds checking 4552@cindex mudflap 4553For front-ends that support it (C and C++), instrument all risky 4554pointer/array dereferencing operations, some standard library 4555string/heap functions, and some other associated constructs with 4556range/validity tests. Modules so instrumented should be immune to 4557buffer overflows, invalid heap use, and some other classes of C/C++ 4558programming errors. The instrumentation relies on a separate runtime 4559library (@file{libmudflap}), which will be linked into a program if 4560@option{-fmudflap} is given at link time. Run-time behavior of the 4561instrumented program is controlled by the @env{MUDFLAP_OPTIONS} 4562environment variable. See @code{env MUDFLAP_OPTIONS=-help a.out} 4563for its options. 4564 4565Use @option{-fmudflapth} instead of @option{-fmudflap} to compile and to 4566link if your program is multi-threaded. Use @option{-fmudflapir}, in 4567addition to @option{-fmudflap} or @option{-fmudflapth}, if 4568instrumentation should ignore pointer reads. This produces less 4569instrumentation (and therefore faster execution) and still provides 4570some protection against outright memory corrupting writes, but allows 4571erroneously read data to propagate within a program. 4572 4573@item -fthread-jumps 4574@opindex fthread-jumps 4575Perform optimizations where we check to see if a jump branches to a 4576location where another comparison subsumed by the first is found. If 4577so, the first branch is redirected to either the destination of the 4578second branch or a point immediately following it, depending on whether 4579the condition is known to be true or false. 4580 4581Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4582 4583@item -fcse-follow-jumps 4584@opindex fcse-follow-jumps 4585In common subexpression elimination, scan through jump instructions 4586when the target of the jump is not reached by any other path. For 4587example, when CSE encounters an @code{if} statement with an 4588@code{else} clause, CSE will follow the jump when the condition 4589tested is false. 4590 4591Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4592 4593@item -fcse-skip-blocks 4594@opindex fcse-skip-blocks 4595This is similar to @option{-fcse-follow-jumps}, but causes CSE to 4596follow jumps which conditionally skip over blocks. When CSE 4597encounters a simple @code{if} statement with no else clause, 4598@option{-fcse-skip-blocks} causes CSE to follow the jump around the 4599body of the @code{if}. 4600 4601Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4602 4603@item -frerun-cse-after-loop 4604@opindex frerun-cse-after-loop 4605Re-run common subexpression elimination after loop optimizations has been 4606performed. 4607 4608Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4609 4610@item -fgcse 4611@opindex fgcse 4612Perform a global common subexpression elimination pass. 4613This pass also performs global constant and copy propagation. 4614 4615@emph{Note:} When compiling a program using computed gotos, a GCC 4616extension, you may get better runtime performance if you disable 4617the global common subexpression elimination pass by adding 4618@option{-fno-gcse} to the command line. 4619 4620Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4621 4622@item -fgcse-lm 4623@opindex fgcse-lm 4624When @option{-fgcse-lm} is enabled, global common subexpression elimination will 4625attempt to move loads which are only killed by stores into themselves. This 4626allows a loop containing a load/store sequence to be changed to a load outside 4627the loop, and a copy/store within the loop. 4628 4629Enabled by default when gcse is enabled. 4630 4631@item -fgcse-sm 4632@opindex fgcse-sm 4633When @option{-fgcse-sm} is enabled, a store motion pass is run after 4634global common subexpression elimination. This pass will attempt to move 4635stores out of loops. When used in conjunction with @option{-fgcse-lm}, 4636loops containing a load/store sequence can be changed to a load before 4637the loop and a store after the loop. 4638 4639Not enabled at any optimization level. 4640 4641@item -fgcse-las 4642@opindex fgcse-las 4643When @option{-fgcse-las} is enabled, the global common subexpression 4644elimination pass eliminates redundant loads that come after stores to the 4645same memory location (both partial and full redundancies). 4646 4647Not enabled at any optimization level. 4648 4649@item -fgcse-after-reload 4650@opindex fgcse-after-reload 4651When @option{-fgcse-after-reload} is enabled, a redundant load elimination 4652pass is performed after reload. The purpose of this pass is to cleanup 4653redundant spilling. 4654 4655@item -funsafe-loop-optimizations 4656@opindex funsafe-loop-optimizations 4657If given, the loop optimizer will assume that loop indices do not 4658overflow, and that the loops with nontrivial exit condition are not 4659infinite. This enables a wider range of loop optimizations even if 4660the loop optimizer itself cannot prove that these assumptions are valid. 4661Using @option{-Wunsafe-loop-optimizations}, the compiler will warn you 4662if it finds this kind of loop. 4663 4664@item -fcrossjumping 4665@opindex crossjumping 4666Perform cross-jumping transformation. This transformation unifies equivalent code and save code size. The 4667resulting code may or may not perform better than without cross-jumping. 4668 4669Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4670 4671@item -fif-conversion 4672@opindex if-conversion 4673Attempt to transform conditional jumps into branch-less equivalents. This 4674include use of conditional moves, min, max, set flags and abs instructions, and 4675some tricks doable by standard arithmetics. The use of conditional execution 4676on chips where it is available is controlled by @code{if-conversion2}. 4677 4678Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4679 4680@item -fif-conversion2 4681@opindex if-conversion2 4682Use conditional execution (where available) to transform conditional jumps into 4683branch-less equivalents. 4684 4685Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4686 4687@item -fdelete-null-pointer-checks 4688@opindex fdelete-null-pointer-checks 4689Use global dataflow analysis to identify and eliminate useless checks 4690for null pointers. The compiler assumes that dereferencing a null 4691pointer would have halted the program. If a pointer is checked after 4692it has already been dereferenced, it cannot be null. 4693 4694In some environments, this assumption is not true, and programs can 4695safely dereference null pointers. Use 4696@option{-fno-delete-null-pointer-checks} to disable this optimization 4697for programs which depend on that behavior. 4698 4699Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4700 4701@item -fexpensive-optimizations 4702@opindex fexpensive-optimizations 4703Perform a number of minor optimizations that are relatively expensive. 4704 4705Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4706 4707@item -foptimize-register-move 4708@itemx -fregmove 4709@opindex foptimize-register-move 4710@opindex fregmove 4711Attempt to reassign register numbers in move instructions and as 4712operands of other simple instructions in order to maximize the amount of 4713register tying. This is especially helpful on machines with two-operand 4714instructions. 4715 4716Note @option{-fregmove} and @option{-foptimize-register-move} are the same 4717optimization. 4718 4719Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4720 4721@item -fdelayed-branch 4722@opindex fdelayed-branch 4723If supported for the target machine, attempt to reorder instructions 4724to exploit instruction slots available after delayed branch 4725instructions. 4726 4727Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 4728 4729@item -fschedule-insns 4730@opindex fschedule-insns 4731If supported for the target machine, attempt to reorder instructions to 4732eliminate execution stalls due to required data being unavailable. This 4733helps machines that have slow floating point or memory load instructions 4734by allowing other instructions to be issued until the result of the load 4735or floating point instruction is required. 4736 4737Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4738 4739@item -fschedule-insns2 4740@opindex fschedule-insns2 4741Similar to @option{-fschedule-insns}, but requests an additional pass of 4742instruction scheduling after register allocation has been done. This is 4743especially useful on machines with a relatively small number of 4744registers and where memory load instructions take more than one cycle. 4745 4746Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4747 4748@item -fno-sched-interblock 4749@opindex fno-sched-interblock 4750Don't schedule instructions across basic blocks. This is normally 4751enabled by default when scheduling before register allocation, i.e.@: 4752with @option{-fschedule-insns} or at @option{-O2} or higher. 4753 4754@item -fno-sched-spec 4755@opindex fno-sched-spec 4756Don't allow speculative motion of non-load instructions. This is normally 4757enabled by default when scheduling before register allocation, i.e.@: 4758with @option{-fschedule-insns} or at @option{-O2} or higher. 4759 4760@item -fsched-spec-load 4761@opindex fsched-spec-load 4762Allow speculative motion of some load instructions. This only makes 4763sense when scheduling before register allocation, i.e.@: with 4764@option{-fschedule-insns} or at @option{-O2} or higher. 4765 4766@item -fsched-spec-load-dangerous 4767@opindex fsched-spec-load-dangerous 4768Allow speculative motion of more load instructions. This only makes 4769sense when scheduling before register allocation, i.e.@: with 4770@option{-fschedule-insns} or at @option{-O2} or higher. 4771 4772@item -fsched-stalled-insns=@var{n} 4773@opindex fsched-stalled-insns 4774Define how many insns (if any) can be moved prematurely from the queue 4775of stalled insns into the ready list, during the second scheduling pass. 4776 4777@item -fsched-stalled-insns-dep=@var{n} 4778@opindex fsched-stalled-insns-dep 4779Define how many insn groups (cycles) will be examined for a dependency 4780on a stalled insn that is candidate for premature removal from the queue 4781of stalled insns. Has an effect only during the second scheduling pass, 4782and only if @option{-fsched-stalled-insns} is used and its value is not zero. 4783 4784@item -fsched2-use-superblocks 4785@opindex fsched2-use-superblocks 4786When scheduling after register allocation, do use superblock scheduling 4787algorithm. Superblock scheduling allows motion across basic block boundaries 4788resulting on faster schedules. This option is experimental, as not all machine 4789descriptions used by GCC model the CPU closely enough to avoid unreliable 4790results from the algorithm. 4791 4792This only makes sense when scheduling after register allocation, i.e.@: with 4793@option{-fschedule-insns2} or at @option{-O2} or higher. 4794 4795@item -fsched2-use-traces 4796@opindex fsched2-use-traces 4797Use @option{-fsched2-use-superblocks} algorithm when scheduling after register 4798allocation and additionally perform code duplication in order to increase the 4799size of superblocks using tracer pass. See @option{-ftracer} for details on 4800trace formation. 4801 4802This mode should produce faster but significantly longer programs. Also 4803without @option{-fbranch-probabilities} the traces constructed may not 4804match the reality and hurt the performance. This only makes 4805sense when scheduling after register allocation, i.e.@: with 4806@option{-fschedule-insns2} or at @option{-O2} or higher. 4807 4808@item -fsee 4809@opindex fsee 4810Eliminates redundant extension instructions and move the non redundant 4811ones to optimal placement using LCM. 4812 4813@item -freschedule-modulo-scheduled-loops 4814@opindex fscheduling-in-modulo-scheduled-loops 4815The modulo scheduling comes before the traditional scheduling, if a loop was modulo scheduled 4816we may want to prevent the later scheduling passes from changing its schedule, we use this 4817option to control that. 4818 4819@item -fcaller-saves 4820@opindex fcaller-saves 4821Enable values to be allocated in registers that will be clobbered by 4822function calls, by emitting extra instructions to save and restore the 4823registers around such calls. Such allocation is done only when it 4824seems to result in better code than would otherwise be produced. 4825 4826This option is always enabled by default on certain machines, usually 4827those which have no call-preserved registers to use instead. 4828 4829Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 4830 4831@item -ftree-pre 4832Perform Partial Redundancy Elimination (PRE) on trees. This flag is 4833enabled by default at @option{-O2} and @option{-O3}. 4834 4835@item -ftree-fre 4836Perform Full Redundancy Elimination (FRE) on trees. The difference 4837between FRE and PRE is that FRE only considers expressions 4838that are computed on all paths leading to the redundant computation. 4839This analysis faster than PRE, though it exposes fewer redundancies. 4840This flag is enabled by default at @option{-O} and higher. 4841 4842@item -ftree-copy-prop 4843Perform copy propagation on trees. This pass eliminates unnecessary 4844copy operations. This flag is enabled by default at @option{-O} and 4845higher. 4846 4847@item -ftree-store-copy-prop 4848Perform copy propagation of memory loads and stores. This pass 4849eliminates unnecessary copy operations in memory references 4850(structures, global variables, arrays, etc). This flag is enabled by 4851default at @option{-O2} and higher. 4852 4853@item -ftree-salias 4854Perform structural alias analysis on trees. This flag 4855is enabled by default at @option{-O} and higher. 4856 4857@item -fipa-pta 4858Perform interprocedural pointer analysis. 4859 4860@item -ftree-sink 4861Perform forward store motion on trees. This flag is 4862enabled by default at @option{-O} and higher. 4863 4864@item -ftree-ccp 4865Perform sparse conditional constant propagation (CCP) on trees. This 4866pass only operates on local scalar variables and is enabled by default 4867at @option{-O} and higher. 4868 4869@item -ftree-store-ccp 4870Perform sparse conditional constant propagation (CCP) on trees. This 4871pass operates on both local scalar variables and memory stores and 4872loads (global variables, structures, arrays, etc). This flag is 4873enabled by default at @option{-O2} and higher. 4874 4875@item -ftree-dce 4876Perform dead code elimination (DCE) on trees. This flag is enabled by 4877default at @option{-O} and higher. 4878 4879@item -ftree-dominator-opts 4880Perform a variety of simple scalar cleanups (constant/copy 4881propagation, redundancy elimination, range propagation and expression 4882simplification) based on a dominator tree traversal. This also 4883performs jump threading (to reduce jumps to jumps). This flag is 4884enabled by default at @option{-O} and higher. 4885 4886@item -ftree-ch 4887Perform loop header copying on trees. This is beneficial since it increases 4888effectiveness of code motion optimizations. It also saves one jump. This flag 4889is enabled by default at @option{-O} and higher. It is not enabled 4890for @option{-Os}, since it usually increases code size. 4891 4892@item -ftree-loop-optimize 4893Perform loop optimizations on trees. This flag is enabled by default 4894at @option{-O} and higher. 4895 4896@item -ftree-loop-linear 4897Perform linear loop transformations on tree. This flag can improve cache 4898performance and allow further loop optimizations to take place. 4899 4900@item -ftree-loop-im 4901Perform loop invariant motion on trees. This pass moves only invariants that 4902would be hard to handle at RTL level (function calls, operations that expand to 4903nontrivial sequences of insns). With @option{-funswitch-loops} it also moves 4904operands of conditions that are invariant out of the loop, so that we can use 4905just trivial invariantness analysis in loop unswitching. The pass also includes 4906store motion. 4907 4908@item -ftree-loop-ivcanon 4909Create a canonical counter for number of iterations in the loop for that 4910determining number of iterations requires complicated analysis. Later 4911optimizations then may determine the number easily. Useful especially 4912in connection with unrolling. 4913 4914@item -fivopts 4915Perform induction variable optimizations (strength reduction, induction 4916variable merging and induction variable elimination) on trees. 4917 4918@item -ftree-sra 4919Perform scalar replacement of aggregates. This pass replaces structure 4920references with scalars to prevent committing structures to memory too 4921early. This flag is enabled by default at @option{-O} and higher. 4922 4923@item -ftree-copyrename 4924Perform copy renaming on trees. This pass attempts to rename compiler 4925temporaries to other variables at copy locations, usually resulting in 4926variable names which more closely resemble the original variables. This flag 4927is enabled by default at @option{-O} and higher. 4928 4929@item -ftree-ter 4930Perform temporary expression replacement during the SSA->normal phase. Single 4931use/single def temporaries are replaced at their use location with their 4932defining expression. This results in non-GIMPLE code, but gives the expanders 4933much more complex trees to work on resulting in better RTL generation. This is 4934enabled by default at @option{-O} and higher. 4935 4936@item -ftree-lrs 4937Perform live range splitting during the SSA->normal phase. Distinct live 4938ranges of a variable are split into unique variables, allowing for better 4939optimization later. This is enabled by default at @option{-O} and higher. 4940 4941@item -ftree-vectorize 4942Perform loop vectorization on trees. 4943 4944@item -ftree-vect-loop-version 4945@opindex ftree-vect-loop-version 4946Perform loop versioning when doing loop vectorization on trees. When a loop 4947appears to be vectorizable except that data alignment or data dependence cannot 4948be determined at compile time then vectorized and non-vectorized versions of 4949the loop are generated along with runtime checks for alignment or dependence 4950to control which version is executed. This option is enabled by default 4951except at level @option{-Os} where it is disabled. 4952 4953@item -ftree-vrp 4954Perform Value Range Propagation on trees. This is similar to the 4955constant propagation pass, but instead of values, ranges of values are 4956propagated. This allows the optimizers to remove unnecessary range 4957checks like array bound checks and null pointer checks. This is 4958enabled by default at @option{-O2} and higher. Null pointer check 4959elimination is only done if @option{-fdelete-null-pointer-checks} is 4960enabled. 4961 4962@item -ftracer 4963@opindex ftracer 4964Perform tail duplication to enlarge superblock size. This transformation 4965simplifies the control flow of the function allowing other optimizations to do 4966better job. 4967 4968@item -funroll-loops 4969@opindex funroll-loops 4970Unroll loops whose number of iterations can be determined at compile 4971time or upon entry to the loop. @option{-funroll-loops} implies 4972@option{-frerun-cse-after-loop}. This option makes code larger, 4973and may or may not make it run faster. 4974 4975@item -funroll-all-loops 4976@opindex funroll-all-loops 4977Unroll all loops, even if their number of iterations is uncertain when 4978the loop is entered. This usually makes programs run more slowly. 4979@option{-funroll-all-loops} implies the same options as 4980@option{-funroll-loops}, 4981 4982@item -fsplit-ivs-in-unroller 4983@opindex fsplit-ivs-in-unroller 4984Enables expressing of values of induction variables in later iterations 4985of the unrolled loop using the value in the first iteration. This breaks 4986long dependency chains, thus improving efficiency of the scheduling passes. 4987 4988Combination of @option{-fweb} and CSE is often sufficient to obtain the 4989same effect. However in cases the loop body is more complicated than 4990a single basic block, this is not reliable. It also does not work at all 4991on some of the architectures due to restrictions in the CSE pass. 4992 4993This optimization is enabled by default. 4994 4995@item -fvariable-expansion-in-unroller 4996@opindex fvariable-expansion-in-unroller 4997With this option, the compiler will create multiple copies of some 4998local variables when unrolling a loop which can result in superior code. 4999 5000@item -fprefetch-loop-arrays 5001@opindex fprefetch-loop-arrays 5002If supported by the target machine, generate instructions to prefetch 5003memory to improve the performance of loops that access large arrays. 5004 5005This option may generate better or worse code; results are highly 5006dependent on the structure of loops within the source code. 5007 5008Disabled at level @option{-Os}. 5009 5010@item -fno-peephole 5011@itemx -fno-peephole2 5012@opindex fno-peephole 5013@opindex fno-peephole2 5014Disable any machine-specific peephole optimizations. The difference 5015between @option{-fno-peephole} and @option{-fno-peephole2} is in how they 5016are implemented in the compiler; some targets use one, some use the 5017other, a few use both. 5018 5019@option{-fpeephole} is enabled by default. 5020@option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 5021 5022@item -fno-guess-branch-probability 5023@opindex fno-guess-branch-probability 5024Do not guess branch probabilities using heuristics. 5025 5026GCC will use heuristics to guess branch probabilities if they are 5027not provided by profiling feedback (@option{-fprofile-arcs}). These 5028heuristics are based on the control flow graph. If some branch probabilities 5029are specified by @samp{__builtin_expect}, then the heuristics will be 5030used to guess branch probabilities for the rest of the control flow graph, 5031taking the @samp{__builtin_expect} info into account. The interactions 5032between the heuristics and @samp{__builtin_expect} can be complex, and in 5033some cases, it may be useful to disable the heuristics so that the effects 5034of @samp{__builtin_expect} are easier to understand. 5035 5036The default is @option{-fguess-branch-probability} at levels 5037@option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 5038 5039@item -freorder-blocks 5040@opindex freorder-blocks 5041Reorder basic blocks in the compiled function in order to reduce number of 5042taken branches and improve code locality. 5043 5044Enabled at levels @option{-O2}, @option{-O3}. 5045 5046@item -freorder-blocks-and-partition 5047@opindex freorder-blocks-and-partition 5048In addition to reordering basic blocks in the compiled function, in order 5049to reduce number of taken branches, partitions hot and cold basic blocks 5050into separate sections of the assembly and .o files, to improve 5051paging and cache locality performance. 5052 5053This optimization is automatically turned off in the presence of 5054exception handling, for linkonce sections, for functions with a user-defined 5055section attribute and on any architecture that does not support named 5056sections. 5057 5058@item -freorder-functions 5059@opindex freorder-functions 5060Reorder functions in the object file in order to 5061improve code locality. This is implemented by using special 5062subsections @code{.text.hot} for most frequently executed functions and 5063@code{.text.unlikely} for unlikely executed functions. Reordering is done by 5064the linker so object file format must support named sections and linker must 5065place them in a reasonable way. 5066 5067Also profile feedback must be available in to make this option effective. See 5068@option{-fprofile-arcs} for details. 5069 5070Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 5071 5072@item -fstrict-aliasing 5073@opindex fstrict-aliasing 5074Allows the compiler to assume the strictest aliasing rules applicable to 5075the language being compiled. For C (and C++), this activates 5076optimizations based on the type of expressions. In particular, an 5077object of one type is assumed never to reside at the same address as an 5078object of a different type, unless the types are almost the same. For 5079example, an @code{unsigned int} can alias an @code{int}, but not a 5080@code{void*} or a @code{double}. A character type may alias any other 5081type. 5082 5083Pay special attention to code like this: 5084@smallexample 5085union a_union @{ 5086 int i; 5087 double d; 5088@}; 5089 5090int f() @{ 5091 a_union t; 5092 t.d = 3.0; 5093 return t.i; 5094@} 5095@end smallexample 5096The practice of reading from a different union member than the one most 5097recently written to (called ``type-punning'') is common. Even with 5098@option{-fstrict-aliasing}, type-punning is allowed, provided the memory 5099is accessed through the union type. So, the code above will work as 5100expected. However, this code might not: 5101@smallexample 5102int f() @{ 5103 a_union t; 5104 int* ip; 5105 t.d = 3.0; 5106 ip = &t.i; 5107 return *ip; 5108@} 5109@end smallexample 5110 5111Every language that wishes to perform language-specific alias analysis 5112should define a function that computes, given an @code{tree} 5113node, an alias set for the node. Nodes in different alias sets are not 5114allowed to alias. For an example, see the C front-end function 5115@code{c_get_alias_set}. 5116 5117Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 5118 5119@item -fstrict-overflow 5120@opindex fstrict-overflow 5121Allow the compiler to assume strict signed overflow rules, depending 5122on the language being compiled. For C (and C++) this means that 5123overflow when doing arithmetic with signed numbers is undefined, which 5124means that the compiler may assume that it will not happen. This 5125permits various optimizations. For example, the compiler will assume 5126that an expression like @code{i + 10 > i} will always be true for 5127signed @code{i}. This assumption is only valid if signed overflow is 5128undefined, as the expression is false if @code{i + 10} overflows when 5129using twos complement arithmetic. When this option is in effect any 5130attempt to determine whether an operation on signed numbers will 5131overflow must be written carefully to not actually involve overflow. 5132 5133See also the @option{-fwrapv} option. Using @option{-fwrapv} means 5134that signed overflow is fully defined: it wraps. When 5135@option{-fwrapv} is used, there is no difference between 5136@option{-fstrict-overflow} and @option{-fno-strict-overflow}. With 5137@option{-fwrapv} certain types of overflow are permitted. For 5138example, if the compiler gets an overflow when doing arithmetic on 5139constants, the overflowed value can still be used with 5140@option{-fwrapv}, but not otherwise. 5141 5142The @option{-fstrict-overflow} option is enabled at levels 5143@option{-O2}, @option{-O3}, @option{-Os}. 5144 5145@item -falign-functions 5146@itemx -falign-functions=@var{n} 5147@opindex falign-functions 5148Align the start of functions to the next power-of-two greater than 5149@var{n}, skipping up to @var{n} bytes. For instance, 5150@option{-falign-functions=32} aligns functions to the next 32-byte 5151boundary, but @option{-falign-functions=24} would align to the next 515232-byte boundary only if this can be done by skipping 23 bytes or less. 5153 5154@option{-fno-align-functions} and @option{-falign-functions=1} are 5155equivalent and mean that functions will not be aligned. 5156 5157Some assemblers only support this flag when @var{n} is a power of two; 5158in that case, it is rounded up. 5159 5160If @var{n} is not specified or is zero, use a machine-dependent default. 5161 5162Enabled at levels @option{-O2}, @option{-O3}. 5163 5164@item -falign-labels 5165@itemx -falign-labels=@var{n} 5166@opindex falign-labels 5167Align all branch targets to a power-of-two boundary, skipping up to 5168@var{n} bytes like @option{-falign-functions}. This option can easily 5169make code slower, because it must insert dummy operations for when the 5170branch target is reached in the usual flow of the code. 5171 5172@option{-fno-align-labels} and @option{-falign-labels=1} are 5173equivalent and mean that labels will not be aligned. 5174 5175If @option{-falign-loops} or @option{-falign-jumps} are applicable and 5176are greater than this value, then their values are used instead. 5177 5178If @var{n} is not specified or is zero, use a machine-dependent default 5179which is very likely to be @samp{1}, meaning no alignment. 5180 5181Enabled at levels @option{-O2}, @option{-O3}. 5182 5183@item -falign-loops 5184@itemx -falign-loops=@var{n} 5185@opindex falign-loops 5186Align loops to a power-of-two boundary, skipping up to @var{n} bytes 5187like @option{-falign-functions}. The hope is that the loop will be 5188executed many times, which will make up for any execution of the dummy 5189operations. 5190 5191@option{-fno-align-loops} and @option{-falign-loops=1} are 5192equivalent and mean that loops will not be aligned. 5193 5194If @var{n} is not specified or is zero, use a machine-dependent default. 5195 5196Enabled at levels @option{-O2}, @option{-O3}. 5197 5198@item -falign-jumps 5199@itemx -falign-jumps=@var{n} 5200@opindex falign-jumps 5201Align branch targets to a power-of-two boundary, for branch targets 5202where the targets can only be reached by jumping, skipping up to @var{n} 5203bytes like @option{-falign-functions}. In this case, no dummy operations 5204need be executed. 5205 5206@option{-fno-align-jumps} and @option{-falign-jumps=1} are 5207equivalent and mean that loops will not be aligned. 5208 5209If @var{n} is not specified or is zero, use a machine-dependent default. 5210 5211Enabled at levels @option{-O2}, @option{-O3}. 5212 5213@item -funit-at-a-time 5214@opindex funit-at-a-time 5215Parse the whole compilation unit before starting to produce code. 5216This allows some extra optimizations to take place but consumes 5217more memory (in general). There are some compatibility issues 5218with @emph{unit-at-a-time} mode: 5219@itemize @bullet 5220@item 5221enabling @emph{unit-at-a-time} mode may change the order 5222in which functions, variables, and top-level @code{asm} statements 5223are emitted, and will likely break code relying on some particular 5224ordering. The majority of such top-level @code{asm} statements, 5225though, can be replaced by @code{section} attributes. The 5226@option{fno-toplevel-reorder} option may be used to keep the ordering 5227used in the input file, at the cost of some optimizations. 5228 5229@item 5230@emph{unit-at-a-time} mode removes unreferenced static variables 5231and functions. This may result in undefined references 5232when an @code{asm} statement refers directly to variables or functions 5233that are otherwise unused. In that case either the variable/function 5234shall be listed as an operand of the @code{asm} statement operand or, 5235in the case of top-level @code{asm} statements the attribute @code{used} 5236shall be used on the declaration. 5237 5238@item 5239Static functions now can use non-standard passing conventions that 5240may break @code{asm} statements calling functions directly. Again, 5241attribute @code{used} will prevent this behavior. 5242@end itemize 5243 5244As a temporary workaround, @option{-fno-unit-at-a-time} can be used, 5245but this scheme may not be supported by future releases of GCC@. 5246 5247Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 5248 5249@item -fno-toplevel-reorder 5250Do not reorder top-level functions, variables, and @code{asm} 5251statements. Output them in the same order that they appear in the 5252input file. When this option is used, unreferenced static variables 5253will not be removed. This option is intended to support existing code 5254which relies on a particular ordering. For new code, it is better to 5255use attributes. 5256 5257@item -fweb 5258@opindex fweb 5259Constructs webs as commonly used for register allocation purposes and assign 5260each web individual pseudo register. This allows the register allocation pass 5261to operate on pseudos directly, but also strengthens several other optimization 5262passes, such as CSE, loop optimizer and trivial dead code remover. It can, 5263however, make debugging impossible, since variables will no longer stay in a 5264``home register''. 5265 5266Enabled by default with @option{-funroll-loops}. 5267 5268@item -fwhole-program 5269@opindex fwhole-program 5270Assume that the current compilation unit represents whole program being 5271compiled. All public functions and variables with the exception of @code{main} 5272and those merged by attribute @code{externally_visible} become static functions 5273and in a affect gets more aggressively optimized by interprocedural optimizers. 5274While this option is equivalent to proper use of @code{static} keyword for 5275programs consisting of single file, in combination with option 5276@option{--combine} this flag can be used to compile most of smaller scale C 5277programs since the functions and variables become local for the whole combined 5278compilation unit, not for the single source file itself. 5279 5280 5281@item -fno-cprop-registers 5282@opindex fno-cprop-registers 5283After register allocation and post-register allocation instruction splitting, 5284we perform a copy-propagation pass to try to reduce scheduling dependencies 5285and occasionally eliminate the copy. 5286 5287Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 5288 5289@item -fprofile-generate 5290@opindex fprofile-generate 5291 5292Enable options usually used for instrumenting application to produce 5293profile useful for later recompilation with profile feedback based 5294optimization. You must use @option{-fprofile-generate} both when 5295compiling and when linking your program. 5296 5297The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}. 5298 5299@item -fprofile-use 5300@opindex fprofile-use 5301Enable profile feedback directed optimizations, and optimizations 5302generally profitable only with profile feedback available. 5303 5304The following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt}, 5305@code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer} 5306 5307@end table 5308 5309The following options control compiler behavior regarding floating 5310point arithmetic. These options trade off between speed and 5311correctness. All must be specifically enabled. 5312 5313@table @gcctabopt 5314@item -ffloat-store 5315@opindex ffloat-store 5316Do not store floating point variables in registers, and inhibit other 5317options that might change whether a floating point value is taken from a 5318register or memory. 5319 5320@cindex floating point precision 5321This option prevents undesirable excess precision on machines such as 5322the 68000 where the floating registers (of the 68881) keep more 5323precision than a @code{double} is supposed to have. Similarly for the 5324x86 architecture. For most programs, the excess precision does only 5325good, but a few programs rely on the precise definition of IEEE floating 5326point. Use @option{-ffloat-store} for such programs, after modifying 5327them to store all pertinent intermediate computations into variables. 5328 5329@item -ffast-math 5330@opindex ffast-math 5331Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, @* 5332@option{-fno-trapping-math}, @option{-ffinite-math-only}, 5333@option{-fno-rounding-math}, @option{-fno-signaling-nans} 5334and @option{fcx-limited-range}. 5335 5336This option causes the preprocessor macro @code{__FAST_MATH__} to be defined. 5337 5338This option should never be turned on by any @option{-O} option since 5339it can result in incorrect output for programs which depend on 5340an exact implementation of IEEE or ISO rules/specifications for 5341math functions. 5342 5343@item -fno-math-errno 5344@opindex fno-math-errno 5345Do not set ERRNO after calling math functions that are executed 5346with a single instruction, e.g., sqrt. A program that relies on 5347IEEE exceptions for math error handling may want to use this flag 5348for speed while maintaining IEEE arithmetic compatibility. 5349 5350This option should never be turned on by any @option{-O} option since 5351it can result in incorrect output for programs which depend on 5352an exact implementation of IEEE or ISO rules/specifications for 5353math functions. 5354 5355The default is @option{-fmath-errno}. 5356 5357On Darwin and FreeBSD systems, the math library never sets @code{errno}. 5358There is therefore 5359no reason for the compiler to consider the possibility that it might, 5360and @option{-fno-math-errno} is the default. 5361 5362@item -funsafe-math-optimizations 5363@opindex funsafe-math-optimizations 5364Allow optimizations for floating-point arithmetic that (a) assume 5365that arguments and results are valid and (b) may violate IEEE or 5366ANSI standards. When used at link-time, it may include libraries 5367or startup files that change the default FPU control word or other 5368similar optimizations. 5369 5370This option should never be turned on by any @option{-O} option since 5371it can result in incorrect output for programs which depend on 5372an exact implementation of IEEE or ISO rules/specifications for 5373math functions. 5374 5375The default is @option{-fno-unsafe-math-optimizations}. 5376 5377@item -ffinite-math-only 5378@opindex ffinite-math-only 5379Allow optimizations for floating-point arithmetic that assume 5380that arguments and results are not NaNs or +-Infs. 5381 5382This option should never be turned on by any @option{-O} option since 5383it can result in incorrect output for programs which depend on 5384an exact implementation of IEEE or ISO rules/specifications. 5385 5386The default is @option{-fno-finite-math-only}. 5387 5388@item -fno-trapping-math 5389@opindex fno-trapping-math 5390Compile code assuming that floating-point operations cannot generate 5391user-visible traps. These traps include division by zero, overflow, 5392underflow, inexact result and invalid operation. This option implies 5393@option{-fno-signaling-nans}. Setting this option may allow faster 5394code if one relies on ``non-stop'' IEEE arithmetic, for example. 5395 5396This option should never be turned on by any @option{-O} option since 5397it can result in incorrect output for programs which depend on 5398an exact implementation of IEEE or ISO rules/specifications for 5399math functions. 5400 5401The default is @option{-ftrapping-math}. 5402 5403@item -frounding-math 5404@opindex frounding-math 5405Disable transformations and optimizations that assume default floating 5406point rounding behavior. This is round-to-zero for all floating point 5407to integer conversions, and round-to-nearest for all other arithmetic 5408truncations. This option should be specified for programs that change 5409the FP rounding mode dynamically, or that may be executed with a 5410non-default rounding mode. This option disables constant folding of 5411floating point expressions at compile-time (which may be affected by 5412rounding mode) and arithmetic transformations that are unsafe in the 5413presence of sign-dependent rounding modes. 5414 5415The default is @option{-fno-rounding-math}. 5416 5417This option is experimental and does not currently guarantee to 5418disable all GCC optimizations that are affected by rounding mode. 5419Future versions of GCC may provide finer control of this setting 5420using C99's @code{FENV_ACCESS} pragma. This command line option 5421will be used to specify the default state for @code{FENV_ACCESS}. 5422 5423@item -frtl-abstract-sequences 5424@opindex frtl-abstract-sequences 5425It is a size optimization method. This option is to find identical 5426sequences of code, which can be turned into pseudo-procedures and 5427then replace all occurrences with calls to the newly created 5428subroutine. It is kind of an opposite of @option{-finline-functions}. 5429This optimization runs at RTL level. 5430 5431@item -fsignaling-nans 5432@opindex fsignaling-nans 5433Compile code assuming that IEEE signaling NaNs may generate user-visible 5434traps during floating-point operations. Setting this option disables 5435optimizations that may change the number of exceptions visible with 5436signaling NaNs. This option implies @option{-ftrapping-math}. 5437 5438This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to 5439be defined. 5440 5441The default is @option{-fno-signaling-nans}. 5442 5443This option is experimental and does not currently guarantee to 5444disable all GCC optimizations that affect signaling NaN behavior. 5445 5446@item -fsingle-precision-constant 5447@opindex fsingle-precision-constant 5448Treat floating point constant as single precision constant instead of 5449implicitly converting it to double precision constant. 5450 5451@item -fcx-limited-range 5452@itemx -fno-cx-limited-range 5453@opindex fcx-limited-range 5454@opindex fno-cx-limited-range 5455When enabled, this option states that a range reduction step is not 5456needed when performing complex division. The default is 5457@option{-fno-cx-limited-range}, but is enabled by @option{-ffast-math}. 5458 5459This option controls the default setting of the ISO C99 5460@code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to 5461all languages. 5462 5463@end table 5464 5465The following options control optimizations that may improve 5466performance, but are not enabled by any @option{-O} options. This 5467section includes experimental options that may produce broken code. 5468 5469@table @gcctabopt 5470@item -fbranch-probabilities 5471@opindex fbranch-probabilities 5472After running a program compiled with @option{-fprofile-arcs} 5473(@pxref{Debugging Options,, Options for Debugging Your Program or 5474@command{gcc}}), you can compile it a second time using 5475@option{-fbranch-probabilities}, to improve optimizations based on 5476the number of times each branch was taken. When the program 5477compiled with @option{-fprofile-arcs} exits it saves arc execution 5478counts to a file called @file{@var{sourcename}.gcda} for each source 5479file The information in this data file is very dependent on the 5480structure of the generated code, so you must use the same source code 5481and the same optimization options for both compilations. 5482 5483With @option{-fbranch-probabilities}, GCC puts a 5484@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}. 5485These can be used to improve optimization. Currently, they are only 5486used in one place: in @file{reorg.c}, instead of guessing which path a 5487branch is mostly to take, the @samp{REG_BR_PROB} values are used to 5488exactly determine which path is taken more often. 5489 5490@item -fprofile-values 5491@opindex fprofile-values 5492If combined with @option{-fprofile-arcs}, it adds code so that some 5493data about values of expressions in the program is gathered. 5494 5495With @option{-fbranch-probabilities}, it reads back the data gathered 5496from profiling values of expressions and adds @samp{REG_VALUE_PROFILE} 5497notes to instructions for their later usage in optimizations. 5498 5499Enabled with @option{-fprofile-generate} and @option{-fprofile-use}. 5500 5501@item -fvpt 5502@opindex fvpt 5503If combined with @option{-fprofile-arcs}, it instructs the compiler to add 5504a code to gather information about values of expressions. 5505 5506With @option{-fbranch-probabilities}, it reads back the data gathered 5507and actually performs the optimizations based on them. 5508Currently the optimizations include specialization of division operation 5509using the knowledge about the value of the denominator. 5510 5511@item -frename-registers 5512@opindex frename-registers 5513Attempt to avoid false dependencies in scheduled code by making use 5514of registers left over after register allocation. This optimization 5515will most benefit processors with lots of registers. Depending on the 5516debug information format adopted by the target, however, it can 5517make debugging impossible, since variables will no longer stay in 5518a ``home register''. 5519 5520Enabled by default with @option{-funroll-loops}. 5521 5522@item -ftracer 5523@opindex ftracer 5524Perform tail duplication to enlarge superblock size. This transformation 5525simplifies the control flow of the function allowing other optimizations to do 5526better job. 5527 5528Enabled with @option{-fprofile-use}. 5529 5530@item -funroll-loops 5531@opindex funroll-loops 5532Unroll loops whose number of iterations can be determined at compile time or 5533upon entry to the loop. @option{-funroll-loops} implies 5534@option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}. 5535It also turns on complete loop peeling (i.e.@: complete removal of loops with 5536small constant number of iterations). This option makes code larger, and may 5537or may not make it run faster. 5538 5539Enabled with @option{-fprofile-use}. 5540 5541@item -funroll-all-loops 5542@opindex funroll-all-loops 5543Unroll all loops, even if their number of iterations is uncertain when 5544the loop is entered. This usually makes programs run more slowly. 5545@option{-funroll-all-loops} implies the same options as 5546@option{-funroll-loops}. 5547 5548@item -fpeel-loops 5549@opindex fpeel-loops 5550Peels the loops for that there is enough information that they do not 5551roll much (from profile feedback). It also turns on complete loop peeling 5552(i.e.@: complete removal of loops with small constant number of iterations). 5553 5554Enabled with @option{-fprofile-use}. 5555 5556@item -fmove-loop-invariants 5557@opindex fmove-loop-invariants 5558Enables the loop invariant motion pass in the RTL loop optimizer. Enabled 5559at level @option{-O1} 5560 5561@item -funswitch-loops 5562@opindex funswitch-loops 5563Move branches with loop invariant conditions out of the loop, with duplicates 5564of the loop on both branches (modified according to result of the condition). 5565 5566@item -ffunction-sections 5567@itemx -fdata-sections 5568@opindex ffunction-sections 5569@opindex fdata-sections 5570Place each function or data item into its own section in the output 5571file if the target supports arbitrary sections. The name of the 5572function or the name of the data item determines the section's name 5573in the output file. 5574 5575Use these options on systems where the linker can perform optimizations 5576to improve locality of reference in the instruction space. Most systems 5577using the ELF object format and SPARC processors running Solaris 2 have 5578linkers with such optimizations. AIX may have these optimizations in 5579the future. 5580 5581Only use these options when there are significant benefits from doing 5582so. When you specify these options, the assembler and linker will 5583create larger object and executable files and will also be slower. 5584You will not be able to use @code{gprof} on all systems if you 5585specify this option and you may have problems with debugging if 5586you specify both this option and @option{-g}. 5587 5588@item -fbranch-target-load-optimize 5589@opindex fbranch-target-load-optimize 5590Perform branch target register load optimization before prologue / epilogue 5591threading. 5592The use of target registers can typically be exposed only during reload, 5593thus hoisting loads out of loops and doing inter-block scheduling needs 5594a separate optimization pass. 5595 5596@item -fbranch-target-load-optimize2 5597@opindex fbranch-target-load-optimize2 5598Perform branch target register load optimization after prologue / epilogue 5599threading. 5600 5601@item -fbtr-bb-exclusive 5602@opindex fbtr-bb-exclusive 5603When performing branch target register load optimization, don't reuse 5604branch target registers in within any basic block. 5605 5606@item -fstack-protector 5607Emit extra code to check for buffer overflows, such as stack smashing 5608attacks. This is done by adding a guard variable to functions with 5609vulnerable objects. This includes functions that call alloca, and 5610functions with buffers larger than 8 bytes. The guards are initialized 5611when a function is entered and then checked when the function exits. 5612If a guard check fails, an error message is printed and the program exits. 5613 5614@item -fstack-protector-all 5615Like @option{-fstack-protector} except that all functions are protected. 5616 5617@item -fsection-anchors 5618@opindex fsection-anchors 5619Try to reduce the number of symbolic address calculations by using 5620shared ``anchor'' symbols to address nearby objects. This transformation 5621can help to reduce the number of GOT entries and GOT accesses on some 5622targets. 5623 5624For example, the implementation of the following function @code{foo}: 5625 5626@smallexample 5627static int a, b, c; 5628int foo (void) @{ return a + b + c; @} 5629@end smallexample 5630 5631would usually calculate the addresses of all three variables, but if you 5632compile it with @option{-fsection-anchors}, it will access the variables 5633from a common anchor point instead. The effect is similar to the 5634following pseudocode (which isn't valid C): 5635 5636@smallexample 5637int foo (void) 5638@{ 5639 register int *xr = &x; 5640 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x]; 5641@} 5642@end smallexample 5643 5644Not all targets support this option. 5645 5646@item --param @var{name}=@var{value} 5647@opindex param 5648In some places, GCC uses various constants to control the amount of 5649optimization that is done. For example, GCC will not inline functions 5650that contain more that a certain number of instructions. You can 5651control some of these constants on the command-line using the 5652@option{--param} option. 5653 5654The names of specific parameters, and the meaning of the values, are 5655tied to the internals of the compiler, and are subject to change 5656without notice in future releases. 5657 5658In each case, the @var{value} is an integer. The allowable choices for 5659@var{name} are given in the following table: 5660 5661@table @gcctabopt 5662@item salias-max-implicit-fields 5663The maximum number of fields in a variable without direct 5664structure accesses for which structure aliasing will consider trying 5665to track each field. The default is 5 5666 5667@item salias-max-array-elements 5668The maximum number of elements an array can have and its elements 5669still be tracked individually by structure aliasing. The default is 4 5670 5671@item sra-max-structure-size 5672The maximum structure size, in bytes, at which the scalar replacement 5673of aggregates (SRA) optimization will perform block copies. The 5674default value, 0, implies that GCC will select the most appropriate 5675size itself. 5676 5677@item sra-field-structure-ratio 5678The threshold ratio (as a percentage) between instantiated fields and 5679the complete structure size. We say that if the ratio of the number 5680of bytes in instantiated fields to the number of bytes in the complete 5681structure exceeds this parameter, then block copies are not used. The 5682default is 75. 5683 5684@item max-crossjump-edges 5685The maximum number of incoming edges to consider for crossjumping. 5686The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in 5687the number of edges incoming to each block. Increasing values mean 5688more aggressive optimization, making the compile time increase with 5689probably small improvement in executable size. 5690 5691@item min-crossjump-insns 5692The minimum number of instructions which must be matched at the end 5693of two blocks before crossjumping will be performed on them. This 5694value is ignored in the case where all instructions in the block being 5695crossjumped from are matched. The default value is 5. 5696 5697@item max-grow-copy-bb-insns 5698The maximum code size expansion factor when copying basic blocks 5699instead of jumping. The expansion is relative to a jump instruction. 5700The default value is 8. 5701 5702@item max-goto-duplication-insns 5703The maximum number of instructions to duplicate to a block that jumps 5704to a computed goto. To avoid @math{O(N^2)} behavior in a number of 5705passes, GCC factors computed gotos early in the compilation process, 5706and unfactors them as late as possible. Only computed jumps at the 5707end of a basic blocks with no more than max-goto-duplication-insns are 5708unfactored. The default value is 8. 5709 5710@item max-delay-slot-insn-search 5711The maximum number of instructions to consider when looking for an 5712instruction to fill a delay slot. If more than this arbitrary number of 5713instructions is searched, the time savings from filling the delay slot 5714will be minimal so stop searching. Increasing values mean more 5715aggressive optimization, making the compile time increase with probably 5716small improvement in executable run time. 5717 5718@item max-delay-slot-live-search 5719When trying to fill delay slots, the maximum number of instructions to 5720consider when searching for a block with valid live register 5721information. Increasing this arbitrarily chosen value means more 5722aggressive optimization, increasing the compile time. This parameter 5723should be removed when the delay slot code is rewritten to maintain the 5724control-flow graph. 5725 5726@item max-gcse-memory 5727The approximate maximum amount of memory that will be allocated in 5728order to perform the global common subexpression elimination 5729optimization. If more memory than specified is required, the 5730optimization will not be done. 5731 5732@item max-gcse-passes 5733The maximum number of passes of GCSE to run. The default is 1. 5734 5735@item max-pending-list-length 5736The maximum number of pending dependencies scheduling will allow 5737before flushing the current state and starting over. Large functions 5738with few branches or calls can create excessively large lists which 5739needlessly consume memory and resources. 5740 5741@item max-inline-insns-single 5742Several parameters control the tree inliner used in gcc. 5743This number sets the maximum number of instructions (counted in GCC's 5744internal representation) in a single function that the tree inliner 5745will consider for inlining. This only affects functions declared 5746inline and methods implemented in a class declaration (C++). 5747The default value is 450. 5748 5749@item max-inline-insns-auto 5750When you use @option{-finline-functions} (included in @option{-O3}), 5751a lot of functions that would otherwise not be considered for inlining 5752by the compiler will be investigated. To those functions, a different 5753(more restrictive) limit compared to functions declared inline can 5754be applied. 5755The default value is 90. 5756 5757@item large-function-insns 5758The limit specifying really large functions. For functions larger than this 5759limit after inlining inlining is constrained by 5760@option{--param large-function-growth}. This parameter is useful primarily 5761to avoid extreme compilation time caused by non-linear algorithms used by the 5762backend. 5763This parameter is ignored when @option{-funit-at-a-time} is not used. 5764The default value is 2700. 5765 5766@item large-function-growth 5767Specifies maximal growth of large function caused by inlining in percents. 5768This parameter is ignored when @option{-funit-at-a-time} is not used. 5769The default value is 100 which limits large function growth to 2.0 times 5770the original size. 5771 5772@item large-unit-insns 5773The limit specifying large translation unit. Growth caused by inlining of 5774units larger than this limit is limited by @option{--param inline-unit-growth}. 5775For small units this might be too tight (consider unit consisting of function A 5776that is inline and B that just calls A three time. If B is small relative to 5777A, the growth of unit is 300\% and yet such inlining is very sane. For very 5778large units consisting of small inlininable functions however the overall unit 5779growth limit is needed to avoid exponential explosion of code size. Thus for 5780smaller units, the size is increased to @option{--param large-unit-insns} 5781before applying @option{--param inline-unit-growth}. The default is 10000 5782 5783@item inline-unit-growth 5784Specifies maximal overall growth of the compilation unit caused by inlining. 5785This parameter is ignored when @option{-funit-at-a-time} is not used. 5786The default value is 50 which limits unit growth to 1.5 times the original 5787size. 5788 5789@item max-inline-insns-recursive 5790@itemx max-inline-insns-recursive-auto 5791Specifies maximum number of instructions out-of-line copy of self recursive inline 5792function can grow into by performing recursive inlining. 5793 5794For functions declared inline @option{--param max-inline-insns-recursive} is 5795taken into account. For function not declared inline, recursive inlining 5796happens only when @option{-finline-functions} (included in @option{-O3}) is 5797enabled and @option{--param max-inline-insns-recursive-auto} is used. The 5798default value is 450. 5799 5800@item max-inline-recursive-depth 5801@itemx max-inline-recursive-depth-auto 5802Specifies maximum recursion depth used by the recursive inlining. 5803 5804For functions declared inline @option{--param max-inline-recursive-depth} is 5805taken into account. For function not declared inline, recursive inlining 5806happens only when @option{-finline-functions} (included in @option{-O3}) is 5807enabled and @option{--param max-inline-recursive-depth-auto} is used. The 5808default value is 450. 5809 5810@item min-inline-recursive-probability 5811Recursive inlining is profitable only for function having deep recursion 5812in average and can hurt for function having little recursion depth by 5813increasing the prologue size or complexity of function body to other 5814optimizers. 5815 5816When profile feedback is available (see @option{-fprofile-generate}) the actual 5817recursion depth can be guessed from probability that function will recurse via 5818given call expression. This parameter limits inlining only to call expression 5819whose probability exceeds given threshold (in percents). The default value is 582010. 5821 5822@item inline-call-cost 5823Specify cost of call instruction relative to simple arithmetics operations 5824(having cost of 1). Increasing this cost disqualifies inlining of non-leaf 5825functions and at the same time increases size of leaf function that is believed to 5826reduce function size by being inlined. In effect it increases amount of 5827inlining for code having large abstraction penalty (many functions that just 5828pass the arguments to other functions) and decrease inlining for code with low 5829abstraction penalty. The default value is 16. 5830 5831@item max-unrolled-insns 5832The maximum number of instructions that a loop should have if that loop 5833is unrolled, and if the loop is unrolled, it determines how many times 5834the loop code is unrolled. 5835 5836@item max-average-unrolled-insns 5837The maximum number of instructions biased by probabilities of their execution 5838that a loop should have if that loop is unrolled, and if the loop is unrolled, 5839it determines how many times the loop code is unrolled. 5840 5841@item max-unroll-times 5842The maximum number of unrollings of a single loop. 5843 5844@item max-peeled-insns 5845The maximum number of instructions that a loop should have if that loop 5846is peeled, and if the loop is peeled, it determines how many times 5847the loop code is peeled. 5848 5849@item max-peel-times 5850The maximum number of peelings of a single loop. 5851 5852@item max-completely-peeled-insns 5853The maximum number of insns of a completely peeled loop. 5854 5855@item max-completely-peel-times 5856The maximum number of iterations of a loop to be suitable for complete peeling. 5857 5858@item max-unswitch-insns 5859The maximum number of insns of an unswitched loop. 5860 5861@item max-unswitch-level 5862The maximum number of branches unswitched in a single loop. 5863 5864@item lim-expensive 5865The minimum cost of an expensive expression in the loop invariant motion. 5866 5867@item iv-consider-all-candidates-bound 5868Bound on number of candidates for induction variables below that 5869all candidates are considered for each use in induction variable 5870optimizations. Only the most relevant candidates are considered 5871if there are more candidates, to avoid quadratic time complexity. 5872 5873@item iv-max-considered-uses 5874The induction variable optimizations give up on loops that contain more 5875induction variable uses. 5876 5877@item iv-always-prune-cand-set-bound 5878If number of candidates in the set is smaller than this value, 5879we always try to remove unnecessary ivs from the set during its 5880optimization when a new iv is added to the set. 5881 5882@item scev-max-expr-size 5883Bound on size of expressions used in the scalar evolutions analyzer. 5884Large expressions slow the analyzer. 5885 5886@item vect-max-version-checks 5887The maximum number of runtime checks that can be performed when doing 5888loop versioning in the vectorizer. See option ftree-vect-loop-version 5889for more information. 5890 5891@item max-iterations-to-track 5892 5893The maximum number of iterations of a loop the brute force algorithm 5894for analysis of # of iterations of the loop tries to evaluate. 5895 5896@item hot-bb-count-fraction 5897Select fraction of the maximal count of repetitions of basic block in program 5898given basic block needs to have to be considered hot. 5899 5900@item hot-bb-frequency-fraction 5901Select fraction of the maximal frequency of executions of basic block in 5902function given basic block needs to have to be considered hot 5903 5904@item max-predicted-iterations 5905The maximum number of loop iterations we predict statically. This is useful 5906in cases where function contain single loop with known bound and other loop 5907with unknown. We predict the known number of iterations correctly, while 5908the unknown number of iterations average to roughly 10. This means that the 5909loop without bounds would appear artificially cold relative to the other one. 5910 5911@item tracer-dynamic-coverage 5912@itemx tracer-dynamic-coverage-feedback 5913 5914This value is used to limit superblock formation once the given percentage of 5915executed instructions is covered. This limits unnecessary code size 5916expansion. 5917 5918The @option{tracer-dynamic-coverage-feedback} is used only when profile 5919feedback is available. The real profiles (as opposed to statically estimated 5920ones) are much less balanced allowing the threshold to be larger value. 5921 5922@item tracer-max-code-growth 5923Stop tail duplication once code growth has reached given percentage. This is 5924rather hokey argument, as most of the duplicates will be eliminated later in 5925cross jumping, so it may be set to much higher values than is the desired code 5926growth. 5927 5928@item tracer-min-branch-ratio 5929 5930Stop reverse growth when the reverse probability of best edge is less than this 5931threshold (in percent). 5932 5933@item tracer-min-branch-ratio 5934@itemx tracer-min-branch-ratio-feedback 5935 5936Stop forward growth if the best edge do have probability lower than this 5937threshold. 5938 5939Similarly to @option{tracer-dynamic-coverage} two values are present, one for 5940compilation for profile feedback and one for compilation without. The value 5941for compilation with profile feedback needs to be more conservative (higher) in 5942order to make tracer effective. 5943 5944@item max-cse-path-length 5945 5946Maximum number of basic blocks on path that cse considers. The default is 10. 5947 5948@item max-cse-insns 5949The maximum instructions CSE process before flushing. The default is 1000. 5950 5951@item global-var-threshold 5952 5953Counts the number of function calls (@var{n}) and the number of 5954call-clobbered variables (@var{v}). If @var{n}x@var{v} is larger than this limit, a 5955single artificial variable will be created to represent all the 5956call-clobbered variables at function call sites. This artificial 5957variable will then be made to alias every call-clobbered variable. 5958(done as @code{int * size_t} on the host machine; beware overflow). 5959 5960@item max-aliased-vops 5961 5962Maximum number of virtual operands allowed to represent aliases 5963before triggering the alias grouping heuristic. Alias grouping 5964reduces compile times and memory consumption needed for aliasing at 5965the expense of precision loss in alias information. 5966 5967@item ggc-min-expand 5968 5969GCC uses a garbage collector to manage its own memory allocation. This 5970parameter specifies the minimum percentage by which the garbage 5971collector's heap should be allowed to expand between collections. 5972Tuning this may improve compilation speed; it has no effect on code 5973generation. 5974 5975The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when 5976RAM >= 1GB@. If @code{getrlimit} is available, the notion of "RAM" is 5977the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If 5978GCC is not able to calculate RAM on a particular platform, the lower 5979bound of 30% is used. Setting this parameter and 5980@option{ggc-min-heapsize} to zero causes a full collection to occur at 5981every opportunity. This is extremely slow, but can be useful for 5982debugging. 5983 5984@item ggc-min-heapsize 5985 5986Minimum size of the garbage collector's heap before it begins bothering 5987to collect garbage. The first collection occurs after the heap expands 5988by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again, 5989tuning this may improve compilation speed, and has no effect on code 5990generation. 5991 5992The default is the smaller of RAM/8, RLIMIT_RSS, or a limit which 5993tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but 5994with a lower bound of 4096 (four megabytes) and an upper bound of 5995131072 (128 megabytes). If GCC is not able to calculate RAM on a 5996particular platform, the lower bound is used. Setting this parameter 5997very large effectively disables garbage collection. Setting this 5998parameter and @option{ggc-min-expand} to zero causes a full collection 5999to occur at every opportunity. 6000 6001@item max-reload-search-insns 6002The maximum number of instruction reload should look backward for equivalent 6003register. Increasing values mean more aggressive optimization, making the 6004compile time increase with probably slightly better performance. The default 6005value is 100. 6006 6007@item max-cselib-memory-locations 6008The maximum number of memory locations cselib should take into account. 6009Increasing values mean more aggressive optimization, making the compile time 6010increase with probably slightly better performance. The default value is 500. 6011 6012@item max-flow-memory-locations 6013Similar as @option{max-cselib-memory-locations} but for dataflow liveness. 6014The default value is 100. 6015 6016@item reorder-blocks-duplicate 6017@itemx reorder-blocks-duplicate-feedback 6018 6019Used by basic block reordering pass to decide whether to use unconditional 6020branch or duplicate the code on its destination. Code is duplicated when its 6021estimated size is smaller than this value multiplied by the estimated size of 6022unconditional jump in the hot spots of the program. 6023 6024The @option{reorder-block-duplicate-feedback} is used only when profile 6025feedback is available and may be set to higher values than 6026@option{reorder-block-duplicate} since information about the hot spots is more 6027accurate. 6028 6029@item max-sched-ready-insns 6030The maximum number of instructions ready to be issued the scheduler should 6031consider at any given time during the first scheduling pass. Increasing 6032values mean more thorough searches, making the compilation time increase 6033with probably little benefit. The default value is 100. 6034 6035@item max-sched-region-blocks 6036The maximum number of blocks in a region to be considered for 6037interblock scheduling. The default value is 10. 6038 6039@item max-sched-region-insns 6040The maximum number of insns in a region to be considered for 6041interblock scheduling. The default value is 100. 6042 6043@item min-spec-prob 6044The minimum probability (in percents) of reaching a source block 6045for interblock speculative scheduling. The default value is 40. 6046 6047@item max-sched-extend-regions-iters 6048The maximum number of iterations through CFG to extend regions. 60490 - disable region extension, 6050N - do at most N iterations. 6051The default value is 0. 6052 6053@item max-sched-insn-conflict-delay 6054The maximum conflict delay for an insn to be considered for speculative motion. 6055The default value is 3. 6056 6057@item sched-spec-prob-cutoff 6058The minimal probability of speculation success (in percents), so that 6059speculative insn will be scheduled. 6060The default value is 40. 6061 6062@item max-last-value-rtl 6063 6064The maximum size measured as number of RTLs that can be recorded in an expression 6065in combiner for a pseudo register as last known value of that register. The default 6066is 10000. 6067 6068@item integer-share-limit 6069Small integer constants can use a shared data structure, reducing the 6070compiler's memory usage and increasing its speed. This sets the maximum 6071value of a shared integer constant's. The default value is 256. 6072 6073@item min-virtual-mappings 6074Specifies the minimum number of virtual mappings in the incremental 6075SSA updater that should be registered to trigger the virtual mappings 6076heuristic defined by virtual-mappings-ratio. The default value is 6077100. 6078 6079@item virtual-mappings-ratio 6080If the number of virtual mappings is virtual-mappings-ratio bigger 6081than the number of virtual symbols to be updated, then the incremental 6082SSA updater switches to a full update for those symbols. The default 6083ratio is 3. 6084 6085@item ssp-buffer-size 6086The minimum size of buffers (i.e. arrays) that will receive stack smashing 6087protection when @option{-fstack-protection} is used. 6088 6089@item max-jump-thread-duplication-stmts 6090Maximum number of statements allowed in a block that needs to be 6091duplicated when threading jumps. 6092 6093@item max-fields-for-field-sensitive 6094Maximum number of fields in a structure we will treat in 6095a field sensitive manner during pointer analysis. 6096 6097@end table 6098@end table 6099 6100@node Preprocessor Options 6101@section Options Controlling the Preprocessor 6102@cindex preprocessor options 6103@cindex options, preprocessor 6104 6105These options control the C preprocessor, which is run on each C source 6106file before actual compilation. 6107 6108If you use the @option{-E} option, nothing is done except preprocessing. 6109Some of these options make sense only together with @option{-E} because 6110they cause the preprocessor output to be unsuitable for actual 6111compilation. 6112 6113@table @gcctabopt 6114@opindex Wp 6115You can use @option{-Wp,@var{option}} to bypass the compiler driver 6116and pass @var{option} directly through to the preprocessor. If 6117@var{option} contains commas, it is split into multiple options at the 6118commas. However, many options are modified, translated or interpreted 6119by the compiler driver before being passed to the preprocessor, and 6120@option{-Wp} forcibly bypasses this phase. The preprocessor's direct 6121interface is undocumented and subject to change, so whenever possible 6122you should avoid using @option{-Wp} and let the driver handle the 6123options instead. 6124 6125@item -Xpreprocessor @var{option} 6126@opindex preprocessor 6127Pass @var{option} as an option to the preprocessor. You can use this to 6128supply system-specific preprocessor options which GCC does not know how to 6129recognize. 6130 6131If you want to pass an option that takes an argument, you must use 6132@option{-Xpreprocessor} twice, once for the option and once for the argument. 6133@end table 6134 6135@include cppopts.texi 6136 6137@node Assembler Options 6138@section Passing Options to the Assembler 6139 6140@c prevent bad page break with this line 6141You can pass options to the assembler. 6142 6143@table @gcctabopt 6144@item -Wa,@var{option} 6145@opindex Wa 6146Pass @var{option} as an option to the assembler. If @var{option} 6147contains commas, it is split into multiple options at the commas. 6148 6149@item -Xassembler @var{option} 6150@opindex Xassembler 6151Pass @var{option} as an option to the assembler. You can use this to 6152supply system-specific assembler options which GCC does not know how to 6153recognize. 6154 6155If you want to pass an option that takes an argument, you must use 6156@option{-Xassembler} twice, once for the option and once for the argument. 6157 6158@end table 6159 6160@node Link Options 6161@section Options for Linking 6162@cindex link options 6163@cindex options, linking 6164 6165These options come into play when the compiler links object files into 6166an executable output file. They are meaningless if the compiler is 6167not doing a link step. 6168 6169@table @gcctabopt 6170@cindex file names 6171@item @var{object-file-name} 6172A file name that does not end in a special recognized suffix is 6173considered to name an object file or library. (Object files are 6174distinguished from libraries by the linker according to the file 6175contents.) If linking is done, these object files are used as input 6176to the linker. 6177 6178@item -c 6179@itemx -S 6180@itemx -E 6181@opindex c 6182@opindex S 6183@opindex E 6184If any of these options is used, then the linker is not run, and 6185object file names should not be used as arguments. @xref{Overall 6186Options}. 6187 6188@cindex Libraries 6189@item -l@var{library} 6190@itemx -l @var{library} 6191@opindex l 6192Search the library named @var{library} when linking. (The second 6193alternative with the library as a separate argument is only for 6194POSIX compliance and is not recommended.) 6195 6196It makes a difference where in the command you write this option; the 6197linker searches and processes libraries and object files in the order they 6198are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z} 6199after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers 6200to functions in @samp{z}, those functions may not be loaded. 6201 6202The linker searches a standard list of directories for the library, 6203which is actually a file named @file{lib@var{library}.a}. The linker 6204then uses this file as if it had been specified precisely by name. 6205 6206The directories searched include several standard system directories 6207plus any that you specify with @option{-L}. 6208 6209Normally the files found this way are library files---archive files 6210whose members are object files. The linker handles an archive file by 6211scanning through it for members which define symbols that have so far 6212been referenced but not defined. But if the file that is found is an 6213ordinary object file, it is linked in the usual fashion. The only 6214difference between using an @option{-l} option and specifying a file name 6215is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a} 6216and searches several directories. 6217 6218@item -nostartfiles 6219@opindex nostartfiles 6220Do not use the standard system startup files when linking. 6221The standard system libraries are used normally, unless @option{-nostdlib} 6222or @option{-nodefaultlibs} is used. 6223 6224@item -nodefaultlibs 6225@opindex nodefaultlibs 6226Do not use the standard system libraries when linking. 6227Only the libraries you specify will be passed to the linker. 6228The standard startup files are used normally, unless @option{-nostartfiles} 6229is used. The compiler may generate calls to @code{memcmp}, 6230@code{memset}, @code{memcpy} and @code{memmove}. 6231These entries are usually resolved by entries in 6232libc. These entry points should be supplied through some other 6233mechanism when this option is specified. 6234 6235@item -nostdlib 6236@opindex nostdlib 6237Do not use the standard system startup files or libraries when linking. 6238No startup files and only the libraries you specify will be passed to 6239the linker. The compiler may generate calls to @code{memcmp}, @code{memset}, 6240@code{memcpy} and @code{memmove}. 6241These entries are usually resolved by entries in 6242libc. These entry points should be supplied through some other 6243mechanism when this option is specified. 6244 6245@cindex @option{-lgcc}, use with @option{-nostdlib} 6246@cindex @option{-nostdlib} and unresolved references 6247@cindex unresolved references and @option{-nostdlib} 6248@cindex @option{-lgcc}, use with @option{-nodefaultlibs} 6249@cindex @option{-nodefaultlibs} and unresolved references 6250@cindex unresolved references and @option{-nodefaultlibs} 6251One of the standard libraries bypassed by @option{-nostdlib} and 6252@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines 6253that GCC uses to overcome shortcomings of particular machines, or special 6254needs for some languages. 6255(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler 6256Collection (GCC) Internals}, 6257for more discussion of @file{libgcc.a}.) 6258In most cases, you need @file{libgcc.a} even when you want to avoid 6259other standard libraries. In other words, when you specify @option{-nostdlib} 6260or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well. 6261This ensures that you have no unresolved references to internal GCC 6262library subroutines. (For example, @samp{__main}, used to ensure C++ 6263constructors will be called; @pxref{Collect2,,@code{collect2}, gccint, 6264GNU Compiler Collection (GCC) Internals}.) 6265 6266@item -pie 6267@opindex pie 6268Produce a position independent executable on targets which support it. 6269For predictable results, you must also specify the same set of options 6270that were used to generate code (@option{-fpie}, @option{-fPIE}, 6271or model suboptions) when you specify this option. 6272 6273@item -rdynamic 6274@opindex rdynamic 6275Pass the flag @option{-export-dynamic} to the ELF linker, on targets 6276that support it. This instructs the linker to add all symbols, not 6277only used ones, to the dynamic symbol table. This option is needed 6278for some uses of @code{dlopen} or to allow obtaining backtraces 6279from within a program. 6280 6281@item -s 6282@opindex s 6283Remove all symbol table and relocation information from the executable. 6284 6285@item -static 6286@opindex static 6287On systems that support dynamic linking, this prevents linking with the shared 6288libraries. On other systems, this option has no effect. 6289 6290@item -shared 6291@opindex shared 6292Produce a shared object which can then be linked with other objects to 6293form an executable. Not all systems support this option. For predictable 6294results, you must also specify the same set of options that were used to 6295generate code (@option{-fpic}, @option{-fPIC}, or model suboptions) 6296when you specify this option.@footnote{On some systems, @samp{gcc -shared} 6297needs to build supplementary stub code for constructors to work. On 6298multi-libbed systems, @samp{gcc -shared} must select the correct support 6299libraries to link against. Failing to supply the correct flags may lead 6300to subtle defects. Supplying them in cases where they are not necessary 6301is innocuous.} 6302 6303@item -shared-libgcc 6304@itemx -static-libgcc 6305@opindex shared-libgcc 6306@opindex static-libgcc 6307On systems that provide @file{libgcc} as a shared library, these options 6308force the use of either the shared or static version respectively. 6309If no shared version of @file{libgcc} was built when the compiler was 6310configured, these options have no effect. 6311 6312There are several situations in which an application should use the 6313shared @file{libgcc} instead of the static version. The most common 6314of these is when the application wishes to throw and catch exceptions 6315across different shared libraries. In that case, each of the libraries 6316as well as the application itself should use the shared @file{libgcc}. 6317 6318Therefore, the G++ and GCJ drivers automatically add 6319@option{-shared-libgcc} whenever you build a shared library or a main 6320executable, because C++ and Java programs typically use exceptions, so 6321this is the right thing to do. 6322 6323If, instead, you use the GCC driver to create shared libraries, you may 6324find that they will not always be linked with the shared @file{libgcc}. 6325If GCC finds, at its configuration time, that you have a non-GNU linker 6326or a GNU linker that does not support option @option{--eh-frame-hdr}, 6327it will link the shared version of @file{libgcc} into shared libraries 6328by default. Otherwise, it will take advantage of the linker and optimize 6329away the linking with the shared version of @file{libgcc}, linking with 6330the static version of libgcc by default. This allows exceptions to 6331propagate through such shared libraries, without incurring relocation 6332costs at library load time. 6333 6334However, if a library or main executable is supposed to throw or catch 6335exceptions, you must link it using the G++ or GCJ driver, as appropriate 6336for the languages used in the program, or using the option 6337@option{-shared-libgcc}, such that it is linked with the shared 6338@file{libgcc}. 6339 6340@item -symbolic 6341@opindex symbolic 6342Bind references to global symbols when building a shared object. Warn 6343about any unresolved references (unless overridden by the link editor 6344option @samp{-Xlinker -z -Xlinker defs}). Only a few systems support 6345this option. 6346 6347@item -Xlinker @var{option} 6348@opindex Xlinker 6349Pass @var{option} as an option to the linker. You can use this to 6350supply system-specific linker options which GCC does not know how to 6351recognize. 6352 6353If you want to pass an option that takes an argument, you must use 6354@option{-Xlinker} twice, once for the option and once for the argument. 6355For example, to pass @option{-assert definitions}, you must write 6356@samp{-Xlinker -assert -Xlinker definitions}. It does not work to write 6357@option{-Xlinker "-assert definitions"}, because this passes the entire 6358string as a single argument, which is not what the linker expects. 6359 6360@item -Wl,@var{option} 6361@opindex Wl 6362Pass @var{option} as an option to the linker. If @var{option} contains 6363commas, it is split into multiple options at the commas. 6364 6365@item -u @var{symbol} 6366@opindex u 6367Pretend the symbol @var{symbol} is undefined, to force linking of 6368library modules to define it. You can use @option{-u} multiple times with 6369different symbols to force loading of additional library modules. 6370@end table 6371 6372@node Directory Options 6373@section Options for Directory Search 6374@cindex directory options 6375@cindex options, directory search 6376@cindex search path 6377 6378These options specify directories to search for header files, for 6379libraries and for parts of the compiler: 6380 6381@table @gcctabopt 6382@item -I@var{dir} 6383@opindex I 6384Add the directory @var{dir} to the head of the list of directories to be 6385searched for header files. This can be used to override a system header 6386file, substituting your own version, since these directories are 6387searched before the system header file directories. However, you should 6388not use this option to add directories that contain vendor-supplied 6389system header files (use @option{-isystem} for that). If you use more than 6390one @option{-I} option, the directories are scanned in left-to-right 6391order; the standard system directories come after. 6392 6393If a standard system include directory, or a directory specified with 6394@option{-isystem}, is also specified with @option{-I}, the @option{-I} 6395option will be ignored. The directory will still be searched but as a 6396system directory at its normal position in the system include chain. 6397This is to ensure that GCC's procedure to fix buggy system headers and 6398the ordering for the include_next directive are not inadvertently changed. 6399If you really need to change the search order for system directories, 6400use the @option{-nostdinc} and/or @option{-isystem} options. 6401 6402@item -iquote@var{dir} 6403@opindex iquote 6404Add the directory @var{dir} to the head of the list of directories to 6405be searched for header files only for the case of @samp{#include 6406"@var{file}"}; they are not searched for @samp{#include <@var{file}>}, 6407otherwise just like @option{-I}. 6408 6409@item -L@var{dir} 6410@opindex L 6411Add directory @var{dir} to the list of directories to be searched 6412for @option{-l}. 6413 6414@item -B@var{prefix} 6415@opindex B 6416This option specifies where to find the executables, libraries, 6417include files, and data files of the compiler itself. 6418 6419The compiler driver program runs one or more of the subprograms 6420@file{cpp}, @file{cc1}, @file{as} and @file{ld}. It tries 6421@var{prefix} as a prefix for each program it tries to run, both with and 6422without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}). 6423 6424For each subprogram to be run, the compiler driver first tries the 6425@option{-B} prefix, if any. If that name is not found, or if @option{-B} 6426was not specified, the driver tries two standard prefixes, which are 6427@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of 6428those results in a file name that is found, the unmodified program 6429name is searched for using the directories specified in your 6430@env{PATH} environment variable. 6431 6432The compiler will check to see if the path provided by the @option{-B} 6433refers to a directory, and if necessary it will add a directory 6434separator character at the end of the path. 6435 6436@option{-B} prefixes that effectively specify directory names also apply 6437to libraries in the linker, because the compiler translates these 6438options into @option{-L} options for the linker. They also apply to 6439includes files in the preprocessor, because the compiler translates these 6440options into @option{-isystem} options for the preprocessor. In this case, 6441the compiler appends @samp{include} to the prefix. 6442 6443The run-time support file @file{libgcc.a} can also be searched for using 6444the @option{-B} prefix, if needed. If it is not found there, the two 6445standard prefixes above are tried, and that is all. The file is left 6446out of the link if it is not found by those means. 6447 6448Another way to specify a prefix much like the @option{-B} prefix is to use 6449the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment 6450Variables}. 6451 6452As a special kludge, if the path provided by @option{-B} is 6453@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to 64549, then it will be replaced by @file{[dir/]include}. This is to help 6455with boot-strapping the compiler. 6456 6457@item -specs=@var{file} 6458@opindex specs 6459Process @var{file} after the compiler reads in the standard @file{specs} 6460file, in order to override the defaults that the @file{gcc} driver 6461program uses when determining what switches to pass to @file{cc1}, 6462@file{cc1plus}, @file{as}, @file{ld}, etc. More than one 6463@option{-specs=@var{file}} can be specified on the command line, and they 6464are processed in order, from left to right. 6465 6466@item --sysroot=@var{dir} 6467@opindex sysroot 6468Use @var{dir} as the logical root directory for headers and libraries. 6469For example, if the compiler would normally search for headers in 6470@file{/usr/include} and libraries in @file{/usr/lib}, it will instead 6471search @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}. 6472 6473If you use both this option and the @option{-isysroot} option, then 6474the @option{--sysroot} option will apply to libraries, but the 6475@option{-isysroot} option will apply to header files. 6476 6477The GNU linker (beginning with version 2.16) has the necessary support 6478for this option. If your linker does not support this option, the 6479header file aspect of @option{--sysroot} will still work, but the 6480library aspect will not. 6481 6482@item -I- 6483@opindex I- 6484This option has been deprecated. Please use @option{-iquote} instead for 6485@option{-I} directories before the @option{-I-} and remove the @option{-I-}. 6486Any directories you specify with @option{-I} options before the @option{-I-} 6487option are searched only for the case of @samp{#include "@var{file}"}; 6488they are not searched for @samp{#include <@var{file}>}. 6489 6490If additional directories are specified with @option{-I} options after 6491the @option{-I-}, these directories are searched for all @samp{#include} 6492directives. (Ordinarily @emph{all} @option{-I} directories are used 6493this way.) 6494 6495In addition, the @option{-I-} option inhibits the use of the current 6496directory (where the current input file came from) as the first search 6497directory for @samp{#include "@var{file}"}. There is no way to 6498override this effect of @option{-I-}. With @option{-I.} you can specify 6499searching the directory which was current when the compiler was 6500invoked. That is not exactly the same as what the preprocessor does 6501by default, but it is often satisfactory. 6502 6503@option{-I-} does not inhibit the use of the standard system directories 6504for header files. Thus, @option{-I-} and @option{-nostdinc} are 6505independent. 6506@end table 6507 6508@c man end 6509 6510@node Spec Files 6511@section Specifying subprocesses and the switches to pass to them 6512@cindex Spec Files 6513 6514@command{gcc} is a driver program. It performs its job by invoking a 6515sequence of other programs to do the work of compiling, assembling and 6516linking. GCC interprets its command-line parameters and uses these to 6517deduce which programs it should invoke, and which command-line options 6518it ought to place on their command lines. This behavior is controlled 6519by @dfn{spec strings}. In most cases there is one spec string for each 6520program that GCC can invoke, but a few programs have multiple spec 6521strings to control their behavior. The spec strings built into GCC can 6522be overridden by using the @option{-specs=} command-line switch to specify 6523a spec file. 6524 6525@dfn{Spec files} are plaintext files that are used to construct spec 6526strings. They consist of a sequence of directives separated by blank 6527lines. The type of directive is determined by the first non-whitespace 6528character on the line and it can be one of the following: 6529 6530@table @code 6531@item %@var{command} 6532Issues a @var{command} to the spec file processor. The commands that can 6533appear here are: 6534 6535@table @code 6536@item %include <@var{file}> 6537@cindex %include 6538Search for @var{file} and insert its text at the current point in the 6539specs file. 6540 6541@item %include_noerr <@var{file}> 6542@cindex %include_noerr 6543Just like @samp{%include}, but do not generate an error message if the include 6544file cannot be found. 6545 6546@item %rename @var{old_name} @var{new_name} 6547@cindex %rename 6548Rename the spec string @var{old_name} to @var{new_name}. 6549 6550@end table 6551 6552@item *[@var{spec_name}]: 6553This tells the compiler to create, override or delete the named spec 6554string. All lines after this directive up to the next directive or 6555blank line are considered to be the text for the spec string. If this 6556results in an empty string then the spec will be deleted. (Or, if the 6557spec did not exist, then nothing will happened.) Otherwise, if the spec 6558does not currently exist a new spec will be created. If the spec does 6559exist then its contents will be overridden by the text of this 6560directive, unless the first character of that text is the @samp{+} 6561character, in which case the text will be appended to the spec. 6562 6563@item [@var{suffix}]: 6564Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive 6565and up to the next directive or blank line are considered to make up the 6566spec string for the indicated suffix. When the compiler encounters an 6567input file with the named suffix, it will processes the spec string in 6568order to work out how to compile that file. For example: 6569 6570@smallexample 6571.ZZ: 6572z-compile -input %i 6573@end smallexample 6574 6575This says that any input file whose name ends in @samp{.ZZ} should be 6576passed to the program @samp{z-compile}, which should be invoked with the 6577command-line switch @option{-input} and with the result of performing the 6578@samp{%i} substitution. (See below.) 6579 6580As an alternative to providing a spec string, the text that follows a 6581suffix directive can be one of the following: 6582 6583@table @code 6584@item @@@var{language} 6585This says that the suffix is an alias for a known @var{language}. This is 6586similar to using the @option{-x} command-line switch to GCC to specify a 6587language explicitly. For example: 6588 6589@smallexample 6590.ZZ: 6591@@c++ 6592@end smallexample 6593 6594Says that .ZZ files are, in fact, C++ source files. 6595 6596@item #@var{name} 6597This causes an error messages saying: 6598 6599@smallexample 6600@var{name} compiler not installed on this system. 6601@end smallexample 6602@end table 6603 6604GCC already has an extensive list of suffixes built into it. 6605This directive will add an entry to the end of the list of suffixes, but 6606since the list is searched from the end backwards, it is effectively 6607possible to override earlier entries using this technique. 6608 6609@end table 6610 6611GCC has the following spec strings built into it. Spec files can 6612override these strings or create their own. Note that individual 6613targets can also add their own spec strings to this list. 6614 6615@smallexample 6616asm Options to pass to the assembler 6617asm_final Options to pass to the assembler post-processor 6618cpp Options to pass to the C preprocessor 6619cc1 Options to pass to the C compiler 6620cc1plus Options to pass to the C++ compiler 6621endfile Object files to include at the end of the link 6622link Options to pass to the linker 6623lib Libraries to include on the command line to the linker 6624libgcc Decides which GCC support library to pass to the linker 6625linker Sets the name of the linker 6626predefines Defines to be passed to the C preprocessor 6627signed_char Defines to pass to CPP to say whether @code{char} is signed 6628 by default 6629startfile Object files to include at the start of the link 6630@end smallexample 6631 6632Here is a small example of a spec file: 6633 6634@smallexample 6635%rename lib old_lib 6636 6637*lib: 6638--start-group -lgcc -lc -leval1 --end-group %(old_lib) 6639@end smallexample 6640 6641This example renames the spec called @samp{lib} to @samp{old_lib} and 6642then overrides the previous definition of @samp{lib} with a new one. 6643The new definition adds in some extra command-line options before 6644including the text of the old definition. 6645 6646@dfn{Spec strings} are a list of command-line options to be passed to their 6647corresponding program. In addition, the spec strings can contain 6648@samp{%}-prefixed sequences to substitute variable text or to 6649conditionally insert text into the command line. Using these constructs 6650it is possible to generate quite complex command lines. 6651 6652Here is a table of all defined @samp{%}-sequences for spec 6653strings. Note that spaces are not generated automatically around the 6654results of expanding these sequences. Therefore you can concatenate them 6655together or combine them with constant text in a single argument. 6656 6657@table @code 6658@item %% 6659Substitute one @samp{%} into the program name or argument. 6660 6661@item %i 6662Substitute the name of the input file being processed. 6663 6664@item %b 6665Substitute the basename of the input file being processed. 6666This is the substring up to (and not including) the last period 6667and not including the directory. 6668 6669@item %B 6670This is the same as @samp{%b}, but include the file suffix (text after 6671the last period). 6672 6673@item %d 6674Marks the argument containing or following the @samp{%d} as a 6675temporary file name, so that that file will be deleted if GCC exits 6676successfully. Unlike @samp{%g}, this contributes no text to the 6677argument. 6678 6679@item %g@var{suffix} 6680Substitute a file name that has suffix @var{suffix} and is chosen 6681once per compilation, and mark the argument in the same way as 6682@samp{%d}. To reduce exposure to denial-of-service attacks, the file 6683name is now chosen in a way that is hard to predict even when previously 6684chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s} 6685might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches 6686the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is 6687treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g} 6688was simply substituted with a file name chosen once per compilation, 6689without regard to any appended suffix (which was therefore treated 6690just like ordinary text), making such attacks more likely to succeed. 6691 6692@item %u@var{suffix} 6693Like @samp{%g}, but generates a new temporary file name even if 6694@samp{%u@var{suffix}} was already seen. 6695 6696@item %U@var{suffix} 6697Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a 6698new one if there is no such last file name. In the absence of any 6699@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share 6700the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s} 6701would involve the generation of two distinct file names, one 6702for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was 6703simply substituted with a file name chosen for the previous @samp{%u}, 6704without regard to any appended suffix. 6705 6706@item %j@var{suffix} 6707Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is 6708writable, and if save-temps is off; otherwise, substitute the name 6709of a temporary file, just like @samp{%u}. This temporary file is not 6710meant for communication between processes, but rather as a junk 6711disposal mechanism. 6712 6713@item %|@var{suffix} 6714@itemx %m@var{suffix} 6715Like @samp{%g}, except if @option{-pipe} is in effect. In that case 6716@samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at 6717all. These are the two most common ways to instruct a program that it 6718should read from standard input or write to standard output. If you 6719need something more elaborate you can use an @samp{%@{pipe:@code{X}@}} 6720construct: see for example @file{f/lang-specs.h}. 6721 6722@item %.@var{SUFFIX} 6723Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args 6724when it is subsequently output with @samp{%*}. @var{SUFFIX} is 6725terminated by the next space or %. 6726 6727@item %w 6728Marks the argument containing or following the @samp{%w} as the 6729designated output file of this compilation. This puts the argument 6730into the sequence of arguments that @samp{%o} will substitute later. 6731 6732@item %o 6733Substitutes the names of all the output files, with spaces 6734automatically placed around them. You should write spaces 6735around the @samp{%o} as well or the results are undefined. 6736@samp{%o} is for use in the specs for running the linker. 6737Input files whose names have no recognized suffix are not compiled 6738at all, but they are included among the output files, so they will 6739be linked. 6740 6741@item %O 6742Substitutes the suffix for object files. Note that this is 6743handled specially when it immediately follows @samp{%g, %u, or %U}, 6744because of the need for those to form complete file names. The 6745handling is such that @samp{%O} is treated exactly as if it had already 6746been substituted, except that @samp{%g, %u, and %U} do not currently 6747support additional @var{suffix} characters following @samp{%O} as they would 6748following, for example, @samp{.o}. 6749 6750@item %p 6751Substitutes the standard macro predefinitions for the 6752current target machine. Use this when running @code{cpp}. 6753 6754@item %P 6755Like @samp{%p}, but puts @samp{__} before and after the name of each 6756predefined macro, except for macros that start with @samp{__} or with 6757@samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO 6758C@. 6759 6760@item %I 6761Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}), 6762@option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}), 6763@option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options) 6764and @option{-imultilib} as necessary. 6765 6766@item %s 6767Current argument is the name of a library or startup file of some sort. 6768Search for that file in a standard list of directories and substitute 6769the full name found. 6770 6771@item %e@var{str} 6772Print @var{str} as an error message. @var{str} is terminated by a newline. 6773Use this when inconsistent options are detected. 6774 6775@item %(@var{name}) 6776Substitute the contents of spec string @var{name} at this point. 6777 6778@item %[@var{name}] 6779Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments. 6780 6781@item %x@{@var{option}@} 6782Accumulate an option for @samp{%X}. 6783 6784@item %X 6785Output the accumulated linker options specified by @option{-Wl} or a @samp{%x} 6786spec string. 6787 6788@item %Y 6789Output the accumulated assembler options specified by @option{-Wa}. 6790 6791@item %Z 6792Output the accumulated preprocessor options specified by @option{-Wp}. 6793 6794@item %a 6795Process the @code{asm} spec. This is used to compute the 6796switches to be passed to the assembler. 6797 6798@item %A 6799Process the @code{asm_final} spec. This is a spec string for 6800passing switches to an assembler post-processor, if such a program is 6801needed. 6802 6803@item %l 6804Process the @code{link} spec. This is the spec for computing the 6805command line passed to the linker. Typically it will make use of the 6806@samp{%L %G %S %D and %E} sequences. 6807 6808@item %D 6809Dump out a @option{-L} option for each directory that GCC believes might 6810contain startup files. If the target supports multilibs then the 6811current multilib directory will be prepended to each of these paths. 6812 6813@item %L 6814Process the @code{lib} spec. This is a spec string for deciding which 6815libraries should be included on the command line to the linker. 6816 6817@item %G 6818Process the @code{libgcc} spec. This is a spec string for deciding 6819which GCC support library should be included on the command line to the linker. 6820 6821@item %S 6822Process the @code{startfile} spec. This is a spec for deciding which 6823object files should be the first ones passed to the linker. Typically 6824this might be a file named @file{crt0.o}. 6825 6826@item %E 6827Process the @code{endfile} spec. This is a spec string that specifies 6828the last object files that will be passed to the linker. 6829 6830@item %C 6831Process the @code{cpp} spec. This is used to construct the arguments 6832to be passed to the C preprocessor. 6833 6834@item %1 6835Process the @code{cc1} spec. This is used to construct the options to be 6836passed to the actual C compiler (@samp{cc1}). 6837 6838@item %2 6839Process the @code{cc1plus} spec. This is used to construct the options to be 6840passed to the actual C++ compiler (@samp{cc1plus}). 6841 6842@item %* 6843Substitute the variable part of a matched option. See below. 6844Note that each comma in the substituted string is replaced by 6845a single space. 6846 6847@item %<@code{S} 6848Remove all occurrences of @code{-S} from the command line. Note---this 6849command is position dependent. @samp{%} commands in the spec string 6850before this one will see @code{-S}, @samp{%} commands in the spec string 6851after this one will not. 6852 6853@item %:@var{function}(@var{args}) 6854Call the named function @var{function}, passing it @var{args}. 6855@var{args} is first processed as a nested spec string, then split 6856into an argument vector in the usual fashion. The function returns 6857a string which is processed as if it had appeared literally as part 6858of the current spec. 6859 6860The following built-in spec functions are provided: 6861 6862@table @code 6863@item @code{if-exists} 6864The @code{if-exists} spec function takes one argument, an absolute 6865pathname to a file. If the file exists, @code{if-exists} returns the 6866pathname. Here is a small example of its usage: 6867 6868@smallexample 6869*startfile: 6870crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s 6871@end smallexample 6872 6873@item @code{if-exists-else} 6874The @code{if-exists-else} spec function is similar to the @code{if-exists} 6875spec function, except that it takes two arguments. The first argument is 6876an absolute pathname to a file. If the file exists, @code{if-exists-else} 6877returns the pathname. If it does not exist, it returns the second argument. 6878This way, @code{if-exists-else} can be used to select one file or another, 6879based on the existence of the first. Here is a small example of its usage: 6880 6881@smallexample 6882*startfile: 6883crt0%O%s %:if-exists(crti%O%s) \ 6884%:if-exists-else(crtbeginT%O%s crtbegin%O%s) 6885@end smallexample 6886 6887@item @code{replace-outfile} 6888The @code{replace-outfile} spec function takes two arguments. It looks for the 6889first argument in the outfiles array and replaces it with the second argument. Here 6890is a small example of its usage: 6891 6892@smallexample 6893%@{static|static-libgcc|static-libstdc++:%:replace-outfile(-lstdc++ \ 6894libstdc++.a%s)@} 6895 6896@end smallexample 6897 6898@end table 6899 6900@item %@{@code{S}@} 6901Substitutes the @code{-S} switch, if that switch was given to GCC@. 6902If that switch was not specified, this substitutes nothing. Note that 6903the leading dash is omitted when specifying this option, and it is 6904automatically inserted if the substitution is performed. Thus the spec 6905string @samp{%@{foo@}} would match the command-line option @option{-foo} 6906and would output the command line option @option{-foo}. 6907 6908@item %W@{@code{S}@} 6909Like %@{@code{S}@} but mark last argument supplied within as a file to be 6910deleted on failure. 6911 6912@item %@{@code{S}*@} 6913Substitutes all the switches specified to GCC whose names start 6914with @code{-S}, but which also take an argument. This is used for 6915switches like @option{-o}, @option{-D}, @option{-I}, etc. 6916GCC considers @option{-o foo} as being 6917one switch whose names starts with @samp{o}. %@{o*@} would substitute this 6918text, including the space. Thus two arguments would be generated. 6919 6920@item %@{@code{S}*&@code{T}*@} 6921Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options 6922(the order of @code{S} and @code{T} in the spec is not significant). 6923There can be any number of ampersand-separated variables; for each the 6924wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}. 6925 6926@item %@{@code{S}:@code{X}@} 6927Substitutes @code{X}, if the @samp{-S} switch was given to GCC@. 6928 6929@item %@{!@code{S}:@code{X}@} 6930Substitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@. 6931 6932@item %@{@code{S}*:@code{X}@} 6933Substitutes @code{X} if one or more switches whose names start with 6934@code{-S} are specified to GCC@. Normally @code{X} is substituted only 6935once, no matter how many such switches appeared. However, if @code{%*} 6936appears somewhere in @code{X}, then @code{X} will be substituted once 6937for each matching switch, with the @code{%*} replaced by the part of 6938that switch that matched the @code{*}. 6939 6940@item %@{.@code{S}:@code{X}@} 6941Substitutes @code{X}, if processing a file with suffix @code{S}. 6942 6943@item %@{!.@code{S}:@code{X}@} 6944Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}. 6945 6946@item %@{@code{S}|@code{P}:@code{X}@} 6947Substitutes @code{X} if either @code{-S} or @code{-P} was given to GCC@. 6948This may be combined with @samp{!}, @samp{.}, and @code{*} sequences as well, 6949although they have a stronger binding than the @samp{|}. If @code{%*} 6950appears in @code{X}, all of the alternatives must be starred, and only 6951the first matching alternative is substituted. 6952 6953For example, a spec string like this: 6954 6955@smallexample 6956%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@} 6957@end smallexample 6958 6959will output the following command-line options from the following input 6960command-line options: 6961 6962@smallexample 6963fred.c -foo -baz 6964jim.d -bar -boggle 6965-d fred.c -foo -baz -boggle 6966-d jim.d -bar -baz -boggle 6967@end smallexample 6968 6969@item %@{S:X; T:Y; :D@} 6970 6971If @code{S} was given to GCC, substitutes @code{X}; else if @code{T} was 6972given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can 6973be as many clauses as you need. This may be combined with @code{.}, 6974@code{!}, @code{|}, and @code{*} as needed. 6975 6976 6977@end table 6978 6979The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar 6980construct may contain other nested @samp{%} constructs or spaces, or 6981even newlines. They are processed as usual, as described above. 6982Trailing white space in @code{X} is ignored. White space may also 6983appear anywhere on the left side of the colon in these constructs, 6984except between @code{.} or @code{*} and the corresponding word. 6985 6986The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are 6987handled specifically in these constructs. If another value of 6988@option{-O} or the negated form of a @option{-f}, @option{-m}, or 6989@option{-W} switch is found later in the command line, the earlier 6990switch value is ignored, except with @{@code{S}*@} where @code{S} is 6991just one letter, which passes all matching options. 6992 6993The character @samp{|} at the beginning of the predicate text is used to 6994indicate that a command should be piped to the following command, but 6995only if @option{-pipe} is specified. 6996 6997It is built into GCC which switches take arguments and which do not. 6998(You might think it would be useful to generalize this to allow each 6999compiler's spec to say which switches take arguments. But this cannot 7000be done in a consistent fashion. GCC cannot even decide which input 7001files have been specified without knowing which switches take arguments, 7002and it must know which input files to compile in order to tell which 7003compilers to run). 7004 7005GCC also knows implicitly that arguments starting in @option{-l} are to be 7006treated as compiler output files, and passed to the linker in their 7007proper position among the other output files. 7008 7009@c man begin OPTIONS 7010 7011@node Target Options 7012@section Specifying Target Machine and Compiler Version 7013@cindex target options 7014@cindex cross compiling 7015@cindex specifying machine version 7016@cindex specifying compiler version and target machine 7017@cindex compiler version, specifying 7018@cindex target machine, specifying 7019 7020The usual way to run GCC is to run the executable called @file{gcc}, or 7021@file{<machine>-gcc} when cross-compiling, or 7022@file{<machine>-gcc-<version>} to run a version other than the one that 7023was installed last. Sometimes this is inconvenient, so GCC provides 7024options that will switch to another cross-compiler or version. 7025 7026@table @gcctabopt 7027@item -b @var{machine} 7028@opindex b 7029The argument @var{machine} specifies the target machine for compilation. 7030 7031The value to use for @var{machine} is the same as was specified as the 7032machine type when configuring GCC as a cross-compiler. For 7033example, if a cross-compiler was configured with @samp{configure 7034arm-elf}, meaning to compile for an arm processor with elf binaries, 7035then you would specify @option{-b arm-elf} to run that cross compiler. 7036Because there are other options beginning with @option{-b}, the 7037configuration must contain a hyphen. 7038 7039@item -V @var{version} 7040@opindex V 7041The argument @var{version} specifies which version of GCC to run. 7042This is useful when multiple versions are installed. For example, 7043@var{version} might be @samp{4.0}, meaning to run GCC version 4.0. 7044@end table 7045 7046The @option{-V} and @option{-b} options work by running the 7047@file{<machine>-gcc-<version>} executable, so there's no real reason to 7048use them if you can just run that directly. 7049 7050@node Submodel Options 7051@section Hardware Models and Configurations 7052@cindex submodel options 7053@cindex specifying hardware config 7054@cindex hardware models and configurations, specifying 7055@cindex machine dependent options 7056 7057Earlier we discussed the standard option @option{-b} which chooses among 7058different installed compilers for completely different target 7059machines, such as VAX vs.@: 68000 vs.@: 80386. 7060 7061In addition, each of these target machine types can have its own 7062special options, starting with @samp{-m}, to choose among various 7063hardware models or configurations---for example, 68010 vs 68020, 7064floating coprocessor or none. A single installed version of the 7065compiler can compile for any model or configuration, according to the 7066options specified. 7067 7068Some configurations of the compiler also support additional special 7069options, usually for compatibility with other compilers on the same 7070platform. 7071 7072@c This list is ordered alphanumerically by subsection name. 7073@c It should be the same order and spelling as these options are listed 7074@c in Machine Dependent Options 7075 7076@menu 7077* ARC Options:: 7078* ARM Options:: 7079* AVR Options:: 7080* Blackfin Options:: 7081* CRIS Options:: 7082* CRX Options:: 7083* Darwin Options:: 7084* DEC Alpha Options:: 7085* DEC Alpha/VMS Options:: 7086* FRV Options:: 7087* GNU/Linux Options:: 7088* H8/300 Options:: 7089* HPPA Options:: 7090* i386 and x86-64 Options:: 7091* IA-64 Options:: 7092* M32C Options:: 7093* M32R/D Options:: 7094* M680x0 Options:: 7095* M68hc1x Options:: 7096* MCore Options:: 7097* MIPS Options:: 7098* MMIX Options:: 7099* MN10300 Options:: 7100* MT Options:: 7101* PDP-11 Options:: 7102* PowerPC Options:: 7103* RS/6000 and PowerPC Options:: 7104* S/390 and zSeries Options:: 7105* Score Options:: 7106* SH Options:: 7107* SPARC Options:: 7108* System V Options:: 7109* TMS320C3x/C4x Options:: 7110* V850 Options:: 7111* VAX Options:: 7112* x86-64 Options:: 7113* Xstormy16 Options:: 7114* Xtensa Options:: 7115* zSeries Options:: 7116@end menu 7117 7118@node ARC Options 7119@subsection ARC Options 7120@cindex ARC Options 7121 7122These options are defined for ARC implementations: 7123 7124@table @gcctabopt 7125@item -EL 7126@opindex EL 7127Compile code for little endian mode. This is the default. 7128 7129@item -EB 7130@opindex EB 7131Compile code for big endian mode. 7132 7133@item -mmangle-cpu 7134@opindex mmangle-cpu 7135Prepend the name of the cpu to all public symbol names. 7136In multiple-processor systems, there are many ARC variants with different 7137instruction and register set characteristics. This flag prevents code 7138compiled for one cpu to be linked with code compiled for another. 7139No facility exists for handling variants that are ``almost identical''. 7140This is an all or nothing option. 7141 7142@item -mcpu=@var{cpu} 7143@opindex mcpu 7144Compile code for ARC variant @var{cpu}. 7145Which variants are supported depend on the configuration. 7146All variants support @option{-mcpu=base}, this is the default. 7147 7148@item -mtext=@var{text-section} 7149@itemx -mdata=@var{data-section} 7150@itemx -mrodata=@var{readonly-data-section} 7151@opindex mtext 7152@opindex mdata 7153@opindex mrodata 7154Put functions, data, and readonly data in @var{text-section}, 7155@var{data-section}, and @var{readonly-data-section} respectively 7156by default. This can be overridden with the @code{section} attribute. 7157@xref{Variable Attributes}. 7158 7159@end table 7160 7161@node ARM Options 7162@subsection ARM Options 7163@cindex ARM options 7164 7165These @samp{-m} options are defined for Advanced RISC Machines (ARM) 7166architectures: 7167 7168@table @gcctabopt 7169@item -mabi=@var{name} 7170@opindex mabi 7171Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu}, 7172@samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}. 7173 7174@item -mapcs-frame 7175@opindex mapcs-frame 7176Generate a stack frame that is compliant with the ARM Procedure Call 7177Standard for all functions, even if this is not strictly necessary for 7178correct execution of the code. Specifying @option{-fomit-frame-pointer} 7179with this option will cause the stack frames not to be generated for 7180leaf functions. The default is @option{-mno-apcs-frame}. 7181 7182@item -mapcs 7183@opindex mapcs 7184This is a synonym for @option{-mapcs-frame}. 7185 7186@ignore 7187@c not currently implemented 7188@item -mapcs-stack-check 7189@opindex mapcs-stack-check 7190Generate code to check the amount of stack space available upon entry to 7191every function (that actually uses some stack space). If there is 7192insufficient space available then either the function 7193@samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be 7194called, depending upon the amount of stack space required. The run time 7195system is required to provide these functions. The default is 7196@option{-mno-apcs-stack-check}, since this produces smaller code. 7197 7198@c not currently implemented 7199@item -mapcs-float 7200@opindex mapcs-float 7201Pass floating point arguments using the float point registers. This is 7202one of the variants of the APCS@. This option is recommended if the 7203target hardware has a floating point unit or if a lot of floating point 7204arithmetic is going to be performed by the code. The default is 7205@option{-mno-apcs-float}, since integer only code is slightly increased in 7206size if @option{-mapcs-float} is used. 7207 7208@c not currently implemented 7209@item -mapcs-reentrant 7210@opindex mapcs-reentrant 7211Generate reentrant, position independent code. The default is 7212@option{-mno-apcs-reentrant}. 7213@end ignore 7214 7215@item -mthumb-interwork 7216@opindex mthumb-interwork 7217Generate code which supports calling between the ARM and Thumb 7218instruction sets. Without this option the two instruction sets cannot 7219be reliably used inside one program. The default is 7220@option{-mno-thumb-interwork}, since slightly larger code is generated 7221when @option{-mthumb-interwork} is specified. 7222 7223@item -mno-sched-prolog 7224@opindex mno-sched-prolog 7225Prevent the reordering of instructions in the function prolog, or the 7226merging of those instruction with the instructions in the function's 7227body. This means that all functions will start with a recognizable set 7228of instructions (or in fact one of a choice from a small set of 7229different function prologues), and this information can be used to 7230locate the start if functions inside an executable piece of code. The 7231default is @option{-msched-prolog}. 7232 7233@item -mhard-float 7234@opindex mhard-float 7235Generate output containing floating point instructions. This is the 7236default. 7237 7238@item -msoft-float 7239@opindex msoft-float 7240Generate output containing library calls for floating point. 7241@strong{Warning:} the requisite libraries are not available for all ARM 7242targets. Normally the facilities of the machine's usual C compiler are 7243used, but this cannot be done directly in cross-compilation. You must make 7244your own arrangements to provide suitable library functions for 7245cross-compilation. 7246 7247@option{-msoft-float} changes the calling convention in the output file; 7248therefore, it is only useful if you compile @emph{all} of a program with 7249this option. In particular, you need to compile @file{libgcc.a}, the 7250library that comes with GCC, with @option{-msoft-float} in order for 7251this to work. 7252 7253@item -mfloat-abi=@var{name} 7254@opindex mfloat-abi 7255Specifies which ABI to use for floating point values. Permissible values 7256are: @samp{soft}, @samp{softfp} and @samp{hard}. 7257 7258@samp{soft} and @samp{hard} are equivalent to @option{-msoft-float} 7259and @option{-mhard-float} respectively. @samp{softfp} allows the generation 7260of floating point instructions, but still uses the soft-float calling 7261conventions. 7262 7263@item -mlittle-endian 7264@opindex mlittle-endian 7265Generate code for a processor running in little-endian mode. This is 7266the default for all standard configurations. 7267 7268@item -mbig-endian 7269@opindex mbig-endian 7270Generate code for a processor running in big-endian mode; the default is 7271to compile code for a little-endian processor. 7272 7273@item -mwords-little-endian 7274@opindex mwords-little-endian 7275This option only applies when generating code for big-endian processors. 7276Generate code for a little-endian word order but a big-endian byte 7277order. That is, a byte order of the form @samp{32107654}. Note: this 7278option should only be used if you require compatibility with code for 7279big-endian ARM processors generated by versions of the compiler prior to 72802.8. 7281 7282@item -mcpu=@var{name} 7283@opindex mcpu 7284This specifies the name of the target ARM processor. GCC uses this name 7285to determine what kind of instructions it can emit when generating 7286assembly code. Permissible names are: @samp{arm2}, @samp{arm250}, 7287@samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610}, 7288@samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm}, 7289@samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700}, 7290@samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100}, 7291@samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s}, 7292@samp{arm8}, @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100}, 7293@samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920}, 7294@samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s}, 7295@samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi}, 7296@samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s}, 7297@samp{arm10e}, @samp{arm1020e}, @samp{arm1022e}, 7298@samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp}, 7299@samp{arm1176jz-s}, @samp{arm1176jzf-s}, @samp{xscale}, @samp{iwmmxt}, 7300@samp{ep9312}. 7301 7302@itemx -mtune=@var{name} 7303@opindex mtune 7304This option is very similar to the @option{-mcpu=} option, except that 7305instead of specifying the actual target processor type, and hence 7306restricting which instructions can be used, it specifies that GCC should 7307tune the performance of the code as if the target were of the type 7308specified in this option, but still choosing the instructions that it 7309will generate based on the cpu specified by a @option{-mcpu=} option. 7310For some ARM implementations better performance can be obtained by using 7311this option. 7312 7313@item -march=@var{name} 7314@opindex march 7315This specifies the name of the target ARM architecture. GCC uses this 7316name to determine what kind of instructions it can emit when generating 7317assembly code. This option can be used in conjunction with or instead 7318of the @option{-mcpu=} option. Permissible names are: @samp{armv2}, 7319@samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t}, 7320@samp{armv5}, @samp{armv5t}, @samp{armv5te}, @samp{armv6}, @samp{armv6j}, 7321@samp{iwmmxt}, @samp{ep9312}. 7322 7323@item -mfpu=@var{name} 7324@itemx -mfpe=@var{number} 7325@itemx -mfp=@var{number} 7326@opindex mfpu 7327@opindex mfpe 7328@opindex mfp 7329This specifies what floating point hardware (or hardware emulation) is 7330available on the target. Permissible names are: @samp{fpa}, @samp{fpe2}, 7331@samp{fpe3}, @samp{maverick}, @samp{vfp}. @option{-mfp} and @option{-mfpe} 7332are synonyms for @option{-mfpu}=@samp{fpe}@var{number}, for compatibility 7333with older versions of GCC@. 7334 7335If @option{-msoft-float} is specified this specifies the format of 7336floating point values. 7337 7338@item -mstructure-size-boundary=@var{n} 7339@opindex mstructure-size-boundary 7340The size of all structures and unions will be rounded up to a multiple 7341of the number of bits set by this option. Permissible values are 8, 32 7342and 64. The default value varies for different toolchains. For the COFF 7343targeted toolchain the default value is 8. A value of 64 is only allowed 7344if the underlying ABI supports it. 7345 7346Specifying the larger number can produce faster, more efficient code, but 7347can also increase the size of the program. Different values are potentially 7348incompatible. Code compiled with one value cannot necessarily expect to 7349work with code or libraries compiled with another value, if they exchange 7350information using structures or unions. 7351 7352@item -mabort-on-noreturn 7353@opindex mabort-on-noreturn 7354Generate a call to the function @code{abort} at the end of a 7355@code{noreturn} function. It will be executed if the function tries to 7356return. 7357 7358@item -mlong-calls 7359@itemx -mno-long-calls 7360@opindex mlong-calls 7361@opindex mno-long-calls 7362Tells the compiler to perform function calls by first loading the 7363address of the function into a register and then performing a subroutine 7364call on this register. This switch is needed if the target function 7365will lie outside of the 64 megabyte addressing range of the offset based 7366version of subroutine call instruction. 7367 7368Even if this switch is enabled, not all function calls will be turned 7369into long calls. The heuristic is that static functions, functions 7370which have the @samp{short-call} attribute, functions that are inside 7371the scope of a @samp{#pragma no_long_calls} directive and functions whose 7372definitions have already been compiled within the current compilation 7373unit, will not be turned into long calls. The exception to this rule is 7374that weak function definitions, functions with the @samp{long-call} 7375attribute or the @samp{section} attribute, and functions that are within 7376the scope of a @samp{#pragma long_calls} directive, will always be 7377turned into long calls. 7378 7379This feature is not enabled by default. Specifying 7380@option{-mno-long-calls} will restore the default behavior, as will 7381placing the function calls within the scope of a @samp{#pragma 7382long_calls_off} directive. Note these switches have no effect on how 7383the compiler generates code to handle function calls via function 7384pointers. 7385 7386@item -mnop-fun-dllimport 7387@opindex mnop-fun-dllimport 7388Disable support for the @code{dllimport} attribute. 7389 7390@item -msingle-pic-base 7391@opindex msingle-pic-base 7392Treat the register used for PIC addressing as read-only, rather than 7393loading it in the prologue for each function. The run-time system is 7394responsible for initializing this register with an appropriate value 7395before execution begins. 7396 7397@item -mpic-register=@var{reg} 7398@opindex mpic-register 7399Specify the register to be used for PIC addressing. The default is R10 7400unless stack-checking is enabled, when R9 is used. 7401 7402@item -mcirrus-fix-invalid-insns 7403@opindex mcirrus-fix-invalid-insns 7404@opindex mno-cirrus-fix-invalid-insns 7405Insert NOPs into the instruction stream to in order to work around 7406problems with invalid Maverick instruction combinations. This option 7407is only valid if the @option{-mcpu=ep9312} option has been used to 7408enable generation of instructions for the Cirrus Maverick floating 7409point co-processor. This option is not enabled by default, since the 7410problem is only present in older Maverick implementations. The default 7411can be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns} 7412switch. 7413 7414@item -mpoke-function-name 7415@opindex mpoke-function-name 7416Write the name of each function into the text section, directly 7417preceding the function prologue. The generated code is similar to this: 7418 7419@smallexample 7420 t0 7421 .ascii "arm_poke_function_name", 0 7422 .align 7423 t1 7424 .word 0xff000000 + (t1 - t0) 7425 arm_poke_function_name 7426 mov ip, sp 7427 stmfd sp!, @{fp, ip, lr, pc@} 7428 sub fp, ip, #4 7429@end smallexample 7430 7431When performing a stack backtrace, code can inspect the value of 7432@code{pc} stored at @code{fp + 0}. If the trace function then looks at 7433location @code{pc - 12} and the top 8 bits are set, then we know that 7434there is a function name embedded immediately preceding this location 7435and has length @code{((pc[-3]) & 0xff000000)}. 7436 7437@item -mthumb 7438@opindex mthumb 7439Generate code for the 16-bit Thumb instruction set. The default is to 7440use the 32-bit ARM instruction set. 7441 7442@item -mtpcs-frame 7443@opindex mtpcs-frame 7444Generate a stack frame that is compliant with the Thumb Procedure Call 7445Standard for all non-leaf functions. (A leaf function is one that does 7446not call any other functions.) The default is @option{-mno-tpcs-frame}. 7447 7448@item -mtpcs-leaf-frame 7449@opindex mtpcs-leaf-frame 7450Generate a stack frame that is compliant with the Thumb Procedure Call 7451Standard for all leaf functions. (A leaf function is one that does 7452not call any other functions.) The default is @option{-mno-apcs-leaf-frame}. 7453 7454@item -mcallee-super-interworking 7455@opindex mcallee-super-interworking 7456Gives all externally visible functions in the file being compiled an ARM 7457instruction set header which switches to Thumb mode before executing the 7458rest of the function. This allows these functions to be called from 7459non-interworking code. 7460 7461@item -mcaller-super-interworking 7462@opindex mcaller-super-interworking 7463Allows calls via function pointers (including virtual functions) to 7464execute correctly regardless of whether the target code has been 7465compiled for interworking or not. There is a small overhead in the cost 7466of executing a function pointer if this option is enabled. 7467 7468@item -mtp=@var{name} 7469@opindex mtp 7470Specify the access model for the thread local storage pointer. The valid 7471models are @option{soft}, which generates calls to @code{__aeabi_read_tp}, 7472@option{cp15}, which fetches the thread pointer from @code{cp15} directly 7473(supported in the arm6k architecture), and @option{auto}, which uses the 7474best available method for the selected processor. The default setting is 7475@option{auto}. 7476 7477@end table 7478 7479@node AVR Options 7480@subsection AVR Options 7481@cindex AVR Options 7482 7483These options are defined for AVR implementations: 7484 7485@table @gcctabopt 7486@item -mmcu=@var{mcu} 7487@opindex mmcu 7488Specify ATMEL AVR instruction set or MCU type. 7489 7490Instruction set avr1 is for the minimal AVR core, not supported by the C 7491compiler, only for assembler programs (MCU types: at90s1200, attiny10, 7492attiny11, attiny12, attiny15, attiny28). 7493 7494Instruction set avr2 (default) is for the classic AVR core with up to 74958K program memory space (MCU types: at90s2313, at90s2323, attiny22, 7496at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515, 7497at90c8534, at90s8535). 7498 7499Instruction set avr3 is for the classic AVR core with up to 128K program 7500memory space (MCU types: atmega103, atmega603, at43usb320, at76c711). 7501 7502Instruction set avr4 is for the enhanced AVR core with up to 8K program 7503memory space (MCU types: atmega8, atmega83, atmega85). 7504 7505Instruction set avr5 is for the enhanced AVR core with up to 128K program 7506memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323, 7507atmega64, atmega128, at43usb355, at94k). 7508 7509@item -msize 7510@opindex msize 7511Output instruction sizes to the asm file. 7512 7513@item -minit-stack=@var{N} 7514@opindex minit-stack 7515Specify the initial stack address, which may be a symbol or numeric value, 7516@samp{__stack} is the default. 7517 7518@item -mno-interrupts 7519@opindex mno-interrupts 7520Generated code is not compatible with hardware interrupts. 7521Code size will be smaller. 7522 7523@item -mcall-prologues 7524@opindex mcall-prologues 7525Functions prologues/epilogues expanded as call to appropriate 7526subroutines. Code size will be smaller. 7527 7528@item -mno-tablejump 7529@opindex mno-tablejump 7530Do not generate tablejump insns which sometimes increase code size. 7531 7532@item -mtiny-stack 7533@opindex mtiny-stack 7534Change only the low 8 bits of the stack pointer. 7535 7536@item -mint8 7537@opindex mint8 7538Assume int to be 8 bit integer. This affects the sizes of all types: A 7539char will be 1 byte, an int will be 1 byte, an long will be 2 bytes 7540and long long will be 4 bytes. Please note that this option does not 7541comply to the C standards, but it will provide you with smaller code 7542size. 7543@end table 7544 7545@node Blackfin Options 7546@subsection Blackfin Options 7547@cindex Blackfin Options 7548 7549@table @gcctabopt 7550@item -momit-leaf-frame-pointer 7551@opindex momit-leaf-frame-pointer 7552Don't keep the frame pointer in a register for leaf functions. This 7553avoids the instructions to save, set up and restore frame pointers and 7554makes an extra register available in leaf functions. The option 7555@option{-fomit-frame-pointer} removes the frame pointer for all functions 7556which might make debugging harder. 7557 7558@item -mspecld-anomaly 7559@opindex mspecld-anomaly 7560When enabled, the compiler will ensure that the generated code does not 7561contain speculative loads after jump instructions. This option is enabled 7562by default. 7563 7564@item -mno-specld-anomaly 7565@opindex mno-specld-anomaly 7566Don't generate extra code to prevent speculative loads from occurring. 7567 7568@item -mcsync-anomaly 7569@opindex mcsync-anomaly 7570When enabled, the compiler will ensure that the generated code does not 7571contain CSYNC or SSYNC instructions too soon after conditional branches. 7572This option is enabled by default. 7573 7574@item -mno-csync-anomaly 7575@opindex mno-csync-anomaly 7576Don't generate extra code to prevent CSYNC or SSYNC instructions from 7577occurring too soon after a conditional branch. 7578 7579@item -mlow-64k 7580@opindex mlow-64k 7581When enabled, the compiler is free to take advantage of the knowledge that 7582the entire program fits into the low 64k of memory. 7583 7584@item -mno-low-64k 7585@opindex mno-low-64k 7586Assume that the program is arbitrarily large. This is the default. 7587 7588@item -mid-shared-library 7589@opindex mid-shared-library 7590Generate code that supports shared libraries via the library ID method. 7591This allows for execute in place and shared libraries in an environment 7592without virtual memory management. This option implies @option{-fPIC}. 7593 7594@item -mno-id-shared-library 7595@opindex mno-id-shared-library 7596Generate code that doesn't assume ID based shared libraries are being used. 7597This is the default. 7598 7599@item -mshared-library-id=n 7600@opindex mshared-library-id 7601Specified the identification number of the ID based shared library being 7602compiled. Specifying a value of 0 will generate more compact code, specifying 7603other values will force the allocation of that number to the current 7604library but is no more space or time efficient than omitting this option. 7605 7606@item -mlong-calls 7607@itemx -mno-long-calls 7608@opindex mlong-calls 7609@opindex mno-long-calls 7610Tells the compiler to perform function calls by first loading the 7611address of the function into a register and then performing a subroutine 7612call on this register. This switch is needed if the target function 7613will lie outside of the 24 bit addressing range of the offset based 7614version of subroutine call instruction. 7615 7616This feature is not enabled by default. Specifying 7617@option{-mno-long-calls} will restore the default behavior. Note these 7618switches have no effect on how the compiler generates code to handle 7619function calls via function pointers. 7620@end table 7621 7622@node CRIS Options 7623@subsection CRIS Options 7624@cindex CRIS Options 7625 7626These options are defined specifically for the CRIS ports. 7627 7628@table @gcctabopt 7629@item -march=@var{architecture-type} 7630@itemx -mcpu=@var{architecture-type} 7631@opindex march 7632@opindex mcpu 7633Generate code for the specified architecture. The choices for 7634@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for 7635respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@. 7636Default is @samp{v0} except for cris-axis-linux-gnu, where the default is 7637@samp{v10}. 7638 7639@item -mtune=@var{architecture-type} 7640@opindex mtune 7641Tune to @var{architecture-type} everything applicable about the generated 7642code, except for the ABI and the set of available instructions. The 7643choices for @var{architecture-type} are the same as for 7644@option{-march=@var{architecture-type}}. 7645 7646@item -mmax-stack-frame=@var{n} 7647@opindex mmax-stack-frame 7648Warn when the stack frame of a function exceeds @var{n} bytes. 7649 7650@item -melinux-stacksize=@var{n} 7651@opindex melinux-stacksize 7652Only available with the @samp{cris-axis-aout} target. Arranges for 7653indications in the program to the kernel loader that the stack of the 7654program should be set to @var{n} bytes. 7655 7656@item -metrax4 7657@itemx -metrax100 7658@opindex metrax4 7659@opindex metrax100 7660The options @option{-metrax4} and @option{-metrax100} are synonyms for 7661@option{-march=v3} and @option{-march=v8} respectively. 7662 7663@item -mmul-bug-workaround 7664@itemx -mno-mul-bug-workaround 7665@opindex mmul-bug-workaround 7666@opindex mno-mul-bug-workaround 7667Work around a bug in the @code{muls} and @code{mulu} instructions for CPU 7668models where it applies. This option is active by default. 7669 7670@item -mpdebug 7671@opindex mpdebug 7672Enable CRIS-specific verbose debug-related information in the assembly 7673code. This option also has the effect to turn off the @samp{#NO_APP} 7674formatted-code indicator to the assembler at the beginning of the 7675assembly file. 7676 7677@item -mcc-init 7678@opindex mcc-init 7679Do not use condition-code results from previous instruction; always emit 7680compare and test instructions before use of condition codes. 7681 7682@item -mno-side-effects 7683@opindex mno-side-effects 7684Do not emit instructions with side-effects in addressing modes other than 7685post-increment. 7686 7687@item -mstack-align 7688@itemx -mno-stack-align 7689@itemx -mdata-align 7690@itemx -mno-data-align 7691@itemx -mconst-align 7692@itemx -mno-const-align 7693@opindex mstack-align 7694@opindex mno-stack-align 7695@opindex mdata-align 7696@opindex mno-data-align 7697@opindex mconst-align 7698@opindex mno-const-align 7699These options (no-options) arranges (eliminate arrangements) for the 7700stack-frame, individual data and constants to be aligned for the maximum 7701single data access size for the chosen CPU model. The default is to 7702arrange for 32-bit alignment. ABI details such as structure layout are 7703not affected by these options. 7704 7705@item -m32-bit 7706@itemx -m16-bit 7707@itemx -m8-bit 7708@opindex m32-bit 7709@opindex m16-bit 7710@opindex m8-bit 7711Similar to the stack- data- and const-align options above, these options 7712arrange for stack-frame, writable data and constants to all be 32-bit, 771316-bit or 8-bit aligned. The default is 32-bit alignment. 7714 7715@item -mno-prologue-epilogue 7716@itemx -mprologue-epilogue 7717@opindex mno-prologue-epilogue 7718@opindex mprologue-epilogue 7719With @option{-mno-prologue-epilogue}, the normal function prologue and 7720epilogue that sets up the stack-frame are omitted and no return 7721instructions or return sequences are generated in the code. Use this 7722option only together with visual inspection of the compiled code: no 7723warnings or errors are generated when call-saved registers must be saved, 7724or storage for local variable needs to be allocated. 7725 7726@item -mno-gotplt 7727@itemx -mgotplt 7728@opindex mno-gotplt 7729@opindex mgotplt 7730With @option{-fpic} and @option{-fPIC}, don't generate (do generate) 7731instruction sequences that load addresses for functions from the PLT part 7732of the GOT rather than (traditional on other architectures) calls to the 7733PLT@. The default is @option{-mgotplt}. 7734 7735@item -maout 7736@opindex maout 7737Legacy no-op option only recognized with the cris-axis-aout target. 7738 7739@item -melf 7740@opindex melf 7741Legacy no-op option only recognized with the cris-axis-elf and 7742cris-axis-linux-gnu targets. 7743 7744@item -melinux 7745@opindex melinux 7746Only recognized with the cris-axis-aout target, where it selects a 7747GNU/linux-like multilib, include files and instruction set for 7748@option{-march=v8}. 7749 7750@item -mlinux 7751@opindex mlinux 7752Legacy no-op option only recognized with the cris-axis-linux-gnu target. 7753 7754@item -sim 7755@opindex sim 7756This option, recognized for the cris-axis-aout and cris-axis-elf arranges 7757to link with input-output functions from a simulator library. Code, 7758initialized data and zero-initialized data are allocated consecutively. 7759 7760@item -sim2 7761@opindex sim2 7762Like @option{-sim}, but pass linker options to locate initialized data at 77630x40000000 and zero-initialized data at 0x80000000. 7764@end table 7765 7766@node CRX Options 7767@subsection CRX Options 7768@cindex CRX Options 7769 7770These options are defined specifically for the CRX ports. 7771 7772@table @gcctabopt 7773 7774@item -mmac 7775@opindex mmac 7776Enable the use of multiply-accumulate instructions. Disabled by default. 7777 7778@item -mpush-args 7779@opindex mpush-args 7780Push instructions will be used to pass outgoing arguments when functions 7781are called. Enabled by default. 7782@end table 7783 7784@node Darwin Options 7785@subsection Darwin Options 7786@cindex Darwin options 7787 7788These options are defined for all architectures running the Darwin operating 7789system. 7790 7791FSF GCC on Darwin does not create ``fat'' object files; it will create 7792an object file for the single architecture that it was built to 7793target. Apple's GCC on Darwin does create ``fat'' files if multiple 7794@option{-arch} options are used; it does so by running the compiler or 7795linker multiple times and joining the results together with 7796@file{lipo}. 7797 7798The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or 7799@samp{i686}) is determined by the flags that specify the ISA 7800that GCC is targetting, like @option{-mcpu} or @option{-march}. The 7801@option{-force_cpusubtype_ALL} option can be used to override this. 7802 7803The Darwin tools vary in their behavior when presented with an ISA 7804mismatch. The assembler, @file{as}, will only permit instructions to 7805be used that are valid for the subtype of the file it is generating, 7806so you cannot put 64-bit instructions in an @samp{ppc750} object file. 7807The linker for shared libraries, @file{/usr/bin/libtool}, will fail 7808and print an error if asked to create a shared library with a less 7809restrictive subtype than its input files (for instance, trying to put 7810a @samp{ppc970} object file in a @samp{ppc7400} library). The linker 7811for executables, @file{ld}, will quietly give the executable the most 7812restrictive subtype of any of its input files. 7813 7814@table @gcctabopt 7815@item -F@var{dir} 7816@opindex F 7817Add the framework directory @var{dir} to the head of the list of 7818directories to be searched for header files. These directories are 7819interleaved with those specified by @option{-I} options and are 7820scanned in a left-to-right order. 7821 7822A framework directory is a directory with frameworks in it. A 7823framework is a directory with a @samp{"Headers"} and/or 7824@samp{"PrivateHeaders"} directory contained directly in it that ends 7825in @samp{".framework"}. The name of a framework is the name of this 7826directory excluding the @samp{".framework"}. Headers associated with 7827the framework are found in one of those two directories, with 7828@samp{"Headers"} being searched first. A subframework is a framework 7829directory that is in a framework's @samp{"Frameworks"} directory. 7830Includes of subframework headers can only appear in a header of a 7831framework that contains the subframework, or in a sibling subframework 7832header. Two subframeworks are siblings if they occur in the same 7833framework. A subframework should not have the same name as a 7834framework, a warning will be issued if this is violated. Currently a 7835subframework cannot have subframeworks, in the future, the mechanism 7836may be extended to support this. The standard frameworks can be found 7837in @samp{"/System/Library/Frameworks"} and 7838@samp{"/Library/Frameworks"}. An example include looks like 7839@code{#include <Framework/header.h>}, where @samp{Framework} denotes 7840the name of the framework and header.h is found in the 7841@samp{"PrivateHeaders"} or @samp{"Headers"} directory. 7842 7843@item -gused 7844@opindex gused 7845Emit debugging information for symbols that are used. For STABS 7846debugging format, this enables @option{-feliminate-unused-debug-symbols}. 7847This is by default ON@. 7848 7849@item -gfull 7850@opindex gfull 7851Emit debugging information for all symbols and types. 7852 7853@item -mmacosx-version-min=@var{version} 7854The earliest version of MacOS X that this executable will run on 7855is @var{version}. Typical values of @var{version} include @code{10.1}, 7856@code{10.2}, and @code{10.3.9}. 7857 7858The default for this option is to make choices that seem to be most 7859useful. 7860 7861@item -mkernel 7862@opindex mkernel 7863Enable kernel development mode. The @option{-mkernel} option sets 7864@option{-static}, @option{-fno-common}, @option{-fno-cxa-atexit}, 7865@option{-fno-exceptions}, @option{-fno-non-call-exceptions}, 7866@option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where 7867applicable. This mode also sets @option{-mno-altivec}, 7868@option{-msoft-float}, @option{-fno-builtin} and 7869@option{-mlong-branch} for PowerPC targets. 7870 7871@item -mone-byte-bool 7872@opindex mone-byte-bool 7873Override the defaults for @samp{bool} so that @samp{sizeof(bool)==1}. 7874By default @samp{sizeof(bool)} is @samp{4} when compiling for 7875Darwin/PowerPC and @samp{1} when compiling for Darwin/x86, so this 7876option has no effect on x86. 7877 7878@strong{Warning:} The @option{-mone-byte-bool} switch causes GCC 7879to generate code that is not binary compatible with code generated 7880without that switch. Using this switch may require recompiling all 7881other modules in a program, including system libraries. Use this 7882switch to conform to a non-default data model. 7883 7884@item -mfix-and-continue 7885@itemx -ffix-and-continue 7886@itemx -findirect-data 7887@opindex mfix-and-continue 7888@opindex ffix-and-continue 7889@opindex findirect-data 7890Generate code suitable for fast turn around development. Needed to 7891enable gdb to dynamically load @code{.o} files into already running 7892programs. @option{-findirect-data} and @option{-ffix-and-continue} 7893are provided for backwards compatibility. 7894 7895@item -all_load 7896@opindex all_load 7897Loads all members of static archive libraries. 7898See man ld(1) for more information. 7899 7900@item -arch_errors_fatal 7901@opindex arch_errors_fatal 7902Cause the errors having to do with files that have the wrong architecture 7903to be fatal. 7904 7905@item -bind_at_load 7906@opindex bind_at_load 7907Causes the output file to be marked such that the dynamic linker will 7908bind all undefined references when the file is loaded or launched. 7909 7910@item -bundle 7911@opindex bundle 7912Produce a Mach-o bundle format file. 7913See man ld(1) for more information. 7914 7915@item -bundle_loader @var{executable} 7916@opindex bundle_loader 7917This option specifies the @var{executable} that will be loading the build 7918output file being linked. See man ld(1) for more information. 7919 7920@item -dynamiclib 7921@opindex dynamiclib 7922When passed this option, GCC will produce a dynamic library instead of 7923an executable when linking, using the Darwin @file{libtool} command. 7924 7925@item -force_cpusubtype_ALL 7926@opindex force_cpusubtype_ALL 7927This causes GCC's output file to have the @var{ALL} subtype, instead of 7928one controlled by the @option{-mcpu} or @option{-march} option. 7929 7930@item -allowable_client @var{client_name} 7931@itemx -client_name 7932@itemx -compatibility_version 7933@itemx -current_version 7934@itemx -dead_strip 7935@itemx -dependency-file 7936@itemx -dylib_file 7937@itemx -dylinker_install_name 7938@itemx -dynamic 7939@itemx -exported_symbols_list 7940@itemx -filelist 7941@itemx -flat_namespace 7942@itemx -force_flat_namespace 7943@itemx -headerpad_max_install_names 7944@itemx -image_base 7945@itemx -init 7946@itemx -install_name 7947@itemx -keep_private_externs 7948@itemx -multi_module 7949@itemx -multiply_defined 7950@itemx -multiply_defined_unused 7951@itemx -noall_load 7952@itemx -no_dead_strip_inits_and_terms 7953@itemx -nofixprebinding 7954@itemx -nomultidefs 7955@itemx -noprebind 7956@itemx -noseglinkedit 7957@itemx -pagezero_size 7958@itemx -prebind 7959@itemx -prebind_all_twolevel_modules 7960@itemx -private_bundle 7961@itemx -read_only_relocs 7962@itemx -sectalign 7963@itemx -sectobjectsymbols 7964@itemx -whyload 7965@itemx -seg1addr 7966@itemx -sectcreate 7967@itemx -sectobjectsymbols 7968@itemx -sectorder 7969@itemx -segaddr 7970@itemx -segs_read_only_addr 7971@itemx -segs_read_write_addr 7972@itemx -seg_addr_table 7973@itemx -seg_addr_table_filename 7974@itemx -seglinkedit 7975@itemx -segprot 7976@itemx -segs_read_only_addr 7977@itemx -segs_read_write_addr 7978@itemx -single_module 7979@itemx -static 7980@itemx -sub_library 7981@itemx -sub_umbrella 7982@itemx -twolevel_namespace 7983@itemx -umbrella 7984@itemx -undefined 7985@itemx -unexported_symbols_list 7986@itemx -weak_reference_mismatches 7987@itemx -whatsloaded 7988 7989@opindex allowable_client 7990@opindex client_name 7991@opindex compatibility_version 7992@opindex current_version 7993@opindex dead_strip 7994@opindex dependency-file 7995@opindex dylib_file 7996@opindex dylinker_install_name 7997@opindex dynamic 7998@opindex exported_symbols_list 7999@opindex filelist 8000@opindex flat_namespace 8001@opindex force_flat_namespace 8002@opindex headerpad_max_install_names 8003@opindex image_base 8004@opindex init 8005@opindex install_name 8006@opindex keep_private_externs 8007@opindex multi_module 8008@opindex multiply_defined 8009@opindex multiply_defined_unused 8010@opindex noall_load 8011@opindex no_dead_strip_inits_and_terms 8012@opindex nofixprebinding 8013@opindex nomultidefs 8014@opindex noprebind 8015@opindex noseglinkedit 8016@opindex pagezero_size 8017@opindex prebind 8018@opindex prebind_all_twolevel_modules 8019@opindex private_bundle 8020@opindex read_only_relocs 8021@opindex sectalign 8022@opindex sectobjectsymbols 8023@opindex whyload 8024@opindex seg1addr 8025@opindex sectcreate 8026@opindex sectobjectsymbols 8027@opindex sectorder 8028@opindex segaddr 8029@opindex segs_read_only_addr 8030@opindex segs_read_write_addr 8031@opindex seg_addr_table 8032@opindex seg_addr_table_filename 8033@opindex seglinkedit 8034@opindex segprot 8035@opindex segs_read_only_addr 8036@opindex segs_read_write_addr 8037@opindex single_module 8038@opindex static 8039@opindex sub_library 8040@opindex sub_umbrella 8041@opindex twolevel_namespace 8042@opindex umbrella 8043@opindex undefined 8044@opindex unexported_symbols_list 8045@opindex weak_reference_mismatches 8046@opindex whatsloaded 8047 8048These options are passed to the Darwin linker. The Darwin linker man page 8049describes them in detail. 8050@end table 8051 8052@node DEC Alpha Options 8053@subsection DEC Alpha Options 8054 8055These @samp{-m} options are defined for the DEC Alpha implementations: 8056 8057@table @gcctabopt 8058@item -mno-soft-float 8059@itemx -msoft-float 8060@opindex mno-soft-float 8061@opindex msoft-float 8062Use (do not use) the hardware floating-point instructions for 8063floating-point operations. When @option{-msoft-float} is specified, 8064functions in @file{libgcc.a} will be used to perform floating-point 8065operations. Unless they are replaced by routines that emulate the 8066floating-point operations, or compiled in such a way as to call such 8067emulations routines, these routines will issue floating-point 8068operations. If you are compiling for an Alpha without floating-point 8069operations, you must ensure that the library is built so as not to call 8070them. 8071 8072Note that Alpha implementations without floating-point operations are 8073required to have floating-point registers. 8074 8075@item -mfp-reg 8076@itemx -mno-fp-regs 8077@opindex mfp-reg 8078@opindex mno-fp-regs 8079Generate code that uses (does not use) the floating-point register set. 8080@option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point 8081register set is not used, floating point operands are passed in integer 8082registers as if they were integers and floating-point results are passed 8083in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence, 8084so any function with a floating-point argument or return value called by code 8085compiled with @option{-mno-fp-regs} must also be compiled with that 8086option. 8087 8088A typical use of this option is building a kernel that does not use, 8089and hence need not save and restore, any floating-point registers. 8090 8091@item -mieee 8092@opindex mieee 8093The Alpha architecture implements floating-point hardware optimized for 8094maximum performance. It is mostly compliant with the IEEE floating 8095point standard. However, for full compliance, software assistance is 8096required. This option generates code fully IEEE compliant code 8097@emph{except} that the @var{inexact-flag} is not maintained (see below). 8098If this option is turned on, the preprocessor macro @code{_IEEE_FP} is 8099defined during compilation. The resulting code is less efficient but is 8100able to correctly support denormalized numbers and exceptional IEEE 8101values such as not-a-number and plus/minus infinity. Other Alpha 8102compilers call this option @option{-ieee_with_no_inexact}. 8103 8104@item -mieee-with-inexact 8105@opindex mieee-with-inexact 8106This is like @option{-mieee} except the generated code also maintains 8107the IEEE @var{inexact-flag}. Turning on this option causes the 8108generated code to implement fully-compliant IEEE math. In addition to 8109@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor 8110macro. On some Alpha implementations the resulting code may execute 8111significantly slower than the code generated by default. Since there is 8112very little code that depends on the @var{inexact-flag}, you should 8113normally not specify this option. Other Alpha compilers call this 8114option @option{-ieee_with_inexact}. 8115 8116@item -mfp-trap-mode=@var{trap-mode} 8117@opindex mfp-trap-mode 8118This option controls what floating-point related traps are enabled. 8119Other Alpha compilers call this option @option{-fptm @var{trap-mode}}. 8120The trap mode can be set to one of four values: 8121 8122@table @samp 8123@item n 8124This is the default (normal) setting. The only traps that are enabled 8125are the ones that cannot be disabled in software (e.g., division by zero 8126trap). 8127 8128@item u 8129In addition to the traps enabled by @samp{n}, underflow traps are enabled 8130as well. 8131 8132@item su 8133Like @samp{u}, but the instructions are marked to be safe for software 8134completion (see Alpha architecture manual for details). 8135 8136@item sui 8137Like @samp{su}, but inexact traps are enabled as well. 8138@end table 8139 8140@item -mfp-rounding-mode=@var{rounding-mode} 8141@opindex mfp-rounding-mode 8142Selects the IEEE rounding mode. Other Alpha compilers call this option 8143@option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one 8144of: 8145 8146@table @samp 8147@item n 8148Normal IEEE rounding mode. Floating point numbers are rounded towards 8149the nearest machine number or towards the even machine number in case 8150of a tie. 8151 8152@item m 8153Round towards minus infinity. 8154 8155@item c 8156Chopped rounding mode. Floating point numbers are rounded towards zero. 8157 8158@item d 8159Dynamic rounding mode. A field in the floating point control register 8160(@var{fpcr}, see Alpha architecture reference manual) controls the 8161rounding mode in effect. The C library initializes this register for 8162rounding towards plus infinity. Thus, unless your program modifies the 8163@var{fpcr}, @samp{d} corresponds to round towards plus infinity. 8164@end table 8165 8166@item -mtrap-precision=@var{trap-precision} 8167@opindex mtrap-precision 8168In the Alpha architecture, floating point traps are imprecise. This 8169means without software assistance it is impossible to recover from a 8170floating trap and program execution normally needs to be terminated. 8171GCC can generate code that can assist operating system trap handlers 8172in determining the exact location that caused a floating point trap. 8173Depending on the requirements of an application, different levels of 8174precisions can be selected: 8175 8176@table @samp 8177@item p 8178Program precision. This option is the default and means a trap handler 8179can only identify which program caused a floating point exception. 8180 8181@item f 8182Function precision. The trap handler can determine the function that 8183caused a floating point exception. 8184 8185@item i 8186Instruction precision. The trap handler can determine the exact 8187instruction that caused a floating point exception. 8188@end table 8189 8190Other Alpha compilers provide the equivalent options called 8191@option{-scope_safe} and @option{-resumption_safe}. 8192 8193@item -mieee-conformant 8194@opindex mieee-conformant 8195This option marks the generated code as IEEE conformant. You must not 8196use this option unless you also specify @option{-mtrap-precision=i} and either 8197@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect 8198is to emit the line @samp{.eflag 48} in the function prologue of the 8199generated assembly file. Under DEC Unix, this has the effect that 8200IEEE-conformant math library routines will be linked in. 8201 8202@item -mbuild-constants 8203@opindex mbuild-constants 8204Normally GCC examines a 32- or 64-bit integer constant to 8205see if it can construct it from smaller constants in two or three 8206instructions. If it cannot, it will output the constant as a literal and 8207generate code to load it from the data segment at runtime. 8208 8209Use this option to require GCC to construct @emph{all} integer constants 8210using code, even if it takes more instructions (the maximum is six). 8211 8212You would typically use this option to build a shared library dynamic 8213loader. Itself a shared library, it must relocate itself in memory 8214before it can find the variables and constants in its own data segment. 8215 8216@item -malpha-as 8217@itemx -mgas 8218@opindex malpha-as 8219@opindex mgas 8220Select whether to generate code to be assembled by the vendor-supplied 8221assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}. 8222 8223@item -mbwx 8224@itemx -mno-bwx 8225@itemx -mcix 8226@itemx -mno-cix 8227@itemx -mfix 8228@itemx -mno-fix 8229@itemx -mmax 8230@itemx -mno-max 8231@opindex mbwx 8232@opindex mno-bwx 8233@opindex mcix 8234@opindex mno-cix 8235@opindex mfix 8236@opindex mno-fix 8237@opindex mmax 8238@opindex mno-max 8239Indicate whether GCC should generate code to use the optional BWX, 8240CIX, FIX and MAX instruction sets. The default is to use the instruction 8241sets supported by the CPU type specified via @option{-mcpu=} option or that 8242of the CPU on which GCC was built if none was specified. 8243 8244@item -mfloat-vax 8245@itemx -mfloat-ieee 8246@opindex mfloat-vax 8247@opindex mfloat-ieee 8248Generate code that uses (does not use) VAX F and G floating point 8249arithmetic instead of IEEE single and double precision. 8250 8251@item -mexplicit-relocs 8252@itemx -mno-explicit-relocs 8253@opindex mexplicit-relocs 8254@opindex mno-explicit-relocs 8255Older Alpha assemblers provided no way to generate symbol relocations 8256except via assembler macros. Use of these macros does not allow 8257optimal instruction scheduling. GNU binutils as of version 2.12 8258supports a new syntax that allows the compiler to explicitly mark 8259which relocations should apply to which instructions. This option 8260is mostly useful for debugging, as GCC detects the capabilities of 8261the assembler when it is built and sets the default accordingly. 8262 8263@item -msmall-data 8264@itemx -mlarge-data 8265@opindex msmall-data 8266@opindex mlarge-data 8267When @option{-mexplicit-relocs} is in effect, static data is 8268accessed via @dfn{gp-relative} relocations. When @option{-msmall-data} 8269is used, objects 8 bytes long or smaller are placed in a @dfn{small data area} 8270(the @code{.sdata} and @code{.sbss} sections) and are accessed via 827116-bit relocations off of the @code{$gp} register. This limits the 8272size of the small data area to 64KB, but allows the variables to be 8273directly accessed via a single instruction. 8274 8275The default is @option{-mlarge-data}. With this option the data area 8276is limited to just below 2GB@. Programs that require more than 2GB of 8277data must use @code{malloc} or @code{mmap} to allocate the data in the 8278heap instead of in the program's data segment. 8279 8280When generating code for shared libraries, @option{-fpic} implies 8281@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}. 8282 8283@item -msmall-text 8284@itemx -mlarge-text 8285@opindex msmall-text 8286@opindex mlarge-text 8287When @option{-msmall-text} is used, the compiler assumes that the 8288code of the entire program (or shared library) fits in 4MB, and is 8289thus reachable with a branch instruction. When @option{-msmall-data} 8290is used, the compiler can assume that all local symbols share the 8291same @code{$gp} value, and thus reduce the number of instructions 8292required for a function call from 4 to 1. 8293 8294The default is @option{-mlarge-text}. 8295 8296@item -mcpu=@var{cpu_type} 8297@opindex mcpu 8298Set the instruction set and instruction scheduling parameters for 8299machine type @var{cpu_type}. You can specify either the @samp{EV} 8300style name or the corresponding chip number. GCC supports scheduling 8301parameters for the EV4, EV5 and EV6 family of processors and will 8302choose the default values for the instruction set from the processor 8303you specify. If you do not specify a processor type, GCC will default 8304to the processor on which the compiler was built. 8305 8306Supported values for @var{cpu_type} are 8307 8308@table @samp 8309@item ev4 8310@itemx ev45 8311@itemx 21064 8312Schedules as an EV4 and has no instruction set extensions. 8313 8314@item ev5 8315@itemx 21164 8316Schedules as an EV5 and has no instruction set extensions. 8317 8318@item ev56 8319@itemx 21164a 8320Schedules as an EV5 and supports the BWX extension. 8321 8322@item pca56 8323@itemx 21164pc 8324@itemx 21164PC 8325Schedules as an EV5 and supports the BWX and MAX extensions. 8326 8327@item ev6 8328@itemx 21264 8329Schedules as an EV6 and supports the BWX, FIX, and MAX extensions. 8330 8331@item ev67 8332@itemx 21264a 8333Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions. 8334@end table 8335 8336@item -mtune=@var{cpu_type} 8337@opindex mtune 8338Set only the instruction scheduling parameters for machine type 8339@var{cpu_type}. The instruction set is not changed. 8340 8341@item -mmemory-latency=@var{time} 8342@opindex mmemory-latency 8343Sets the latency the scheduler should assume for typical memory 8344references as seen by the application. This number is highly 8345dependent on the memory access patterns used by the application 8346and the size of the external cache on the machine. 8347 8348Valid options for @var{time} are 8349 8350@table @samp 8351@item @var{number} 8352A decimal number representing clock cycles. 8353 8354@item L1 8355@itemx L2 8356@itemx L3 8357@itemx main 8358The compiler contains estimates of the number of clock cycles for 8359``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches 8360(also called Dcache, Scache, and Bcache), as well as to main memory. 8361Note that L3 is only valid for EV5. 8362 8363@end table 8364@end table 8365 8366@node DEC Alpha/VMS Options 8367@subsection DEC Alpha/VMS Options 8368 8369These @samp{-m} options are defined for the DEC Alpha/VMS implementations: 8370 8371@table @gcctabopt 8372@item -mvms-return-codes 8373@opindex mvms-return-codes 8374Return VMS condition codes from main. The default is to return POSIX 8375style condition (e.g.@ error) codes. 8376@end table 8377 8378@node FRV Options 8379@subsection FRV Options 8380@cindex FRV Options 8381 8382@table @gcctabopt 8383@item -mgpr-32 8384@opindex mgpr-32 8385 8386Only use the first 32 general purpose registers. 8387 8388@item -mgpr-64 8389@opindex mgpr-64 8390 8391Use all 64 general purpose registers. 8392 8393@item -mfpr-32 8394@opindex mfpr-32 8395 8396Use only the first 32 floating point registers. 8397 8398@item -mfpr-64 8399@opindex mfpr-64 8400 8401Use all 64 floating point registers 8402 8403@item -mhard-float 8404@opindex mhard-float 8405 8406Use hardware instructions for floating point operations. 8407 8408@item -msoft-float 8409@opindex msoft-float 8410 8411Use library routines for floating point operations. 8412 8413@item -malloc-cc 8414@opindex malloc-cc 8415 8416Dynamically allocate condition code registers. 8417 8418@item -mfixed-cc 8419@opindex mfixed-cc 8420 8421Do not try to dynamically allocate condition code registers, only 8422use @code{icc0} and @code{fcc0}. 8423 8424@item -mdword 8425@opindex mdword 8426 8427Change ABI to use double word insns. 8428 8429@item -mno-dword 8430@opindex mno-dword 8431 8432Do not use double word instructions. 8433 8434@item -mdouble 8435@opindex mdouble 8436 8437Use floating point double instructions. 8438 8439@item -mno-double 8440@opindex mno-double 8441 8442Do not use floating point double instructions. 8443 8444@item -mmedia 8445@opindex mmedia 8446 8447Use media instructions. 8448 8449@item -mno-media 8450@opindex mno-media 8451 8452Do not use media instructions. 8453 8454@item -mmuladd 8455@opindex mmuladd 8456 8457Use multiply and add/subtract instructions. 8458 8459@item -mno-muladd 8460@opindex mno-muladd 8461 8462Do not use multiply and add/subtract instructions. 8463 8464@item -mfdpic 8465@opindex mfdpic 8466 8467Select the FDPIC ABI, that uses function descriptors to represent 8468pointers to functions. Without any PIC/PIE-related options, it 8469implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it 8470assumes GOT entries and small data are within a 12-bit range from the 8471GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets 8472are computed with 32 bits. 8473 8474@item -minline-plt 8475@opindex minline-plt 8476 8477Enable inlining of PLT entries in function calls to functions that are 8478not known to bind locally. It has no effect without @option{-mfdpic}. 8479It's enabled by default if optimizing for speed and compiling for 8480shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an 8481optimization option such as @option{-O3} or above is present in the 8482command line. 8483 8484@item -mTLS 8485@opindex TLS 8486 8487Assume a large TLS segment when generating thread-local code. 8488 8489@item -mtls 8490@opindex tls 8491 8492Do not assume a large TLS segment when generating thread-local code. 8493 8494@item -mgprel-ro 8495@opindex mgprel-ro 8496 8497Enable the use of @code{GPREL} relocations in the FDPIC ABI for data 8498that is known to be in read-only sections. It's enabled by default, 8499except for @option{-fpic} or @option{-fpie}: even though it may help 8500make the global offset table smaller, it trades 1 instruction for 4. 8501With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4, 8502one of which may be shared by multiple symbols, and it avoids the need 8503for a GOT entry for the referenced symbol, so it's more likely to be a 8504win. If it is not, @option{-mno-gprel-ro} can be used to disable it. 8505 8506@item -multilib-library-pic 8507@opindex multilib-library-pic 8508 8509Link with the (library, not FD) pic libraries. It's implied by 8510@option{-mlibrary-pic}, as well as by @option{-fPIC} and 8511@option{-fpic} without @option{-mfdpic}. You should never have to use 8512it explicitly. 8513 8514@item -mlinked-fp 8515@opindex mlinked-fp 8516 8517Follow the EABI requirement of always creating a frame pointer whenever 8518a stack frame is allocated. This option is enabled by default and can 8519be disabled with @option{-mno-linked-fp}. 8520 8521@item -mlong-calls 8522@opindex mlong-calls 8523 8524Use indirect addressing to call functions outside the current 8525compilation unit. This allows the functions to be placed anywhere 8526within the 32-bit address space. 8527 8528@item -malign-labels 8529@opindex malign-labels 8530 8531Try to align labels to an 8-byte boundary by inserting nops into the 8532previous packet. This option only has an effect when VLIW packing 8533is enabled. It doesn't create new packets; it merely adds nops to 8534existing ones. 8535 8536@item -mlibrary-pic 8537@opindex mlibrary-pic 8538 8539Generate position-independent EABI code. 8540 8541@item -macc-4 8542@opindex macc-4 8543 8544Use only the first four media accumulator registers. 8545 8546@item -macc-8 8547@opindex macc-8 8548 8549Use all eight media accumulator registers. 8550 8551@item -mpack 8552@opindex mpack 8553 8554Pack VLIW instructions. 8555 8556@item -mno-pack 8557@opindex mno-pack 8558 8559Do not pack VLIW instructions. 8560 8561@item -mno-eflags 8562@opindex mno-eflags 8563 8564Do not mark ABI switches in e_flags. 8565 8566@item -mcond-move 8567@opindex mcond-move 8568 8569Enable the use of conditional-move instructions (default). 8570 8571This switch is mainly for debugging the compiler and will likely be removed 8572in a future version. 8573 8574@item -mno-cond-move 8575@opindex mno-cond-move 8576 8577Disable the use of conditional-move instructions. 8578 8579This switch is mainly for debugging the compiler and will likely be removed 8580in a future version. 8581 8582@item -mscc 8583@opindex mscc 8584 8585Enable the use of conditional set instructions (default). 8586 8587This switch is mainly for debugging the compiler and will likely be removed 8588in a future version. 8589 8590@item -mno-scc 8591@opindex mno-scc 8592 8593Disable the use of conditional set instructions. 8594 8595This switch is mainly for debugging the compiler and will likely be removed 8596in a future version. 8597 8598@item -mcond-exec 8599@opindex mcond-exec 8600 8601Enable the use of conditional execution (default). 8602 8603This switch is mainly for debugging the compiler and will likely be removed 8604in a future version. 8605 8606@item -mno-cond-exec 8607@opindex mno-cond-exec 8608 8609Disable the use of conditional execution. 8610 8611This switch is mainly for debugging the compiler and will likely be removed 8612in a future version. 8613 8614@item -mvliw-branch 8615@opindex mvliw-branch 8616 8617Run a pass to pack branches into VLIW instructions (default). 8618 8619This switch is mainly for debugging the compiler and will likely be removed 8620in a future version. 8621 8622@item -mno-vliw-branch 8623@opindex mno-vliw-branch 8624 8625Do not run a pass to pack branches into VLIW instructions. 8626 8627This switch is mainly for debugging the compiler and will likely be removed 8628in a future version. 8629 8630@item -mmulti-cond-exec 8631@opindex mmulti-cond-exec 8632 8633Enable optimization of @code{&&} and @code{||} in conditional execution 8634(default). 8635 8636This switch is mainly for debugging the compiler and will likely be removed 8637in a future version. 8638 8639@item -mno-multi-cond-exec 8640@opindex mno-multi-cond-exec 8641 8642Disable optimization of @code{&&} and @code{||} in conditional execution. 8643 8644This switch is mainly for debugging the compiler and will likely be removed 8645in a future version. 8646 8647@item -mnested-cond-exec 8648@opindex mnested-cond-exec 8649 8650Enable nested conditional execution optimizations (default). 8651 8652This switch is mainly for debugging the compiler and will likely be removed 8653in a future version. 8654 8655@item -mno-nested-cond-exec 8656@opindex mno-nested-cond-exec 8657 8658Disable nested conditional execution optimizations. 8659 8660This switch is mainly for debugging the compiler and will likely be removed 8661in a future version. 8662 8663@item -moptimize-membar 8664@opindex moptimize-membar 8665 8666This switch removes redundant @code{membar} instructions from the 8667compiler generated code. It is enabled by default. 8668 8669@item -mno-optimize-membar 8670@opindex mno-optimize-membar 8671 8672This switch disables the automatic removal of redundant @code{membar} 8673instructions from the generated code. 8674 8675@item -mtomcat-stats 8676@opindex mtomcat-stats 8677 8678Cause gas to print out tomcat statistics. 8679 8680@item -mcpu=@var{cpu} 8681@opindex mcpu 8682 8683Select the processor type for which to generate code. Possible values are 8684@samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450}, 8685@samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}. 8686 8687@end table 8688 8689@node GNU/Linux Options 8690@subsection GNU/Linux Options 8691 8692These @samp{-m} options are defined for GNU/Linux targets: 8693 8694@table @gcctabopt 8695@item -mglibc 8696@opindex mglibc 8697Use the GNU C library instead of uClibc. This is the default except 8698on @samp{*-*-linux-*uclibc*} targets. 8699 8700@item -muclibc 8701@opindex muclibc 8702Use uClibc instead of the GNU C library. This is the default on 8703@samp{*-*-linux-*uclibc*} targets. 8704@end table 8705 8706@node H8/300 Options 8707@subsection H8/300 Options 8708 8709These @samp{-m} options are defined for the H8/300 implementations: 8710 8711@table @gcctabopt 8712@item -mrelax 8713@opindex mrelax 8714Shorten some address references at link time, when possible; uses the 8715linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300, 8716ld, Using ld}, for a fuller description. 8717 8718@item -mh 8719@opindex mh 8720Generate code for the H8/300H@. 8721 8722@item -ms 8723@opindex ms 8724Generate code for the H8S@. 8725 8726@item -mn 8727@opindex mn 8728Generate code for the H8S and H8/300H in the normal mode. This switch 8729must be used either with @option{-mh} or @option{-ms}. 8730 8731@item -ms2600 8732@opindex ms2600 8733Generate code for the H8S/2600. This switch must be used with @option{-ms}. 8734 8735@item -mint32 8736@opindex mint32 8737Make @code{int} data 32 bits by default. 8738 8739@item -malign-300 8740@opindex malign-300 8741On the H8/300H and H8S, use the same alignment rules as for the H8/300. 8742The default for the H8/300H and H8S is to align longs and floats on 4 8743byte boundaries. 8744@option{-malign-300} causes them to be aligned on 2 byte boundaries. 8745This option has no effect on the H8/300. 8746@end table 8747 8748@node HPPA Options 8749@subsection HPPA Options 8750@cindex HPPA Options 8751 8752These @samp{-m} options are defined for the HPPA family of computers: 8753 8754@table @gcctabopt 8755@item -march=@var{architecture-type} 8756@opindex march 8757Generate code for the specified architecture. The choices for 8758@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA 87591.1, and @samp{2.0} for PA 2.0 processors. Refer to 8760@file{/usr/lib/sched.models} on an HP-UX system to determine the proper 8761architecture option for your machine. Code compiled for lower numbered 8762architectures will run on higher numbered architectures, but not the 8763other way around. 8764 8765@item -mpa-risc-1-0 8766@itemx -mpa-risc-1-1 8767@itemx -mpa-risc-2-0 8768@opindex mpa-risc-1-0 8769@opindex mpa-risc-1-1 8770@opindex mpa-risc-2-0 8771Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively. 8772 8773@item -mbig-switch 8774@opindex mbig-switch 8775Generate code suitable for big switch tables. Use this option only if 8776the assembler/linker complain about out of range branches within a switch 8777table. 8778 8779@item -mjump-in-delay 8780@opindex mjump-in-delay 8781Fill delay slots of function calls with unconditional jump instructions 8782by modifying the return pointer for the function call to be the target 8783of the conditional jump. 8784 8785@item -mdisable-fpregs 8786@opindex mdisable-fpregs 8787Prevent floating point registers from being used in any manner. This is 8788necessary for compiling kernels which perform lazy context switching of 8789floating point registers. If you use this option and attempt to perform 8790floating point operations, the compiler will abort. 8791 8792@item -mdisable-indexing 8793@opindex mdisable-indexing 8794Prevent the compiler from using indexing address modes. This avoids some 8795rather obscure problems when compiling MIG generated code under MACH@. 8796 8797@item -mno-space-regs 8798@opindex mno-space-regs 8799Generate code that assumes the target has no space registers. This allows 8800GCC to generate faster indirect calls and use unscaled index address modes. 8801 8802Such code is suitable for level 0 PA systems and kernels. 8803 8804@item -mfast-indirect-calls 8805@opindex mfast-indirect-calls 8806Generate code that assumes calls never cross space boundaries. This 8807allows GCC to emit code which performs faster indirect calls. 8808 8809This option will not work in the presence of shared libraries or nested 8810functions. 8811 8812@item -mfixed-range=@var{register-range} 8813@opindex mfixed-range 8814Generate code treating the given register range as fixed registers. 8815A fixed register is one that the register allocator can not use. This is 8816useful when compiling kernel code. A register range is specified as 8817two registers separated by a dash. Multiple register ranges can be 8818specified separated by a comma. 8819 8820@item -mlong-load-store 8821@opindex mlong-load-store 8822Generate 3-instruction load and store sequences as sometimes required by 8823the HP-UX 10 linker. This is equivalent to the @samp{+k} option to 8824the HP compilers. 8825 8826@item -mportable-runtime 8827@opindex mportable-runtime 8828Use the portable calling conventions proposed by HP for ELF systems. 8829 8830@item -mgas 8831@opindex mgas 8832Enable the use of assembler directives only GAS understands. 8833 8834@item -mschedule=@var{cpu-type} 8835@opindex mschedule 8836Schedule code according to the constraints for the machine type 8837@var{cpu-type}. The choices for @var{cpu-type} are @samp{700} 8838@samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer 8839to @file{/usr/lib/sched.models} on an HP-UX system to determine the 8840proper scheduling option for your machine. The default scheduling is 8841@samp{8000}. 8842 8843@item -mlinker-opt 8844@opindex mlinker-opt 8845Enable the optimization pass in the HP-UX linker. Note this makes symbolic 8846debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9 8847linkers in which they give bogus error messages when linking some programs. 8848 8849@item -msoft-float 8850@opindex msoft-float 8851Generate output containing library calls for floating point. 8852@strong{Warning:} the requisite libraries are not available for all HPPA 8853targets. Normally the facilities of the machine's usual C compiler are 8854used, but this cannot be done directly in cross-compilation. You must make 8855your own arrangements to provide suitable library functions for 8856cross-compilation. The embedded target @samp{hppa1.1-*-pro} 8857does provide software floating point support. 8858 8859@option{-msoft-float} changes the calling convention in the output file; 8860therefore, it is only useful if you compile @emph{all} of a program with 8861this option. In particular, you need to compile @file{libgcc.a}, the 8862library that comes with GCC, with @option{-msoft-float} in order for 8863this to work. 8864 8865@item -msio 8866@opindex msio 8867Generate the predefine, @code{_SIO}, for server IO@. The default is 8868@option{-mwsio}. This generates the predefines, @code{__hp9000s700}, 8869@code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These 8870options are available under HP-UX and HI-UX@. 8871 8872@item -mgnu-ld 8873@opindex gnu-ld 8874Use GNU ld specific options. This passes @option{-shared} to ld when 8875building a shared library. It is the default when GCC is configured, 8876explicitly or implicitly, with the GNU linker. This option does not 8877have any affect on which ld is called, it only changes what parameters 8878are passed to that ld. The ld that is called is determined by the 8879@option{--with-ld} configure option, GCC's program search path, and 8880finally by the user's @env{PATH}. The linker used by GCC can be printed 8881using @samp{which `gcc -print-prog-name=ld`}. This option is only available 8882on the 64 bit HP-UX GCC, i.e. configured with @samp{hppa*64*-*-hpux*}. 8883 8884@item -mhp-ld 8885@opindex hp-ld 8886Use HP ld specific options. This passes @option{-b} to ld when building 8887a shared library and passes @option{+Accept TypeMismatch} to ld on all 8888links. It is the default when GCC is configured, explicitly or 8889implicitly, with the HP linker. This option does not have any affect on 8890which ld is called, it only changes what parameters are passed to that 8891ld. The ld that is called is determined by the @option{--with-ld} 8892configure option, GCC's program search path, and finally by the user's 8893@env{PATH}. The linker used by GCC can be printed using @samp{which 8894`gcc -print-prog-name=ld`}. This option is only available on the 64 bit 8895HP-UX GCC, i.e. configured with @samp{hppa*64*-*-hpux*}. 8896 8897@item -mlong-calls 8898@opindex mno-long-calls 8899Generate code that uses long call sequences. This ensures that a call 8900is always able to reach linker generated stubs. The default is to generate 8901long calls only when the distance from the call site to the beginning 8902of the function or translation unit, as the case may be, exceeds a 8903predefined limit set by the branch type being used. The limits for 8904normal calls are 7,600,000 and 240,000 bytes, respectively for the 8905PA 2.0 and PA 1.X architectures. Sibcalls are always limited at 8906240,000 bytes. 8907 8908Distances are measured from the beginning of functions when using the 8909@option{-ffunction-sections} option, or when using the @option{-mgas} 8910and @option{-mno-portable-runtime} options together under HP-UX with 8911the SOM linker. 8912 8913It is normally not desirable to use this option as it will degrade 8914performance. However, it may be useful in large applications, 8915particularly when partial linking is used to build the application. 8916 8917The types of long calls used depends on the capabilities of the 8918assembler and linker, and the type of code being generated. The 8919impact on systems that support long absolute calls, and long pic 8920symbol-difference or pc-relative calls should be relatively small. 8921However, an indirect call is used on 32-bit ELF systems in pic code 8922and it is quite long. 8923 8924@item -munix=@var{unix-std} 8925@opindex march 8926Generate compiler predefines and select a startfile for the specified 8927UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95} 8928and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95} 8929is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX 893011.11 and later. The default values are @samp{93} for HP-UX 10.00, 8931@samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11 8932and later. 8933 8934@option{-munix=93} provides the same predefines as GCC 3.3 and 3.4. 8935@option{-munix=95} provides additional predefines for @code{XOPEN_UNIX} 8936and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}. 8937@option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX}, 8938@code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and 8939@code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}. 8940 8941It is @emph{important} to note that this option changes the interfaces 8942for various library routines. It also affects the operational behavior 8943of the C library. Thus, @emph{extreme} care is needed in using this 8944option. 8945 8946Library code that is intended to operate with more than one UNIX 8947standard must test, set and restore the variable @var{__xpg4_extended_mask} 8948as appropriate. Most GNU software doesn't provide this capability. 8949 8950@item -nolibdld 8951@opindex nolibdld 8952Suppress the generation of link options to search libdld.sl when the 8953@option{-static} option is specified on HP-UX 10 and later. 8954 8955@item -static 8956@opindex static 8957The HP-UX implementation of setlocale in libc has a dependency on 8958libdld.sl. There isn't an archive version of libdld.sl. Thus, 8959when the @option{-static} option is specified, special link options 8960are needed to resolve this dependency. 8961 8962On HP-UX 10 and later, the GCC driver adds the necessary options to 8963link with libdld.sl when the @option{-static} option is specified. 8964This causes the resulting binary to be dynamic. On the 64-bit port, 8965the linkers generate dynamic binaries by default in any case. The 8966@option{-nolibdld} option can be used to prevent the GCC driver from 8967adding these link options. 8968 8969@item -threads 8970@opindex threads 8971Add support for multithreading with the @dfn{dce thread} library 8972under HP-UX@. This option sets flags for both the preprocessor and 8973linker. 8974@end table 8975 8976@node i386 and x86-64 Options 8977@subsection Intel 386 and AMD x86-64 Options 8978@cindex i386 Options 8979@cindex x86-64 Options 8980@cindex Intel 386 Options 8981@cindex AMD x86-64 Options 8982 8983These @samp{-m} options are defined for the i386 and x86-64 family of 8984computers: 8985 8986@table @gcctabopt 8987@item -mtune=@var{cpu-type} 8988@opindex mtune 8989Tune to @var{cpu-type} everything applicable about the generated code, except 8990for the ABI and the set of available instructions. The choices for 8991@var{cpu-type} are: 8992@table @emph 8993@item generic 8994Produce code optimized for the most common IA32/AMD64/EM64T processors. 8995If you know the CPU on which your code will run, then you should use 8996the corresponding @option{-mtune} option instead of 8997@option{-mtune=generic}. But, if you do not know exactly what CPU users 8998of your application will have, then you should use this option. 8999 9000As new processors are deployed in the marketplace, the behavior of this 9001option will change. Therefore, if you upgrade to a newer version of 9002GCC, the code generated option will change to reflect the processors 9003that were most common when that version of GCC was released. 9004 9005There is no @option{-march=generic} option because @option{-march} 9006indicates the instruction set the compiler can use, and there is no 9007generic instruction set applicable to all processors. In contrast, 9008@option{-mtune} indicates the processor (or, in this case, collection of 9009processors) for which the code is optimized. 9010@item native 9011This selects the CPU to tune for at compilation time by determining 9012the processor type of the compiling machine. Using @option{-mtune=native} 9013will produce code optimized for the local machine under the constraints 9014of the selected instruction set. Using @option{-march=native} will 9015enable all instruction subsets supported by the local machine (hence 9016the result might not run on different machines). 9017@item i386 9018Original Intel's i386 CPU@. 9019@item i486 9020Intel's i486 CPU@. (No scheduling is implemented for this chip.) 9021@item i586, pentium 9022Intel Pentium CPU with no MMX support. 9023@item pentium-mmx 9024Intel PentiumMMX CPU based on Pentium core with MMX instruction set support. 9025@item pentiumpro 9026Intel PentiumPro CPU@. 9027@item i686 9028Same as @code{generic}, but when used as @code{march} option, PentiumPro 9029instruction set will be used, so the code will run on all i686 family chips. 9030@item pentium2 9031Intel Pentium2 CPU based on PentiumPro core with MMX instruction set support. 9032@item pentium3, pentium3m 9033Intel Pentium3 CPU based on PentiumPro core with MMX and SSE instruction set 9034support. 9035@item pentium-m 9036Low power version of Intel Pentium3 CPU with MMX, SSE and SSE2 instruction set 9037support. Used by Centrino notebooks. 9038@item pentium4, pentium4m 9039Intel Pentium4 CPU with MMX, SSE and SSE2 instruction set support. 9040@item prescott 9041Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction 9042set support. 9043@item nocona 9044Improved version of Intel Pentium4 CPU with 64-bit extensions, MMX, SSE, 9045SSE2 and SSE3 instruction set support. 9046@item core2 9047Intel Core2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3 9048instruction set support. 9049@item k6 9050AMD K6 CPU with MMX instruction set support. 9051@item k6-2, k6-3 9052Improved versions of AMD K6 CPU with MMX and 3dNOW! instruction set support. 9053@item athlon, athlon-tbird 9054AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and SSE prefetch instructions 9055support. 9056@item athlon-4, athlon-xp, athlon-mp 9057Improved AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and full SSE 9058instruction set support. 9059@item k8, opteron, athlon64, athlon-fx 9060AMD K8 core based CPUs with x86-64 instruction set support. (This supersets 9061MMX, SSE, SSE2, 3dNOW!, enhanced 3dNOW! and 64-bit instruction set extensions.) 9062@item k8-sse3, opteron-sse3, athlon64-sse3 9063Improved versions of k8, opteron and athlon64 with SSE3 instruction set support. 9064@item winchip-c6 9065IDT Winchip C6 CPU, dealt in same way as i486 with additional MMX instruction 9066set support. 9067@item winchip2 9068IDT Winchip2 CPU, dealt in same way as i486 with additional MMX and 3dNOW! 9069instruction set support. 9070@item c3 9071Via C3 CPU with MMX and 3dNOW! instruction set support. (No scheduling is 9072implemented for this chip.) 9073@item c3-2 9074Via C3-2 CPU with MMX and SSE instruction set support. (No scheduling is 9075implemented for this chip.) 9076@item geode 9077Embedded AMD CPU with MMX and 3dNOW! instruction set support. 9078@end table 9079 9080While picking a specific @var{cpu-type} will schedule things appropriately 9081for that particular chip, the compiler will not generate any code that 9082does not run on the i386 without the @option{-march=@var{cpu-type}} option 9083being used. 9084 9085@item -march=@var{cpu-type} 9086@opindex march 9087Generate instructions for the machine type @var{cpu-type}. The choices 9088for @var{cpu-type} are the same as for @option{-mtune}. Moreover, 9089specifying @option{-march=@var{cpu-type}} implies @option{-mtune=@var{cpu-type}}. 9090 9091@item -mcpu=@var{cpu-type} 9092@opindex mcpu 9093A deprecated synonym for @option{-mtune}. 9094 9095@item -m386 9096@itemx -m486 9097@itemx -mpentium 9098@itemx -mpentiumpro 9099@opindex m386 9100@opindex m486 9101@opindex mpentium 9102@opindex mpentiumpro 9103These options are synonyms for @option{-mtune=i386}, @option{-mtune=i486}, 9104@option{-mtune=pentium}, and @option{-mtune=pentiumpro} respectively. 9105These synonyms are deprecated. 9106 9107@item -mfpmath=@var{unit} 9108@opindex march 9109Generate floating point arithmetics for selected unit @var{unit}. The choices 9110for @var{unit} are: 9111 9112@table @samp 9113@item 387 9114Use the standard 387 floating point coprocessor present majority of chips and 9115emulated otherwise. Code compiled with this option will run almost everywhere. 9116The temporary results are computed in 80bit precision instead of precision 9117specified by the type resulting in slightly different results compared to most 9118of other chips. See @option{-ffloat-store} for more detailed description. 9119 9120This is the default choice for i386 compiler. 9121 9122@item sse 9123Use scalar floating point instructions present in the SSE instruction set. 9124This instruction set is supported by Pentium3 and newer chips, in the AMD line 9125by Athlon-4, Athlon-xp and Athlon-mp chips. The earlier version of SSE 9126instruction set supports only single precision arithmetics, thus the double and 9127extended precision arithmetics is still done using 387. Later version, present 9128only in Pentium4 and the future AMD x86-64 chips supports double precision 9129arithmetics too. 9130 9131For the i386 compiler, you need to use @option{-march=@var{cpu-type}}, @option{-msse} 9132or @option{-msse2} switches to enable SSE extensions and make this option 9133effective. For the x86-64 compiler, these extensions are enabled by default. 9134 9135The resulting code should be considerably faster in the majority of cases and avoid 9136the numerical instability problems of 387 code, but may break some existing 9137code that expects temporaries to be 80bit. 9138 9139This is the default choice for the x86-64 compiler. 9140 9141@item sse,387 9142Attempt to utilize both instruction sets at once. This effectively double the 9143amount of available registers and on chips with separate execution units for 9144387 and SSE the execution resources too. Use this option with care, as it is 9145still experimental, because the GCC register allocator does not model separate 9146functional units well resulting in instable performance. 9147@end table 9148 9149@item -masm=@var{dialect} 9150@opindex masm=@var{dialect} 9151Output asm instructions using selected @var{dialect}. Supported 9152choices are @samp{intel} or @samp{att} (the default one). Darwin does 9153not support @samp{intel}. 9154 9155@item -mieee-fp 9156@itemx -mno-ieee-fp 9157@opindex mieee-fp 9158@opindex mno-ieee-fp 9159Control whether or not the compiler uses IEEE floating point 9160comparisons. These handle correctly the case where the result of a 9161comparison is unordered. 9162 9163@item -msoft-float 9164@opindex msoft-float 9165Generate output containing library calls for floating point. 9166@strong{Warning:} the requisite libraries are not part of GCC@. 9167Normally the facilities of the machine's usual C compiler are used, but 9168this can't be done directly in cross-compilation. You must make your 9169own arrangements to provide suitable library functions for 9170cross-compilation. 9171 9172On machines where a function returns floating point results in the 80387 9173register stack, some floating point opcodes may be emitted even if 9174@option{-msoft-float} is used. 9175 9176@item -mno-fp-ret-in-387 9177@opindex mno-fp-ret-in-387 9178Do not use the FPU registers for return values of functions. 9179 9180The usual calling convention has functions return values of types 9181@code{float} and @code{double} in an FPU register, even if there 9182is no FPU@. The idea is that the operating system should emulate 9183an FPU@. 9184 9185The option @option{-mno-fp-ret-in-387} causes such values to be returned 9186in ordinary CPU registers instead. 9187 9188@item -mno-fancy-math-387 9189@opindex mno-fancy-math-387 9190Some 387 emulators do not support the @code{sin}, @code{cos} and 9191@code{sqrt} instructions for the 387. Specify this option to avoid 9192generating those instructions. This option is the default on 9193OpenBSD and NetBSD@. This option is overridden when @option{-march} 9194indicates that the target cpu will always have an FPU and so the 9195instruction will not need emulation. As of revision 2.6.1, these 9196instructions are not generated unless you also use the 9197@option{-funsafe-math-optimizations} switch. 9198 9199@item -malign-double 9200@itemx -mno-align-double 9201@opindex malign-double 9202@opindex mno-align-double 9203Control whether GCC aligns @code{double}, @code{long double}, and 9204@code{long long} variables on a two word boundary or a one word 9205boundary. Aligning @code{double} variables on a two word boundary will 9206produce code that runs somewhat faster on a @samp{Pentium} at the 9207expense of more memory. 9208 9209On x86-64, @option{-malign-double} is enabled by default. 9210 9211@strong{Warning:} if you use the @option{-malign-double} switch, 9212structures containing the above types will be aligned differently than 9213the published application binary interface specifications for the 386 9214and will not be binary compatible with structures in code compiled 9215without that switch. 9216 9217@item -m96bit-long-double 9218@itemx -m128bit-long-double 9219@opindex m96bit-long-double 9220@opindex m128bit-long-double 9221These switches control the size of @code{long double} type. The i386 9222application binary interface specifies the size to be 96 bits, 9223so @option{-m96bit-long-double} is the default in 32 bit mode. 9224 9225Modern architectures (Pentium and newer) would prefer @code{long double} 9226to be aligned to an 8 or 16 byte boundary. In arrays or structures 9227conforming to the ABI, this would not be possible. So specifying a 9228@option{-m128bit-long-double} will align @code{long double} 9229to a 16 byte boundary by padding the @code{long double} with an additional 923032 bit zero. 9231 9232In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as 9233its ABI specifies that @code{long double} is to be aligned on 16 byte boundary. 9234 9235Notice that neither of these options enable any extra precision over the x87 9236standard of 80 bits for a @code{long double}. 9237 9238@strong{Warning:} if you override the default value for your target ABI, the 9239structures and arrays containing @code{long double} variables will change 9240their size as well as function calling convention for function taking 9241@code{long double} will be modified. Hence they will not be binary 9242compatible with arrays or structures in code compiled without that switch. 9243 9244@item -mmlarge-data-threshold=@var{number} 9245@opindex mlarge-data-threshold=@var{number} 9246When @option{-mcmodel=medium} is specified, the data greater than 9247@var{threshold} are placed in large data section. This value must be the 9248same across all object linked into the binary and defaults to 65535. 9249 9250@item -msvr3-shlib 9251@itemx -mno-svr3-shlib 9252@opindex msvr3-shlib 9253@opindex mno-svr3-shlib 9254Control whether GCC places uninitialized local variables into the 9255@code{bss} or @code{data} segments. @option{-msvr3-shlib} places them 9256into @code{bss}. These options are meaningful only on System V Release 3. 9257 9258@item -mrtd 9259@opindex mrtd 9260Use a different function-calling convention, in which functions that 9261take a fixed number of arguments return with the @code{ret} @var{num} 9262instruction, which pops their arguments while returning. This saves one 9263instruction in the caller since there is no need to pop the arguments 9264there. 9265 9266You can specify that an individual function is called with this calling 9267sequence with the function attribute @samp{stdcall}. You can also 9268override the @option{-mrtd} option by using the function attribute 9269@samp{cdecl}. @xref{Function Attributes}. 9270 9271@strong{Warning:} this calling convention is incompatible with the one 9272normally used on Unix, so you cannot use it if you need to call 9273libraries compiled with the Unix compiler. 9274 9275Also, you must provide function prototypes for all functions that 9276take variable numbers of arguments (including @code{printf}); 9277otherwise incorrect code will be generated for calls to those 9278functions. 9279 9280In addition, seriously incorrect code will result if you call a 9281function with too many arguments. (Normally, extra arguments are 9282harmlessly ignored.) 9283 9284@item -mregparm=@var{num} 9285@opindex mregparm 9286Control how many registers are used to pass integer arguments. By 9287default, no registers are used to pass arguments, and at most 3 9288registers can be used. You can control this behavior for a specific 9289function by using the function attribute @samp{regparm}. 9290@xref{Function Attributes}. 9291 9292@strong{Warning:} if you use this switch, and 9293@var{num} is nonzero, then you must build all modules with the same 9294value, including any libraries. This includes the system libraries and 9295startup modules. 9296 9297@item -msseregparm 9298@opindex msseregparm 9299Use SSE register passing conventions for float and double arguments 9300and return values. You can control this behavior for a specific 9301function by using the function attribute @samp{sseregparm}. 9302@xref{Function Attributes}. 9303 9304@strong{Warning:} if you use this switch then you must build all 9305modules with the same value, including any libraries. This includes 9306the system libraries and startup modules. 9307 9308@item -mstackrealign 9309@opindex mstackrealign 9310Realign the stack at entry. On the Intel x86, the 9311@option{-mstackrealign} option will generate an alternate prologue and 9312epilogue that realigns the runtime stack. This supports mixing legacy 9313codes that keep a 4-byte aligned stack with modern codes that keep a 931416-byte stack for SSE compatibility. The alternate prologue and 9315epilogue are slower and bigger than the regular ones, and the 9316alternate prologue requires an extra scratch register; this lowers the 9317number of registers available if used in conjunction with the 9318@code{regparm} attribute. The @option{-mstackrealign} option is 9319incompatible with the nested function prologue; this is considered a 9320hard error. See also the attribute @code{force_align_arg_pointer}, 9321applicable to individual functions. 9322 9323@item -mpreferred-stack-boundary=@var{num} 9324@opindex mpreferred-stack-boundary 9325Attempt to keep the stack boundary aligned to a 2 raised to @var{num} 9326byte boundary. If @option{-mpreferred-stack-boundary} is not specified, 9327the default is 4 (16 bytes or 128 bits). 9328 9329On Pentium and PentiumPro, @code{double} and @code{long double} values 9330should be aligned to an 8 byte boundary (see @option{-malign-double}) or 9331suffer significant run time performance penalties. On Pentium III, the 9332Streaming SIMD Extension (SSE) data type @code{__m128} may not work 9333properly if it is not 16 byte aligned. 9334 9335To ensure proper alignment of this values on the stack, the stack boundary 9336must be as aligned as that required by any value stored on the stack. 9337Further, every function must be generated such that it keeps the stack 9338aligned. Thus calling a function compiled with a higher preferred 9339stack boundary from a function compiled with a lower preferred stack 9340boundary will most likely misalign the stack. It is recommended that 9341libraries that use callbacks always use the default setting. 9342 9343This extra alignment does consume extra stack space, and generally 9344increases code size. Code that is sensitive to stack space usage, such 9345as embedded systems and operating system kernels, may want to reduce the 9346preferred alignment to @option{-mpreferred-stack-boundary=2}. 9347 9348@item -mmmx 9349@itemx -mno-mmx 9350@item -msse 9351@itemx -mno-sse 9352@item -msse2 9353@itemx -mno-sse2 9354@item -msse3 9355@itemx -mno-sse3 9356@item -mssse3 9357@itemx -mno-ssse3 9358@item -m3dnow 9359@itemx -mno-3dnow 9360@opindex mmmx 9361@opindex mno-mmx 9362@opindex msse 9363@opindex mno-sse 9364@opindex m3dnow 9365@opindex mno-3dnow 9366These switches enable or disable the use of instructions in the MMX, 9367SSE, SSE2, SSE3, SSSE3 or 3DNow! extended instruction sets. 9368These extensions are also available as built-in functions: see 9369@ref{X86 Built-in Functions}, for details of the functions enabled and 9370disabled by these switches. 9371 9372To have SSE/SSE2 instructions generated automatically from floating-point 9373code (as opposed to 387 instructions), see @option{-mfpmath=sse}. 9374 9375These options will enable GCC to use these extended instructions in 9376generated code, even without @option{-mfpmath=sse}. Applications which 9377perform runtime CPU detection must compile separate files for each 9378supported architecture, using the appropriate flags. In particular, 9379the file containing the CPU detection code should be compiled without 9380these options. 9381 9382@item -mpush-args 9383@itemx -mno-push-args 9384@opindex mpush-args 9385@opindex mno-push-args 9386Use PUSH operations to store outgoing parameters. This method is shorter 9387and usually equally fast as method using SUB/MOV operations and is enabled 9388by default. In some cases disabling it may improve performance because of 9389improved scheduling and reduced dependencies. 9390 9391@item -maccumulate-outgoing-args 9392@opindex maccumulate-outgoing-args 9393If enabled, the maximum amount of space required for outgoing arguments will be 9394computed in the function prologue. This is faster on most modern CPUs 9395because of reduced dependencies, improved scheduling and reduced stack usage 9396when preferred stack boundary is not equal to 2. The drawback is a notable 9397increase in code size. This switch implies @option{-mno-push-args}. 9398 9399@item -mthreads 9400@opindex mthreads 9401Support thread-safe exception handling on @samp{Mingw32}. Code that relies 9402on thread-safe exception handling must compile and link all code with the 9403@option{-mthreads} option. When compiling, @option{-mthreads} defines 9404@option{-D_MT}; when linking, it links in a special thread helper library 9405@option{-lmingwthrd} which cleans up per thread exception handling data. 9406 9407@item -mno-align-stringops 9408@opindex mno-align-stringops 9409Do not align destination of inlined string operations. This switch reduces 9410code size and improves performance in case the destination is already aligned, 9411but GCC doesn't know about it. 9412 9413@item -minline-all-stringops 9414@opindex minline-all-stringops 9415By default GCC inlines string operations only when destination is known to be 9416aligned at least to 4 byte boundary. This enables more inlining, increase code 9417size, but may improve performance of code that depends on fast memcpy, strlen 9418and memset for short lengths. 9419 9420@item -momit-leaf-frame-pointer 9421@opindex momit-leaf-frame-pointer 9422Don't keep the frame pointer in a register for leaf functions. This 9423avoids the instructions to save, set up and restore frame pointers and 9424makes an extra register available in leaf functions. The option 9425@option{-fomit-frame-pointer} removes the frame pointer for all functions 9426which might make debugging harder. 9427 9428@item -mtls-direct-seg-refs 9429@itemx -mno-tls-direct-seg-refs 9430@opindex mtls-direct-seg-refs 9431Controls whether TLS variables may be accessed with offsets from the 9432TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit), 9433or whether the thread base pointer must be added. Whether or not this 9434is legal depends on the operating system, and whether it maps the 9435segment to cover the entire TLS area. 9436 9437For systems that use GNU libc, the default is on. 9438@end table 9439 9440These @samp{-m} switches are supported in addition to the above 9441on AMD x86-64 processors in 64-bit environments. 9442 9443@table @gcctabopt 9444@item -m32 9445@itemx -m64 9446@opindex m32 9447@opindex m64 9448Generate code for a 32-bit or 64-bit environment. 9449The 32-bit environment sets int, long and pointer to 32 bits and 9450generates code that runs on any i386 system. 9451The 64-bit environment sets int to 32 bits and long and pointer 9452to 64 bits and generates code for AMD's x86-64 architecture. For 9453darwin only the -m64 option turns off the @option{-fno-pic} and 9454@option{-mdynamic-no-pic} options. 9455 9456@item -mno-red-zone 9457@opindex no-red-zone 9458Do not use a so called red zone for x86-64 code. The red zone is mandated 9459by the x86-64 ABI, it is a 128-byte area beyond the location of the 9460stack pointer that will not be modified by signal or interrupt handlers 9461and therefore can be used for temporary data without adjusting the stack 9462pointer. The flag @option{-mno-red-zone} disables this red zone. 9463 9464@item -mcmodel=small 9465@opindex mcmodel=small 9466Generate code for the small code model: the program and its symbols must 9467be linked in the lower 2 GB of the address space. Pointers are 64 bits. 9468Programs can be statically or dynamically linked. This is the default 9469code model. 9470 9471@item -mcmodel=kernel 9472@opindex mcmodel=kernel 9473Generate code for the kernel code model. The kernel runs in the 9474negative 2 GB of the address space. 9475This model has to be used for Linux kernel code. 9476 9477@item -mcmodel=medium 9478@opindex mcmodel=medium 9479Generate code for the medium model: The program is linked in the lower 2 9480GB of the address space but symbols can be located anywhere in the 9481address space. Programs can be statically or dynamically linked, but 9482building of shared libraries are not supported with the medium model. 9483 9484@item -mcmodel=large 9485@opindex mcmodel=large 9486Generate code for the large model: This model makes no assumptions 9487about addresses and sizes of sections. Currently GCC does not implement 9488this model. 9489@end table 9490 9491@node IA-64 Options 9492@subsection IA-64 Options 9493@cindex IA-64 Options 9494 9495These are the @samp{-m} options defined for the Intel IA-64 architecture. 9496 9497@table @gcctabopt 9498@item -mbig-endian 9499@opindex mbig-endian 9500Generate code for a big endian target. This is the default for HP-UX@. 9501 9502@item -mlittle-endian 9503@opindex mlittle-endian 9504Generate code for a little endian target. This is the default for AIX5 9505and GNU/Linux. 9506 9507@item -mgnu-as 9508@itemx -mno-gnu-as 9509@opindex mgnu-as 9510@opindex mno-gnu-as 9511Generate (or don't) code for the GNU assembler. This is the default. 9512@c Also, this is the default if the configure option @option{--with-gnu-as} 9513@c is used. 9514 9515@item -mgnu-ld 9516@itemx -mno-gnu-ld 9517@opindex mgnu-ld 9518@opindex mno-gnu-ld 9519Generate (or don't) code for the GNU linker. This is the default. 9520@c Also, this is the default if the configure option @option{--with-gnu-ld} 9521@c is used. 9522 9523@item -mno-pic 9524@opindex mno-pic 9525Generate code that does not use a global pointer register. The result 9526is not position independent code, and violates the IA-64 ABI@. 9527 9528@item -mvolatile-asm-stop 9529@itemx -mno-volatile-asm-stop 9530@opindex mvolatile-asm-stop 9531@opindex mno-volatile-asm-stop 9532Generate (or don't) a stop bit immediately before and after volatile asm 9533statements. 9534 9535@item -mregister-names 9536@itemx -mno-register-names 9537@opindex mregister-names 9538@opindex mno-register-names 9539Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for 9540the stacked registers. This may make assembler output more readable. 9541 9542@item -mno-sdata 9543@itemx -msdata 9544@opindex mno-sdata 9545@opindex msdata 9546Disable (or enable) optimizations that use the small data section. This may 9547be useful for working around optimizer bugs. 9548 9549@item -mconstant-gp 9550@opindex mconstant-gp 9551Generate code that uses a single constant global pointer value. This is 9552useful when compiling kernel code. 9553 9554@item -mauto-pic 9555@opindex mauto-pic 9556Generate code that is self-relocatable. This implies @option{-mconstant-gp}. 9557This is useful when compiling firmware code. 9558 9559@item -minline-float-divide-min-latency 9560@opindex minline-float-divide-min-latency 9561Generate code for inline divides of floating point values 9562using the minimum latency algorithm. 9563 9564@item -minline-float-divide-max-throughput 9565@opindex minline-float-divide-max-throughput 9566Generate code for inline divides of floating point values 9567using the maximum throughput algorithm. 9568 9569@item -minline-int-divide-min-latency 9570@opindex minline-int-divide-min-latency 9571Generate code for inline divides of integer values 9572using the minimum latency algorithm. 9573 9574@item -minline-int-divide-max-throughput 9575@opindex minline-int-divide-max-throughput 9576Generate code for inline divides of integer values 9577using the maximum throughput algorithm. 9578 9579@item -minline-sqrt-min-latency 9580@opindex minline-sqrt-min-latency 9581Generate code for inline square roots 9582using the minimum latency algorithm. 9583 9584@item -minline-sqrt-max-throughput 9585@opindex minline-sqrt-max-throughput 9586Generate code for inline square roots 9587using the maximum throughput algorithm. 9588 9589@item -mno-dwarf2-asm 9590@itemx -mdwarf2-asm 9591@opindex mno-dwarf2-asm 9592@opindex mdwarf2-asm 9593Don't (or do) generate assembler code for the DWARF2 line number debugging 9594info. This may be useful when not using the GNU assembler. 9595 9596@item -mearly-stop-bits 9597@itemx -mno-early-stop-bits 9598@opindex mearly-stop-bits 9599@opindex mno-early-stop-bits 9600Allow stop bits to be placed earlier than immediately preceding the 9601instruction that triggered the stop bit. This can improve instruction 9602scheduling, but does not always do so. 9603 9604@item -mfixed-range=@var{register-range} 9605@opindex mfixed-range 9606Generate code treating the given register range as fixed registers. 9607A fixed register is one that the register allocator can not use. This is 9608useful when compiling kernel code. A register range is specified as 9609two registers separated by a dash. Multiple register ranges can be 9610specified separated by a comma. 9611 9612@item -mtls-size=@var{tls-size} 9613@opindex mtls-size 9614Specify bit size of immediate TLS offsets. Valid values are 14, 22, and 961564. 9616 9617@item -mtune=@var{cpu-type} 9618@opindex mtune 9619Tune the instruction scheduling for a particular CPU, Valid values are 9620itanium, itanium1, merced, itanium2, and mckinley. 9621 9622@item -mt 9623@itemx -pthread 9624@opindex mt 9625@opindex pthread 9626Add support for multithreading using the POSIX threads library. This 9627option sets flags for both the preprocessor and linker. It does 9628not affect the thread safety of object code produced by the compiler or 9629that of libraries supplied with it. These are HP-UX specific flags. 9630 9631@item -milp32 9632@itemx -mlp64 9633@opindex milp32 9634@opindex mlp64 9635Generate code for a 32-bit or 64-bit environment. 9636The 32-bit environment sets int, long and pointer to 32 bits. 9637The 64-bit environment sets int to 32 bits and long and pointer 9638to 64 bits. These are HP-UX specific flags. 9639 9640@item -mno-sched-br-data-spec 9641@itemx -msched-br-data-spec 9642@opindex mno-sched-br-data-spec 9643@opindex msched-br-data-spec 9644(Dis/En)able data speculative scheduling before reload. 9645This will result in generation of the ld.a instructions and 9646the corresponding check instructions (ld.c / chk.a). 9647The default is 'disable'. 9648 9649@item -msched-ar-data-spec 9650@itemx -mno-sched-ar-data-spec 9651@opindex msched-ar-data-spec 9652@opindex mno-sched-ar-data-spec 9653(En/Dis)able data speculative scheduling after reload. 9654This will result in generation of the ld.a instructions and 9655the corresponding check instructions (ld.c / chk.a). 9656The default is 'enable'. 9657 9658@item -mno-sched-control-spec 9659@itemx -msched-control-spec 9660@opindex mno-sched-control-spec 9661@opindex msched-control-spec 9662(Dis/En)able control speculative scheduling. This feature is 9663available only during region scheduling (i.e. before reload). 9664This will result in generation of the ld.s instructions and 9665the corresponding check instructions chk.s . 9666The default is 'disable'. 9667 9668@item -msched-br-in-data-spec 9669@itemx -mno-sched-br-in-data-spec 9670@opindex msched-br-in-data-spec 9671@opindex mno-sched-br-in-data-spec 9672(En/Dis)able speculative scheduling of the instructions that 9673are dependent on the data speculative loads before reload. 9674This is effective only with @option{-msched-br-data-spec} enabled. 9675The default is 'enable'. 9676 9677@item -msched-ar-in-data-spec 9678@itemx -mno-sched-ar-in-data-spec 9679@opindex msched-ar-in-data-spec 9680@opindex mno-sched-ar-in-data-spec 9681(En/Dis)able speculative scheduling of the instructions that 9682are dependent on the data speculative loads after reload. 9683This is effective only with @option{-msched-ar-data-spec} enabled. 9684The default is 'enable'. 9685 9686@item -msched-in-control-spec 9687@itemx -mno-sched-in-control-spec 9688@opindex msched-in-control-spec 9689@opindex mno-sched-in-control-spec 9690(En/Dis)able speculative scheduling of the instructions that 9691are dependent on the control speculative loads. 9692This is effective only with @option{-msched-control-spec} enabled. 9693The default is 'enable'. 9694 9695@item -msched-ldc 9696@itemx -mno-sched-ldc 9697@opindex msched-ldc 9698@opindex mno-sched-ldc 9699(En/Dis)able use of simple data speculation checks ld.c . 9700If disabled, only chk.a instructions will be emitted to check 9701data speculative loads. 9702The default is 'enable'. 9703 9704@item -mno-sched-control-ldc 9705@itemx -msched-control-ldc 9706@opindex mno-sched-control-ldc 9707@opindex msched-control-ldc 9708(Dis/En)able use of ld.c instructions to check control speculative loads. 9709If enabled, in case of control speculative load with no speculatively 9710scheduled dependent instructions this load will be emitted as ld.sa and 9711ld.c will be used to check it. 9712The default is 'disable'. 9713 9714@item -mno-sched-spec-verbose 9715@itemx -msched-spec-verbose 9716@opindex mno-sched-spec-verbose 9717@opindex msched-spec-verbose 9718(Dis/En)able printing of the information about speculative motions. 9719 9720@item -mno-sched-prefer-non-data-spec-insns 9721@itemx -msched-prefer-non-data-spec-insns 9722@opindex mno-sched-prefer-non-data-spec-insns 9723@opindex msched-prefer-non-data-spec-insns 9724If enabled, data speculative instructions will be chosen for schedule 9725only if there are no other choices at the moment. This will make 9726the use of the data speculation much more conservative. 9727The default is 'disable'. 9728 9729@item -mno-sched-prefer-non-control-spec-insns 9730@itemx -msched-prefer-non-control-spec-insns 9731@opindex mno-sched-prefer-non-control-spec-insns 9732@opindex msched-prefer-non-control-spec-insns 9733If enabled, control speculative instructions will be chosen for schedule 9734only if there are no other choices at the moment. This will make 9735the use of the control speculation much more conservative. 9736The default is 'disable'. 9737 9738@item -mno-sched-count-spec-in-critical-path 9739@itemx -msched-count-spec-in-critical-path 9740@opindex mno-sched-count-spec-in-critical-path 9741@opindex msched-count-spec-in-critical-path 9742If enabled, speculative dependencies will be considered during 9743computation of the instructions priorities. This will make the use of the 9744speculation a bit more conservative. 9745The default is 'disable'. 9746 9747@end table 9748 9749@node M32C Options 9750@subsection M32C Options 9751@cindex M32C options 9752 9753@table @gcctabopt 9754@item -mcpu=@var{name} 9755@opindex mcpu= 9756Select the CPU for which code is generated. @var{name} may be one of 9757@samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to 9758/60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for 9759the M32C/80 series. 9760 9761@item -msim 9762@opindex msim 9763Specifies that the program will be run on the simulator. This causes 9764an alternate runtime library to be linked in which supports, for 9765example, file I/O. You must not use this option when generating 9766programs that will run on real hardware; you must provide your own 9767runtime library for whatever I/O functions are needed. 9768 9769@item -memregs=@var{number} 9770@opindex memregs= 9771Specifies the number of memory-based pseudo-registers GCC will use 9772during code generation. These pseudo-registers will be used like real 9773registers, so there is a tradeoff between GCC's ability to fit the 9774code into available registers, and the performance penalty of using 9775memory instead of registers. Note that all modules in a program must 9776be compiled with the same value for this option. Because of that, you 9777must not use this option with the default runtime libraries gcc 9778builds. 9779 9780@end table 9781 9782@node M32R/D Options 9783@subsection M32R/D Options 9784@cindex M32R/D options 9785 9786These @option{-m} options are defined for Renesas M32R/D architectures: 9787 9788@table @gcctabopt 9789@item -m32r2 9790@opindex m32r2 9791Generate code for the M32R/2@. 9792 9793@item -m32rx 9794@opindex m32rx 9795Generate code for the M32R/X@. 9796 9797@item -m32r 9798@opindex m32r 9799Generate code for the M32R@. This is the default. 9800 9801@item -mmodel=small 9802@opindex mmodel=small 9803Assume all objects live in the lower 16MB of memory (so that their addresses 9804can be loaded with the @code{ld24} instruction), and assume all subroutines 9805are reachable with the @code{bl} instruction. 9806This is the default. 9807 9808The addressability of a particular object can be set with the 9809@code{model} attribute. 9810 9811@item -mmodel=medium 9812@opindex mmodel=medium 9813Assume objects may be anywhere in the 32-bit address space (the compiler 9814will generate @code{seth/add3} instructions to load their addresses), and 9815assume all subroutines are reachable with the @code{bl} instruction. 9816 9817@item -mmodel=large 9818@opindex mmodel=large 9819Assume objects may be anywhere in the 32-bit address space (the compiler 9820will generate @code{seth/add3} instructions to load their addresses), and 9821assume subroutines may not be reachable with the @code{bl} instruction 9822(the compiler will generate the much slower @code{seth/add3/jl} 9823instruction sequence). 9824 9825@item -msdata=none 9826@opindex msdata=none 9827Disable use of the small data area. Variables will be put into 9828one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the 9829@code{section} attribute has been specified). 9830This is the default. 9831 9832The small data area consists of sections @samp{.sdata} and @samp{.sbss}. 9833Objects may be explicitly put in the small data area with the 9834@code{section} attribute using one of these sections. 9835 9836@item -msdata=sdata 9837@opindex msdata=sdata 9838Put small global and static data in the small data area, but do not 9839generate special code to reference them. 9840 9841@item -msdata=use 9842@opindex msdata=use 9843Put small global and static data in the small data area, and generate 9844special instructions to reference them. 9845 9846@item -G @var{num} 9847@opindex G 9848@cindex smaller data references 9849Put global and static objects less than or equal to @var{num} bytes 9850into the small data or bss sections instead of the normal data or bss 9851sections. The default value of @var{num} is 8. 9852The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use} 9853for this option to have any effect. 9854 9855All modules should be compiled with the same @option{-G @var{num}} value. 9856Compiling with different values of @var{num} may or may not work; if it 9857doesn't the linker will give an error message---incorrect code will not be 9858generated. 9859 9860@item -mdebug 9861@opindex mdebug 9862Makes the M32R specific code in the compiler display some statistics 9863that might help in debugging programs. 9864 9865@item -malign-loops 9866@opindex malign-loops 9867Align all loops to a 32-byte boundary. 9868 9869@item -mno-align-loops 9870@opindex mno-align-loops 9871Do not enforce a 32-byte alignment for loops. This is the default. 9872 9873@item -missue-rate=@var{number} 9874@opindex missue-rate=@var{number} 9875Issue @var{number} instructions per cycle. @var{number} can only be 1 9876or 2. 9877 9878@item -mbranch-cost=@var{number} 9879@opindex mbranch-cost=@var{number} 9880@var{number} can only be 1 or 2. If it is 1 then branches will be 9881preferred over conditional code, if it is 2, then the opposite will 9882apply. 9883 9884@item -mflush-trap=@var{number} 9885@opindex mflush-trap=@var{number} 9886Specifies the trap number to use to flush the cache. The default is 988712. Valid numbers are between 0 and 15 inclusive. 9888 9889@item -mno-flush-trap 9890@opindex mno-flush-trap 9891Specifies that the cache cannot be flushed by using a trap. 9892 9893@item -mflush-func=@var{name} 9894@opindex mflush-func=@var{name} 9895Specifies the name of the operating system function to call to flush 9896the cache. The default is @emph{_flush_cache}, but a function call 9897will only be used if a trap is not available. 9898 9899@item -mno-flush-func 9900@opindex mno-flush-func 9901Indicates that there is no OS function for flushing the cache. 9902 9903@end table 9904 9905@node M680x0 Options 9906@subsection M680x0 Options 9907@cindex M680x0 options 9908 9909These are the @samp{-m} options defined for the 68000 series. The default 9910values for these options depends on which style of 68000 was selected when 9911the compiler was configured; the defaults for the most common choices are 9912given below. 9913 9914@table @gcctabopt 9915@item -m68000 9916@itemx -mc68000 9917@opindex m68000 9918@opindex mc68000 9919Generate output for a 68000. This is the default 9920when the compiler is configured for 68000-based systems. 9921 9922Use this option for microcontrollers with a 68000 or EC000 core, 9923including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356. 9924 9925@item -m68020 9926@itemx -mc68020 9927@opindex m68020 9928@opindex mc68020 9929Generate output for a 68020. This is the default 9930when the compiler is configured for 68020-based systems. 9931 9932@item -m68881 9933@opindex m68881 9934Generate output containing 68881 instructions for floating point. 9935This is the default for most 68020 systems unless @option{--nfp} was 9936specified when the compiler was configured. 9937 9938@item -m68030 9939@opindex m68030 9940Generate output for a 68030. This is the default when the compiler is 9941configured for 68030-based systems. 9942 9943@item -m68040 9944@opindex m68040 9945Generate output for a 68040. This is the default when the compiler is 9946configured for 68040-based systems. 9947 9948This option inhibits the use of 68881/68882 instructions that have to be 9949emulated by software on the 68040. Use this option if your 68040 does not 9950have code to emulate those instructions. 9951 9952@item -m68060 9953@opindex m68060 9954Generate output for a 68060. This is the default when the compiler is 9955configured for 68060-based systems. 9956 9957This option inhibits the use of 68020 and 68881/68882 instructions that 9958have to be emulated by software on the 68060. Use this option if your 68060 9959does not have code to emulate those instructions. 9960 9961@item -mcpu32 9962@opindex mcpu32 9963Generate output for a CPU32. This is the default 9964when the compiler is configured for CPU32-based systems. 9965 9966Use this option for microcontrollers with a 9967CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334, 996868336, 68340, 68341, 68349 and 68360. 9969 9970@item -m5200 9971@opindex m5200 9972Generate output for a 520X ``coldfire'' family cpu. This is the default 9973when the compiler is configured for 520X-based systems. 9974 9975Use this option for microcontroller with a 5200 core, including 9976the MCF5202, MCF5203, MCF5204 and MCF5202. 9977 9978@item -mcfv4e 9979@opindex mcfv4e 9980Generate output for a ColdFire V4e family cpu (e.g.@: 547x/548x). 9981This includes use of hardware floating point instructions. 9982 9983@item -m68020-40 9984@opindex m68020-40 9985Generate output for a 68040, without using any of the new instructions. 9986This results in code which can run relatively efficiently on either a 998768020/68881 or a 68030 or a 68040. The generated code does use the 998868881 instructions that are emulated on the 68040. 9989 9990@item -m68020-60 9991@opindex m68020-60 9992Generate output for a 68060, without using any of the new instructions. 9993This results in code which can run relatively efficiently on either a 999468020/68881 or a 68030 or a 68040. The generated code does use the 999568881 instructions that are emulated on the 68060. 9996 9997@item -msoft-float 9998@opindex msoft-float 9999Generate output containing library calls for floating point. 10000@strong{Warning:} the requisite libraries are not available for all m68k 10001targets. Normally the facilities of the machine's usual C compiler are 10002used, but this can't be done directly in cross-compilation. You must 10003make your own arrangements to provide suitable library functions for 10004cross-compilation. The embedded targets @samp{m68k-*-aout} and 10005@samp{m68k-*-coff} do provide software floating point support. 10006 10007@item -mshort 10008@opindex mshort 10009Consider type @code{int} to be 16 bits wide, like @code{short int}. 10010Additionally, parameters passed on the stack are also aligned to a 1001116-bit boundary even on targets whose API mandates promotion to 32-bit. 10012 10013@item -mnobitfield 10014@opindex mnobitfield 10015Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32} 10016and @option{-m5200} options imply @w{@option{-mnobitfield}}. 10017 10018@item -mbitfield 10019@opindex mbitfield 10020Do use the bit-field instructions. The @option{-m68020} option implies 10021@option{-mbitfield}. This is the default if you use a configuration 10022designed for a 68020. 10023 10024@item -mrtd 10025@opindex mrtd 10026Use a different function-calling convention, in which functions 10027that take a fixed number of arguments return with the @code{rtd} 10028instruction, which pops their arguments while returning. This 10029saves one instruction in the caller since there is no need to pop 10030the arguments there. 10031 10032This calling convention is incompatible with the one normally 10033used on Unix, so you cannot use it if you need to call libraries 10034compiled with the Unix compiler. 10035 10036Also, you must provide function prototypes for all functions that 10037take variable numbers of arguments (including @code{printf}); 10038otherwise incorrect code will be generated for calls to those 10039functions. 10040 10041In addition, seriously incorrect code will result if you call a 10042function with too many arguments. (Normally, extra arguments are 10043harmlessly ignored.) 10044 10045The @code{rtd} instruction is supported by the 68010, 68020, 68030, 1004668040, 68060 and CPU32 processors, but not by the 68000 or 5200. 10047 10048@item -malign-int 10049@itemx -mno-align-int 10050@opindex malign-int 10051@opindex mno-align-int 10052Control whether GCC aligns @code{int}, @code{long}, @code{long long}, 10053@code{float}, @code{double}, and @code{long double} variables on a 32-bit 10054boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}). 10055Aligning variables on 32-bit boundaries produces code that runs somewhat 10056faster on processors with 32-bit busses at the expense of more memory. 10057 10058@strong{Warning:} if you use the @option{-malign-int} switch, GCC will 10059align structures containing the above types differently than 10060most published application binary interface specifications for the m68k. 10061 10062@item -mpcrel 10063@opindex mpcrel 10064Use the pc-relative addressing mode of the 68000 directly, instead of 10065using a global offset table. At present, this option implies @option{-fpic}, 10066allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is 10067not presently supported with @option{-mpcrel}, though this could be supported for 1006868020 and higher processors. 10069 10070@item -mno-strict-align 10071@itemx -mstrict-align 10072@opindex mno-strict-align 10073@opindex mstrict-align 10074Do not (do) assume that unaligned memory references will be handled by 10075the system. 10076 10077@item -msep-data 10078Generate code that allows the data segment to be located in a different 10079area of memory from the text segment. This allows for execute in place in 10080an environment without virtual memory management. This option implies 10081@option{-fPIC}. 10082 10083@item -mno-sep-data 10084Generate code that assumes that the data segment follows the text segment. 10085This is the default. 10086 10087@item -mid-shared-library 10088Generate code that supports shared libraries via the library ID method. 10089This allows for execute in place and shared libraries in an environment 10090without virtual memory management. This option implies @option{-fPIC}. 10091 10092@item -mno-id-shared-library 10093Generate code that doesn't assume ID based shared libraries are being used. 10094This is the default. 10095 10096@item -mshared-library-id=n 10097Specified the identification number of the ID based shared library being 10098compiled. Specifying a value of 0 will generate more compact code, specifying 10099other values will force the allocation of that number to the current 10100library but is no more space or time efficient than omitting this option. 10101 10102@end table 10103 10104@node M68hc1x Options 10105@subsection M68hc1x Options 10106@cindex M68hc1x options 10107 10108These are the @samp{-m} options defined for the 68hc11 and 68hc12 10109microcontrollers. The default values for these options depends on 10110which style of microcontroller was selected when the compiler was configured; 10111the defaults for the most common choices are given below. 10112 10113@table @gcctabopt 10114@item -m6811 10115@itemx -m68hc11 10116@opindex m6811 10117@opindex m68hc11 10118Generate output for a 68HC11. This is the default 10119when the compiler is configured for 68HC11-based systems. 10120 10121@item -m6812 10122@itemx -m68hc12 10123@opindex m6812 10124@opindex m68hc12 10125Generate output for a 68HC12. This is the default 10126when the compiler is configured for 68HC12-based systems. 10127 10128@item -m68S12 10129@itemx -m68hcs12 10130@opindex m68S12 10131@opindex m68hcs12 10132Generate output for a 68HCS12. 10133 10134@item -mauto-incdec 10135@opindex mauto-incdec 10136Enable the use of 68HC12 pre and post auto-increment and auto-decrement 10137addressing modes. 10138 10139@item -minmax 10140@itemx -nominmax 10141@opindex minmax 10142@opindex mnominmax 10143Enable the use of 68HC12 min and max instructions. 10144 10145@item -mlong-calls 10146@itemx -mno-long-calls 10147@opindex mlong-calls 10148@opindex mno-long-calls 10149Treat all calls as being far away (near). If calls are assumed to be 10150far away, the compiler will use the @code{call} instruction to 10151call a function and the @code{rtc} instruction for returning. 10152 10153@item -mshort 10154@opindex mshort 10155Consider type @code{int} to be 16 bits wide, like @code{short int}. 10156 10157@item -msoft-reg-count=@var{count} 10158@opindex msoft-reg-count 10159Specify the number of pseudo-soft registers which are used for the 10160code generation. The maximum number is 32. Using more pseudo-soft 10161register may or may not result in better code depending on the program. 10162The default is 4 for 68HC11 and 2 for 68HC12. 10163 10164@end table 10165 10166@node MCore Options 10167@subsection MCore Options 10168@cindex MCore options 10169 10170These are the @samp{-m} options defined for the Motorola M*Core 10171processors. 10172 10173@table @gcctabopt 10174 10175@item -mhardlit 10176@itemx -mno-hardlit 10177@opindex mhardlit 10178@opindex mno-hardlit 10179Inline constants into the code stream if it can be done in two 10180instructions or less. 10181 10182@item -mdiv 10183@itemx -mno-div 10184@opindex mdiv 10185@opindex mno-div 10186Use the divide instruction. (Enabled by default). 10187 10188@item -mrelax-immediate 10189@itemx -mno-relax-immediate 10190@opindex mrelax-immediate 10191@opindex mno-relax-immediate 10192Allow arbitrary sized immediates in bit operations. 10193 10194@item -mwide-bitfields 10195@itemx -mno-wide-bitfields 10196@opindex mwide-bitfields 10197@opindex mno-wide-bitfields 10198Always treat bit-fields as int-sized. 10199 10200@item -m4byte-functions 10201@itemx -mno-4byte-functions 10202@opindex m4byte-functions 10203@opindex mno-4byte-functions 10204Force all functions to be aligned to a four byte boundary. 10205 10206@item -mcallgraph-data 10207@itemx -mno-callgraph-data 10208@opindex mcallgraph-data 10209@opindex mno-callgraph-data 10210Emit callgraph information. 10211 10212@item -mslow-bytes 10213@itemx -mno-slow-bytes 10214@opindex mslow-bytes 10215@opindex mno-slow-bytes 10216Prefer word access when reading byte quantities. 10217 10218@item -mlittle-endian 10219@itemx -mbig-endian 10220@opindex mlittle-endian 10221@opindex mbig-endian 10222Generate code for a little endian target. 10223 10224@item -m210 10225@itemx -m340 10226@opindex m210 10227@opindex m340 10228Generate code for the 210 processor. 10229@end table 10230 10231@node MIPS Options 10232@subsection MIPS Options 10233@cindex MIPS options 10234 10235@table @gcctabopt 10236 10237@item -EB 10238@opindex EB 10239Generate big-endian code. 10240 10241@item -EL 10242@opindex EL 10243Generate little-endian code. This is the default for @samp{mips*el-*-*} 10244configurations. 10245 10246@item -march=@var{arch} 10247@opindex march 10248Generate code that will run on @var{arch}, which can be the name of a 10249generic MIPS ISA, or the name of a particular processor. 10250The ISA names are: 10251@samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4}, 10252@samp{mips32}, @samp{mips32r2}, and @samp{mips64}. 10253The processor names are: 10254@samp{4kc}, @samp{4km}, @samp{4kp}, 10255@samp{5kc}, @samp{5kf}, 10256@samp{20kc}, 10257@samp{24k}, @samp{24kc}, @samp{24kf}, @samp{24kx}, 10258@samp{m4k}, 10259@samp{orion}, 10260@samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400}, 10261@samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000}, 10262@samp{rm7000}, @samp{rm9000}, 10263@samp{sb1}, 10264@samp{sr71000}, 10265@samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300}, 10266@samp{vr5000}, @samp{vr5400} and @samp{vr5500}. 10267The special value @samp{from-abi} selects the 10268most compatible architecture for the selected ABI (that is, 10269@samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@. 10270 10271In processor names, a final @samp{000} can be abbreviated as @samp{k} 10272(for example, @samp{-march=r2k}). Prefixes are optional, and 10273@samp{vr} may be written @samp{r}. 10274 10275GCC defines two macros based on the value of this option. The first 10276is @samp{_MIPS_ARCH}, which gives the name of target architecture, as 10277a string. The second has the form @samp{_MIPS_ARCH_@var{foo}}, 10278where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@. 10279For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH} 10280to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}. 10281 10282Note that the @samp{_MIPS_ARCH} macro uses the processor names given 10283above. In other words, it will have the full prefix and will not 10284abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi}, 10285the macro names the resolved architecture (either @samp{"mips1"} or 10286@samp{"mips3"}). It names the default architecture when no 10287@option{-march} option is given. 10288 10289@item -mtune=@var{arch} 10290@opindex mtune 10291Optimize for @var{arch}. Among other things, this option controls 10292the way instructions are scheduled, and the perceived cost of arithmetic 10293operations. The list of @var{arch} values is the same as for 10294@option{-march}. 10295 10296When this option is not used, GCC will optimize for the processor 10297specified by @option{-march}. By using @option{-march} and 10298@option{-mtune} together, it is possible to generate code that will 10299run on a family of processors, but optimize the code for one 10300particular member of that family. 10301 10302@samp{-mtune} defines the macros @samp{_MIPS_TUNE} and 10303@samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the 10304@samp{-march} ones described above. 10305 10306@item -mips1 10307@opindex mips1 10308Equivalent to @samp{-march=mips1}. 10309 10310@item -mips2 10311@opindex mips2 10312Equivalent to @samp{-march=mips2}. 10313 10314@item -mips3 10315@opindex mips3 10316Equivalent to @samp{-march=mips3}. 10317 10318@item -mips4 10319@opindex mips4 10320Equivalent to @samp{-march=mips4}. 10321 10322@item -mips32 10323@opindex mips32 10324Equivalent to @samp{-march=mips32}. 10325 10326@item -mips32r2 10327@opindex mips32r2 10328Equivalent to @samp{-march=mips32r2}. 10329 10330@item -mips64 10331@opindex mips64 10332Equivalent to @samp{-march=mips64}. 10333 10334@item -mips16 10335@itemx -mno-mips16 10336@opindex mips16 10337@opindex mno-mips16 10338Generate (do not generate) MIPS16 code. If GCC is targetting a 10339MIPS32 or MIPS64 architecture, it will make use of the MIPS16e ASE@. 10340 10341@item -mabi=32 10342@itemx -mabi=o64 10343@itemx -mabi=n32 10344@itemx -mabi=64 10345@itemx -mabi=eabi 10346@opindex mabi=32 10347@opindex mabi=o64 10348@opindex mabi=n32 10349@opindex mabi=64 10350@opindex mabi=eabi 10351Generate code for the given ABI@. 10352 10353Note that the EABI has a 32-bit and a 64-bit variant. GCC normally 10354generates 64-bit code when you select a 64-bit architecture, but you 10355can use @option{-mgp32} to get 32-bit code instead. 10356 10357For information about the O64 ABI, see 10358@w{@uref{http://gcc.gnu.org/projects/mipso64-abi.html}}. 10359 10360@item -mabicalls 10361@itemx -mno-abicalls 10362@opindex mabicalls 10363@opindex mno-abicalls 10364Generate (do not generate) code that is suitable for SVR4-style 10365dynamic objects. @option{-mabicalls} is the default for SVR4-based 10366systems. 10367 10368@item -mshared 10369@itemx -mno-shared 10370Generate (do not generate) code that is fully position-independent, 10371and that can therefore be linked into shared libraries. This option 10372only affects @option{-mabicalls}. 10373 10374All @option{-mabicalls} code has traditionally been position-independent, 10375regardless of options like @option{-fPIC} and @option{-fpic}. However, 10376as an extension, the GNU toolchain allows executables to use absolute 10377accesses for locally-binding symbols. It can also use shorter GP 10378initialization sequences and generate direct calls to locally-defined 10379functions. This mode is selected by @option{-mno-shared}. 10380 10381@option{-mno-shared} depends on binutils 2.16 or higher and generates 10382objects that can only be linked by the GNU linker. However, the option 10383does not affect the ABI of the final executable; it only affects the ABI 10384of relocatable objects. Using @option{-mno-shared} will generally make 10385executables both smaller and quicker. 10386 10387@option{-mshared} is the default. 10388 10389@item -mxgot 10390@itemx -mno-xgot 10391@opindex mxgot 10392@opindex mno-xgot 10393Lift (do not lift) the usual restrictions on the size of the global 10394offset table. 10395 10396GCC normally uses a single instruction to load values from the GOT@. 10397While this is relatively efficient, it will only work if the GOT 10398is smaller than about 64k. Anything larger will cause the linker 10399to report an error such as: 10400 10401@cindex relocation truncated to fit (MIPS) 10402@smallexample 10403relocation truncated to fit: R_MIPS_GOT16 foobar 10404@end smallexample 10405 10406If this happens, you should recompile your code with @option{-mxgot}. 10407It should then work with very large GOTs, although it will also be 10408less efficient, since it will take three instructions to fetch the 10409value of a global symbol. 10410 10411Note that some linkers can create multiple GOTs. If you have such a 10412linker, you should only need to use @option{-mxgot} when a single object 10413file accesses more than 64k's worth of GOT entries. Very few do. 10414 10415These options have no effect unless GCC is generating position 10416independent code. 10417 10418@item -mgp32 10419@opindex mgp32 10420Assume that general-purpose registers are 32 bits wide. 10421 10422@item -mgp64 10423@opindex mgp64 10424Assume that general-purpose registers are 64 bits wide. 10425 10426@item -mfp32 10427@opindex mfp32 10428Assume that floating-point registers are 32 bits wide. 10429 10430@item -mfp64 10431@opindex mfp64 10432Assume that floating-point registers are 64 bits wide. 10433 10434@item -mhard-float 10435@opindex mhard-float 10436Use floating-point coprocessor instructions. 10437 10438@item -msoft-float 10439@opindex msoft-float 10440Do not use floating-point coprocessor instructions. Implement 10441floating-point calculations using library calls instead. 10442 10443@item -msingle-float 10444@opindex msingle-float 10445Assume that the floating-point coprocessor only supports single-precision 10446operations. 10447 10448@itemx -mdouble-float 10449@opindex mdouble-float 10450Assume that the floating-point coprocessor supports double-precision 10451operations. This is the default. 10452 10453@itemx -mdsp 10454@itemx -mno-dsp 10455@opindex mdsp 10456@opindex mno-dsp 10457Use (do not use) the MIPS DSP ASE. @xref{MIPS DSP Built-in Functions}. 10458 10459@itemx -mpaired-single 10460@itemx -mno-paired-single 10461@opindex mpaired-single 10462@opindex mno-paired-single 10463Use (do not use) paired-single floating-point instructions. 10464@xref{MIPS Paired-Single Support}. This option can only be used 10465when generating 64-bit code and requires hardware floating-point 10466support to be enabled. 10467 10468@itemx -mips3d 10469@itemx -mno-mips3d 10470@opindex mips3d 10471@opindex mno-mips3d 10472Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}. 10473The option @option{-mips3d} implies @option{-mpaired-single}. 10474 10475@item -mlong64 10476@opindex mlong64 10477Force @code{long} types to be 64 bits wide. See @option{-mlong32} for 10478an explanation of the default and the way that the pointer size is 10479determined. 10480 10481@item -mlong32 10482@opindex mlong32 10483Force @code{long}, @code{int}, and pointer types to be 32 bits wide. 10484 10485The default size of @code{int}s, @code{long}s and pointers depends on 10486the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI 10487uses 64-bit @code{long}s, as does the 64-bit EABI; the others use 1048832-bit @code{long}s. Pointers are the same size as @code{long}s, 10489or the same size as integer registers, whichever is smaller. 10490 10491@item -msym32 10492@itemx -mno-sym32 10493@opindex msym32 10494@opindex mno-sym32 10495Assume (do not assume) that all symbols have 32-bit values, regardless 10496of the selected ABI@. This option is useful in combination with 10497@option{-mabi=64} and @option{-mno-abicalls} because it allows GCC 10498to generate shorter and faster references to symbolic addresses. 10499 10500@item -G @var{num} 10501@opindex G 10502@cindex smaller data references (MIPS) 10503@cindex gp-relative references (MIPS) 10504Put global and static items less than or equal to @var{num} bytes into 10505the small data or bss section instead of the normal data or bss section. 10506This allows the data to be accessed using a single instruction. 10507 10508All modules should be compiled with the same @option{-G @var{num}} 10509value. 10510 10511@item -membedded-data 10512@itemx -mno-embedded-data 10513@opindex membedded-data 10514@opindex mno-embedded-data 10515Allocate variables to the read-only data section first if possible, then 10516next in the small data section if possible, otherwise in data. This gives 10517slightly slower code than the default, but reduces the amount of RAM required 10518when executing, and thus may be preferred for some embedded systems. 10519 10520@item -muninit-const-in-rodata 10521@itemx -mno-uninit-const-in-rodata 10522@opindex muninit-const-in-rodata 10523@opindex mno-uninit-const-in-rodata 10524Put uninitialized @code{const} variables in the read-only data section. 10525This option is only meaningful in conjunction with @option{-membedded-data}. 10526 10527@item -msplit-addresses 10528@itemx -mno-split-addresses 10529@opindex msplit-addresses 10530@opindex mno-split-addresses 10531Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler 10532relocation operators. This option has been superseded by 10533@option{-mexplicit-relocs} but is retained for backwards compatibility. 10534 10535@item -mexplicit-relocs 10536@itemx -mno-explicit-relocs 10537@opindex mexplicit-relocs 10538@opindex mno-explicit-relocs 10539Use (do not use) assembler relocation operators when dealing with symbolic 10540addresses. The alternative, selected by @option{-mno-explicit-relocs}, 10541is to use assembler macros instead. 10542 10543@option{-mexplicit-relocs} is the default if GCC was configured 10544to use an assembler that supports relocation operators. 10545 10546@item -mcheck-zero-division 10547@itemx -mno-check-zero-division 10548@opindex mcheck-zero-division 10549@opindex mno-check-zero-division 10550Trap (do not trap) on integer division by zero. The default is 10551@option{-mcheck-zero-division}. 10552 10553@item -mdivide-traps 10554@itemx -mdivide-breaks 10555@opindex mdivide-traps 10556@opindex mdivide-breaks 10557MIPS systems check for division by zero by generating either a 10558conditional trap or a break instruction. Using traps results in 10559smaller code, but is only supported on MIPS II and later. Also, some 10560versions of the Linux kernel have a bug that prevents trap from 10561generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to 10562allow conditional traps on architectures that support them and 10563@option{-mdivide-breaks} to force the use of breaks. 10564 10565The default is usually @option{-mdivide-traps}, but this can be 10566overridden at configure time using @option{--with-divide=breaks}. 10567Divide-by-zero checks can be completely disabled using 10568@option{-mno-check-zero-division}. 10569 10570@item -mmemcpy 10571@itemx -mno-memcpy 10572@opindex mmemcpy 10573@opindex mno-memcpy 10574Force (do not force) the use of @code{memcpy()} for non-trivial block 10575moves. The default is @option{-mno-memcpy}, which allows GCC to inline 10576most constant-sized copies. 10577 10578@item -mlong-calls 10579@itemx -mno-long-calls 10580@opindex mlong-calls 10581@opindex mno-long-calls 10582Disable (do not disable) use of the @code{jal} instruction. Calling 10583functions using @code{jal} is more efficient but requires the caller 10584and callee to be in the same 256 megabyte segment. 10585 10586This option has no effect on abicalls code. The default is 10587@option{-mno-long-calls}. 10588 10589@item -mmad 10590@itemx -mno-mad 10591@opindex mmad 10592@opindex mno-mad 10593Enable (disable) use of the @code{mad}, @code{madu} and @code{mul} 10594instructions, as provided by the R4650 ISA@. 10595 10596@item -mfused-madd 10597@itemx -mno-fused-madd 10598@opindex mfused-madd 10599@opindex mno-fused-madd 10600Enable (disable) use of the floating point multiply-accumulate 10601instructions, when they are available. The default is 10602@option{-mfused-madd}. 10603 10604When multiply-accumulate instructions are used, the intermediate 10605product is calculated to infinite precision and is not subject to 10606the FCSR Flush to Zero bit. This may be undesirable in some 10607circumstances. 10608 10609@item -nocpp 10610@opindex nocpp 10611Tell the MIPS assembler to not run its preprocessor over user 10612assembler files (with a @samp{.s} suffix) when assembling them. 10613 10614@item -mfix-r4000 10615@itemx -mno-fix-r4000 10616@opindex mfix-r4000 10617@opindex mno-fix-r4000 10618Work around certain R4000 CPU errata: 10619@itemize @minus 10620@item 10621A double-word or a variable shift may give an incorrect result if executed 10622immediately after starting an integer division. 10623@item 10624A double-word or a variable shift may give an incorrect result if executed 10625while an integer multiplication is in progress. 10626@item 10627An integer division may give an incorrect result if started in a delay slot 10628of a taken branch or a jump. 10629@end itemize 10630 10631@item -mfix-r4400 10632@itemx -mno-fix-r4400 10633@opindex mfix-r4400 10634@opindex mno-fix-r4400 10635Work around certain R4400 CPU errata: 10636@itemize @minus 10637@item 10638A double-word or a variable shift may give an incorrect result if executed 10639immediately after starting an integer division. 10640@end itemize 10641 10642@item -mfix-vr4120 10643@itemx -mno-fix-vr4120 10644@opindex mfix-vr4120 10645Work around certain VR4120 errata: 10646@itemize @minus 10647@item 10648@code{dmultu} does not always produce the correct result. 10649@item 10650@code{div} and @code{ddiv} do not always produce the correct result if one 10651of the operands is negative. 10652@end itemize 10653The workarounds for the division errata rely on special functions in 10654@file{libgcc.a}. At present, these functions are only provided by 10655the @code{mips64vr*-elf} configurations. 10656 10657Other VR4120 errata require a nop to be inserted between certain pairs of 10658instructions. These errata are handled by the assembler, not by GCC itself. 10659 10660@item -mfix-vr4130 10661@opindex mfix-vr4130 10662Work around the VR4130 @code{mflo}/@code{mfhi} errata. The 10663workarounds are implemented by the assembler rather than by GCC, 10664although GCC will avoid using @code{mflo} and @code{mfhi} if the 10665VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi} 10666instructions are available instead. 10667 10668@item -mfix-sb1 10669@itemx -mno-fix-sb1 10670@opindex mfix-sb1 10671Work around certain SB-1 CPU core errata. 10672(This flag currently works around the SB-1 revision 2 10673``F1'' and ``F2'' floating point errata.) 10674 10675@item -mflush-func=@var{func} 10676@itemx -mno-flush-func 10677@opindex mflush-func 10678Specifies the function to call to flush the I and D caches, or to not 10679call any such function. If called, the function must take the same 10680arguments as the common @code{_flush_func()}, that is, the address of the 10681memory range for which the cache is being flushed, the size of the 10682memory range, and the number 3 (to flush both caches). The default 10683depends on the target GCC was configured for, but commonly is either 10684@samp{_flush_func} or @samp{__cpu_flush}. 10685 10686@item -mbranch-likely 10687@itemx -mno-branch-likely 10688@opindex mbranch-likely 10689@opindex mno-branch-likely 10690Enable or disable use of Branch Likely instructions, regardless of the 10691default for the selected architecture. By default, Branch Likely 10692instructions may be generated if they are supported by the selected 10693architecture. An exception is for the MIPS32 and MIPS64 architectures 10694and processors which implement those architectures; for those, Branch 10695Likely instructions will not be generated by default because the MIPS32 10696and MIPS64 architectures specifically deprecate their use. 10697 10698@item -mfp-exceptions 10699@itemx -mno-fp-exceptions 10700@opindex mfp-exceptions 10701Specifies whether FP exceptions are enabled. This affects how we schedule 10702FP instructions for some processors. The default is that FP exceptions are 10703enabled. 10704 10705For instance, on the SB-1, if FP exceptions are disabled, and we are emitting 1070664-bit code, then we can use both FP pipes. Otherwise, we can only use one 10707FP pipe. 10708 10709@item -mvr4130-align 10710@itemx -mno-vr4130-align 10711@opindex mvr4130-align 10712The VR4130 pipeline is two-way superscalar, but can only issue two 10713instructions together if the first one is 8-byte aligned. When this 10714option is enabled, GCC will align pairs of instructions that it 10715thinks should execute in parallel. 10716 10717This option only has an effect when optimizing for the VR4130. 10718It normally makes code faster, but at the expense of making it bigger. 10719It is enabled by default at optimization level @option{-O3}. 10720@end table 10721 10722@node MMIX Options 10723@subsection MMIX Options 10724@cindex MMIX Options 10725 10726These options are defined for the MMIX: 10727 10728@table @gcctabopt 10729@item -mlibfuncs 10730@itemx -mno-libfuncs 10731@opindex mlibfuncs 10732@opindex mno-libfuncs 10733Specify that intrinsic library functions are being compiled, passing all 10734values in registers, no matter the size. 10735 10736@item -mepsilon 10737@itemx -mno-epsilon 10738@opindex mepsilon 10739@opindex mno-epsilon 10740Generate floating-point comparison instructions that compare with respect 10741to the @code{rE} epsilon register. 10742 10743@item -mabi=mmixware 10744@itemx -mabi=gnu 10745@opindex mabi-mmixware 10746@opindex mabi=gnu 10747Generate code that passes function parameters and return values that (in 10748the called function) are seen as registers @code{$0} and up, as opposed to 10749the GNU ABI which uses global registers @code{$231} and up. 10750 10751@item -mzero-extend 10752@itemx -mno-zero-extend 10753@opindex mzero-extend 10754@opindex mno-zero-extend 10755When reading data from memory in sizes shorter than 64 bits, use (do not 10756use) zero-extending load instructions by default, rather than 10757sign-extending ones. 10758 10759@item -mknuthdiv 10760@itemx -mno-knuthdiv 10761@opindex mknuthdiv 10762@opindex mno-knuthdiv 10763Make the result of a division yielding a remainder have the same sign as 10764the divisor. With the default, @option{-mno-knuthdiv}, the sign of the 10765remainder follows the sign of the dividend. Both methods are 10766arithmetically valid, the latter being almost exclusively used. 10767 10768@item -mtoplevel-symbols 10769@itemx -mno-toplevel-symbols 10770@opindex mtoplevel-symbols 10771@opindex mno-toplevel-symbols 10772Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly 10773code can be used with the @code{PREFIX} assembly directive. 10774 10775@item -melf 10776@opindex melf 10777Generate an executable in the ELF format, rather than the default 10778@samp{mmo} format used by the @command{mmix} simulator. 10779 10780@item -mbranch-predict 10781@itemx -mno-branch-predict 10782@opindex mbranch-predict 10783@opindex mno-branch-predict 10784Use (do not use) the probable-branch instructions, when static branch 10785prediction indicates a probable branch. 10786 10787@item -mbase-addresses 10788@itemx -mno-base-addresses 10789@opindex mbase-addresses 10790@opindex mno-base-addresses 10791Generate (do not generate) code that uses @emph{base addresses}. Using a 10792base address automatically generates a request (handled by the assembler 10793and the linker) for a constant to be set up in a global register. The 10794register is used for one or more base address requests within the range 0 10795to 255 from the value held in the register. The generally leads to short 10796and fast code, but the number of different data items that can be 10797addressed is limited. This means that a program that uses lots of static 10798data may require @option{-mno-base-addresses}. 10799 10800@item -msingle-exit 10801@itemx -mno-single-exit 10802@opindex msingle-exit 10803@opindex mno-single-exit 10804Force (do not force) generated code to have a single exit point in each 10805function. 10806@end table 10807 10808@node MN10300 Options 10809@subsection MN10300 Options 10810@cindex MN10300 options 10811 10812These @option{-m} options are defined for Matsushita MN10300 architectures: 10813 10814@table @gcctabopt 10815@item -mmult-bug 10816@opindex mmult-bug 10817Generate code to avoid bugs in the multiply instructions for the MN10300 10818processors. This is the default. 10819 10820@item -mno-mult-bug 10821@opindex mno-mult-bug 10822Do not generate code to avoid bugs in the multiply instructions for the 10823MN10300 processors. 10824 10825@item -mam33 10826@opindex mam33 10827Generate code which uses features specific to the AM33 processor. 10828 10829@item -mno-am33 10830@opindex mno-am33 10831Do not generate code which uses features specific to the AM33 processor. This 10832is the default. 10833 10834@item -mreturn-pointer-on-d0 10835@opindex mreturn-pointer-on-d0 10836When generating a function which returns a pointer, return the pointer 10837in both @code{a0} and @code{d0}. Otherwise, the pointer is returned 10838only in a0, and attempts to call such functions without a prototype 10839would result in errors. Note that this option is on by default; use 10840@option{-mno-return-pointer-on-d0} to disable it. 10841 10842@item -mno-crt0 10843@opindex mno-crt0 10844Do not link in the C run-time initialization object file. 10845 10846@item -mrelax 10847@opindex mrelax 10848Indicate to the linker that it should perform a relaxation optimization pass 10849to shorten branches, calls and absolute memory addresses. This option only 10850has an effect when used on the command line for the final link step. 10851 10852This option makes symbolic debugging impossible. 10853@end table 10854 10855@node MT Options 10856@subsection MT Options 10857@cindex MT options 10858 10859These @option{-m} options are defined for Morpho MT architectures: 10860 10861@table @gcctabopt 10862 10863@item -march=@var{cpu-type} 10864@opindex march 10865Generate code that will run on @var{cpu-type}, which is the name of a system 10866representing a certain processor type. Possible values for 10867@var{cpu-type} are @samp{ms1-64-001}, @samp{ms1-16-002}, 10868@samp{ms1-16-003} and @samp{ms2}. 10869 10870When this option is not used, the default is @option{-march=ms1-16-002}. 10871 10872@item -mbacc 10873@opindex mbacc 10874Use byte loads and stores when generating code. 10875 10876@item -mno-bacc 10877@opindex mno-bacc 10878Do not use byte loads and stores when generating code. 10879 10880@item -msim 10881@opindex msim 10882Use simulator runtime 10883 10884@item -mno-crt0 10885@opindex mno-crt0 10886Do not link in the C run-time initialization object file 10887@file{crti.o}. Other run-time initialization and termination files 10888such as @file{startup.o} and @file{exit.o} are still included on the 10889linker command line. 10890 10891@end table 10892 10893@node PDP-11 Options 10894@subsection PDP-11 Options 10895@cindex PDP-11 Options 10896 10897These options are defined for the PDP-11: 10898 10899@table @gcctabopt 10900@item -mfpu 10901@opindex mfpu 10902Use hardware FPP floating point. This is the default. (FIS floating 10903point on the PDP-11/40 is not supported.) 10904 10905@item -msoft-float 10906@opindex msoft-float 10907Do not use hardware floating point. 10908 10909@item -mac0 10910@opindex mac0 10911Return floating-point results in ac0 (fr0 in Unix assembler syntax). 10912 10913@item -mno-ac0 10914@opindex mno-ac0 10915Return floating-point results in memory. This is the default. 10916 10917@item -m40 10918@opindex m40 10919Generate code for a PDP-11/40. 10920 10921@item -m45 10922@opindex m45 10923Generate code for a PDP-11/45. This is the default. 10924 10925@item -m10 10926@opindex m10 10927Generate code for a PDP-11/10. 10928 10929@item -mbcopy-builtin 10930@opindex bcopy-builtin 10931Use inline @code{movmemhi} patterns for copying memory. This is the 10932default. 10933 10934@item -mbcopy 10935@opindex mbcopy 10936Do not use inline @code{movmemhi} patterns for copying memory. 10937 10938@item -mint16 10939@itemx -mno-int32 10940@opindex mint16 10941@opindex mno-int32 10942Use 16-bit @code{int}. This is the default. 10943 10944@item -mint32 10945@itemx -mno-int16 10946@opindex mint32 10947@opindex mno-int16 10948Use 32-bit @code{int}. 10949 10950@item -mfloat64 10951@itemx -mno-float32 10952@opindex mfloat64 10953@opindex mno-float32 10954Use 64-bit @code{float}. This is the default. 10955 10956@item -mfloat32 10957@itemx -mno-float64 10958@opindex mfloat32 10959@opindex mno-float64 10960Use 32-bit @code{float}. 10961 10962@item -mabshi 10963@opindex mabshi 10964Use @code{abshi2} pattern. This is the default. 10965 10966@item -mno-abshi 10967@opindex mno-abshi 10968Do not use @code{abshi2} pattern. 10969 10970@item -mbranch-expensive 10971@opindex mbranch-expensive 10972Pretend that branches are expensive. This is for experimenting with 10973code generation only. 10974 10975@item -mbranch-cheap 10976@opindex mbranch-cheap 10977Do not pretend that branches are expensive. This is the default. 10978 10979@item -msplit 10980@opindex msplit 10981Generate code for a system with split I&D@. 10982 10983@item -mno-split 10984@opindex mno-split 10985Generate code for a system without split I&D@. This is the default. 10986 10987@item -munix-asm 10988@opindex munix-asm 10989Use Unix assembler syntax. This is the default when configured for 10990@samp{pdp11-*-bsd}. 10991 10992@item -mdec-asm 10993@opindex mdec-asm 10994Use DEC assembler syntax. This is the default when configured for any 10995PDP-11 target other than @samp{pdp11-*-bsd}. 10996@end table 10997 10998@node PowerPC Options 10999@subsection PowerPC Options 11000@cindex PowerPC options 11001 11002These are listed under @xref{RS/6000 and PowerPC Options}. 11003 11004@node RS/6000 and PowerPC Options 11005@subsection IBM RS/6000 and PowerPC Options 11006@cindex RS/6000 and PowerPC Options 11007@cindex IBM RS/6000 and PowerPC Options 11008 11009These @samp{-m} options are defined for the IBM RS/6000 and PowerPC: 11010@table @gcctabopt 11011@item -mpower 11012@itemx -mno-power 11013@itemx -mpower2 11014@itemx -mno-power2 11015@itemx -mpowerpc 11016@itemx -mno-powerpc 11017@itemx -mpowerpc-gpopt 11018@itemx -mno-powerpc-gpopt 11019@itemx -mpowerpc-gfxopt 11020@itemx -mno-powerpc-gfxopt 11021@itemx -mpowerpc64 11022@itemx -mno-powerpc64 11023@itemx -mmfcrf 11024@itemx -mno-mfcrf 11025@itemx -mpopcntb 11026@itemx -mno-popcntb 11027@itemx -mfprnd 11028@itemx -mno-fprnd 11029@opindex mpower 11030@opindex mno-power 11031@opindex mpower2 11032@opindex mno-power2 11033@opindex mpowerpc 11034@opindex mno-powerpc 11035@opindex mpowerpc-gpopt 11036@opindex mno-powerpc-gpopt 11037@opindex mpowerpc-gfxopt 11038@opindex mno-powerpc-gfxopt 11039@opindex mpowerpc64 11040@opindex mno-powerpc64 11041@opindex mmfcrf 11042@opindex mno-mfcrf 11043@opindex mpopcntb 11044@opindex mno-popcntb 11045@opindex mfprnd 11046@opindex mno-fprnd 11047GCC supports two related instruction set architectures for the 11048RS/6000 and PowerPC@. The @dfn{POWER} instruction set are those 11049instructions supported by the @samp{rios} chip set used in the original 11050RS/6000 systems and the @dfn{PowerPC} instruction set is the 11051architecture of the Freescale MPC5xx, MPC6xx, MPC8xx microprocessors, and 11052the IBM 4xx, 6xx, and follow-on microprocessors. 11053 11054Neither architecture is a subset of the other. However there is a 11055large common subset of instructions supported by both. An MQ 11056register is included in processors supporting the POWER architecture. 11057 11058You use these options to specify which instructions are available on the 11059processor you are using. The default value of these options is 11060determined when configuring GCC@. Specifying the 11061@option{-mcpu=@var{cpu_type}} overrides the specification of these 11062options. We recommend you use the @option{-mcpu=@var{cpu_type}} option 11063rather than the options listed above. 11064 11065The @option{-mpower} option allows GCC to generate instructions that 11066are found only in the POWER architecture and to use the MQ register. 11067Specifying @option{-mpower2} implies @option{-power} and also allows GCC 11068to generate instructions that are present in the POWER2 architecture but 11069not the original POWER architecture. 11070 11071The @option{-mpowerpc} option allows GCC to generate instructions that 11072are found only in the 32-bit subset of the PowerPC architecture. 11073Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows 11074GCC to use the optional PowerPC architecture instructions in the 11075General Purpose group, including floating-point square root. Specifying 11076@option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to 11077use the optional PowerPC architecture instructions in the Graphics 11078group, including floating-point select. 11079 11080The @option{-mmfcrf} option allows GCC to generate the move from 11081condition register field instruction implemented on the POWER4 11082processor and other processors that support the PowerPC V2.01 11083architecture. 11084The @option{-mpopcntb} option allows GCC to generate the popcount and 11085double precision FP reciprocal estimate instruction implemented on the 11086POWER5 processor and other processors that support the PowerPC V2.02 11087architecture. 11088The @option{-mfprnd} option allows GCC to generate the FP round to 11089integer instructions implemented on the POWER5+ processor and other 11090processors that support the PowerPC V2.03 architecture. 11091 11092The @option{-mpowerpc64} option allows GCC to generate the additional 1109364-bit instructions that are found in the full PowerPC64 architecture 11094and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to 11095@option{-mno-powerpc64}. 11096 11097If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC 11098will use only the instructions in the common subset of both 11099architectures plus some special AIX common-mode calls, and will not use 11100the MQ register. Specifying both @option{-mpower} and @option{-mpowerpc} 11101permits GCC to use any instruction from either architecture and to 11102allow use of the MQ register; specify this for the Motorola MPC601. 11103 11104@item -mnew-mnemonics 11105@itemx -mold-mnemonics 11106@opindex mnew-mnemonics 11107@opindex mold-mnemonics 11108Select which mnemonics to use in the generated assembler code. With 11109@option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for 11110the PowerPC architecture. With @option{-mold-mnemonics} it uses the 11111assembler mnemonics defined for the POWER architecture. Instructions 11112defined in only one architecture have only one mnemonic; GCC uses that 11113mnemonic irrespective of which of these options is specified. 11114 11115GCC defaults to the mnemonics appropriate for the architecture in 11116use. Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the 11117value of these option. Unless you are building a cross-compiler, you 11118should normally not specify either @option{-mnew-mnemonics} or 11119@option{-mold-mnemonics}, but should instead accept the default. 11120 11121@item -mcpu=@var{cpu_type} 11122@opindex mcpu 11123Set architecture type, register usage, choice of mnemonics, and 11124instruction scheduling parameters for machine type @var{cpu_type}. 11125Supported values for @var{cpu_type} are @samp{401}, @samp{403}, 11126@samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{505}, 11127@samp{601}, @samp{602}, @samp{603}, @samp{603e}, @samp{604}, 11128@samp{604e}, @samp{620}, @samp{630}, @samp{740}, @samp{7400}, 11129@samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823}, 11130@samp{860}, @samp{970}, @samp{8540}, @samp{ec603e}, @samp{G3}, 11131@samp{G4}, @samp{G5}, @samp{power}, @samp{power2}, @samp{power3}, 11132@samp{power4}, @samp{power5}, @samp{power5+}, @samp{power6}, 11133@samp{common}, @samp{powerpc}, @samp{powerpc64}, 11134@samp{rios}, @samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64}. 11135 11136@option{-mcpu=common} selects a completely generic processor. Code 11137generated under this option will run on any POWER or PowerPC processor. 11138GCC will use only the instructions in the common subset of both 11139architectures, and will not use the MQ register. GCC assumes a generic 11140processor model for scheduling purposes. 11141 11142@option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and 11143@option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit 11144PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine 11145types, with an appropriate, generic processor model assumed for 11146scheduling purposes. 11147 11148The other options specify a specific processor. Code generated under 11149those options will run best on that processor, and may not run at all on 11150others. 11151 11152The @option{-mcpu} options automatically enable or disable the 11153following options: @option{-maltivec}, @option{-mfprnd}, 11154@option{-mhard-float}, @option{-mmfcrf}, @option{-mmultiple}, 11155@option{-mnew-mnemonics}, @option{-mpopcntb}, @option{-mpower}, 11156@option{-mpower2}, @option{-mpowerpc64}, @option{-mpowerpc-gpopt}, 11157@option{-mpowerpc-gfxopt}, @option{-mstring}, @option{-mmulhw}, @option{-mdlmzb}. 11158The particular options 11159set for any particular CPU will vary between compiler versions, 11160depending on what setting seems to produce optimal code for that CPU; 11161it doesn't necessarily reflect the actual hardware's capabilities. If 11162you wish to set an individual option to a particular value, you may 11163specify it after the @option{-mcpu} option, like @samp{-mcpu=970 11164-mno-altivec}. 11165 11166On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are 11167not enabled or disabled by the @option{-mcpu} option at present because 11168AIX does not have full support for these options. You may still 11169enable or disable them individually if you're sure it'll work in your 11170environment. 11171 11172@item -mtune=@var{cpu_type} 11173@opindex mtune 11174Set the instruction scheduling parameters for machine type 11175@var{cpu_type}, but do not set the architecture type, register usage, or 11176choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would. The same 11177values for @var{cpu_type} are used for @option{-mtune} as for 11178@option{-mcpu}. If both are specified, the code generated will use the 11179architecture, registers, and mnemonics set by @option{-mcpu}, but the 11180scheduling parameters set by @option{-mtune}. 11181 11182@item -mswdiv 11183@itemx -mno-swdiv 11184@opindex mswdiv 11185@opindex mno-swdiv 11186Generate code to compute division as reciprocal estimate and iterative 11187refinement, creating opportunities for increased throughput. This 11188feature requires: optional PowerPC Graphics instruction set for single 11189precision and FRE instruction for double precision, assuming divides 11190cannot generate user-visible traps, and the domain values not include 11191Infinities, denormals or zero denominator. 11192 11193@item -maltivec 11194@itemx -mno-altivec 11195@opindex maltivec 11196@opindex mno-altivec 11197Generate code that uses (does not use) AltiVec instructions, and also 11198enable the use of built-in functions that allow more direct access to 11199the AltiVec instruction set. You may also need to set 11200@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI 11201enhancements. 11202 11203@item -mvrsave 11204@item -mno-vrsave 11205@opindex mvrsave 11206@opindex mno-vrsave 11207Generate VRSAVE instructions when generating AltiVec code. 11208 11209@item -msecure-plt 11210@opindex msecure-plt 11211Generate code that allows ld and ld.so to build executables and shared 11212libraries with non-exec .plt and .got sections. This is a PowerPC 1121332-bit SYSV ABI option. 11214 11215@item -mbss-plt 11216@opindex mbss-plt 11217Generate code that uses a BSS .plt section that ld.so fills in, and 11218requires .plt and .got sections that are both writable and executable. 11219This is a PowerPC 32-bit SYSV ABI option. 11220 11221@item -misel 11222@itemx -mno-isel 11223@opindex misel 11224@opindex mno-isel 11225This switch enables or disables the generation of ISEL instructions. 11226 11227@item -misel=@var{yes/no} 11228This switch has been deprecated. Use @option{-misel} and 11229@option{-mno-isel} instead. 11230 11231@item -mspe 11232@itemx -mno-spe 11233@opindex mspe 11234@opindex mno-spe 11235This switch enables or disables the generation of SPE simd 11236instructions. 11237 11238@item -mspe=@var{yes/no} 11239This option has been deprecated. Use @option{-mspe} and 11240@option{-mno-spe} instead. 11241 11242@item -mfloat-gprs=@var{yes/single/double/no} 11243@itemx -mfloat-gprs 11244@opindex mfloat-gprs 11245This switch enables or disables the generation of floating point 11246operations on the general purpose registers for architectures that 11247support it. 11248 11249The argument @var{yes} or @var{single} enables the use of 11250single-precision floating point operations. 11251 11252The argument @var{double} enables the use of single and 11253double-precision floating point operations. 11254 11255The argument @var{no} disables floating point operations on the 11256general purpose registers. 11257 11258This option is currently only available on the MPC854x. 11259 11260@item -m32 11261@itemx -m64 11262@opindex m32 11263@opindex m64 11264Generate code for 32-bit or 64-bit environments of Darwin and SVR4 11265targets (including GNU/Linux). The 32-bit environment sets int, long 11266and pointer to 32 bits and generates code that runs on any PowerPC 11267variant. The 64-bit environment sets int to 32 bits and long and 11268pointer to 64 bits, and generates code for PowerPC64, as for 11269@option{-mpowerpc64}. 11270 11271@item -mfull-toc 11272@itemx -mno-fp-in-toc 11273@itemx -mno-sum-in-toc 11274@itemx -mminimal-toc 11275@opindex mfull-toc 11276@opindex mno-fp-in-toc 11277@opindex mno-sum-in-toc 11278@opindex mminimal-toc 11279Modify generation of the TOC (Table Of Contents), which is created for 11280every executable file. The @option{-mfull-toc} option is selected by 11281default. In that case, GCC will allocate at least one TOC entry for 11282each unique non-automatic variable reference in your program. GCC 11283will also place floating-point constants in the TOC@. However, only 1128416,384 entries are available in the TOC@. 11285 11286If you receive a linker error message that saying you have overflowed 11287the available TOC space, you can reduce the amount of TOC space used 11288with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options. 11289@option{-mno-fp-in-toc} prevents GCC from putting floating-point 11290constants in the TOC and @option{-mno-sum-in-toc} forces GCC to 11291generate code to calculate the sum of an address and a constant at 11292run-time instead of putting that sum into the TOC@. You may specify one 11293or both of these options. Each causes GCC to produce very slightly 11294slower and larger code at the expense of conserving TOC space. 11295 11296If you still run out of space in the TOC even when you specify both of 11297these options, specify @option{-mminimal-toc} instead. This option causes 11298GCC to make only one TOC entry for every file. When you specify this 11299option, GCC will produce code that is slower and larger but which 11300uses extremely little TOC space. You may wish to use this option 11301only on files that contain less frequently executed code. 11302 11303@item -maix64 11304@itemx -maix32 11305@opindex maix64 11306@opindex maix32 11307Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit 11308@code{long} type, and the infrastructure needed to support them. 11309Specifying @option{-maix64} implies @option{-mpowerpc64} and 11310@option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and 11311implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}. 11312 11313@item -mxl-compat 11314@itemx -mno-xl-compat 11315@opindex mxl-compat 11316@opindex mno-xl-compat 11317Produce code that conforms more closely to IBM XL compiler semantics 11318when using AIX-compatible ABI. Pass floating-point arguments to 11319prototyped functions beyond the register save area (RSA) on the stack 11320in addition to argument FPRs. Do not assume that most significant 11321double in 128-bit long double value is properly rounded when comparing 11322values and converting to double. Use XL symbol names for long double 11323support routines. 11324 11325The AIX calling convention was extended but not initially documented to 11326handle an obscure K&R C case of calling a function that takes the 11327address of its arguments with fewer arguments than declared. IBM XL 11328compilers access floating point arguments which do not fit in the 11329RSA from the stack when a subroutine is compiled without 11330optimization. Because always storing floating-point arguments on the 11331stack is inefficient and rarely needed, this option is not enabled by 11332default and only is necessary when calling subroutines compiled by IBM 11333XL compilers without optimization. 11334 11335@item -mpe 11336@opindex mpe 11337Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an 11338application written to use message passing with special startup code to 11339enable the application to run. The system must have PE installed in the 11340standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file 11341must be overridden with the @option{-specs=} option to specify the 11342appropriate directory location. The Parallel Environment does not 11343support threads, so the @option{-mpe} option and the @option{-pthread} 11344option are incompatible. 11345 11346@item -malign-natural 11347@itemx -malign-power 11348@opindex malign-natural 11349@opindex malign-power 11350On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option 11351@option{-malign-natural} overrides the ABI-defined alignment of larger 11352types, such as floating-point doubles, on their natural size-based boundary. 11353The option @option{-malign-power} instructs GCC to follow the ABI-specified 11354alignment rules. GCC defaults to the standard alignment defined in the ABI@. 11355 11356On 64-bit Darwin, natural alignment is the default, and @option{-malign-power} 11357is not supported. 11358 11359@item -msoft-float 11360@itemx -mhard-float 11361@opindex msoft-float 11362@opindex mhard-float 11363Generate code that does not use (uses) the floating-point register set. 11364Software floating point emulation is provided if you use the 11365@option{-msoft-float} option, and pass the option to GCC when linking. 11366 11367@item -mmultiple 11368@itemx -mno-multiple 11369@opindex mmultiple 11370@opindex mno-multiple 11371Generate code that uses (does not use) the load multiple word 11372instructions and the store multiple word instructions. These 11373instructions are generated by default on POWER systems, and not 11374generated on PowerPC systems. Do not use @option{-mmultiple} on little 11375endian PowerPC systems, since those instructions do not work when the 11376processor is in little endian mode. The exceptions are PPC740 and 11377PPC750 which permit the instructions usage in little endian mode. 11378 11379@item -mstring 11380@itemx -mno-string 11381@opindex mstring 11382@opindex mno-string 11383Generate code that uses (does not use) the load string instructions 11384and the store string word instructions to save multiple registers and 11385do small block moves. These instructions are generated by default on 11386POWER systems, and not generated on PowerPC systems. Do not use 11387@option{-mstring} on little endian PowerPC systems, since those 11388instructions do not work when the processor is in little endian mode. 11389The exceptions are PPC740 and PPC750 which permit the instructions 11390usage in little endian mode. 11391 11392@item -mupdate 11393@itemx -mno-update 11394@opindex mupdate 11395@opindex mno-update 11396Generate code that uses (does not use) the load or store instructions 11397that update the base register to the address of the calculated memory 11398location. These instructions are generated by default. If you use 11399@option{-mno-update}, there is a small window between the time that the 11400stack pointer is updated and the address of the previous frame is 11401stored, which means code that walks the stack frame across interrupts or 11402signals may get corrupted data. 11403 11404@item -mfused-madd 11405@itemx -mno-fused-madd 11406@opindex mfused-madd 11407@opindex mno-fused-madd 11408Generate code that uses (does not use) the floating point multiply and 11409accumulate instructions. These instructions are generated by default if 11410hardware floating is used. 11411 11412@item -mmulhw 11413@itemx -mno-mulhw 11414@opindex mmulhw 11415@opindex mno-mulhw 11416Generate code that uses (does not use) the half-word multiply and 11417multiply-accumulate instructions on the IBM 405 and 440 processors. 11418These instructions are generated by default when targetting those 11419processors. 11420 11421@item -mdlmzb 11422@itemx -mno-dlmzb 11423@opindex mdlmzb 11424@opindex mno-dlmzb 11425Generate code that uses (does not use) the string-search @samp{dlmzb} 11426instruction on the IBM 405 and 440 processors. This instruction is 11427generated by default when targetting those processors. 11428 11429@item -mno-bit-align 11430@itemx -mbit-align 11431@opindex mno-bit-align 11432@opindex mbit-align 11433On System V.4 and embedded PowerPC systems do not (do) force structures 11434and unions that contain bit-fields to be aligned to the base type of the 11435bit-field. 11436 11437For example, by default a structure containing nothing but 8 11438@code{unsigned} bit-fields of length 1 would be aligned to a 4 byte 11439boundary and have a size of 4 bytes. By using @option{-mno-bit-align}, 11440the structure would be aligned to a 1 byte boundary and be one byte in 11441size. 11442 11443@item -mno-strict-align 11444@itemx -mstrict-align 11445@opindex mno-strict-align 11446@opindex mstrict-align 11447On System V.4 and embedded PowerPC systems do not (do) assume that 11448unaligned memory references will be handled by the system. 11449 11450@item -mrelocatable 11451@itemx -mno-relocatable 11452@opindex mrelocatable 11453@opindex mno-relocatable 11454On embedded PowerPC systems generate code that allows (does not allow) 11455the program to be relocated to a different address at runtime. If you 11456use @option{-mrelocatable} on any module, all objects linked together must 11457be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}. 11458 11459@item -mrelocatable-lib 11460@itemx -mno-relocatable-lib 11461@opindex mrelocatable-lib 11462@opindex mno-relocatable-lib 11463On embedded PowerPC systems generate code that allows (does not allow) 11464the program to be relocated to a different address at runtime. Modules 11465compiled with @option{-mrelocatable-lib} can be linked with either modules 11466compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or 11467with modules compiled with the @option{-mrelocatable} options. 11468 11469@item -mno-toc 11470@itemx -mtoc 11471@opindex mno-toc 11472@opindex mtoc 11473On System V.4 and embedded PowerPC systems do not (do) assume that 11474register 2 contains a pointer to a global area pointing to the addresses 11475used in the program. 11476 11477@item -mlittle 11478@itemx -mlittle-endian 11479@opindex mlittle 11480@opindex mlittle-endian 11481On System V.4 and embedded PowerPC systems compile code for the 11482processor in little endian mode. The @option{-mlittle-endian} option is 11483the same as @option{-mlittle}. 11484 11485@item -mbig 11486@itemx -mbig-endian 11487@opindex mbig 11488@opindex mbig-endian 11489On System V.4 and embedded PowerPC systems compile code for the 11490processor in big endian mode. The @option{-mbig-endian} option is 11491the same as @option{-mbig}. 11492 11493@item -mdynamic-no-pic 11494@opindex mdynamic-no-pic 11495On Darwin and Mac OS X systems, compile code so that it is not 11496relocatable, but that its external references are relocatable. The 11497resulting code is suitable for applications, but not shared 11498libraries. 11499 11500@item -mprioritize-restricted-insns=@var{priority} 11501@opindex mprioritize-restricted-insns 11502This option controls the priority that is assigned to 11503dispatch-slot restricted instructions during the second scheduling 11504pass. The argument @var{priority} takes the value @var{0/1/2} to assign 11505@var{no/highest/second-highest} priority to dispatch slot restricted 11506instructions. 11507 11508@item -msched-costly-dep=@var{dependence_type} 11509@opindex msched-costly-dep 11510This option controls which dependences are considered costly 11511by the target during instruction scheduling. The argument 11512@var{dependence_type} takes one of the following values: 11513@var{no}: no dependence is costly, 11514@var{all}: all dependences are costly, 11515@var{true_store_to_load}: a true dependence from store to load is costly, 11516@var{store_to_load}: any dependence from store to load is costly, 11517@var{number}: any dependence which latency >= @var{number} is costly. 11518 11519@item -minsert-sched-nops=@var{scheme} 11520@opindex minsert-sched-nops 11521This option controls which nop insertion scheme will be used during 11522the second scheduling pass. The argument @var{scheme} takes one of the 11523following values: 11524@var{no}: Don't insert nops. 11525@var{pad}: Pad with nops any dispatch group which has vacant issue slots, 11526according to the scheduler's grouping. 11527@var{regroup_exact}: Insert nops to force costly dependent insns into 11528separate groups. Insert exactly as many nops as needed to force an insn 11529to a new group, according to the estimated processor grouping. 11530@var{number}: Insert nops to force costly dependent insns into 11531separate groups. Insert @var{number} nops to force an insn to a new group. 11532 11533@item -mcall-sysv 11534@opindex mcall-sysv 11535On System V.4 and embedded PowerPC systems compile code using calling 11536conventions that adheres to the March 1995 draft of the System V 11537Application Binary Interface, PowerPC processor supplement. This is the 11538default unless you configured GCC using @samp{powerpc-*-eabiaix}. 11539 11540@item -mcall-sysv-eabi 11541@opindex mcall-sysv-eabi 11542Specify both @option{-mcall-sysv} and @option{-meabi} options. 11543 11544@item -mcall-sysv-noeabi 11545@opindex mcall-sysv-noeabi 11546Specify both @option{-mcall-sysv} and @option{-mno-eabi} options. 11547 11548@item -mcall-solaris 11549@opindex mcall-solaris 11550On System V.4 and embedded PowerPC systems compile code for the Solaris 11551operating system. 11552 11553@item -mcall-linux 11554@opindex mcall-linux 11555On System V.4 and embedded PowerPC systems compile code for the 11556Linux-based GNU system. 11557 11558@item -mcall-gnu 11559@opindex mcall-gnu 11560On System V.4 and embedded PowerPC systems compile code for the 11561Hurd-based GNU system. 11562 11563@item -mcall-netbsd 11564@opindex mcall-netbsd 11565On System V.4 and embedded PowerPC systems compile code for the 11566NetBSD operating system. 11567 11568@item -maix-struct-return 11569@opindex maix-struct-return 11570Return all structures in memory (as specified by the AIX ABI)@. 11571 11572@item -msvr4-struct-return 11573@opindex msvr4-struct-return 11574Return structures smaller than 8 bytes in registers (as specified by the 11575SVR4 ABI)@. 11576 11577@item -mabi=@var{abi-type} 11578@opindex mabi 11579Extend the current ABI with a particular extension, or remove such extension. 11580Valid values are @var{altivec}, @var{no-altivec}, @var{spe}, 11581@var{no-spe}, @var{ibmlongdouble}, @var{ieeelongdouble}@. 11582 11583@item -mabi=spe 11584@opindex mabi=spe 11585Extend the current ABI with SPE ABI extensions. This does not change 11586the default ABI, instead it adds the SPE ABI extensions to the current 11587ABI@. 11588 11589@item -mabi=no-spe 11590@opindex mabi=no-spe 11591Disable Booke SPE ABI extensions for the current ABI@. 11592 11593@item -mabi=ibmlongdouble 11594@opindex mabi=ibmlongdouble 11595Change the current ABI to use IBM extended precision long double. 11596This is a PowerPC 32-bit SYSV ABI option. 11597 11598@item -mabi=ieeelongdouble 11599@opindex mabi=ieeelongdouble 11600Change the current ABI to use IEEE extended precision long double. 11601This is a PowerPC 32-bit Linux ABI option. 11602 11603@item -mprototype 11604@itemx -mno-prototype 11605@opindex mprototype 11606@opindex mno-prototype 11607On System V.4 and embedded PowerPC systems assume that all calls to 11608variable argument functions are properly prototyped. Otherwise, the 11609compiler must insert an instruction before every non prototyped call to 11610set or clear bit 6 of the condition code register (@var{CR}) to 11611indicate whether floating point values were passed in the floating point 11612registers in case the function takes a variable arguments. With 11613@option{-mprototype}, only calls to prototyped variable argument functions 11614will set or clear the bit. 11615 11616@item -msim 11617@opindex msim 11618On embedded PowerPC systems, assume that the startup module is called 11619@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and 11620@file{libc.a}. This is the default for @samp{powerpc-*-eabisim}. 11621configurations. 11622 11623@item -mmvme 11624@opindex mmvme 11625On embedded PowerPC systems, assume that the startup module is called 11626@file{crt0.o} and the standard C libraries are @file{libmvme.a} and 11627@file{libc.a}. 11628 11629@item -mads 11630@opindex mads 11631On embedded PowerPC systems, assume that the startup module is called 11632@file{crt0.o} and the standard C libraries are @file{libads.a} and 11633@file{libc.a}. 11634 11635@item -myellowknife 11636@opindex myellowknife 11637On embedded PowerPC systems, assume that the startup module is called 11638@file{crt0.o} and the standard C libraries are @file{libyk.a} and 11639@file{libc.a}. 11640 11641@item -mvxworks 11642@opindex mvxworks 11643On System V.4 and embedded PowerPC systems, specify that you are 11644compiling for a VxWorks system. 11645 11646@item -mwindiss 11647@opindex mwindiss 11648Specify that you are compiling for the WindISS simulation environment. 11649 11650@item -memb 11651@opindex memb 11652On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags 11653header to indicate that @samp{eabi} extended relocations are used. 11654 11655@item -meabi 11656@itemx -mno-eabi 11657@opindex meabi 11658@opindex mno-eabi 11659On System V.4 and embedded PowerPC systems do (do not) adhere to the 11660Embedded Applications Binary Interface (eabi) which is a set of 11661modifications to the System V.4 specifications. Selecting @option{-meabi} 11662means that the stack is aligned to an 8 byte boundary, a function 11663@code{__eabi} is called to from @code{main} to set up the eabi 11664environment, and the @option{-msdata} option can use both @code{r2} and 11665@code{r13} to point to two separate small data areas. Selecting 11666@option{-mno-eabi} means that the stack is aligned to a 16 byte boundary, 11667do not call an initialization function from @code{main}, and the 11668@option{-msdata} option will only use @code{r13} to point to a single 11669small data area. The @option{-meabi} option is on by default if you 11670configured GCC using one of the @samp{powerpc*-*-eabi*} options. 11671 11672@item -msdata=eabi 11673@opindex msdata=eabi 11674On System V.4 and embedded PowerPC systems, put small initialized 11675@code{const} global and static data in the @samp{.sdata2} section, which 11676is pointed to by register @code{r2}. Put small initialized 11677non-@code{const} global and static data in the @samp{.sdata} section, 11678which is pointed to by register @code{r13}. Put small uninitialized 11679global and static data in the @samp{.sbss} section, which is adjacent to 11680the @samp{.sdata} section. The @option{-msdata=eabi} option is 11681incompatible with the @option{-mrelocatable} option. The 11682@option{-msdata=eabi} option also sets the @option{-memb} option. 11683 11684@item -msdata=sysv 11685@opindex msdata=sysv 11686On System V.4 and embedded PowerPC systems, put small global and static 11687data in the @samp{.sdata} section, which is pointed to by register 11688@code{r13}. Put small uninitialized global and static data in the 11689@samp{.sbss} section, which is adjacent to the @samp{.sdata} section. 11690The @option{-msdata=sysv} option is incompatible with the 11691@option{-mrelocatable} option. 11692 11693@item -msdata=default 11694@itemx -msdata 11695@opindex msdata=default 11696@opindex msdata 11697On System V.4 and embedded PowerPC systems, if @option{-meabi} is used, 11698compile code the same as @option{-msdata=eabi}, otherwise compile code the 11699same as @option{-msdata=sysv}. 11700 11701@item -msdata-data 11702@opindex msdata-data 11703On System V.4 and embedded PowerPC systems, put small global 11704data in the @samp{.sdata} section. Put small uninitialized global 11705data in the @samp{.sbss} section. Do not use register @code{r13} 11706to address small data however. This is the default behavior unless 11707other @option{-msdata} options are used. 11708 11709@item -msdata=none 11710@itemx -mno-sdata 11711@opindex msdata=none 11712@opindex mno-sdata 11713On embedded PowerPC systems, put all initialized global and static data 11714in the @samp{.data} section, and all uninitialized data in the 11715@samp{.bss} section. 11716 11717@item -G @var{num} 11718@opindex G 11719@cindex smaller data references (PowerPC) 11720@cindex .sdata/.sdata2 references (PowerPC) 11721On embedded PowerPC systems, put global and static items less than or 11722equal to @var{num} bytes into the small data or bss sections instead of 11723the normal data or bss section. By default, @var{num} is 8. The 11724@option{-G @var{num}} switch is also passed to the linker. 11725All modules should be compiled with the same @option{-G @var{num}} value. 11726 11727@item -mregnames 11728@itemx -mno-regnames 11729@opindex mregnames 11730@opindex mno-regnames 11731On System V.4 and embedded PowerPC systems do (do not) emit register 11732names in the assembly language output using symbolic forms. 11733 11734@item -mlongcall 11735@itemx -mno-longcall 11736@opindex mlongcall 11737@opindex mno-longcall 11738By default assume that all calls are far away so that a longer more 11739expensive calling sequence is required. This is required for calls 11740further than 32 megabytes (33,554,432 bytes) from the current location. 11741A short call will be generated if the compiler knows 11742the call cannot be that far away. This setting can be overridden by 11743the @code{shortcall} function attribute, or by @code{#pragma 11744longcall(0)}. 11745 11746Some linkers are capable of detecting out-of-range calls and generating 11747glue code on the fly. On these systems, long calls are unnecessary and 11748generate slower code. As of this writing, the AIX linker can do this, 11749as can the GNU linker for PowerPC/64. It is planned to add this feature 11750to the GNU linker for 32-bit PowerPC systems as well. 11751 11752On Darwin/PPC systems, @code{#pragma longcall} will generate ``jbsr 11753callee, L42'', plus a ``branch island'' (glue code). The two target 11754addresses represent the callee and the ``branch island''. The 11755Darwin/PPC linker will prefer the first address and generate a ``bl 11756callee'' if the PPC ``bl'' instruction will reach the callee directly; 11757otherwise, the linker will generate ``bl L42'' to call the ``branch 11758island''. The ``branch island'' is appended to the body of the 11759calling function; it computes the full 32-bit address of the callee 11760and jumps to it. 11761 11762On Mach-O (Darwin) systems, this option directs the compiler emit to 11763the glue for every direct call, and the Darwin linker decides whether 11764to use or discard it. 11765 11766In the future, we may cause GCC to ignore all longcall specifications 11767when the linker is known to generate glue. 11768 11769@item -pthread 11770@opindex pthread 11771Adds support for multithreading with the @dfn{pthreads} library. 11772This option sets flags for both the preprocessor and linker. 11773 11774@end table 11775 11776@node S/390 and zSeries Options 11777@subsection S/390 and zSeries Options 11778@cindex S/390 and zSeries Options 11779 11780These are the @samp{-m} options defined for the S/390 and zSeries architecture. 11781 11782@table @gcctabopt 11783@item -mhard-float 11784@itemx -msoft-float 11785@opindex mhard-float 11786@opindex msoft-float 11787Use (do not use) the hardware floating-point instructions and registers 11788for floating-point operations. When @option{-msoft-float} is specified, 11789functions in @file{libgcc.a} will be used to perform floating-point 11790operations. When @option{-mhard-float} is specified, the compiler 11791generates IEEE floating-point instructions. This is the default. 11792 11793@item -mlong-double-64 11794@itemx -mlong-double-128 11795@opindex mlong-double-64 11796@opindex mlong-double-128 11797These switches control the size of @code{long double} type. A size 11798of 64bit makes the @code{long double} type equivalent to the @code{double} 11799type. This is the default. 11800 11801@item -mbackchain 11802@itemx -mno-backchain 11803@opindex mbackchain 11804@opindex mno-backchain 11805Store (do not store) the address of the caller's frame as backchain pointer 11806into the callee's stack frame. 11807A backchain may be needed to allow debugging using tools that do not understand 11808DWARF-2 call frame information. 11809When @option{-mno-packed-stack} is in effect, the backchain pointer is stored 11810at the bottom of the stack frame; when @option{-mpacked-stack} is in effect, 11811the backchain is placed into the topmost word of the 96/160 byte register 11812save area. 11813 11814In general, code compiled with @option{-mbackchain} is call-compatible with 11815code compiled with @option{-mmo-backchain}; however, use of the backchain 11816for debugging purposes usually requires that the whole binary is built with 11817@option{-mbackchain}. Note that the combination of @option{-mbackchain}, 11818@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order 11819to build a linux kernel use @option{-msoft-float}. 11820 11821The default is to not maintain the backchain. 11822 11823@item -mpacked-stack 11824@item -mno-packed-stack 11825@opindex mpacked-stack 11826@opindex mno-packed-stack 11827Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is 11828specified, the compiler uses the all fields of the 96/160 byte register save 11829area only for their default purpose; unused fields still take up stack space. 11830When @option{-mpacked-stack} is specified, register save slots are densely 11831packed at the top of the register save area; unused space is reused for other 11832purposes, allowing for more efficient use of the available stack space. 11833However, when @option{-mbackchain} is also in effect, the topmost word of 11834the save area is always used to store the backchain, and the return address 11835register is always saved two words below the backchain. 11836 11837As long as the stack frame backchain is not used, code generated with 11838@option{-mpacked-stack} is call-compatible with code generated with 11839@option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for 11840S/390 or zSeries generated code that uses the stack frame backchain at run 11841time, not just for debugging purposes. Such code is not call-compatible 11842with code compiled with @option{-mpacked-stack}. Also, note that the 11843combination of @option{-mbackchain}, 11844@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order 11845to build a linux kernel use @option{-msoft-float}. 11846 11847The default is to not use the packed stack layout. 11848 11849@item -msmall-exec 11850@itemx -mno-small-exec 11851@opindex msmall-exec 11852@opindex mno-small-exec 11853Generate (or do not generate) code using the @code{bras} instruction 11854to do subroutine calls. 11855This only works reliably if the total executable size does not 11856exceed 64k. The default is to use the @code{basr} instruction instead, 11857which does not have this limitation. 11858 11859@item -m64 11860@itemx -m31 11861@opindex m64 11862@opindex m31 11863When @option{-m31} is specified, generate code compliant to the 11864GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate 11865code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in 11866particular to generate 64-bit instructions. For the @samp{s390} 11867targets, the default is @option{-m31}, while the @samp{s390x} 11868targets default to @option{-m64}. 11869 11870@item -mzarch 11871@itemx -mesa 11872@opindex mzarch 11873@opindex mesa 11874When @option{-mzarch} is specified, generate code using the 11875instructions available on z/Architecture. 11876When @option{-mesa} is specified, generate code using the 11877instructions available on ESA/390. Note that @option{-mesa} is 11878not possible with @option{-m64}. 11879When generating code compliant to the GNU/Linux for S/390 ABI, 11880the default is @option{-mesa}. When generating code compliant 11881to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}. 11882 11883@item -mmvcle 11884@itemx -mno-mvcle 11885@opindex mmvcle 11886@opindex mno-mvcle 11887Generate (or do not generate) code using the @code{mvcle} instruction 11888to perform block moves. When @option{-mno-mvcle} is specified, 11889use a @code{mvc} loop instead. This is the default unless optimizing for 11890size. 11891 11892@item -mdebug 11893@itemx -mno-debug 11894@opindex mdebug 11895@opindex mno-debug 11896Print (or do not print) additional debug information when compiling. 11897The default is to not print debug information. 11898 11899@item -march=@var{cpu-type} 11900@opindex march 11901Generate code that will run on @var{cpu-type}, which is the name of a system 11902representing a certain processor type. Possible values for 11903@var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, and @samp{z990}. 11904When generating code using the instructions available on z/Architecture, 11905the default is @option{-march=z900}. Otherwise, the default is 11906@option{-march=g5}. 11907 11908@item -mtune=@var{cpu-type} 11909@opindex mtune 11910Tune to @var{cpu-type} everything applicable about the generated code, 11911except for the ABI and the set of available instructions. 11912The list of @var{cpu-type} values is the same as for @option{-march}. 11913The default is the value used for @option{-march}. 11914 11915@item -mtpf-trace 11916@itemx -mno-tpf-trace 11917@opindex mtpf-trace 11918@opindex mno-tpf-trace 11919Generate code that adds (does not add) in TPF OS specific branches to trace 11920routines in the operating system. This option is off by default, even 11921when compiling for the TPF OS@. 11922 11923@item -mfused-madd 11924@itemx -mno-fused-madd 11925@opindex mfused-madd 11926@opindex mno-fused-madd 11927Generate code that uses (does not use) the floating point multiply and 11928accumulate instructions. These instructions are generated by default if 11929hardware floating point is used. 11930 11931@item -mwarn-framesize=@var{framesize} 11932@opindex mwarn-framesize 11933Emit a warning if the current function exceeds the given frame size. Because 11934this is a compile time check it doesn't need to be a real problem when the program 11935runs. It is intended to identify functions which most probably cause 11936a stack overflow. It is useful to be used in an environment with limited stack 11937size e.g.@: the linux kernel. 11938 11939@item -mwarn-dynamicstack 11940@opindex mwarn-dynamicstack 11941Emit a warning if the function calls alloca or uses dynamically 11942sized arrays. This is generally a bad idea with a limited stack size. 11943 11944@item -mstack-guard=@var{stack-guard} 11945@item -mstack-size=@var{stack-size} 11946@opindex mstack-guard 11947@opindex mstack-size 11948These arguments always have to be used in conjunction. If they are present the s390 11949back end emits additional instructions in the function prologue which trigger a trap 11950if the stack size is @var{stack-guard} bytes above the @var{stack-size} 11951(remember that the stack on s390 grows downward). These options are intended to 11952be used to help debugging stack overflow problems. The additionally emitted code 11953causes only little overhead and hence can also be used in production like systems 11954without greater performance degradation. The given values have to be exact 11955powers of 2 and @var{stack-size} has to be greater than @var{stack-guard} without 11956exceeding 64k. 11957In order to be efficient the extra code makes the assumption that the stack starts 11958at an address aligned to the value given by @var{stack-size}. 11959@end table 11960 11961@node Score Options 11962@subsection Score Options 11963@cindex Score Options 11964 11965These options are defined for Score implementations: 11966 11967@table @gcctabopt 11968@item -meb 11969@opindex meb 11970Compile code for big endian mode. This is the default. 11971 11972@item -mel 11973@opindex mel 11974Compile code for little endian mode. 11975 11976@item -mnhwloop 11977@opindex mnhwloop 11978Disable generate bcnz instruction. 11979 11980@item -muls 11981@opindex muls 11982Enable generate unaligned load and store instruction. 11983 11984@item -mmac 11985@opindex mmac 11986Enable the use of multiply-accumulate instructions. Disabled by default. 11987 11988@item -mscore5 11989@opindex mscore5 11990Specify the SCORE5 as the target architecture. 11991 11992@item -mscore5u 11993@opindex mscore5u 11994Specify the SCORE5U of the target architecture. 11995 11996@item -mscore7 11997@opindex mscore7 11998Specify the SCORE7 as the target architecture. This is the default. 11999 12000@item -mscore7d 12001@opindex mscore7d 12002Specify the SCORE7D as the target architecture. 12003@end table 12004 12005@node SH Options 12006@subsection SH Options 12007 12008These @samp{-m} options are defined for the SH implementations: 12009 12010@table @gcctabopt 12011@item -m1 12012@opindex m1 12013Generate code for the SH1. 12014 12015@item -m2 12016@opindex m2 12017Generate code for the SH2. 12018 12019@item -m2e 12020Generate code for the SH2e. 12021 12022@item -m3 12023@opindex m3 12024Generate code for the SH3. 12025 12026@item -m3e 12027@opindex m3e 12028Generate code for the SH3e. 12029 12030@item -m4-nofpu 12031@opindex m4-nofpu 12032Generate code for the SH4 without a floating-point unit. 12033 12034@item -m4-single-only 12035@opindex m4-single-only 12036Generate code for the SH4 with a floating-point unit that only 12037supports single-precision arithmetic. 12038 12039@item -m4-single 12040@opindex m4-single 12041Generate code for the SH4 assuming the floating-point unit is in 12042single-precision mode by default. 12043 12044@item -m4 12045@opindex m4 12046Generate code for the SH4. 12047 12048@item -m4a-nofpu 12049@opindex m4a-nofpu 12050Generate code for the SH4al-dsp, or for a SH4a in such a way that the 12051floating-point unit is not used. 12052 12053@item -m4a-single-only 12054@opindex m4a-single-only 12055Generate code for the SH4a, in such a way that no double-precision 12056floating point operations are used. 12057 12058@item -m4a-single 12059@opindex m4a-single 12060Generate code for the SH4a assuming the floating-point unit is in 12061single-precision mode by default. 12062 12063@item -m4a 12064@opindex m4a 12065Generate code for the SH4a. 12066 12067@item -m4al 12068@opindex m4al 12069Same as @option{-m4a-nofpu}, except that it implicitly passes 12070@option{-dsp} to the assembler. GCC doesn't generate any DSP 12071instructions at the moment. 12072 12073@item -mb 12074@opindex mb 12075Compile code for the processor in big endian mode. 12076 12077@item -ml 12078@opindex ml 12079Compile code for the processor in little endian mode. 12080 12081@item -mdalign 12082@opindex mdalign 12083Align doubles at 64-bit boundaries. Note that this changes the calling 12084conventions, and thus some functions from the standard C library will 12085not work unless you recompile it first with @option{-mdalign}. 12086 12087@item -mrelax 12088@opindex mrelax 12089Shorten some address references at link time, when possible; uses the 12090linker option @option{-relax}. 12091 12092@item -mbigtable 12093@opindex mbigtable 12094Use 32-bit offsets in @code{switch} tables. The default is to use 1209516-bit offsets. 12096 12097@item -mfmovd 12098@opindex mfmovd 12099Enable the use of the instruction @code{fmovd}. 12100 12101@item -mhitachi 12102@opindex mhitachi 12103Comply with the calling conventions defined by Renesas. 12104 12105@item -mrenesas 12106@opindex mhitachi 12107Comply with the calling conventions defined by Renesas. 12108 12109@item -mno-renesas 12110@opindex mhitachi 12111Comply with the calling conventions defined for GCC before the Renesas 12112conventions were available. This option is the default for all 12113targets of the SH toolchain except for @samp{sh-symbianelf}. 12114 12115@item -mnomacsave 12116@opindex mnomacsave 12117Mark the @code{MAC} register as call-clobbered, even if 12118@option{-mhitachi} is given. 12119 12120@item -mieee 12121@opindex mieee 12122Increase IEEE-compliance of floating-point code. 12123At the moment, this is equivalent to @option{-fno-finite-math-only}. 12124When generating 16 bit SH opcodes, getting IEEE-conforming results for 12125comparisons of NANs / infinities incurs extra overhead in every 12126floating point comparison, therefore the default is set to 12127@option{-ffinite-math-only}. 12128 12129@item -misize 12130@opindex misize 12131Dump instruction size and location in the assembly code. 12132 12133@item -mpadstruct 12134@opindex mpadstruct 12135This option is deprecated. It pads structures to multiple of 4 bytes, 12136which is incompatible with the SH ABI@. 12137 12138@item -mspace 12139@opindex mspace 12140Optimize for space instead of speed. Implied by @option{-Os}. 12141 12142@item -mprefergot 12143@opindex mprefergot 12144When generating position-independent code, emit function calls using 12145the Global Offset Table instead of the Procedure Linkage Table. 12146 12147@item -musermode 12148@opindex musermode 12149Generate a library function call to invalidate instruction cache 12150entries, after fixing up a trampoline. This library function call 12151doesn't assume it can write to the whole memory address space. This 12152is the default when the target is @code{sh-*-linux*}. 12153 12154@item -multcost=@var{number} 12155@opindex multcost=@var{number} 12156Set the cost to assume for a multiply insn. 12157 12158@item -mdiv=@var{strategy} 12159@opindex mdiv=@var{strategy} 12160Set the division strategy to use for SHmedia code. @var{strategy} must be 12161one of: call, call2, fp, inv, inv:minlat, inv20u, inv20l, inv:call, 12162inv:call2, inv:fp . 12163"fp" performs the operation in floating point. This has a very high latency, 12164but needs only a few instructions, so it might be a good choice if 12165your code has enough easily exploitable ILP to allow the compiler to 12166schedule the floating point instructions together with other instructions. 12167Division by zero causes a floating point exception. 12168"inv" uses integer operations to calculate the inverse of the divisor, 12169and then multiplies the dividend with the inverse. This strategy allows 12170cse and hoisting of the inverse calculation. Division by zero calculates 12171an unspecified result, but does not trap. 12172"inv:minlat" is a variant of "inv" where if no cse / hoisting opportunities 12173have been found, or if the entire operation has been hoisted to the same 12174place, the last stages of the inverse calculation are intertwined with the 12175final multiply to reduce the overall latency, at the expense of using a few 12176more instructions, and thus offering fewer scheduling opportunities with 12177other code. 12178"call" calls a library function that usually implements the inv:minlat 12179strategy. 12180This gives high code density for m5-*media-nofpu compilations. 12181"call2" uses a different entry point of the same library function, where it 12182assumes that a pointer to a lookup table has already been set up, which 12183exposes the pointer load to cse / code hoisting optimizations. 12184"inv:call", "inv:call2" and "inv:fp" all use the "inv" algorithm for initial 12185code generation, but if the code stays unoptimized, revert to the "call", 12186"call2", or "fp" strategies, respectively. Note that the 12187potentially-trapping side effect of division by zero is carried by a 12188separate instruction, so it is possible that all the integer instructions 12189are hoisted out, but the marker for the side effect stays where it is. 12190A recombination to fp operations or a call is not possible in that case. 12191"inv20u" and "inv20l" are variants of the "inv:minlat" strategy. In the case 12192that the inverse calculation was nor separated from the multiply, they speed 12193up division where the dividend fits into 20 bits (plus sign where applicable), 12194by inserting a test to skip a number of operations in this case; this test 12195slows down the case of larger dividends. inv20u assumes the case of a such 12196a small dividend to be unlikely, and inv20l assumes it to be likely. 12197 12198@item -mdivsi3_libfunc=@var{name} 12199@opindex mdivsi3_libfunc=@var{name} 12200Set the name of the library function used for 32 bit signed division to 12201@var{name}. This only affect the name used in the call and inv:call 12202division strategies, and the compiler will still expect the same 12203sets of input/output/clobbered registers as if this option was not present. 12204 12205@item -madjust-unroll 12206@opindex madjust-unroll 12207Throttle unrolling to avoid thrashing target registers. 12208This option only has an effect if the gcc code base supports the 12209TARGET_ADJUST_UNROLL_MAX target hook. 12210 12211@item -mindexed-addressing 12212@opindex mindexed-addressing 12213Enable the use of the indexed addressing mode for SHmedia32/SHcompact. 12214This is only safe if the hardware and/or OS implement 32 bit wrap-around 12215semantics for the indexed addressing mode. The architecture allows the 12216implementation of processors with 64 bit MMU, which the OS could use to 12217get 32 bit addressing, but since no current hardware implementation supports 12218this or any other way to make the indexed addressing mode safe to use in 12219the 32 bit ABI, the default is -mno-indexed-addressing. 12220 12221@item -mgettrcost=@var{number} 12222@opindex mgettrcost=@var{number} 12223Set the cost assumed for the gettr instruction to @var{number}. 12224The default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise. 12225 12226@item -mpt-fixed 12227@opindex mpt-fixed 12228Assume pt* instructions won't trap. This will generally generate better 12229scheduled code, but is unsafe on current hardware. The current architecture 12230definition says that ptabs and ptrel trap when the target anded with 3 is 3. 12231This has the unintentional effect of making it unsafe to schedule ptabs / 12232ptrel before a branch, or hoist it out of a loop. For example, 12233__do_global_ctors, a part of libgcc that runs constructors at program 12234startup, calls functions in a list which is delimited by -1. With the 12235-mpt-fixed option, the ptabs will be done before testing against -1. 12236That means that all the constructors will be run a bit quicker, but when 12237the loop comes to the end of the list, the program crashes because ptabs 12238loads -1 into a target register. Since this option is unsafe for any 12239hardware implementing the current architecture specification, the default 12240is -mno-pt-fixed. Unless the user specifies a specific cost with 12241@option{-mgettrcost}, -mno-pt-fixed also implies @option{-mgettrcost=100}; 12242this deters register allocation using target registers for storing 12243ordinary integers. 12244 12245@item -minvalid-symbols 12246@opindex minvalid-symbols 12247Assume symbols might be invalid. Ordinary function symbols generated by 12248the compiler will always be valid to load with movi/shori/ptabs or 12249movi/shori/ptrel, but with assembler and/or linker tricks it is possible 12250to generate symbols that will cause ptabs / ptrel to trap. 12251This option is only meaningful when @option{-mno-pt-fixed} is in effect. 12252It will then prevent cross-basic-block cse, hoisting and most scheduling 12253of symbol loads. The default is @option{-mno-invalid-symbols}. 12254@end table 12255 12256@node SPARC Options 12257@subsection SPARC Options 12258@cindex SPARC options 12259 12260These @samp{-m} options are supported on the SPARC: 12261 12262@table @gcctabopt 12263@item -mno-app-regs 12264@itemx -mapp-regs 12265@opindex mno-app-regs 12266@opindex mapp-regs 12267Specify @option{-mapp-regs} to generate output using the global registers 122682 through 4, which the SPARC SVR4 ABI reserves for applications. This 12269is the default. 12270 12271To be fully SVR4 ABI compliant at the cost of some performance loss, 12272specify @option{-mno-app-regs}. You should compile libraries and system 12273software with this option. 12274 12275@item -mfpu 12276@itemx -mhard-float 12277@opindex mfpu 12278@opindex mhard-float 12279Generate output containing floating point instructions. This is the 12280default. 12281 12282@item -mno-fpu 12283@itemx -msoft-float 12284@opindex mno-fpu 12285@opindex msoft-float 12286Generate output containing library calls for floating point. 12287@strong{Warning:} the requisite libraries are not available for all SPARC 12288targets. Normally the facilities of the machine's usual C compiler are 12289used, but this cannot be done directly in cross-compilation. You must make 12290your own arrangements to provide suitable library functions for 12291cross-compilation. The embedded targets @samp{sparc-*-aout} and 12292@samp{sparclite-*-*} do provide software floating point support. 12293 12294@option{-msoft-float} changes the calling convention in the output file; 12295therefore, it is only useful if you compile @emph{all} of a program with 12296this option. In particular, you need to compile @file{libgcc.a}, the 12297library that comes with GCC, with @option{-msoft-float} in order for 12298this to work. 12299 12300@item -mhard-quad-float 12301@opindex mhard-quad-float 12302Generate output containing quad-word (long double) floating point 12303instructions. 12304 12305@item -msoft-quad-float 12306@opindex msoft-quad-float 12307Generate output containing library calls for quad-word (long double) 12308floating point instructions. The functions called are those specified 12309in the SPARC ABI@. This is the default. 12310 12311As of this writing, there are no SPARC implementations that have hardware 12312support for the quad-word floating point instructions. They all invoke 12313a trap handler for one of these instructions, and then the trap handler 12314emulates the effect of the instruction. Because of the trap handler overhead, 12315this is much slower than calling the ABI library routines. Thus the 12316@option{-msoft-quad-float} option is the default. 12317 12318@item -mno-unaligned-doubles 12319@itemx -munaligned-doubles 12320@opindex mno-unaligned-doubles 12321@opindex munaligned-doubles 12322Assume that doubles have 8 byte alignment. This is the default. 12323 12324With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte 12325alignment only if they are contained in another type, or if they have an 12326absolute address. Otherwise, it assumes they have 4 byte alignment. 12327Specifying this option avoids some rare compatibility problems with code 12328generated by other compilers. It is not the default because it results 12329in a performance loss, especially for floating point code. 12330 12331@item -mno-faster-structs 12332@itemx -mfaster-structs 12333@opindex mno-faster-structs 12334@opindex mfaster-structs 12335With @option{-mfaster-structs}, the compiler assumes that structures 12336should have 8 byte alignment. This enables the use of pairs of 12337@code{ldd} and @code{std} instructions for copies in structure 12338assignment, in place of twice as many @code{ld} and @code{st} pairs. 12339However, the use of this changed alignment directly violates the SPARC 12340ABI@. Thus, it's intended only for use on targets where the developer 12341acknowledges that their resulting code will not be directly in line with 12342the rules of the ABI@. 12343 12344@item -mimpure-text 12345@opindex mimpure-text 12346@option{-mimpure-text}, used in addition to @option{-shared}, tells 12347the compiler to not pass @option{-z text} to the linker when linking a 12348shared object. Using this option, you can link position-dependent 12349code into a shared object. 12350 12351@option{-mimpure-text} suppresses the ``relocations remain against 12352allocatable but non-writable sections'' linker error message. 12353However, the necessary relocations will trigger copy-on-write, and the 12354shared object is not actually shared across processes. Instead of 12355using @option{-mimpure-text}, you should compile all source code with 12356@option{-fpic} or @option{-fPIC}. 12357 12358This option is only available on SunOS and Solaris. 12359 12360@item -mcpu=@var{cpu_type} 12361@opindex mcpu 12362Set the instruction set, register set, and instruction scheduling parameters 12363for machine type @var{cpu_type}. Supported values for @var{cpu_type} are 12364@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite}, 12365@samp{f930}, @samp{f934}, @samp{hypersparc}, @samp{sparclite86x}, 12366@samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc}, 12367@samp{ultrasparc3}, and @samp{niagara}. 12368 12369Default instruction scheduling parameters are used for values that select 12370an architecture and not an implementation. These are @samp{v7}, @samp{v8}, 12371@samp{sparclite}, @samp{sparclet}, @samp{v9}. 12372 12373Here is a list of each supported architecture and their supported 12374implementations. 12375 12376@smallexample 12377 v7: cypress 12378 v8: supersparc, hypersparc 12379 sparclite: f930, f934, sparclite86x 12380 sparclet: tsc701 12381 v9: ultrasparc, ultrasparc3, niagara 12382@end smallexample 12383 12384By default (unless configured otherwise), GCC generates code for the V7 12385variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler 12386additionally optimizes it for the Cypress CY7C602 chip, as used in the 12387SPARCStation/SPARCServer 3xx series. This is also appropriate for the older 12388SPARCStation 1, 2, IPX etc. 12389 12390With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC 12391architecture. The only difference from V7 code is that the compiler emits 12392the integer multiply and integer divide instructions which exist in SPARC-V8 12393but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally 12394optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and 123952000 series. 12396 12397With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of 12398the SPARC architecture. This adds the integer multiply, integer divide step 12399and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7. 12400With @option{-mcpu=f930}, the compiler additionally optimizes it for the 12401Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With 12402@option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu 12403MB86934 chip, which is the more recent SPARClite with FPU@. 12404 12405With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of 12406the SPARC architecture. This adds the integer multiply, multiply/accumulate, 12407integer divide step and scan (@code{ffs}) instructions which exist in SPARClet 12408but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally 12409optimizes it for the TEMIC SPARClet chip. 12410 12411With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC 12412architecture. This adds 64-bit integer and floating-point move instructions, 124133 additional floating-point condition code registers and conditional move 12414instructions. With @option{-mcpu=ultrasparc}, the compiler additionally 12415optimizes it for the Sun UltraSPARC I/II/IIi chips. With 12416@option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the 12417Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With 12418@option{-mcpu=niagara}, the compiler additionally optimizes it for 12419Sun UltraSPARC T1 chips. 12420 12421@item -mtune=@var{cpu_type} 12422@opindex mtune 12423Set the instruction scheduling parameters for machine type 12424@var{cpu_type}, but do not set the instruction set or register set that the 12425option @option{-mcpu=@var{cpu_type}} would. 12426 12427The same values for @option{-mcpu=@var{cpu_type}} can be used for 12428@option{-mtune=@var{cpu_type}}, but the only useful values are those 12429that select a particular cpu implementation. Those are @samp{cypress}, 12430@samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934}, 12431@samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc}, 12432@samp{ultrasparc3}, and @samp{niagara}. 12433 12434@item -mv8plus 12435@itemx -mno-v8plus 12436@opindex mv8plus 12437@opindex mno-v8plus 12438With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The 12439difference from the V8 ABI is that the global and out registers are 12440considered 64-bit wide. This is enabled by default on Solaris in 32-bit 12441mode for all SPARC-V9 processors. 12442 12443@item -mvis 12444@itemx -mno-vis 12445@opindex mvis 12446@opindex mno-vis 12447With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC 12448Visual Instruction Set extensions. The default is @option{-mno-vis}. 12449@end table 12450 12451These @samp{-m} options are supported in addition to the above 12452on SPARC-V9 processors in 64-bit environments: 12453 12454@table @gcctabopt 12455@item -mlittle-endian 12456@opindex mlittle-endian 12457Generate code for a processor running in little-endian mode. It is only 12458available for a few configurations and most notably not on Solaris and Linux. 12459 12460@item -m32 12461@itemx -m64 12462@opindex m32 12463@opindex m64 12464Generate code for a 32-bit or 64-bit environment. 12465The 32-bit environment sets int, long and pointer to 32 bits. 12466The 64-bit environment sets int to 32 bits and long and pointer 12467to 64 bits. 12468 12469@item -mcmodel=medlow 12470@opindex mcmodel=medlow 12471Generate code for the Medium/Low code model: 64-bit addresses, programs 12472must be linked in the low 32 bits of memory. Programs can be statically 12473or dynamically linked. 12474 12475@item -mcmodel=medmid 12476@opindex mcmodel=medmid 12477Generate code for the Medium/Middle code model: 64-bit addresses, programs 12478must be linked in the low 44 bits of memory, the text and data segments must 12479be less than 2GB in size and the data segment must be located within 2GB of 12480the text segment. 12481 12482@item -mcmodel=medany 12483@opindex mcmodel=medany 12484Generate code for the Medium/Anywhere code model: 64-bit addresses, programs 12485may be linked anywhere in memory, the text and data segments must be less 12486than 2GB in size and the data segment must be located within 2GB of the 12487text segment. 12488 12489@item -mcmodel=embmedany 12490@opindex mcmodel=embmedany 12491Generate code for the Medium/Anywhere code model for embedded systems: 1249264-bit addresses, the text and data segments must be less than 2GB in 12493size, both starting anywhere in memory (determined at link time). The 12494global register %g4 points to the base of the data segment. Programs 12495are statically linked and PIC is not supported. 12496 12497@item -mstack-bias 12498@itemx -mno-stack-bias 12499@opindex mstack-bias 12500@opindex mno-stack-bias 12501With @option{-mstack-bias}, GCC assumes that the stack pointer, and 12502frame pointer if present, are offset by @minus{}2047 which must be added back 12503when making stack frame references. This is the default in 64-bit mode. 12504Otherwise, assume no such offset is present. 12505@end table 12506 12507These switches are supported in addition to the above on Solaris: 12508 12509@table @gcctabopt 12510@item -threads 12511@opindex threads 12512Add support for multithreading using the Solaris threads library. This 12513option sets flags for both the preprocessor and linker. This option does 12514not affect the thread safety of object code produced by the compiler or 12515that of libraries supplied with it. 12516 12517@item -pthreads 12518@opindex pthreads 12519Add support for multithreading using the POSIX threads library. This 12520option sets flags for both the preprocessor and linker. This option does 12521not affect the thread safety of object code produced by the compiler or 12522that of libraries supplied with it. 12523 12524@item -pthread 12525@opindex pthread 12526This is a synonym for @option{-pthreads}. 12527@end table 12528 12529@node System V Options 12530@subsection Options for System V 12531 12532These additional options are available on System V Release 4 for 12533compatibility with other compilers on those systems: 12534 12535@table @gcctabopt 12536@item -G 12537@opindex G 12538Create a shared object. 12539It is recommended that @option{-symbolic} or @option{-shared} be used instead. 12540 12541@item -Qy 12542@opindex Qy 12543Identify the versions of each tool used by the compiler, in a 12544@code{.ident} assembler directive in the output. 12545 12546@item -Qn 12547@opindex Qn 12548Refrain from adding @code{.ident} directives to the output file (this is 12549the default). 12550 12551@item -YP,@var{dirs} 12552@opindex YP 12553Search the directories @var{dirs}, and no others, for libraries 12554specified with @option{-l}. 12555 12556@item -Ym,@var{dir} 12557@opindex Ym 12558Look in the directory @var{dir} to find the M4 preprocessor. 12559The assembler uses this option. 12560@c This is supposed to go with a -Yd for predefined M4 macro files, but 12561@c the generic assembler that comes with Solaris takes just -Ym. 12562@end table 12563 12564@node TMS320C3x/C4x Options 12565@subsection TMS320C3x/C4x Options 12566@cindex TMS320C3x/C4x Options 12567 12568These @samp{-m} options are defined for TMS320C3x/C4x implementations: 12569 12570@table @gcctabopt 12571 12572@item -mcpu=@var{cpu_type} 12573@opindex mcpu 12574Set the instruction set, register set, and instruction scheduling 12575parameters for machine type @var{cpu_type}. Supported values for 12576@var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and 12577@samp{c44}. The default is @samp{c40} to generate code for the 12578TMS320C40. 12579 12580@item -mbig-memory 12581@itemx -mbig 12582@itemx -msmall-memory 12583@itemx -msmall 12584@opindex mbig-memory 12585@opindex mbig 12586@opindex msmall-memory 12587@opindex msmall 12588Generates code for the big or small memory model. The small memory 12589model assumed that all data fits into one 64K word page. At run-time 12590the data page (DP) register must be set to point to the 64K page 12591containing the .bss and .data program sections. The big memory model is 12592the default and requires reloading of the DP register for every direct 12593memory access. 12594 12595@item -mbk 12596@itemx -mno-bk 12597@opindex mbk 12598@opindex mno-bk 12599Allow (disallow) allocation of general integer operands into the block 12600count register BK@. 12601 12602@item -mdb 12603@itemx -mno-db 12604@opindex mdb 12605@opindex mno-db 12606Enable (disable) generation of code using decrement and branch, 12607DBcond(D), instructions. This is enabled by default for the C4x. To be 12608on the safe side, this is disabled for the C3x, since the maximum 12609iteration count on the C3x is @math{2^{23} + 1} (but who iterates loops more than 12610@math{2^{23}} times on the C3x?). Note that GCC will try to reverse a loop so 12611that it can utilize the decrement and branch instruction, but will give 12612up if there is more than one memory reference in the loop. Thus a loop 12613where the loop counter is decremented can generate slightly more 12614efficient code, in cases where the RPTB instruction cannot be utilized. 12615 12616@item -mdp-isr-reload 12617@itemx -mparanoid 12618@opindex mdp-isr-reload 12619@opindex mparanoid 12620Force the DP register to be saved on entry to an interrupt service 12621routine (ISR), reloaded to point to the data section, and restored on 12622exit from the ISR@. This should not be required unless someone has 12623violated the small memory model by modifying the DP register, say within 12624an object library. 12625 12626@item -mmpyi 12627@itemx -mno-mpyi 12628@opindex mmpyi 12629@opindex mno-mpyi 12630For the C3x use the 24-bit MPYI instruction for integer multiplies 12631instead of a library call to guarantee 32-bit results. Note that if one 12632of the operands is a constant, then the multiplication will be performed 12633using shifts and adds. If the @option{-mmpyi} option is not specified for the C3x, 12634then squaring operations are performed inline instead of a library call. 12635 12636@item -mfast-fix 12637@itemx -mno-fast-fix 12638@opindex mfast-fix 12639@opindex mno-fast-fix 12640The C3x/C4x FIX instruction to convert a floating point value to an 12641integer value chooses the nearest integer less than or equal to the 12642floating point value rather than to the nearest integer. Thus if the 12643floating point number is negative, the result will be incorrectly 12644truncated an additional code is necessary to detect and correct this 12645case. This option can be used to disable generation of the additional 12646code required to correct the result. 12647 12648@item -mrptb 12649@itemx -mno-rptb 12650@opindex mrptb 12651@opindex mno-rptb 12652Enable (disable) generation of repeat block sequences using the RPTB 12653instruction for zero overhead looping. The RPTB construct is only used 12654for innermost loops that do not call functions or jump across the loop 12655boundaries. There is no advantage having nested RPTB loops due to the 12656overhead required to save and restore the RC, RS, and RE registers. 12657This is enabled by default with @option{-O2}. 12658 12659@item -mrpts=@var{count} 12660@itemx -mno-rpts 12661@opindex mrpts 12662@opindex mno-rpts 12663Enable (disable) the use of the single instruction repeat instruction 12664RPTS@. If a repeat block contains a single instruction, and the loop 12665count can be guaranteed to be less than the value @var{count}, GCC will 12666emit a RPTS instruction instead of a RPTB@. If no value is specified, 12667then a RPTS will be emitted even if the loop count cannot be determined 12668at compile time. Note that the repeated instruction following RPTS does 12669not have to be reloaded from memory each iteration, thus freeing up the 12670CPU buses for operands. However, since interrupts are blocked by this 12671instruction, it is disabled by default. 12672 12673@item -mloop-unsigned 12674@itemx -mno-loop-unsigned 12675@opindex mloop-unsigned 12676@opindex mno-loop-unsigned 12677The maximum iteration count when using RPTS and RPTB (and DB on the C40) 12678is @math{2^{31} + 1} since these instructions test if the iteration count is 12679negative to terminate the loop. If the iteration count is unsigned 12680there is a possibility than the @math{2^{31} + 1} maximum iteration count may be 12681exceeded. This switch allows an unsigned iteration count. 12682 12683@item -mti 12684@opindex mti 12685Try to emit an assembler syntax that the TI assembler (asm30) is happy 12686with. This also enforces compatibility with the API employed by the TI 12687C3x C compiler. For example, long doubles are passed as structures 12688rather than in floating point registers. 12689 12690@item -mregparm 12691@itemx -mmemparm 12692@opindex mregparm 12693@opindex mmemparm 12694Generate code that uses registers (stack) for passing arguments to functions. 12695By default, arguments are passed in registers where possible rather 12696than by pushing arguments on to the stack. 12697 12698@item -mparallel-insns 12699@itemx -mno-parallel-insns 12700@opindex mparallel-insns 12701@opindex mno-parallel-insns 12702Allow the generation of parallel instructions. This is enabled by 12703default with @option{-O2}. 12704 12705@item -mparallel-mpy 12706@itemx -mno-parallel-mpy 12707@opindex mparallel-mpy 12708@opindex mno-parallel-mpy 12709Allow the generation of MPY||ADD and MPY||SUB parallel instructions, 12710provided @option{-mparallel-insns} is also specified. These instructions have 12711tight register constraints which can pessimize the code generation 12712of large functions. 12713 12714@end table 12715 12716@node V850 Options 12717@subsection V850 Options 12718@cindex V850 Options 12719 12720These @samp{-m} options are defined for V850 implementations: 12721 12722@table @gcctabopt 12723@item -mlong-calls 12724@itemx -mno-long-calls 12725@opindex mlong-calls 12726@opindex mno-long-calls 12727Treat all calls as being far away (near). If calls are assumed to be 12728far away, the compiler will always load the functions address up into a 12729register, and call indirect through the pointer. 12730 12731@item -mno-ep 12732@itemx -mep 12733@opindex mno-ep 12734@opindex mep 12735Do not optimize (do optimize) basic blocks that use the same index 12736pointer 4 or more times to copy pointer into the @code{ep} register, and 12737use the shorter @code{sld} and @code{sst} instructions. The @option{-mep} 12738option is on by default if you optimize. 12739 12740@item -mno-prolog-function 12741@itemx -mprolog-function 12742@opindex mno-prolog-function 12743@opindex mprolog-function 12744Do not use (do use) external functions to save and restore registers 12745at the prologue and epilogue of a function. The external functions 12746are slower, but use less code space if more than one function saves 12747the same number of registers. The @option{-mprolog-function} option 12748is on by default if you optimize. 12749 12750@item -mspace 12751@opindex mspace 12752Try to make the code as small as possible. At present, this just turns 12753on the @option{-mep} and @option{-mprolog-function} options. 12754 12755@item -mtda=@var{n} 12756@opindex mtda 12757Put static or global variables whose size is @var{n} bytes or less into 12758the tiny data area that register @code{ep} points to. The tiny data 12759area can hold up to 256 bytes in total (128 bytes for byte references). 12760 12761@item -msda=@var{n} 12762@opindex msda 12763Put static or global variables whose size is @var{n} bytes or less into 12764the small data area that register @code{gp} points to. The small data 12765area can hold up to 64 kilobytes. 12766 12767@item -mzda=@var{n} 12768@opindex mzda 12769Put static or global variables whose size is @var{n} bytes or less into 12770the first 32 kilobytes of memory. 12771 12772@item -mv850 12773@opindex mv850 12774Specify that the target processor is the V850. 12775 12776@item -mbig-switch 12777@opindex mbig-switch 12778Generate code suitable for big switch tables. Use this option only if 12779the assembler/linker complain about out of range branches within a switch 12780table. 12781 12782@item -mapp-regs 12783@opindex mapp-regs 12784This option will cause r2 and r5 to be used in the code generated by 12785the compiler. This setting is the default. 12786 12787@item -mno-app-regs 12788@opindex mno-app-regs 12789This option will cause r2 and r5 to be treated as fixed registers. 12790 12791@item -mv850e1 12792@opindex mv850e1 12793Specify that the target processor is the V850E1. The preprocessor 12794constants @samp{__v850e1__} and @samp{__v850e__} will be defined if 12795this option is used. 12796 12797@item -mv850e 12798@opindex mv850e 12799Specify that the target processor is the V850E@. The preprocessor 12800constant @samp{__v850e__} will be defined if this option is used. 12801 12802If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1} 12803are defined then a default target processor will be chosen and the 12804relevant @samp{__v850*__} preprocessor constant will be defined. 12805 12806The preprocessor constants @samp{__v850} and @samp{__v851__} are always 12807defined, regardless of which processor variant is the target. 12808 12809@item -mdisable-callt 12810@opindex mdisable-callt 12811This option will suppress generation of the CALLT instruction for the 12812v850e and v850e1 flavors of the v850 architecture. The default is 12813@option{-mno-disable-callt} which allows the CALLT instruction to be used. 12814 12815@end table 12816 12817@node VAX Options 12818@subsection VAX Options 12819@cindex VAX options 12820 12821These @samp{-m} options are defined for the VAX: 12822 12823@table @gcctabopt 12824@item -munix 12825@opindex munix 12826Do not output certain jump instructions (@code{aobleq} and so on) 12827that the Unix assembler for the VAX cannot handle across long 12828ranges. 12829 12830@item -mgnu 12831@opindex mgnu 12832Do output those jump instructions, on the assumption that you 12833will assemble with the GNU assembler. 12834 12835@item -mg 12836@opindex mg 12837Output code for g-format floating point numbers instead of d-format. 12838@end table 12839 12840@node x86-64 Options 12841@subsection x86-64 Options 12842@cindex x86-64 options 12843 12844These are listed under @xref{i386 and x86-64 Options}. 12845 12846@node Xstormy16 Options 12847@subsection Xstormy16 Options 12848@cindex Xstormy16 Options 12849 12850These options are defined for Xstormy16: 12851 12852@table @gcctabopt 12853@item -msim 12854@opindex msim 12855Choose startup files and linker script suitable for the simulator. 12856@end table 12857 12858@node Xtensa Options 12859@subsection Xtensa Options 12860@cindex Xtensa Options 12861 12862These options are supported for Xtensa targets: 12863 12864@table @gcctabopt 12865@item -mconst16 12866@itemx -mno-const16 12867@opindex mconst16 12868@opindex mno-const16 12869Enable or disable use of @code{CONST16} instructions for loading 12870constant values. The @code{CONST16} instruction is currently not a 12871standard option from Tensilica. When enabled, @code{CONST16} 12872instructions are always used in place of the standard @code{L32R} 12873instructions. The use of @code{CONST16} is enabled by default only if 12874the @code{L32R} instruction is not available. 12875 12876@item -mfused-madd 12877@itemx -mno-fused-madd 12878@opindex mfused-madd 12879@opindex mno-fused-madd 12880Enable or disable use of fused multiply/add and multiply/subtract 12881instructions in the floating-point option. This has no effect if the 12882floating-point option is not also enabled. Disabling fused multiply/add 12883and multiply/subtract instructions forces the compiler to use separate 12884instructions for the multiply and add/subtract operations. This may be 12885desirable in some cases where strict IEEE 754-compliant results are 12886required: the fused multiply add/subtract instructions do not round the 12887intermediate result, thereby producing results with @emph{more} bits of 12888precision than specified by the IEEE standard. Disabling fused multiply 12889add/subtract instructions also ensures that the program output is not 12890sensitive to the compiler's ability to combine multiply and add/subtract 12891operations. 12892 12893@item -mtext-section-literals 12894@itemx -mno-text-section-literals 12895@opindex mtext-section-literals 12896@opindex mno-text-section-literals 12897Control the treatment of literal pools. The default is 12898@option{-mno-text-section-literals}, which places literals in a separate 12899section in the output file. This allows the literal pool to be placed 12900in a data RAM/ROM, and it also allows the linker to combine literal 12901pools from separate object files to remove redundant literals and 12902improve code size. With @option{-mtext-section-literals}, the literals 12903are interspersed in the text section in order to keep them as close as 12904possible to their references. This may be necessary for large assembly 12905files. 12906 12907@item -mtarget-align 12908@itemx -mno-target-align 12909@opindex mtarget-align 12910@opindex mno-target-align 12911When this option is enabled, GCC instructs the assembler to 12912automatically align instructions to reduce branch penalties at the 12913expense of some code density. The assembler attempts to widen density 12914instructions to align branch targets and the instructions following call 12915instructions. If there are not enough preceding safe density 12916instructions to align a target, no widening will be performed. The 12917default is @option{-mtarget-align}. These options do not affect the 12918treatment of auto-aligned instructions like @code{LOOP}, which the 12919assembler will always align, either by widening density instructions or 12920by inserting no-op instructions. 12921 12922@item -mlongcalls 12923@itemx -mno-longcalls 12924@opindex mlongcalls 12925@opindex mno-longcalls 12926When this option is enabled, GCC instructs the assembler to translate 12927direct calls to indirect calls unless it can determine that the target 12928of a direct call is in the range allowed by the call instruction. This 12929translation typically occurs for calls to functions in other source 12930files. Specifically, the assembler translates a direct @code{CALL} 12931instruction into an @code{L32R} followed by a @code{CALLX} instruction. 12932The default is @option{-mno-longcalls}. This option should be used in 12933programs where the call target can potentially be out of range. This 12934option is implemented in the assembler, not the compiler, so the 12935assembly code generated by GCC will still show direct call 12936instructions---look at the disassembled object code to see the actual 12937instructions. Note that the assembler will use an indirect call for 12938every cross-file call, not just those that really will be out of range. 12939@end table 12940 12941@node zSeries Options 12942@subsection zSeries Options 12943@cindex zSeries options 12944 12945These are listed under @xref{S/390 and zSeries Options}. 12946 12947@node Code Gen Options 12948@section Options for Code Generation Conventions 12949@cindex code generation conventions 12950@cindex options, code generation 12951@cindex run-time options 12952 12953These machine-independent options control the interface conventions 12954used in code generation. 12955 12956Most of them have both positive and negative forms; the negative form 12957of @option{-ffoo} would be @option{-fno-foo}. In the table below, only 12958one of the forms is listed---the one which is not the default. You 12959can figure out the other form by either removing @samp{no-} or adding 12960it. 12961 12962@table @gcctabopt 12963@item -fbounds-check 12964@opindex fbounds-check 12965For front-ends that support it, generate additional code to check that 12966indices used to access arrays are within the declared range. This is 12967currently only supported by the Java and Fortran front-ends, where 12968this option defaults to true and false respectively. 12969 12970@item -ftrapv 12971@opindex ftrapv 12972This option generates traps for signed overflow on addition, subtraction, 12973multiplication operations. 12974 12975@item -fwrapv 12976@opindex fwrapv 12977This option instructs the compiler to assume that signed arithmetic 12978overflow of addition, subtraction and multiplication wraps around 12979using twos-complement representation. This flag enables some optimizations 12980and disables others. This option is enabled by default for the Java 12981front-end, as required by the Java language specification. 12982 12983@item -fexceptions 12984@opindex fexceptions 12985Enable exception handling. Generates extra code needed to propagate 12986exceptions. For some targets, this implies GCC will generate frame 12987unwind information for all functions, which can produce significant data 12988size overhead, although it does not affect execution. If you do not 12989specify this option, GCC will enable it by default for languages like 12990C++ which normally require exception handling, and disable it for 12991languages like C that do not normally require it. However, you may need 12992to enable this option when compiling C code that needs to interoperate 12993properly with exception handlers written in C++. You may also wish to 12994disable this option if you are compiling older C++ programs that don't 12995use exception handling. 12996 12997@item -fnon-call-exceptions 12998@opindex fnon-call-exceptions 12999Generate code that allows trapping instructions to throw exceptions. 13000Note that this requires platform-specific runtime support that does 13001not exist everywhere. Moreover, it only allows @emph{trapping} 13002instructions to throw exceptions, i.e.@: memory references or floating 13003point instructions. It does not allow exceptions to be thrown from 13004arbitrary signal handlers such as @code{SIGALRM}. 13005 13006@item -funwind-tables 13007@opindex funwind-tables 13008Similar to @option{-fexceptions}, except that it will just generate any needed 13009static data, but will not affect the generated code in any other way. 13010You will normally not enable this option; instead, a language processor 13011that needs this handling would enable it on your behalf. 13012 13013@item -fasynchronous-unwind-tables 13014@opindex fasynchronous-unwind-tables 13015Generate unwind table in dwarf2 format, if supported by target machine. The 13016table is exact at each instruction boundary, so it can be used for stack 13017unwinding from asynchronous events (such as debugger or garbage collector). 13018 13019@item -fpcc-struct-return 13020@opindex fpcc-struct-return 13021Return ``short'' @code{struct} and @code{union} values in memory like 13022longer ones, rather than in registers. This convention is less 13023efficient, but it has the advantage of allowing intercallability between 13024GCC-compiled files and files compiled with other compilers, particularly 13025the Portable C Compiler (pcc). 13026 13027The precise convention for returning structures in memory depends 13028on the target configuration macros. 13029 13030Short structures and unions are those whose size and alignment match 13031that of some integer type. 13032 13033@strong{Warning:} code compiled with the @option{-fpcc-struct-return} 13034switch is not binary compatible with code compiled with the 13035@option{-freg-struct-return} switch. 13036Use it to conform to a non-default application binary interface. 13037 13038@item -freg-struct-return 13039@opindex freg-struct-return 13040Return @code{struct} and @code{union} values in registers when possible. 13041This is more efficient for small structures than 13042@option{-fpcc-struct-return}. 13043 13044If you specify neither @option{-fpcc-struct-return} nor 13045@option{-freg-struct-return}, GCC defaults to whichever convention is 13046standard for the target. If there is no standard convention, GCC 13047defaults to @option{-fpcc-struct-return}, except on targets where GCC is 13048the principal compiler. In those cases, we can choose the standard, and 13049we chose the more efficient register return alternative. 13050 13051@strong{Warning:} code compiled with the @option{-freg-struct-return} 13052switch is not binary compatible with code compiled with the 13053@option{-fpcc-struct-return} switch. 13054Use it to conform to a non-default application binary interface. 13055 13056@item -fshort-enums 13057@opindex fshort-enums 13058Allocate to an @code{enum} type only as many bytes as it needs for the 13059declared range of possible values. Specifically, the @code{enum} type 13060will be equivalent to the smallest integer type which has enough room. 13061 13062@strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate 13063code that is not binary compatible with code generated without that switch. 13064Use it to conform to a non-default application binary interface. 13065 13066@item -fshort-double 13067@opindex fshort-double 13068Use the same size for @code{double} as for @code{float}. 13069 13070@strong{Warning:} the @option{-fshort-double} switch causes GCC to generate 13071code that is not binary compatible with code generated without that switch. 13072Use it to conform to a non-default application binary interface. 13073 13074@item -fshort-wchar 13075@opindex fshort-wchar 13076Override the underlying type for @samp{wchar_t} to be @samp{short 13077unsigned int} instead of the default for the target. This option is 13078useful for building programs to run under WINE@. 13079 13080@strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate 13081code that is not binary compatible with code generated without that switch. 13082Use it to conform to a non-default application binary interface. 13083 13084@item -fno-common 13085@opindex fno-common 13086In C, allocate even uninitialized global variables in the data section of the 13087object file, rather than generating them as common blocks. This has the 13088effect that if the same variable is declared (without @code{extern}) in 13089two different compilations, you will get an error when you link them. 13090The only reason this might be useful is if you wish to verify that the 13091program will work on other systems which always work this way. 13092 13093@item -fno-ident 13094@opindex fno-ident 13095Ignore the @samp{#ident} directive. 13096 13097@item -finhibit-size-directive 13098@opindex finhibit-size-directive 13099Don't output a @code{.size} assembler directive, or anything else that 13100would cause trouble if the function is split in the middle, and the 13101two halves are placed at locations far apart in memory. This option is 13102used when compiling @file{crtstuff.c}; you should not need to use it 13103for anything else. 13104 13105@item -fverbose-asm 13106@opindex fverbose-asm 13107Put extra commentary information in the generated assembly code to 13108make it more readable. This option is generally only of use to those 13109who actually need to read the generated assembly code (perhaps while 13110debugging the compiler itself). 13111 13112@option{-fno-verbose-asm}, the default, causes the 13113extra information to be omitted and is useful when comparing two assembler 13114files. 13115 13116@item -fpic 13117@opindex fpic 13118@cindex global offset table 13119@cindex PIC 13120Generate position-independent code (PIC) suitable for use in a shared 13121library, if supported for the target machine. Such code accesses all 13122constant addresses through a global offset table (GOT)@. The dynamic 13123loader resolves the GOT entries when the program starts (the dynamic 13124loader is not part of GCC; it is part of the operating system). If 13125the GOT size for the linked executable exceeds a machine-specific 13126maximum size, you get an error message from the linker indicating that 13127@option{-fpic} does not work; in that case, recompile with @option{-fPIC} 13128instead. (These maximums are 8k on the SPARC and 32k 13129on the m68k and RS/6000. The 386 has no such limit.) 13130 13131Position-independent code requires special support, and therefore works 13132only on certain machines. For the 386, GCC supports PIC for System V 13133but not for the Sun 386i. Code generated for the IBM RS/6000 is always 13134position-independent. 13135 13136When this flag is set, the macros @code{__pic__} and @code{__PIC__} 13137are defined to 1. 13138 13139@item -fPIC 13140@opindex fPIC 13141If supported for the target machine, emit position-independent code, 13142suitable for dynamic linking and avoiding any limit on the size of the 13143global offset table. This option makes a difference on the m68k, 13144PowerPC and SPARC@. 13145 13146Position-independent code requires special support, and therefore works 13147only on certain machines. 13148 13149When this flag is set, the macros @code{__pic__} and @code{__PIC__} 13150are defined to 2. 13151 13152@item -fpie 13153@itemx -fPIE 13154@opindex fpie 13155@opindex fPIE 13156These options are similar to @option{-fpic} and @option{-fPIC}, but 13157generated position independent code can be only linked into executables. 13158Usually these options are used when @option{-pie} GCC option will be 13159used during linking. 13160 13161@item -fno-jump-tables 13162@opindex fno-jump-tables 13163Do not use jump tables for switch statements even where it would be 13164more efficient than other code generation strategies. This option is 13165of use in conjunction with @option{-fpic} or @option{-fPIC} for 13166building code which forms part of a dynamic linker and cannot 13167reference the address of a jump table. On some targets, jump tables 13168do not require a GOT and this option is not needed. 13169 13170@item -ffixed-@var{reg} 13171@opindex ffixed 13172Treat the register named @var{reg} as a fixed register; generated code 13173should never refer to it (except perhaps as a stack pointer, frame 13174pointer or in some other fixed role). 13175 13176@var{reg} must be the name of a register. The register names accepted 13177are machine-specific and are defined in the @code{REGISTER_NAMES} 13178macro in the machine description macro file. 13179 13180This flag does not have a negative form, because it specifies a 13181three-way choice. 13182 13183@item -fcall-used-@var{reg} 13184@opindex fcall-used 13185Treat the register named @var{reg} as an allocable register that is 13186clobbered by function calls. It may be allocated for temporaries or 13187variables that do not live across a call. Functions compiled this way 13188will not save and restore the register @var{reg}. 13189 13190It is an error to used this flag with the frame pointer or stack pointer. 13191Use of this flag for other registers that have fixed pervasive roles in 13192the machine's execution model will produce disastrous results. 13193 13194This flag does not have a negative form, because it specifies a 13195three-way choice. 13196 13197@item -fcall-saved-@var{reg} 13198@opindex fcall-saved 13199Treat the register named @var{reg} as an allocable register saved by 13200functions. It may be allocated even for temporaries or variables that 13201live across a call. Functions compiled this way will save and restore 13202the register @var{reg} if they use it. 13203 13204It is an error to used this flag with the frame pointer or stack pointer. 13205Use of this flag for other registers that have fixed pervasive roles in 13206the machine's execution model will produce disastrous results. 13207 13208A different sort of disaster will result from the use of this flag for 13209a register in which function values may be returned. 13210 13211This flag does not have a negative form, because it specifies a 13212three-way choice. 13213 13214@item -fpack-struct[=@var{n}] 13215@opindex fpack-struct 13216Without a value specified, pack all structure members together without 13217holes. When a value is specified (which must be a small power of two), pack 13218structure members according to this value, representing the maximum 13219alignment (that is, objects with default alignment requirements larger than 13220this will be output potentially unaligned at the next fitting location. 13221 13222@strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate 13223code that is not binary compatible with code generated without that switch. 13224Additionally, it makes the code suboptimal. 13225Use it to conform to a non-default application binary interface. 13226 13227@item -finstrument-functions 13228@opindex finstrument-functions 13229Generate instrumentation calls for entry and exit to functions. Just 13230after function entry and just before function exit, the following 13231profiling functions will be called with the address of the current 13232function and its call site. (On some platforms, 13233@code{__builtin_return_address} does not work beyond the current 13234function, so the call site information may not be available to the 13235profiling functions otherwise.) 13236 13237@smallexample 13238void __cyg_profile_func_enter (void *this_fn, 13239 void *call_site); 13240void __cyg_profile_func_exit (void *this_fn, 13241 void *call_site); 13242@end smallexample 13243 13244The first argument is the address of the start of the current function, 13245which may be looked up exactly in the symbol table. 13246 13247This instrumentation is also done for functions expanded inline in other 13248functions. The profiling calls will indicate where, conceptually, the 13249inline function is entered and exited. This means that addressable 13250versions of such functions must be available. If all your uses of a 13251function are expanded inline, this may mean an additional expansion of 13252code size. If you use @samp{extern inline} in your C code, an 13253addressable version of such functions must be provided. (This is 13254normally the case anyways, but if you get lucky and the optimizer always 13255expands the functions inline, you might have gotten away without 13256providing static copies.) 13257 13258A function may be given the attribute @code{no_instrument_function}, in 13259which case this instrumentation will not be done. This can be used, for 13260example, for the profiling functions listed above, high-priority 13261interrupt routines, and any functions from which the profiling functions 13262cannot safely be called (perhaps signal handlers, if the profiling 13263routines generate output or allocate memory). 13264 13265@item -fstack-check 13266@opindex fstack-check 13267Generate code to verify that you do not go beyond the boundary of the 13268stack. You should specify this flag if you are running in an 13269environment with multiple threads, but only rarely need to specify it in 13270a single-threaded environment since stack overflow is automatically 13271detected on nearly all systems if there is only one stack. 13272 13273Note that this switch does not actually cause checking to be done; the 13274operating system must do that. The switch causes generation of code 13275to ensure that the operating system sees the stack being extended. 13276 13277@item -fstack-limit-register=@var{reg} 13278@itemx -fstack-limit-symbol=@var{sym} 13279@itemx -fno-stack-limit 13280@opindex fstack-limit-register 13281@opindex fstack-limit-symbol 13282@opindex fno-stack-limit 13283Generate code to ensure that the stack does not grow beyond a certain value, 13284either the value of a register or the address of a symbol. If the stack 13285would grow beyond the value, a signal is raised. For most targets, 13286the signal is raised before the stack overruns the boundary, so 13287it is possible to catch the signal without taking special precautions. 13288 13289For instance, if the stack starts at absolute address @samp{0x80000000} 13290and grows downwards, you can use the flags 13291@option{-fstack-limit-symbol=__stack_limit} and 13292@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit 13293of 128KB@. Note that this may only work with the GNU linker. 13294 13295@cindex aliasing of parameters 13296@cindex parameters, aliased 13297@item -fargument-alias 13298@itemx -fargument-noalias 13299@itemx -fargument-noalias-global 13300@itemx -fargument-noalias-anything 13301@opindex fargument-alias 13302@opindex fargument-noalias 13303@opindex fargument-noalias-global 13304@opindex fargument-noalias-anything 13305Specify the possible relationships among parameters and between 13306parameters and global data. 13307 13308@option{-fargument-alias} specifies that arguments (parameters) may 13309alias each other and may alias global storage.@* 13310@option{-fargument-noalias} specifies that arguments do not alias 13311each other, but may alias global storage.@* 13312@option{-fargument-noalias-global} specifies that arguments do not 13313alias each other and do not alias global storage. 13314@option{-fargument-noalias-anything} specifies that arguments do not 13315alias any other storage. 13316 13317Each language will automatically use whatever option is required by 13318the language standard. You should not need to use these options yourself. 13319 13320@item -fleading-underscore 13321@opindex fleading-underscore 13322This option and its counterpart, @option{-fno-leading-underscore}, forcibly 13323change the way C symbols are represented in the object file. One use 13324is to help link with legacy assembly code. 13325 13326@strong{Warning:} the @option{-fleading-underscore} switch causes GCC to 13327generate code that is not binary compatible with code generated without that 13328switch. Use it to conform to a non-default application binary interface. 13329Not all targets provide complete support for this switch. 13330 13331@item -ftls-model=@var{model} 13332Alter the thread-local storage model to be used (@pxref{Thread-Local}). 13333The @var{model} argument should be one of @code{global-dynamic}, 13334@code{local-dynamic}, @code{initial-exec} or @code{local-exec}. 13335 13336The default without @option{-fpic} is @code{initial-exec}; with 13337@option{-fpic} the default is @code{global-dynamic}. 13338 13339@item -fvisibility=@var{default|internal|hidden|protected} 13340@opindex fvisibility 13341Set the default ELF image symbol visibility to the specified option---all 13342symbols will be marked with this unless overridden within the code. 13343Using this feature can very substantially improve linking and 13344load times of shared object libraries, produce more optimized 13345code, provide near-perfect API export and prevent symbol clashes. 13346It is @strong{strongly} recommended that you use this in any shared objects 13347you distribute. 13348 13349Despite the nomenclature, @code{default} always means public ie; 13350available to be linked against from outside the shared object. 13351@code{protected} and @code{internal} are pretty useless in real-world 13352usage so the only other commonly used option will be @code{hidden}. 13353The default if @option{-fvisibility} isn't specified is 13354@code{default}, i.e., make every 13355symbol public---this causes the same behavior as previous versions of 13356GCC@. 13357 13358A good explanation of the benefits offered by ensuring ELF 13359symbols have the correct visibility is given by ``How To Write 13360Shared Libraries'' by Ulrich Drepper (which can be found at 13361@w{@uref{http://people.redhat.com/~drepper/}})---however a superior 13362solution made possible by this option to marking things hidden when 13363the default is public is to make the default hidden and mark things 13364public. This is the norm with DLL's on Windows and with @option{-fvisibility=hidden} 13365and @code{__attribute__ ((visibility("default")))} instead of 13366@code{__declspec(dllexport)} you get almost identical semantics with 13367identical syntax. This is a great boon to those working with 13368cross-platform projects. 13369 13370For those adding visibility support to existing code, you may find 13371@samp{#pragma GCC visibility} of use. This works by you enclosing 13372the declarations you wish to set visibility for with (for example) 13373@samp{#pragma GCC visibility push(hidden)} and 13374@samp{#pragma GCC visibility pop}. 13375Bear in mind that symbol visibility should be viewed @strong{as 13376part of the API interface contract} and thus all new code should 13377always specify visibility when it is not the default ie; declarations 13378only for use within the local DSO should @strong{always} be marked explicitly 13379as hidden as so to avoid PLT indirection overheads---making this 13380abundantly clear also aids readability and self-documentation of the code. 13381Note that due to ISO C++ specification requirements, operator new and 13382operator delete must always be of default visibility. 13383 13384Be aware that headers from outside your project, in particular system 13385headers and headers from any other library you use, may not be 13386expecting to be compiled with visibility other than the default. You 13387may need to explicitly say @samp{#pragma GCC visibility push(default)} 13388before including any such headers. 13389 13390@samp{extern} declarations are not affected by @samp{-fvisibility}, so 13391a lot of code can be recompiled with @samp{-fvisibility=hidden} with 13392no modifications. However, this means that calls to @samp{extern} 13393functions with no explicit visibility will use the PLT, so it is more 13394effective to use @samp{__attribute ((visibility))} and/or 13395@samp{#pragma GCC visibility} to tell the compiler which @samp{extern} 13396declarations should be treated as hidden. 13397 13398Note that @samp{-fvisibility} does affect C++ vague linkage 13399entities. This means that, for instance, an exception class that will 13400be thrown between DSOs must be explicitly marked with default 13401visibility so that the @samp{type_info} nodes will be unified between 13402the DSOs. 13403 13404An overview of these techniques, their benefits and how to use them 13405is at @w{@uref{http://gcc.gnu.org/wiki/Visibility}}. 13406 13407@end table 13408 13409@c man end 13410 13411@node Environment Variables 13412@section Environment Variables Affecting GCC 13413@cindex environment variables 13414 13415@c man begin ENVIRONMENT 13416This section describes several environment variables that affect how GCC 13417operates. Some of them work by specifying directories or prefixes to use 13418when searching for various kinds of files. Some are used to specify other 13419aspects of the compilation environment. 13420 13421Note that you can also specify places to search using options such as 13422@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These 13423take precedence over places specified using environment variables, which 13424in turn take precedence over those specified by the configuration of GCC@. 13425@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint, 13426GNU Compiler Collection (GCC) Internals}. 13427 13428@table @env 13429@item LANG 13430@itemx LC_CTYPE 13431@c @itemx LC_COLLATE 13432@itemx LC_MESSAGES 13433@c @itemx LC_MONETARY 13434@c @itemx LC_NUMERIC 13435@c @itemx LC_TIME 13436@itemx LC_ALL 13437@findex LANG 13438@findex LC_CTYPE 13439@c @findex LC_COLLATE 13440@findex LC_MESSAGES 13441@c @findex LC_MONETARY 13442@c @findex LC_NUMERIC 13443@c @findex LC_TIME 13444@findex LC_ALL 13445@cindex locale 13446These environment variables control the way that GCC uses 13447localization information that allow GCC to work with different 13448national conventions. GCC inspects the locale categories 13449@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do 13450so. These locale categories can be set to any value supported by your 13451installation. A typical value is @samp{en_GB.UTF-8} for English in the United 13452Kingdom encoded in UTF-8. 13453 13454The @env{LC_CTYPE} environment variable specifies character 13455classification. GCC uses it to determine the character boundaries in 13456a string; this is needed for some multibyte encodings that contain quote 13457and escape characters that would otherwise be interpreted as a string 13458end or escape. 13459 13460The @env{LC_MESSAGES} environment variable specifies the language to 13461use in diagnostic messages. 13462 13463If the @env{LC_ALL} environment variable is set, it overrides the value 13464of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE} 13465and @env{LC_MESSAGES} default to the value of the @env{LANG} 13466environment variable. If none of these variables are set, GCC 13467defaults to traditional C English behavior. 13468 13469@item TMPDIR 13470@findex TMPDIR 13471If @env{TMPDIR} is set, it specifies the directory to use for temporary 13472files. GCC uses temporary files to hold the output of one stage of 13473compilation which is to be used as input to the next stage: for example, 13474the output of the preprocessor, which is the input to the compiler 13475proper. 13476 13477@item GCC_EXEC_PREFIX 13478@findex GCC_EXEC_PREFIX 13479If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the 13480names of the subprograms executed by the compiler. No slash is added 13481when this prefix is combined with the name of a subprogram, but you can 13482specify a prefix that ends with a slash if you wish. 13483 13484If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out 13485an appropriate prefix to use based on the pathname it was invoked with. 13486 13487If GCC cannot find the subprogram using the specified prefix, it 13488tries looking in the usual places for the subprogram. 13489 13490The default value of @env{GCC_EXEC_PREFIX} is 13491@file{@var{prefix}/lib/gcc/} where @var{prefix} is the value 13492of @code{prefix} when you ran the @file{configure} script. 13493 13494Other prefixes specified with @option{-B} take precedence over this prefix. 13495 13496This prefix is also used for finding files such as @file{crt0.o} that are 13497used for linking. 13498 13499In addition, the prefix is used in an unusual way in finding the 13500directories to search for header files. For each of the standard 13501directories whose name normally begins with @samp{/usr/local/lib/gcc} 13502(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries 13503replacing that beginning with the specified prefix to produce an 13504alternate directory name. Thus, with @option{-Bfoo/}, GCC will search 13505@file{foo/bar} where it would normally search @file{/usr/local/lib/bar}. 13506These alternate directories are searched first; the standard directories 13507come next. 13508 13509@item COMPILER_PATH 13510@findex COMPILER_PATH 13511The value of @env{COMPILER_PATH} is a colon-separated list of 13512directories, much like @env{PATH}. GCC tries the directories thus 13513specified when searching for subprograms, if it can't find the 13514subprograms using @env{GCC_EXEC_PREFIX}. 13515 13516@item LIBRARY_PATH 13517@findex LIBRARY_PATH 13518The value of @env{LIBRARY_PATH} is a colon-separated list of 13519directories, much like @env{PATH}. When configured as a native compiler, 13520GCC tries the directories thus specified when searching for special 13521linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking 13522using GCC also uses these directories when searching for ordinary 13523libraries for the @option{-l} option (but directories specified with 13524@option{-L} come first). 13525 13526@item LANG 13527@findex LANG 13528@cindex locale definition 13529This variable is used to pass locale information to the compiler. One way in 13530which this information is used is to determine the character set to be used 13531when character literals, string literals and comments are parsed in C and C++. 13532When the compiler is configured to allow multibyte characters, 13533the following values for @env{LANG} are recognized: 13534 13535@table @samp 13536@item C-JIS 13537Recognize JIS characters. 13538@item C-SJIS 13539Recognize SJIS characters. 13540@item C-EUCJP 13541Recognize EUCJP characters. 13542@end table 13543 13544If @env{LANG} is not defined, or if it has some other value, then the 13545compiler will use mblen and mbtowc as defined by the default locale to 13546recognize and translate multibyte characters. 13547@end table 13548 13549@noindent 13550Some additional environments variables affect the behavior of the 13551preprocessor. 13552 13553@include cppenv.texi 13554 13555@c man end 13556 13557@node Precompiled Headers 13558@section Using Precompiled Headers 13559@cindex precompiled headers 13560@cindex speed of compilation 13561 13562Often large projects have many header files that are included in every 13563source file. The time the compiler takes to process these header files 13564over and over again can account for nearly all of the time required to 13565build the project. To make builds faster, GCC allows users to 13566`precompile' a header file; then, if builds can use the precompiled 13567header file they will be much faster. 13568 13569To create a precompiled header file, simply compile it as you would any 13570other file, if necessary using the @option{-x} option to make the driver 13571treat it as a C or C++ header file. You will probably want to use a 13572tool like @command{make} to keep the precompiled header up-to-date when 13573the headers it contains change. 13574 13575A precompiled header file will be searched for when @code{#include} is 13576seen in the compilation. As it searches for the included file 13577(@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the 13578compiler looks for a precompiled header in each directory just before it 13579looks for the include file in that directory. The name searched for is 13580the name specified in the @code{#include} with @samp{.gch} appended. If 13581the precompiled header file can't be used, it is ignored. 13582 13583For instance, if you have @code{#include "all.h"}, and you have 13584@file{all.h.gch} in the same directory as @file{all.h}, then the 13585precompiled header file will be used if possible, and the original 13586header will be used otherwise. 13587 13588Alternatively, you might decide to put the precompiled header file in a 13589directory and use @option{-I} to ensure that directory is searched 13590before (or instead of) the directory containing the original header. 13591Then, if you want to check that the precompiled header file is always 13592used, you can put a file of the same name as the original header in this 13593directory containing an @code{#error} command. 13594 13595This also works with @option{-include}. So yet another way to use 13596precompiled headers, good for projects not designed with precompiled 13597header files in mind, is to simply take most of the header files used by 13598a project, include them from another header file, precompile that header 13599file, and @option{-include} the precompiled header. If the header files 13600have guards against multiple inclusion, they will be skipped because 13601they've already been included (in the precompiled header). 13602 13603If you need to precompile the same header file for different 13604languages, targets, or compiler options, you can instead make a 13605@emph{directory} named like @file{all.h.gch}, and put each precompiled 13606header in the directory, perhaps using @option{-o}. It doesn't matter 13607what you call the files in the directory, every precompiled header in 13608the directory will be considered. The first precompiled header 13609encountered in the directory that is valid for this compilation will 13610be used; they're searched in no particular order. 13611 13612There are many other possibilities, limited only by your imagination, 13613good sense, and the constraints of your build system. 13614 13615A precompiled header file can be used only when these conditions apply: 13616 13617@itemize 13618@item 13619Only one precompiled header can be used in a particular compilation. 13620 13621@item 13622A precompiled header can't be used once the first C token is seen. You 13623can have preprocessor directives before a precompiled header; you can 13624even include a precompiled header from inside another header, so long as 13625there are no C tokens before the @code{#include}. 13626 13627@item 13628The precompiled header file must be produced for the same language as 13629the current compilation. You can't use a C precompiled header for a C++ 13630compilation. 13631 13632@item 13633The precompiled header file must have been produced by the same compiler 13634binary as the current compilation is using. 13635 13636@item 13637Any macros defined before the precompiled header is included must 13638either be defined in the same way as when the precompiled header was 13639generated, or must not affect the precompiled header, which usually 13640means that they don't appear in the precompiled header at all. 13641 13642The @option{-D} option is one way to define a macro before a 13643precompiled header is included; using a @code{#define} can also do it. 13644There are also some options that define macros implicitly, like 13645@option{-O} and @option{-Wdeprecated}; the same rule applies to macros 13646defined this way. 13647 13648@item If debugging information is output when using the precompiled 13649header, using @option{-g} or similar, the same kind of debugging information 13650must have been output when building the precompiled header. However, 13651a precompiled header built using @option{-g} can be used in a compilation 13652when no debugging information is being output. 13653 13654@item The same @option{-m} options must generally be used when building 13655and using the precompiled header. @xref{Submodel Options}, 13656for any cases where this rule is relaxed. 13657 13658@item Each of the following options must be the same when building and using 13659the precompiled header: 13660 13661@gccoptlist{-fexceptions -funit-at-a-time} 13662 13663@item 13664Some other command-line options starting with @option{-f}, 13665@option{-p}, or @option{-O} must be defined in the same way as when 13666the precompiled header was generated. At present, it's not clear 13667which options are safe to change and which are not; the safest choice 13668is to use exactly the same options when generating and using the 13669precompiled header. The following are known to be safe: 13670 13671@gccoptlist{-fmessage-length= -fpreprocessed 13672-fsched-interblock -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous 13673-fsched-verbose=<number> -fschedule-insns -fvisibility= 13674-pedantic-errors} 13675 13676@end itemize 13677 13678For all of these except the last, the compiler will automatically 13679ignore the precompiled header if the conditions aren't met. If you 13680find an option combination that doesn't work and doesn't cause the 13681precompiled header to be ignored, please consider filing a bug report, 13682see @ref{Bugs}. 13683 13684If you do use differing options when generating and using the 13685precompiled header, the actual behavior will be a mixture of the 13686behavior for the options. For instance, if you use @option{-g} to 13687generate the precompiled header but not when using it, you may or may 13688not get debugging information for routines in the precompiled header. 13689 13690@node Running Protoize 13691@section Running Protoize 13692 13693The program @code{protoize} is an optional part of GCC@. You can use 13694it to add prototypes to a program, thus converting the program to ISO 13695C in one respect. The companion program @code{unprotoize} does the 13696reverse: it removes argument types from any prototypes that are found. 13697 13698When you run these programs, you must specify a set of source files as 13699command line arguments. The conversion programs start out by compiling 13700these files to see what functions they define. The information gathered 13701about a file @var{foo} is saved in a file named @file{@var{foo}.X}. 13702 13703After scanning comes actual conversion. The specified files are all 13704eligible to be converted; any files they include (whether sources or 13705just headers) are eligible as well. 13706 13707But not all the eligible files are converted. By default, 13708@code{protoize} and @code{unprotoize} convert only source and header 13709files in the current directory. You can specify additional directories 13710whose files should be converted with the @option{-d @var{directory}} 13711option. You can also specify particular files to exclude with the 13712@option{-x @var{file}} option. A file is converted if it is eligible, its 13713directory name matches one of the specified directory names, and its 13714name within the directory has not been excluded. 13715 13716Basic conversion with @code{protoize} consists of rewriting most 13717function definitions and function declarations to specify the types of 13718the arguments. The only ones not rewritten are those for varargs 13719functions. 13720 13721@code{protoize} optionally inserts prototype declarations at the 13722beginning of the source file, to make them available for any calls that 13723precede the function's definition. Or it can insert prototype 13724declarations with block scope in the blocks where undeclared functions 13725are called. 13726 13727Basic conversion with @code{unprotoize} consists of rewriting most 13728function declarations to remove any argument types, and rewriting 13729function definitions to the old-style pre-ISO form. 13730 13731Both conversion programs print a warning for any function declaration or 13732definition that they can't convert. You can suppress these warnings 13733with @option{-q}. 13734 13735The output from @code{protoize} or @code{unprotoize} replaces the 13736original source file. The original file is renamed to a name ending 13737with @samp{.save} (for DOS, the saved filename ends in @samp{.sav} 13738without the original @samp{.c} suffix). If the @samp{.save} (@samp{.sav} 13739for DOS) file already exists, then the source file is simply discarded. 13740 13741@code{protoize} and @code{unprotoize} both depend on GCC itself to 13742scan the program and collect information about the functions it uses. 13743So neither of these programs will work until GCC is installed. 13744 13745Here is a table of the options you can use with @code{protoize} and 13746@code{unprotoize}. Each option works with both programs unless 13747otherwise stated. 13748 13749@table @code 13750@item -B @var{directory} 13751Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the 13752usual directory (normally @file{/usr/local/lib}). This file contains 13753prototype information about standard system functions. This option 13754applies only to @code{protoize}. 13755 13756@item -c @var{compilation-options} 13757Use @var{compilation-options} as the options when running @command{gcc} to 13758produce the @samp{.X} files. The special option @option{-aux-info} is 13759always passed in addition, to tell @command{gcc} to write a @samp{.X} file. 13760 13761Note that the compilation options must be given as a single argument to 13762@code{protoize} or @code{unprotoize}. If you want to specify several 13763@command{gcc} options, you must quote the entire set of compilation options 13764to make them a single word in the shell. 13765 13766There are certain @command{gcc} arguments that you cannot use, because they 13767would produce the wrong kind of output. These include @option{-g}, 13768@option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in 13769the @var{compilation-options}, they are ignored. 13770 13771@item -C 13772Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file 13773systems) instead of @samp{.c}. This is convenient if you are converting 13774a C program to C++. This option applies only to @code{protoize}. 13775 13776@item -g 13777Add explicit global declarations. This means inserting explicit 13778declarations at the beginning of each source file for each function 13779that is called in the file and was not declared. These declarations 13780precede the first function definition that contains a call to an 13781undeclared function. This option applies only to @code{protoize}. 13782 13783@item -i @var{string} 13784Indent old-style parameter declarations with the string @var{string}. 13785This option applies only to @code{protoize}. 13786 13787@code{unprotoize} converts prototyped function definitions to old-style 13788function definitions, where the arguments are declared between the 13789argument list and the initial @samp{@{}. By default, @code{unprotoize} 13790uses five spaces as the indentation. If you want to indent with just 13791one space instead, use @option{-i " "}. 13792 13793@item -k 13794Keep the @samp{.X} files. Normally, they are deleted after conversion 13795is finished. 13796 13797@item -l 13798Add explicit local declarations. @code{protoize} with @option{-l} inserts 13799a prototype declaration for each function in each block which calls the 13800function without any declaration. This option applies only to 13801@code{protoize}. 13802 13803@item -n 13804Make no real changes. This mode just prints information about the conversions 13805that would have been done without @option{-n}. 13806 13807@item -N 13808Make no @samp{.save} files. The original files are simply deleted. 13809Use this option with caution. 13810 13811@item -p @var{program} 13812Use the program @var{program} as the compiler. Normally, the name 13813@file{gcc} is used. 13814 13815@item -q 13816Work quietly. Most warnings are suppressed. 13817 13818@item -v 13819Print the version number, just like @option{-v} for @command{gcc}. 13820@end table 13821 13822If you need special compiler options to compile one of your program's 13823source files, then you should generate that file's @samp{.X} file 13824specially, by running @command{gcc} on that source file with the 13825appropriate options and the option @option{-aux-info}. Then run 13826@code{protoize} on the entire set of files. @code{protoize} will use 13827the existing @samp{.X} file because it is newer than the source file. 13828For example: 13829 13830@smallexample 13831gcc -Dfoo=bar file1.c -aux-info file1.X 13832protoize *.c 13833@end smallexample 13834 13835@noindent 13836You need to include the special files along with the rest in the 13837@code{protoize} command, even though their @samp{.X} files already 13838exist, because otherwise they won't get converted. 13839 13840@xref{Protoize Caveats}, for more information on how to use 13841@code{protoize} successfully. 13842