1@c Copyright (C) 1988-2015 Free Software Foundation, Inc. 2@c This is part of the GCC manual. 3@c For copying conditions, see the file gcc.texi. 4 5@ignore 6@c man begin INCLUDE 7@include gcc-vers.texi 8@c man end 9 10@c man begin COPYRIGHT 11Copyright @copyright{} 1988-2015 Free Software Foundation, Inc. 12 13Permission is granted to copy, distribute and/or modify this document 14under the terms of the GNU Free Documentation License, Version 1.3 or 15any later version published by the Free Software Foundation; with the 16Invariant Sections being ``GNU General Public License'' and ``Funding 17Free Software'', the Front-Cover texts being (a) (see below), and with 18the Back-Cover Texts being (b) (see below). A copy of the license is 19included in the gfdl(7) man page. 20 21(a) The FSF's Front-Cover Text is: 22 23 A GNU Manual 24 25(b) The FSF's Back-Cover Text is: 26 27 You have freedom to copy and modify this GNU Manual, like GNU 28 software. Copies published by the Free Software Foundation raise 29 funds for GNU development. 30@c man end 31@c Set file name and title for the man page. 32@setfilename gcc 33@settitle GNU project C and C++ compiler 34@c man begin SYNOPSIS 35gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}] 36 [@option{-g}] [@option{-pg}] [@option{-O}@var{level}] 37 [@option{-W}@var{warn}@dots{}] [@option{-Wpedantic}] 38 [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}] 39 [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}] 40 [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}] 41 [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{} 42 43Only the most useful options are listed here; see below for the 44remainder. @samp{g++} accepts mostly the same options as @samp{gcc}. 45@c man end 46@c man begin SEEALSO 47gpl(7), gfdl(7), fsf-funding(7), 48cpp(1), gcov(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1) 49and the Info entries for @file{gcc}, @file{cpp}, @file{as}, 50@file{ld}, @file{binutils} and @file{gdb}. 51@c man end 52@c man begin BUGS 53For instructions on reporting bugs, see 54@w{@value{BUGURL}}. 55@c man end 56@c man begin AUTHOR 57See the Info entry for @command{gcc}, or 58@w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}}, 59for contributors to GCC@. 60@c man end 61@end ignore 62 63@node Invoking GCC 64@chapter GCC Command Options 65@cindex GCC command options 66@cindex command options 67@cindex options, GCC command 68 69@c man begin DESCRIPTION 70When you invoke GCC, it normally does preprocessing, compilation, 71assembly and linking. The ``overall options'' allow you to stop this 72process at an intermediate stage. For example, the @option{-c} option 73says not to run the linker. Then the output consists of object files 74output by the assembler. 75 76Other options are passed on to one stage of processing. Some options 77control the preprocessor and others the compiler itself. Yet other 78options control the assembler and linker; most of these are not 79documented here, since you rarely need to use any of them. 80 81@cindex C compilation options 82Most of the command-line options that you can use with GCC are useful 83for C programs; when an option is only useful with another language 84(usually C++), the explanation says so explicitly. If the description 85for a particular option does not mention a source language, you can use 86that option with all supported languages. 87 88@cindex C++ compilation options 89@xref{Invoking G++,,Compiling C++ Programs}, for a summary of special 90options for compiling C++ programs. 91 92@cindex grouping options 93@cindex options, grouping 94The @command{gcc} program accepts options and file names as operands. Many 95options have multi-letter names; therefore multiple single-letter options 96may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d 97-v}}. 98 99@cindex order of options 100@cindex options, order 101You can mix options and other arguments. For the most part, the order 102you use doesn't matter. Order does matter when you use several 103options of the same kind; for example, if you specify @option{-L} more 104than once, the directories are searched in the order specified. Also, 105the placement of the @option{-l} option is significant. 106 107Many options have long names starting with @samp{-f} or with 108@samp{-W}---for example, 109@option{-fmove-loop-invariants}, @option{-Wformat} and so on. Most of 110these have both positive and negative forms; the negative form of 111@option{-ffoo} is @option{-fno-foo}. This manual documents 112only one of these two forms, whichever one is not the default. 113 114@c man end 115 116@xref{Option Index}, for an index to GCC's options. 117 118@menu 119* Option Summary:: Brief list of all options, without explanations. 120* Overall Options:: Controlling the kind of output: 121 an executable, object files, assembler files, 122 or preprocessed source. 123* Invoking G++:: Compiling C++ programs. 124* C Dialect Options:: Controlling the variant of C language compiled. 125* C++ Dialect Options:: Variations on C++. 126* Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C 127 and Objective-C++. 128* Language Independent Options:: Controlling how diagnostics should be 129 formatted. 130* Warning Options:: How picky should the compiler be? 131* Debugging Options:: Symbol tables, measurements, and debugging dumps. 132* Optimize Options:: How much optimization? 133* Preprocessor Options:: Controlling header files and macro definitions. 134 Also, getting dependency information for Make. 135* Assembler Options:: Passing options to the assembler. 136* Link Options:: Specifying libraries and so on. 137* Directory Options:: Where to find header files and libraries. 138 Where to find the compiler executable files. 139* Spec Files:: How to pass switches to sub-processes. 140* Target Options:: Running a cross-compiler, or an old version of GCC. 141* Submodel Options:: Specifying minor hardware or convention variations, 142 such as 68010 vs 68020. 143* Code Gen Options:: Specifying conventions for function calls, data layout 144 and register usage. 145* Environment Variables:: Env vars that affect GCC. 146* Precompiled Headers:: Compiling a header once, and using it many times. 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} -no-canonical-prefixes @gol 161-pipe -pass-exit-codes @gol 162-x @var{language} -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help @gol 163--version -wrapper @@@var{file} -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol 164-fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}} 165 166@item C Language Options 167@xref{C Dialect Options,,Options Controlling C Dialect}. 168@gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol 169-aux-info @var{filename} -fallow-parameterless-variadic-functions @gol 170-fno-asm -fno-builtin -fno-builtin-@var{function} @gol 171-fhosted -ffreestanding -fopenmp -fms-extensions -fplan9-extensions @gol 172-trigraphs -traditional -traditional-cpp @gol 173-fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol 174-fsigned-bitfields -fsigned-char @gol 175-funsigned-bitfields -funsigned-char} 176 177@item C++ Language Options 178@xref{C++ Dialect Options,,Options Controlling C++ Dialect}. 179@gccoptlist{-fabi-version=@var{n} -fno-access-control -fcheck-new @gol 180-fconstexpr-depth=@var{n} -ffriend-injection @gol 181-fno-elide-constructors @gol 182-fno-enforce-eh-specs @gol 183-ffor-scope -fno-for-scope -fno-gnu-keywords @gol 184-fno-implicit-templates @gol 185-fno-implicit-inline-templates @gol 186-fno-implement-inlines -fms-extensions @gol 187-fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol 188-fno-optional-diags -fpermissive @gol 189-fno-pretty-templates @gol 190-frepo -fno-rtti -fstats -ftemplate-backtrace-limit=@var{n} @gol 191-ftemplate-depth=@var{n} @gol 192-fno-threadsafe-statics -fuse-cxa-atexit -fno-weak -nostdinc++ @gol 193-fno-default-inline -fvisibility-inlines-hidden @gol 194-fvisibility-ms-compat @gol 195-fext-numeric-literals @gol 196-Wabi -Wconversion-null -Wctor-dtor-privacy @gol 197-Wdelete-non-virtual-dtor -Wliteral-suffix -Wnarrowing @gol 198-Wnoexcept -Wnon-virtual-dtor -Wreorder @gol 199-Weffc++ -Wstrict-null-sentinel @gol 200-Wno-non-template-friend -Wold-style-cast @gol 201-Woverloaded-virtual -Wno-pmf-conversions @gol 202-Wsign-promo} 203 204@item Objective-C and Objective-C++ Language Options 205@xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling 206Objective-C and Objective-C++ Dialects}. 207@gccoptlist{-fconstant-string-class=@var{class-name} @gol 208-fgnu-runtime -fnext-runtime @gol 209-fno-nil-receivers @gol 210-fobjc-abi-version=@var{n} @gol 211-fobjc-call-cxx-cdtors @gol 212-fobjc-direct-dispatch @gol 213-fobjc-exceptions @gol 214-fobjc-gc @gol 215-fobjc-nilcheck @gol 216-fobjc-std=objc1 @gol 217-freplace-objc-classes @gol 218-fzero-link @gol 219-gen-decls @gol 220-Wassign-intercept @gol 221-Wno-protocol -Wselector @gol 222-Wstrict-selector-match @gol 223-Wundeclared-selector} 224 225@item Language Independent Options 226@xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}. 227@gccoptlist{-fmessage-length=@var{n} @gol 228-fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol 229-fno-diagnostics-show-option -fno-diagnostics-show-caret} 230 231@item Warning Options 232@xref{Warning Options,,Options to Request or Suppress Warnings}. 233@gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol 234-pedantic-errors @gol 235-w -Wextra -Wall -Waddress -Waggregate-return @gol 236-Waggressive-loop-optimizations -Warray-bounds @gol 237-Wno-attributes -Wno-builtin-macro-redefined @gol 238-Wc++-compat -Wc++11-compat -Wcast-align -Wcast-qual @gol 239-Wchar-subscripts -Wclobbered -Wcomment @gol 240-Wconversion -Wcoverage-mismatch -Wno-cpp -Wno-deprecated @gol 241-Wno-deprecated-declarations -Wdisabled-optimization @gol 242-Wno-div-by-zero -Wdouble-promotion -Wempty-body -Wenum-compare @gol 243-Wno-endif-labels -Werror -Werror=* @gol 244-Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol 245-Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol 246-Wformat-security -Wformat-y2k @gol 247-Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol 248-Wignored-qualifiers @gol 249-Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol 250-Winit-self -Winline -Wmaybe-uninitialized @gol 251-Wno-int-to-pointer-cast -Wno-invalid-offsetof @gol 252-Winvalid-pch -Wlarger-than=@var{len} -Wunsafe-loop-optimizations @gol 253-Wlogical-op -Wlong-long @gol 254-Wmain -Wmaybe-uninitialized -Wmissing-braces -Wmissing-field-initializers @gol 255-Wmissing-include-dirs @gol 256-Wno-mudflap @gol 257-Wno-multichar -Wnonnull -Wno-overflow @gol 258-Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol 259-Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol 260-Wpointer-arith -Wno-pointer-to-int-cast @gol 261-Wredundant-decls -Wno-return-local-addr @gol 262-Wreturn-type -Wsequence-point -Wshadow @gol 263-Wsign-compare -Wsign-conversion -Wsizeof-pointer-memaccess @gol 264-Wstack-protector -Wstack-usage=@var{len} -Wstrict-aliasing @gol 265-Wstrict-aliasing=n @gol -Wstrict-overflow -Wstrict-overflow=@var{n} @gol 266-Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]} @gol 267-Wmissing-format-attribute @gol 268-Wswitch -Wswitch-default -Wswitch-enum -Wsync-nand @gol 269-Wsystem-headers -Wtrampolines -Wtrigraphs -Wtype-limits -Wundef @gol 270-Wuninitialized -Wunknown-pragmas -Wno-pragmas @gol 271-Wunsuffixed-float-constants -Wunused -Wunused-function @gol 272-Wunused-label -Wunused-local-typedefs -Wunused-parameter @gol 273-Wno-unused-result -Wunused-value @gol -Wunused-variable @gol 274-Wunused-but-set-parameter -Wunused-but-set-variable @gol 275-Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol 276-Wvla -Wvolatile-register-var -Wwrite-strings -Wzero-as-null-pointer-constant} 277 278@item C and Objective-C-only Warning Options 279@gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol 280-Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol 281-Wold-style-declaration -Wold-style-definition @gol 282-Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol 283-Wdeclaration-after-statement -Wpointer-sign} 284 285@item Debugging Options 286@xref{Debugging Options,,Options for Debugging Your Program or GCC}. 287@gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol 288-fsanitize=@var{style} @gol 289-fdbg-cnt-list -fdbg-cnt=@var{counter-value-list} @gol 290-fdisable-ipa-@var{pass_name} @gol 291-fdisable-rtl-@var{pass_name} @gol 292-fdisable-rtl-@var{pass-name}=@var{range-list} @gol 293-fdisable-tree-@var{pass_name} @gol 294-fdisable-tree-@var{pass-name}=@var{range-list} @gol 295-fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol 296-fdump-translation-unit@r{[}-@var{n}@r{]} @gol 297-fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol 298-fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol 299-fdump-passes @gol 300-fdump-statistics @gol 301-fdump-tree-all @gol 302-fdump-tree-original@r{[}-@var{n}@r{]} @gol 303-fdump-tree-optimized@r{[}-@var{n}@r{]} @gol 304-fdump-tree-cfg -fdump-tree-alias @gol 305-fdump-tree-ch @gol 306-fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol 307-fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol 308-fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol 309-fdump-tree-dom@r{[}-@var{n}@r{]} @gol 310-fdump-tree-dse@r{[}-@var{n}@r{]} @gol 311-fdump-tree-phiprop@r{[}-@var{n}@r{]} @gol 312-fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol 313-fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol 314-fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol 315-fdump-tree-nrv -fdump-tree-vect @gol 316-fdump-tree-sink @gol 317-fdump-tree-sra@r{[}-@var{n}@r{]} @gol 318-fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol 319-fdump-tree-fre@r{[}-@var{n}@r{]} @gol 320-fdump-tree-vrp@r{[}-@var{n}@r{]} @gol 321-ftree-vectorizer-verbose=@var{n} @gol 322-fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol 323-fdump-final-insns=@var{file} @gol 324-fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol 325-feliminate-dwarf2-dups -fno-eliminate-unused-debug-types @gol 326-feliminate-unused-debug-symbols -femit-class-debug-always @gol 327-fenable-@var{kind}-@var{pass} @gol 328-fenable-@var{kind}-@var{pass}=@var{range-list} @gol 329-fdebug-types-section -fmem-report-wpa @gol 330-fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs @gol 331-fopt-info @gol 332-fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol 333-frandom-seed=@var{string} -fsched-verbose=@var{n} @gol 334-fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol 335-fstack-usage -ftest-coverage -ftime-report -fvar-tracking @gol 336-fvar-tracking-assignments -fvar-tracking-assignments-toggle @gol 337-g -g@var{level} -gtoggle -gcoff -gdwarf-@var{version} @gol 338-ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol 339-gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol 340-gvms -gxcoff -gxcoff+ @gol 341-fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol 342-fdebug-prefix-map=@var{old}=@var{new} @gol 343-femit-struct-debug-baseonly -femit-struct-debug-reduced @gol 344-femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol 345-p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol 346-print-multi-directory -print-multi-lib -print-multi-os-directory @gol 347-print-prog-name=@var{program} -print-search-dirs -Q @gol 348-print-sysroot -print-sysroot-headers-suffix @gol 349-save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}} 350 351@item Optimization Options 352@xref{Optimize Options,,Options that Control Optimization}. 353@gccoptlist{-faggressive-loop-optimizations -falign-functions[=@var{n}] @gol 354-falign-jumps[=@var{n}] @gol 355-falign-labels[=@var{n}] -falign-loops[=@var{n}] @gol 356-fassociative-math -fauto-inc-dec -fbranch-probabilities @gol 357-fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol 358-fbtr-bb-exclusive -fcaller-saves @gol 359-fcheck-data-deps -fcombine-stack-adjustments -fconserve-stack @gol 360-fcompare-elim -fcprop-registers -fcrossjumping @gol 361-fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol 362-fcx-limited-range @gol 363-fdata-sections -fdce -fdelayed-branch @gol 364-fdelete-null-pointer-checks -fdevirtualize -fdse @gol 365-fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol 366-ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol 367-fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol 368-fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol 369-fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol 370-fif-conversion2 -findirect-inlining @gol 371-finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol 372-finline-small-functions -fipa-cp -fipa-cp-clone @gol 373-fipa-pta -fipa-profile -fipa-pure-const -fipa-reference @gol 374-fira-algorithm=@var{algorithm} @gol 375-fira-region=@var{region} -fira-hoist-pressure @gol 376-fira-loop-pressure -fno-ira-share-save-slots @gol 377-fno-ira-share-spill-slots -fira-verbose=@var{n} @gol 378-fivopts -fkeep-inline-functions -fkeep-static-consts @gol 379-floop-block -floop-interchange -floop-strip-mine -floop-nest-optimize @gol 380-floop-parallelize-all -flto -flto-compression-level @gol 381-flto-partition=@var{alg} -flto-report -fmerge-all-constants @gol 382-fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol 383-fmove-loop-invariants fmudflap -fmudflapir -fmudflapth -fno-branch-count-reg @gol 384-fno-default-inline @gol 385-fno-defer-pop -fno-function-cse -fno-guess-branch-probability @gol 386-fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol 387-fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol 388-fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol 389-fomit-frame-pointer -foptimize-register-move -foptimize-sibling-calls @gol 390-fpartial-inlining -fpeel-loops -fpredictive-commoning @gol 391-fprefetch-loop-arrays -fprofile-report @gol 392-fprofile-correction -fprofile-dir=@var{path} -fprofile-generate @gol 393-fprofile-generate=@var{path} @gol 394-fprofile-use -fprofile-use=@var{path} -fprofile-values @gol 395-freciprocal-math -free -fregmove -frename-registers -freorder-blocks @gol 396-freorder-blocks-and-partition -freorder-functions @gol 397-frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol 398-frounding-math -fsched2-use-superblocks -fsched-pressure @gol 399-fsched-spec-load -fsched-spec-load-dangerous @gol 400-fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol 401-fsched-group-heuristic -fsched-critical-path-heuristic @gol 402-fsched-spec-insn-heuristic -fsched-rank-heuristic @gol 403-fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol 404-fschedule-insns -fschedule-insns2 -fsection-anchors @gol 405-fselective-scheduling -fselective-scheduling2 @gol 406-fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol 407-fshrink-wrap -fsignaling-nans -fsingle-precision-constant @gol 408-fsplit-ivs-in-unroller -fsplit-wide-types -fstack-protector @gol 409-fstack-protector-all -fstack-protector-strong -fstrict-aliasing @gol 410-fstrict-overflow -fthread-jumps -ftracer -ftree-bit-ccp @gol 411-ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol 412-ftree-coalesce-inline-vars -ftree-coalesce-vars -ftree-copy-prop @gol 413-ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse @gol 414-ftree-forwprop -ftree-fre -ftree-loop-if-convert @gol 415-ftree-loop-if-convert-stores -ftree-loop-im @gol 416-ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol 417-ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol 418-ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol 419-ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol 420-ftree-switch-conversion -ftree-tail-merge @gol 421-ftree-ter -ftree-vect-loop-version -ftree-vectorize -ftree-vrp @gol 422-funit-at-a-time -funroll-all-loops -funroll-loops @gol 423-funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol 424-fvariable-expansion-in-unroller -fvect-cost-model -fvpt -fweb @gol 425-fwhole-program -fwpa -fuse-ld=@var{linker} -fuse-linker-plugin @gol 426--param @var{name}=@var{value} 427-O -O0 -O1 -O2 -O3 -Os -Ofast -Og} 428 429@item Preprocessor Options 430@xref{Preprocessor Options,,Options Controlling the Preprocessor}. 431@gccoptlist{-A@var{question}=@var{answer} @gol 432-A-@var{question}@r{[}=@var{answer}@r{]} @gol 433-C -dD -dI -dM -dN @gol 434-D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol 435-idirafter @var{dir} @gol 436-include @var{file} -imacros @var{file} @gol 437-iprefix @var{file} -iwithprefix @var{dir} @gol 438-iwithprefixbefore @var{dir} -isystem @var{dir} @gol 439-imultilib @var{dir} -isysroot @var{dir} @gol 440-M -MM -MF -MG -MP -MQ -MT -nostdinc @gol 441-P -fdebug-cpp -ftrack-macro-expansion -fworking-directory @gol 442-remap -trigraphs -undef -U@var{macro} @gol 443-Wp,@var{option} -Xpreprocessor @var{option} -no-integrated-cpp} 444 445@item Assembler Option 446@xref{Assembler Options,,Passing Options to the Assembler}. 447@gccoptlist{-Wa,@var{option} -Xassembler @var{option}} 448 449@item Linker Options 450@xref{Link Options,,Options for Linking}. 451@gccoptlist{@var{object-file-name} -l@var{library} @gol 452-nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol 453-s -static -static-libgcc -static-libstdc++ @gol 454-static-libasan -static-libtsan @gol 455-shared -shared-libgcc -symbolic @gol 456-T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol 457-u @var{symbol}} 458 459@item Directory Options 460@xref{Directory Options,,Options for Directory Search}. 461@gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir} @gol 462-iquote@var{dir} -L@var{dir} -specs=@var{file} -I- @gol 463--sysroot=@var{dir} --no-sysroot-suffix} 464 465@item Machine Dependent Options 466@xref{Submodel Options,,Hardware Models and Configurations}. 467@c This list is ordered alphanumerically by subsection name. 468@c Try and put the significant identifier (CPU or system) first, 469@c so users have a clue at guessing where the ones they want will be. 470 471@emph{AArch64 Options} 472@gccoptlist{-mbig-endian -mlittle-endian @gol 473-mgeneral-regs-only @gol 474-mcmodel=tiny -mcmodel=small -mcmodel=large @gol 475-mstrict-align @gol 476-momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol 477-mtls-dialect=desc -mtls-dialect=traditional @gol 478-mfix-cortex-a53-835769 -mno-fix-cortex-a53-835769 @gol 479-march=@var{name} -mcpu=@var{name} -mtune=@var{name}} 480 481@emph{Adapteva Epiphany Options} 482@gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol 483-mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol 484-msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol 485-mround-nearest -mlong-calls -mshort-calls -msmall16 @gol 486-mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol 487-msplit-vecmove-early -m1reg-@var{reg}} 488 489@emph{ARM Options} 490@gccoptlist{-mapcs-frame -mno-apcs-frame @gol 491-mabi=@var{name} @gol 492-mapcs-stack-check -mno-apcs-stack-check @gol 493-mapcs-float -mno-apcs-float @gol 494-mapcs-reentrant -mno-apcs-reentrant @gol 495-msched-prolog -mno-sched-prolog @gol 496-mlittle-endian -mbig-endian -mwords-little-endian @gol 497-mfloat-abi=@var{name} @gol 498-mfp16-format=@var{name} 499-mthumb-interwork -mno-thumb-interwork @gol 500-mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol 501-mstructure-size-boundary=@var{n} @gol 502-mabort-on-noreturn @gol 503-mlong-calls -mno-long-calls @gol 504-msingle-pic-base -mno-single-pic-base @gol 505-mpic-register=@var{reg} @gol 506-mnop-fun-dllimport @gol 507-mpoke-function-name @gol 508-mthumb -marm @gol 509-mtpcs-frame -mtpcs-leaf-frame @gol 510-mcaller-super-interworking -mcallee-super-interworking @gol 511-mtp=@var{name} -mtls-dialect=@var{dialect} @gol 512-mword-relocations @gol 513-mfix-cortex-m3-ldrd @gol 514-munaligned-access} 515 516@emph{AVR Options} 517@gccoptlist{-mmcu=@var{mcu} -maccumulate-args -mbranch-cost=@var{cost} @gol 518-mcall-prologues -mint8 -mno-interrupts -mrelax @gol 519-mstrict-X -mtiny-stack -Waddr-space-convert} 520 521@emph{Blackfin Options} 522@gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol 523-msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol 524-mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol 525-mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol 526-mno-id-shared-library -mshared-library-id=@var{n} @gol 527-mleaf-id-shared-library -mno-leaf-id-shared-library @gol 528-msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol 529-mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol 530-micplb} 531 532@emph{C6X Options} 533@gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol 534-msim -msdata=@var{sdata-type}} 535 536@emph{CRIS Options} 537@gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol 538-mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol 539-metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol 540-mstack-align -mdata-align -mconst-align @gol 541-m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol 542-melf -maout -melinux -mlinux -sim -sim2 @gol 543-mmul-bug-workaround -mno-mul-bug-workaround} 544 545@emph{CR16 Options} 546@gccoptlist{-mmac @gol 547-mcr16cplus -mcr16c @gol 548-msim -mint32 -mbit-ops 549-mdata-model=@var{model}} 550 551@emph{Darwin Options} 552@gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol 553-arch_only -bind_at_load -bundle -bundle_loader @gol 554-client_name -compatibility_version -current_version @gol 555-dead_strip @gol 556-dependency-file -dylib_file -dylinker_install_name @gol 557-dynamic -dynamiclib -exported_symbols_list @gol 558-filelist -flat_namespace -force_cpusubtype_ALL @gol 559-force_flat_namespace -headerpad_max_install_names @gol 560-iframework @gol 561-image_base -init -install_name -keep_private_externs @gol 562-multi_module -multiply_defined -multiply_defined_unused @gol 563-noall_load -no_dead_strip_inits_and_terms @gol 564-nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol 565-pagezero_size -prebind -prebind_all_twolevel_modules @gol 566-private_bundle -read_only_relocs -sectalign @gol 567-sectobjectsymbols -whyload -seg1addr @gol 568-sectcreate -sectobjectsymbols -sectorder @gol 569-segaddr -segs_read_only_addr -segs_read_write_addr @gol 570-seg_addr_table -seg_addr_table_filename -seglinkedit @gol 571-segprot -segs_read_only_addr -segs_read_write_addr @gol 572-single_module -static -sub_library -sub_umbrella @gol 573-twolevel_namespace -umbrella -undefined @gol 574-unexported_symbols_list -weak_reference_mismatches @gol 575-whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol 576-mkernel -mone-byte-bool} 577 578@emph{DEC Alpha Options} 579@gccoptlist{-mno-fp-regs -msoft-float @gol 580-mieee -mieee-with-inexact -mieee-conformant @gol 581-mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol 582-mtrap-precision=@var{mode} -mbuild-constants @gol 583-mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol 584-mbwx -mmax -mfix -mcix @gol 585-mfloat-vax -mfloat-ieee @gol 586-mexplicit-relocs -msmall-data -mlarge-data @gol 587-msmall-text -mlarge-text @gol 588-mmemory-latency=@var{time}} 589 590@emph{FR30 Options} 591@gccoptlist{-msmall-model -mno-lsim} 592 593@emph{FRV Options} 594@gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol 595-mhard-float -msoft-float @gol 596-malloc-cc -mfixed-cc -mdword -mno-dword @gol 597-mdouble -mno-double @gol 598-mmedia -mno-media -mmuladd -mno-muladd @gol 599-mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol 600-mlinked-fp -mlong-calls -malign-labels @gol 601-mlibrary-pic -macc-4 -macc-8 @gol 602-mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol 603-moptimize-membar -mno-optimize-membar @gol 604-mscc -mno-scc -mcond-exec -mno-cond-exec @gol 605-mvliw-branch -mno-vliw-branch @gol 606-mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol 607-mno-nested-cond-exec -mtomcat-stats @gol 608-mTLS -mtls @gol 609-mcpu=@var{cpu}} 610 611@emph{GNU/Linux Options} 612@gccoptlist{-mglibc -muclibc -mbionic -mandroid @gol 613-tno-android-cc -tno-android-ld} 614 615@emph{H8/300 Options} 616@gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300} 617 618@emph{HPPA Options} 619@gccoptlist{-march=@var{architecture-type} @gol 620-mbig-switch -mdisable-fpregs -mdisable-indexing @gol 621-mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol 622-mfixed-range=@var{register-range} @gol 623-mjump-in-delay -mlinker-opt -mlong-calls @gol 624-mlong-load-store -mno-big-switch -mno-disable-fpregs @gol 625-mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol 626-mno-jump-in-delay -mno-long-load-store @gol 627-mno-portable-runtime -mno-soft-float @gol 628-mno-space-regs -msoft-float -mpa-risc-1-0 @gol 629-mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol 630-mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol 631-munix=@var{unix-std} -nolibdld -static -threads} 632 633@emph{i386 and x86-64 Options} 634@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol 635-mfpmath=@var{unit} @gol 636-masm=@var{dialect} -mno-fancy-math-387 @gol 637-mno-fp-ret-in-387 -msoft-float @gol 638-mno-wide-multiply -mrtd -malign-double @gol 639-mpreferred-stack-boundary=@var{num} @gol 640-mincoming-stack-boundary=@var{num} @gol 641-mcld -mcx16 -msahf -mmovbe -mcrc32 @gol 642-mrecip -mrecip=@var{opt} @gol 643-mvzeroupper -mprefer-avx128 @gol 644-mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol 645-mavx2 -maes -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma @gol 646-msse4a -m3dnow -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop -mlzcnt @gol 647-mbmi2 -mrtm -mlwp -mthreads @gol 648-mno-align-stringops -minline-all-stringops @gol 649-minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol 650-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol 651-m96bit-long-double -mlong-double-64 -mlong-double-80 @gol 652-mregparm=@var{num} -msseregparm @gol 653-mveclibabi=@var{type} -mvect8-ret-in-mem @gol 654-mpc32 -mpc64 -mpc80 -mstackrealign @gol 655-momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol 656-mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol 657-m32 -m64 -mx32 -mlarge-data-threshold=@var{num} @gol 658-msse2avx -mfentry -m8bit-idiv @gol 659-mavx256-split-unaligned-load -mavx256-split-unaligned-store} 660 661@emph{i386 and x86-64 Windows Options} 662@gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol 663-mnop-fun-dllimport -mthread @gol 664-municode -mwin32 -mwindows -fno-set-stack-executable} 665 666@emph{IA-64 Options} 667@gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol 668-mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol 669-mconstant-gp -mauto-pic -mfused-madd @gol 670-minline-float-divide-min-latency @gol 671-minline-float-divide-max-throughput @gol 672-mno-inline-float-divide @gol 673-minline-int-divide-min-latency @gol 674-minline-int-divide-max-throughput @gol 675-mno-inline-int-divide @gol 676-minline-sqrt-min-latency -minline-sqrt-max-throughput @gol 677-mno-inline-sqrt @gol 678-mdwarf2-asm -mearly-stop-bits @gol 679-mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol 680-mtune=@var{cpu-type} -milp32 -mlp64 @gol 681-msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol 682-msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol 683-msched-spec-ldc -msched-spec-control-ldc @gol 684-msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol 685-msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol 686-msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol 687-msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}} 688 689@emph{LM32 Options} 690@gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol 691-msign-extend-enabled -muser-enabled} 692 693@emph{M32R/D Options} 694@gccoptlist{-m32r2 -m32rx -m32r @gol 695-mdebug @gol 696-malign-loops -mno-align-loops @gol 697-missue-rate=@var{number} @gol 698-mbranch-cost=@var{number} @gol 699-mmodel=@var{code-size-model-type} @gol 700-msdata=@var{sdata-type} @gol 701-mno-flush-func -mflush-func=@var{name} @gol 702-mno-flush-trap -mflush-trap=@var{number} @gol 703-G @var{num}} 704 705@emph{M32C Options} 706@gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}} 707 708@emph{M680x0 Options} 709@gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} 710-m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol 711-m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol 712-mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol 713-mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol 714-mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol 715-malign-int -mstrict-align -msep-data -mno-sep-data @gol 716-mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol 717-mxgot -mno-xgot} 718 719@emph{MCore Options} 720@gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol 721-mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol 722-m4byte-functions -mno-4byte-functions -mcallgraph-data @gol 723-mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol 724-mlittle-endian -mbig-endian -m210 -m340 -mstack-increment} 725 726@emph{MeP Options} 727@gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol 728-mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol 729-mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol 730-mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol 731-mtiny=@var{n}} 732 733@emph{MicroBlaze Options} 734@gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol 735-mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol 736-mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol 737-mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol 738-mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}} 739 740@emph{MIPS Options} 741@gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol 742-mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 @gol 743-mips64 -mips64r2 @gol 744-mips16 -mno-mips16 -mflip-mips16 @gol 745-minterlink-mips16 -mno-interlink-mips16 @gol 746-mabi=@var{abi} -mabicalls -mno-abicalls @gol 747-mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol 748-mgp32 -mgp64 -mfp32 -mfp64 -mhard-float -msoft-float @gol 749-mno-float -msingle-float -mdouble-float @gol 750-mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol 751-mmcu -mmno-mcu @gol 752-mfpu=@var{fpu-type} @gol 753-msmartmips -mno-smartmips @gol 754-mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol 755-mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol 756-mlong64 -mlong32 -msym32 -mno-sym32 @gol 757-G@var{num} -mlocal-sdata -mno-local-sdata @gol 758-mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol 759-membedded-data -mno-embedded-data @gol 760-muninit-const-in-rodata -mno-uninit-const-in-rodata @gol 761-mcode-readable=@var{setting} @gol 762-msplit-addresses -mno-split-addresses @gol 763-mexplicit-relocs -mno-explicit-relocs @gol 764-mcheck-zero-division -mno-check-zero-division @gol 765-mdivide-traps -mdivide-breaks @gol 766-mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol 767-mmad -mno-mad -mfused-madd -mno-fused-madd -nocpp @gol 768-mfix-24k -mno-fix-24k @gol 769-mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol 770-mfix-r10000 -mno-fix-r10000 -mfix-vr4120 -mno-fix-vr4120 @gol 771-mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol 772-mflush-func=@var{func} -mno-flush-func @gol 773-mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol 774-mfp-exceptions -mno-fp-exceptions @gol 775-mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol 776-mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address} 777 778@emph{MMIX Options} 779@gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol 780-mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol 781-melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol 782-mno-base-addresses -msingle-exit -mno-single-exit} 783 784@emph{MN10300 Options} 785@gccoptlist{-mmult-bug -mno-mult-bug @gol 786-mno-am33 -mam33 -mam33-2 -mam34 @gol 787-mtune=@var{cpu-type} @gol 788-mreturn-pointer-on-d0 @gol 789-mno-crt0 -mrelax -mliw -msetlb} 790 791@emph{Moxie Options} 792@gccoptlist{-meb -mel -mno-crt0} 793 794@emph{PDP-11 Options} 795@gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol 796-mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol 797-mint16 -mno-int32 -mfloat32 -mno-float64 @gol 798-mfloat64 -mno-float32 -mabshi -mno-abshi @gol 799-mbranch-expensive -mbranch-cheap @gol 800-munix-asm -mdec-asm} 801 802@emph{picoChip Options} 803@gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol 804-msymbol-as-address -mno-inefficient-warnings} 805 806@emph{PowerPC Options} 807See RS/6000 and PowerPC Options. 808 809@emph{RL78 Options} 810@gccoptlist{-msim -mmul=none -mmul=g13 -mmul=rl78} 811 812@emph{RS/6000 and PowerPC Options} 813@gccoptlist{-mcpu=@var{cpu-type} @gol 814-mtune=@var{cpu-type} @gol 815-mcmodel=@var{code-model} @gol 816-mpowerpc64 @gol 817-maltivec -mno-altivec @gol 818-mpowerpc-gpopt -mno-powerpc-gpopt @gol 819-mpowerpc-gfxopt -mno-powerpc-gfxopt @gol 820-mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol 821-mfprnd -mno-fprnd @gol 822-mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol 823-mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol 824-m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol 825-malign-power -malign-natural @gol 826-msoft-float -mhard-float -mmultiple -mno-multiple @gol 827-msingle-float -mdouble-float -msimple-fpu @gol 828-mstring -mno-string -mupdate -mno-update @gol 829-mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol 830-mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol 831-mstrict-align -mno-strict-align -mrelocatable @gol 832-mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol 833-mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol 834-mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol 835-mprioritize-restricted-insns=@var{priority} @gol 836-msched-costly-dep=@var{dependence_type} @gol 837-minsert-sched-nops=@var{scheme} @gol 838-mcall-sysv -mcall-netbsd @gol 839-maix-struct-return -msvr4-struct-return @gol 840-mabi=@var{abi-type} -msecure-plt -mbss-plt @gol 841-mblock-move-inline-limit=@var{num} @gol 842-misel -mno-isel @gol 843-misel=yes -misel=no @gol 844-mspe -mno-spe @gol 845-mspe=yes -mspe=no @gol 846-mpaired @gol 847-mgen-cell-microcode -mwarn-cell-microcode @gol 848-mvrsave -mno-vrsave @gol 849-mmulhw -mno-mulhw @gol 850-mdlmzb -mno-dlmzb @gol 851-mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol 852-mprototype -mno-prototype @gol 853-msim -mmvme -mads -myellowknife -memb -msdata @gol 854-msdata=@var{opt} -mvxworks -G @var{num} -pthread @gol 855-mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol 856-mno-recip-precision @gol 857-mveclibabi=@var{type} -mfriz -mno-friz @gol 858-mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol 859-msave-toc-indirect -mno-save-toc-indirect @gol 860-mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol 861-mcrypto -mno-crypto -mdirect-move -mno-direct-move @gol 862-mquad-memory -mno-quad-memory @gol 863-mquad-memory-atomic -mno-quad-memory-atomic @gol 864-mcompat-align-parm -mno-compat-align-parm} 865 866@emph{RX Options} 867@gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol 868-mcpu=@gol 869-mbig-endian-data -mlittle-endian-data @gol 870-msmall-data @gol 871-msim -mno-sim@gol 872-mas100-syntax -mno-as100-syntax@gol 873-mrelax@gol 874-mmax-constant-size=@gol 875-mint-register=@gol 876-mpid@gol 877-mno-warn-multiple-fast-interrupts@gol 878-msave-acc-in-interrupts} 879 880@emph{S/390 and zSeries Options} 881@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol 882-mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol 883-mlong-double-64 -mlong-double-128 @gol 884-mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol 885-msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol 886-m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol 887-mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol 888-mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol 889-mhotpatch=@var{halfwords},@var{halfwords}} 890 891@emph{Score Options} 892@gccoptlist{-meb -mel @gol 893-mnhwloop @gol 894-muls @gol 895-mmac @gol 896-mscore5 -mscore5u -mscore7 -mscore7d} 897 898@emph{SH Options} 899@gccoptlist{-m1 -m2 -m2e @gol 900-m2a-nofpu -m2a-single-only -m2a-single -m2a @gol 901-m3 -m3e @gol 902-m4-nofpu -m4-single-only -m4-single -m4 @gol 903-m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol 904-m5-64media -m5-64media-nofpu @gol 905-m5-32media -m5-32media-nofpu @gol 906-m5-compact -m5-compact-nofpu @gol 907-mb -ml -mdalign -mrelax @gol 908-mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol 909-mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol 910-mspace -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol 911-mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol 912-mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol 913-maccumulate-outgoing-args -minvalid-symbols @gol 914-matomic-model=@var{atomic-model} @gol 915-mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch -mcbranchdi -mcmpeqdi @gol 916-mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol 917-mpretend-cmove -mtas} 918 919@emph{Solaris 2 Options} 920@gccoptlist{-mimpure-text -mno-impure-text @gol 921-pthreads -pthread} 922 923@emph{SPARC Options} 924@gccoptlist{-mcpu=@var{cpu-type} @gol 925-mtune=@var{cpu-type} @gol 926-mcmodel=@var{code-model} @gol 927-mmemory-model=@var{mem-model} @gol 928-m32 -m64 -mapp-regs -mno-app-regs @gol 929-mfaster-structs -mno-faster-structs -mflat -mno-flat @gol 930-mfpu -mno-fpu -mhard-float -msoft-float @gol 931-mhard-quad-float -msoft-quad-float @gol 932-mstack-bias -mno-stack-bias @gol 933-munaligned-doubles -mno-unaligned-doubles @gol 934-muser-mode -mno-user-mode @gol 935-mv8plus -mno-v8plus -mvis -mno-vis @gol 936-mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol 937-mcbcond -mno-cbcond @gol 938-mfmaf -mno-fmaf -mpopc -mno-popc @gol 939-mfix-at697f -mfix-ut699} 940 941@emph{SPU Options} 942@gccoptlist{-mwarn-reloc -merror-reloc @gol 943-msafe-dma -munsafe-dma @gol 944-mbranch-hints @gol 945-msmall-mem -mlarge-mem -mstdmain @gol 946-mfixed-range=@var{register-range} @gol 947-mea32 -mea64 @gol 948-maddress-space-conversion -mno-address-space-conversion @gol 949-mcache-size=@var{cache-size} @gol 950-matomic-updates -mno-atomic-updates} 951 952@emph{System V Options} 953@gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}} 954 955@emph{TILE-Gx Options} 956@gccoptlist{-mcpu=@var{cpu} -m32 -m64 -mcmodel=@var{code-model}} 957 958@emph{TILEPro Options} 959@gccoptlist{-mcpu=@var{cpu} -m32} 960 961@emph{V850 Options} 962@gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol 963-mprolog-function -mno-prolog-function -mspace @gol 964-mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol 965-mapp-regs -mno-app-regs @gol 966-mdisable-callt -mno-disable-callt @gol 967-mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol 968-mv850e -mv850 -mv850e3v5 @gol 969-mloop @gol 970-mrelax @gol 971-mlong-jumps @gol 972-msoft-float @gol 973-mhard-float @gol 974-mgcc-abi @gol 975-mrh850-abi @gol 976-mbig-switch} 977 978@emph{VAX Options} 979@gccoptlist{-mg -mgnu -munix} 980 981@emph{VMS Options} 982@gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol 983-mpointer-size=@var{size}} 984 985@emph{VxWorks Options} 986@gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol 987-Xbind-lazy -Xbind-now} 988 989@emph{x86-64 Options} 990See i386 and x86-64 Options. 991 992@emph{Xstormy16 Options} 993@gccoptlist{-msim} 994 995@emph{Xtensa Options} 996@gccoptlist{-mconst16 -mno-const16 @gol 997-mfused-madd -mno-fused-madd @gol 998-mforce-no-pic @gol 999-mserialize-volatile -mno-serialize-volatile @gol 1000-mtext-section-literals -mno-text-section-literals @gol 1001-mtarget-align -mno-target-align @gol 1002-mlongcalls -mno-longcalls} 1003 1004@emph{zSeries Options} 1005See S/390 and zSeries Options. 1006 1007@item Code Generation Options 1008@xref{Code Gen Options,,Options for Code Generation Conventions}. 1009@gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol 1010-ffixed-@var{reg} -fexceptions @gol 1011-fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol 1012-fasynchronous-unwind-tables @gol 1013-fno-gnu-unique @gol 1014-finhibit-size-directive -finstrument-functions @gol 1015-finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol 1016-finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @gol 1017-fno-common -fno-ident @gol 1018-fpcc-struct-return -fpic -fPIC -fpie -fPIE @gol 1019-fno-jump-tables @gol 1020-frecord-gcc-switches @gol 1021-freg-struct-return -fshort-enums @gol 1022-fshort-double -fshort-wchar @gol 1023-fverbose-asm -fpack-struct[=@var{n}] -fstack-check @gol 1024-fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol 1025-fno-stack-limit -fsplit-stack @gol 1026-fleading-underscore -ftls-model=@var{model} @gol 1027-fstack-reuse=@var{reuse_level} @gol 1028-ftrapv -fwrapv -fbounds-check @gol 1029-fvisibility -fstrict-volatile-bitfields -fsync-libcalls} 1030@end table 1031 1032@menu 1033* Overall Options:: Controlling the kind of output: 1034 an executable, object files, assembler files, 1035 or preprocessed source. 1036* C Dialect Options:: Controlling the variant of C language compiled. 1037* C++ Dialect Options:: Variations on C++. 1038* Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C 1039 and Objective-C++. 1040* Language Independent Options:: Controlling how diagnostics should be 1041 formatted. 1042* Warning Options:: How picky should the compiler be? 1043* Debugging Options:: Symbol tables, measurements, and debugging dumps. 1044* Optimize Options:: How much optimization? 1045* Preprocessor Options:: Controlling header files and macro definitions. 1046 Also, getting dependency information for Make. 1047* Assembler Options:: Passing options to the assembler. 1048* Link Options:: Specifying libraries and so on. 1049* Directory Options:: Where to find header files and libraries. 1050 Where to find the compiler executable files. 1051* Spec Files:: How to pass switches to sub-processes. 1052* Target Options:: Running a cross-compiler, or an old version of GCC. 1053@end menu 1054 1055@node Overall Options 1056@section Options Controlling the Kind of Output 1057 1058Compilation can involve up to four stages: preprocessing, compilation 1059proper, assembly and linking, always in that order. GCC is capable of 1060preprocessing and compiling several files either into several 1061assembler input files, or into one assembler input file; then each 1062assembler input file produces an object file, and linking combines all 1063the object files (those newly compiled, and those specified as input) 1064into an executable file. 1065 1066@cindex file name suffix 1067For any given input file, the file name suffix determines what kind of 1068compilation is done: 1069 1070@table @gcctabopt 1071@item @var{file}.c 1072C source code that must be preprocessed. 1073 1074@item @var{file}.i 1075C source code that should not be preprocessed. 1076 1077@item @var{file}.ii 1078C++ source code that should not be preprocessed. 1079 1080@item @var{file}.m 1081Objective-C source code. Note that you must link with the @file{libobjc} 1082library to make an Objective-C program work. 1083 1084@item @var{file}.mi 1085Objective-C source code that should not be preprocessed. 1086 1087@item @var{file}.mm 1088@itemx @var{file}.M 1089Objective-C++ source code. Note that you must link with the @file{libobjc} 1090library to make an Objective-C++ program work. Note that @samp{.M} refers 1091to a literal capital M@. 1092 1093@item @var{file}.mii 1094Objective-C++ source code that should not be preprocessed. 1095 1096@item @var{file}.h 1097C, C++, Objective-C or Objective-C++ header file to be turned into a 1098precompiled header (default), or C, C++ header file to be turned into an 1099Ada spec (via the @option{-fdump-ada-spec} switch). 1100 1101@item @var{file}.cc 1102@itemx @var{file}.cp 1103@itemx @var{file}.cxx 1104@itemx @var{file}.cpp 1105@itemx @var{file}.CPP 1106@itemx @var{file}.c++ 1107@itemx @var{file}.C 1108C++ source code that must be preprocessed. Note that in @samp{.cxx}, 1109the last two letters must both be literally @samp{x}. Likewise, 1110@samp{.C} refers to a literal capital C@. 1111 1112@item @var{file}.mm 1113@itemx @var{file}.M 1114Objective-C++ source code that must be preprocessed. 1115 1116@item @var{file}.mii 1117Objective-C++ source code that should not be preprocessed. 1118 1119@item @var{file}.hh 1120@itemx @var{file}.H 1121@itemx @var{file}.hp 1122@itemx @var{file}.hxx 1123@itemx @var{file}.hpp 1124@itemx @var{file}.HPP 1125@itemx @var{file}.h++ 1126@itemx @var{file}.tcc 1127C++ header file to be turned into a precompiled header or Ada spec. 1128 1129@item @var{file}.f 1130@itemx @var{file}.for 1131@itemx @var{file}.ftn 1132Fixed form Fortran source code that should not be preprocessed. 1133 1134@item @var{file}.F 1135@itemx @var{file}.FOR 1136@itemx @var{file}.fpp 1137@itemx @var{file}.FPP 1138@itemx @var{file}.FTN 1139Fixed form Fortran source code that must be preprocessed (with the traditional 1140preprocessor). 1141 1142@item @var{file}.f90 1143@itemx @var{file}.f95 1144@itemx @var{file}.f03 1145@itemx @var{file}.f08 1146Free form Fortran source code that should not be preprocessed. 1147 1148@item @var{file}.F90 1149@itemx @var{file}.F95 1150@itemx @var{file}.F03 1151@itemx @var{file}.F08 1152Free form Fortran source code that must be preprocessed (with the 1153traditional preprocessor). 1154 1155@item @var{file}.go 1156Go source code. 1157 1158@c FIXME: Descriptions of Java file types. 1159@c @var{file}.java 1160@c @var{file}.class 1161@c @var{file}.zip 1162@c @var{file}.jar 1163 1164@item @var{file}.ads 1165Ada source code file that contains a library unit declaration (a 1166declaration of a package, subprogram, or generic, or a generic 1167instantiation), or a library unit renaming declaration (a package, 1168generic, or subprogram renaming declaration). Such files are also 1169called @dfn{specs}. 1170 1171@item @var{file}.adb 1172Ada source code file containing a library unit body (a subprogram or 1173package body). Such files are also called @dfn{bodies}. 1174 1175@c GCC also knows about some suffixes for languages not yet included: 1176@c Pascal: 1177@c @var{file}.p 1178@c @var{file}.pas 1179@c Ratfor: 1180@c @var{file}.r 1181 1182@item @var{file}.s 1183Assembler code. 1184 1185@item @var{file}.S 1186@itemx @var{file}.sx 1187Assembler code that must be preprocessed. 1188 1189@item @var{other} 1190An object file to be fed straight into linking. 1191Any file name with no recognized suffix is treated this way. 1192@end table 1193 1194@opindex x 1195You can specify the input language explicitly with the @option{-x} option: 1196 1197@table @gcctabopt 1198@item -x @var{language} 1199Specify explicitly the @var{language} for the following input files 1200(rather than letting the compiler choose a default based on the file 1201name suffix). This option applies to all following input files until 1202the next @option{-x} option. Possible values for @var{language} are: 1203@smallexample 1204c c-header cpp-output 1205c++ c++-header c++-cpp-output 1206objective-c objective-c-header objective-c-cpp-output 1207objective-c++ objective-c++-header objective-c++-cpp-output 1208assembler assembler-with-cpp 1209ada 1210f77 f77-cpp-input f95 f95-cpp-input 1211go 1212java 1213@end smallexample 1214 1215@item -x none 1216Turn off any specification of a language, so that subsequent files are 1217handled according to their file name suffixes (as they are if @option{-x} 1218has not been used at all). 1219 1220@item -pass-exit-codes 1221@opindex pass-exit-codes 1222Normally the @command{gcc} program exits with the code of 1 if any 1223phase of the compiler returns a non-success return code. If you specify 1224@option{-pass-exit-codes}, the @command{gcc} program instead returns with 1225the numerically highest error produced by any phase returning an error 1226indication. The C, C++, and Fortran front ends return 4 if an internal 1227compiler error is encountered. 1228@end table 1229 1230If you only want some of the stages of compilation, you can use 1231@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and 1232one of the options @option{-c}, @option{-S}, or @option{-E} to say where 1233@command{gcc} is to stop. Note that some combinations (for example, 1234@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all. 1235 1236@table @gcctabopt 1237@item -c 1238@opindex c 1239Compile or assemble the source files, but do not link. The linking 1240stage simply is not done. The ultimate output is in the form of an 1241object file for each source file. 1242 1243By default, the object file name for a source file is made by replacing 1244the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}. 1245 1246Unrecognized input files, not requiring compilation or assembly, are 1247ignored. 1248 1249@item -S 1250@opindex S 1251Stop after the stage of compilation proper; do not assemble. The output 1252is in the form of an assembler code file for each non-assembler input 1253file specified. 1254 1255By default, the assembler file name for a source file is made by 1256replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}. 1257 1258Input files that don't require compilation are ignored. 1259 1260@item -E 1261@opindex E 1262Stop after the preprocessing stage; do not run the compiler proper. The 1263output is in the form of preprocessed source code, which is sent to the 1264standard output. 1265 1266Input files that don't require preprocessing are ignored. 1267 1268@cindex output file option 1269@item -o @var{file} 1270@opindex o 1271Place output in file @var{file}. This applies to whatever 1272sort of output is being produced, whether it be an executable file, 1273an object file, an assembler file or preprocessed C code. 1274 1275If @option{-o} is not specified, the default is to put an executable 1276file in @file{a.out}, the object file for 1277@file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its 1278assembler file in @file{@var{source}.s}, a precompiled header file in 1279@file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on 1280standard output. 1281 1282@item -v 1283@opindex v 1284Print (on standard error output) the commands executed to run the stages 1285of compilation. Also print the version number of the compiler driver 1286program and of the preprocessor and the compiler proper. 1287 1288@item -### 1289@opindex ### 1290Like @option{-v} except the commands are not executed and arguments 1291are quoted unless they contain only alphanumeric characters or @code{./-_}. 1292This is useful for shell scripts to capture the driver-generated command lines. 1293 1294@item -pipe 1295@opindex pipe 1296Use pipes rather than temporary files for communication between the 1297various stages of compilation. This fails to work on some systems where 1298the assembler is unable to read from a pipe; but the GNU assembler has 1299no trouble. 1300 1301@item --help 1302@opindex help 1303Print (on the standard output) a description of the command-line options 1304understood by @command{gcc}. If the @option{-v} option is also specified 1305then @option{--help} is also passed on to the various processes 1306invoked by @command{gcc}, so that they can display the command-line options 1307they accept. If the @option{-Wextra} option has also been specified 1308(prior to the @option{--help} option), then command-line options that 1309have no documentation associated with them are also displayed. 1310 1311@item --target-help 1312@opindex target-help 1313Print (on the standard output) a description of target-specific command-line 1314options for each tool. For some targets extra target-specific 1315information may also be printed. 1316 1317@item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]} 1318Print (on the standard output) a description of the command-line 1319options understood by the compiler that fit into all specified classes 1320and qualifiers. These are the supported classes: 1321 1322@table @asis 1323@item @samp{optimizers} 1324Display all of the optimization options supported by the 1325compiler. 1326 1327@item @samp{warnings} 1328Display all of the options controlling warning messages 1329produced by the compiler. 1330 1331@item @samp{target} 1332Display target-specific options. Unlike the 1333@option{--target-help} option however, target-specific options of the 1334linker and assembler are not displayed. This is because those 1335tools do not currently support the extended @option{--help=} syntax. 1336 1337@item @samp{params} 1338Display the values recognized by the @option{--param} 1339option. 1340 1341@item @var{language} 1342Display the options supported for @var{language}, where 1343@var{language} is the name of one of the languages supported in this 1344version of GCC@. 1345 1346@item @samp{common} 1347Display the options that are common to all languages. 1348@end table 1349 1350These are the supported qualifiers: 1351 1352@table @asis 1353@item @samp{undocumented} 1354Display only those options that are undocumented. 1355 1356@item @samp{joined} 1357Display options taking an argument that appears after an equal 1358sign in the same continuous piece of text, such as: 1359@samp{--help=target}. 1360 1361@item @samp{separate} 1362Display options taking an argument that appears as a separate word 1363following the original option, such as: @samp{-o output-file}. 1364@end table 1365 1366Thus for example to display all the undocumented target-specific 1367switches supported by the compiler, use: 1368 1369@smallexample 1370--help=target,undocumented 1371@end smallexample 1372 1373The sense of a qualifier can be inverted by prefixing it with the 1374@samp{^} character, so for example to display all binary warning 1375options (i.e., ones that are either on or off and that do not take an 1376argument) that have a description, use: 1377 1378@smallexample 1379--help=warnings,^joined,^undocumented 1380@end smallexample 1381 1382The argument to @option{--help=} should not consist solely of inverted 1383qualifiers. 1384 1385Combining several classes is possible, although this usually 1386restricts the output so much that there is nothing to display. One 1387case where it does work, however, is when one of the classes is 1388@var{target}. For example, to display all the target-specific 1389optimization options, use: 1390 1391@smallexample 1392--help=target,optimizers 1393@end smallexample 1394 1395The @option{--help=} option can be repeated on the command line. Each 1396successive use displays its requested class of options, skipping 1397those that have already been displayed. 1398 1399If the @option{-Q} option appears on the command line before the 1400@option{--help=} option, then the descriptive text displayed by 1401@option{--help=} is changed. Instead of describing the displayed 1402options, an indication is given as to whether the option is enabled, 1403disabled or set to a specific value (assuming that the compiler 1404knows this at the point where the @option{--help=} option is used). 1405 1406Here is a truncated example from the ARM port of @command{gcc}: 1407 1408@smallexample 1409 % gcc -Q -mabi=2 --help=target -c 1410 The following options are target specific: 1411 -mabi= 2 1412 -mabort-on-noreturn [disabled] 1413 -mapcs [disabled] 1414@end smallexample 1415 1416The output is sensitive to the effects of previous command-line 1417options, so for example it is possible to find out which optimizations 1418are enabled at @option{-O2} by using: 1419 1420@smallexample 1421-Q -O2 --help=optimizers 1422@end smallexample 1423 1424Alternatively you can discover which binary optimizations are enabled 1425by @option{-O3} by using: 1426 1427@smallexample 1428gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts 1429gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts 1430diff /tmp/O2-opts /tmp/O3-opts | grep enabled 1431@end smallexample 1432 1433@item -no-canonical-prefixes 1434@opindex no-canonical-prefixes 1435Do not expand any symbolic links, resolve references to @samp{/../} 1436or @samp{/./}, or make the path absolute when generating a relative 1437prefix. 1438 1439@item --version 1440@opindex version 1441Display the version number and copyrights of the invoked GCC@. 1442 1443@item -wrapper 1444@opindex wrapper 1445Invoke all subcommands under a wrapper program. The name of the 1446wrapper program and its parameters are passed as a comma separated 1447list. 1448 1449@smallexample 1450gcc -c t.c -wrapper gdb,--args 1451@end smallexample 1452 1453@noindent 1454This invokes all subprograms of @command{gcc} under 1455@samp{gdb --args}, thus the invocation of @command{cc1} is 1456@samp{gdb --args cc1 @dots{}}. 1457 1458@item -fplugin=@var{name}.so 1459Load the plugin code in file @var{name}.so, assumed to be a 1460shared object to be dlopen'd by the compiler. The base name of 1461the shared object file is used to identify the plugin for the 1462purposes of argument parsing (See 1463@option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below). 1464Each plugin should define the callback functions specified in the 1465Plugins API. 1466 1467@item -fplugin-arg-@var{name}-@var{key}=@var{value} 1468Define an argument called @var{key} with a value of @var{value} 1469for the plugin called @var{name}. 1470 1471@item -fdump-ada-spec@r{[}-slim@r{]} 1472@opindex fdump-ada-spec 1473For C and C++ source and include files, generate corresponding Ada specs. 1474@xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn, 1475GNAT User's Guide}, which provides detailed documentation on this feature. 1476 1477@item -fada-spec-parent=@var{unit} 1478@opindex fada-spec-parent 1479In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate 1480Ada specs as child units of parent @var{unit}. 1481 1482@item -fdump-go-spec=@var{file} 1483@opindex fdump-go-spec 1484For input files in any language, generate corresponding Go 1485declarations in @var{file}. This generates Go @code{const}, 1486@code{type}, @code{var}, and @code{func} declarations which may be a 1487useful way to start writing a Go interface to code written in some 1488other language. 1489 1490@include @value{srcdir}/../libiberty/at-file.texi 1491@end table 1492 1493@node Invoking G++ 1494@section Compiling C++ Programs 1495 1496@cindex suffixes for C++ source 1497@cindex C++ source file suffixes 1498C++ source files conventionally use one of the suffixes @samp{.C}, 1499@samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or 1500@samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp}, 1501@samp{.H}, or (for shared template code) @samp{.tcc}; and 1502preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes 1503files with these names and compiles them as C++ programs even if you 1504call the compiler the same way as for compiling C programs (usually 1505with the name @command{gcc}). 1506 1507@findex g++ 1508@findex c++ 1509However, the use of @command{gcc} does not add the C++ library. 1510@command{g++} is a program that calls GCC and automatically specifies linking 1511against the C++ library. It treats @samp{.c}, 1512@samp{.h} and @samp{.i} files as C++ source files instead of C source 1513files unless @option{-x} is used. This program is also useful when 1514precompiling a C header file with a @samp{.h} extension for use in C++ 1515compilations. On many systems, @command{g++} is also installed with 1516the name @command{c++}. 1517 1518@cindex invoking @command{g++} 1519When you compile C++ programs, you may specify many of the same 1520command-line options that you use for compiling programs in any 1521language; or command-line options meaningful for C and related 1522languages; or options that are meaningful only for C++ programs. 1523@xref{C Dialect Options,,Options Controlling C Dialect}, for 1524explanations of options for languages related to C@. 1525@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for 1526explanations of options that are meaningful only for C++ programs. 1527 1528@node C Dialect Options 1529@section Options Controlling C Dialect 1530@cindex dialect options 1531@cindex language dialect options 1532@cindex options, dialect 1533 1534The following options control the dialect of C (or languages derived 1535from C, such as C++, Objective-C and Objective-C++) that the compiler 1536accepts: 1537 1538@table @gcctabopt 1539@cindex ANSI support 1540@cindex ISO support 1541@item -ansi 1542@opindex ansi 1543In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is 1544equivalent to @option{-std=c++98}. 1545 1546This turns off certain features of GCC that are incompatible with ISO 1547C90 (when compiling C code), or of standard C++ (when compiling C++ code), 1548such as the @code{asm} and @code{typeof} keywords, and 1549predefined macros such as @code{unix} and @code{vax} that identify the 1550type of system you are using. It also enables the undesirable and 1551rarely used ISO trigraph feature. For the C compiler, 1552it disables recognition of C++ style @samp{//} comments as well as 1553the @code{inline} keyword. 1554 1555The alternate keywords @code{__asm__}, @code{__extension__}, 1556@code{__inline__} and @code{__typeof__} continue to work despite 1557@option{-ansi}. You would not want to use them in an ISO C program, of 1558course, but it is useful to put them in header files that might be included 1559in compilations done with @option{-ansi}. Alternate predefined macros 1560such as @code{__unix__} and @code{__vax__} are also available, with or 1561without @option{-ansi}. 1562 1563The @option{-ansi} option does not cause non-ISO programs to be 1564rejected gratuitously. For that, @option{-Wpedantic} is required in 1565addition to @option{-ansi}. @xref{Warning Options}. 1566 1567The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi} 1568option is used. Some header files may notice this macro and refrain 1569from declaring certain functions or defining certain macros that the 1570ISO standard doesn't call for; this is to avoid interfering with any 1571programs that might use these names for other things. 1572 1573Functions that are normally built in but do not have semantics 1574defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in 1575functions when @option{-ansi} is used. @xref{Other Builtins,,Other 1576built-in functions provided by GCC}, for details of the functions 1577affected. 1578 1579@item -std= 1580@opindex std 1581Determine the language standard. @xref{Standards,,Language Standards 1582Supported by GCC}, for details of these standard versions. This option 1583is currently only supported when compiling C or C++. 1584 1585The compiler can accept several base standards, such as @samp{c90} or 1586@samp{c++98}, and GNU dialects of those standards, such as 1587@samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the 1588compiler accepts all programs following that standard plus those 1589using GNU extensions that do not contradict it. For example, 1590@option{-std=c90} turns off certain features of GCC that are 1591incompatible with ISO C90, such as the @code{asm} and @code{typeof} 1592keywords, but not other GNU extensions that do not have a meaning in 1593ISO C90, such as omitting the middle term of a @code{?:} 1594expression. On the other hand, when a GNU dialect of a standard is 1595specified, all features supported by the compiler are enabled, even when 1596those features change the meaning of the base standard. As a result, some 1597strict-conforming programs may be rejected. The particular standard 1598is used by @option{-Wpedantic} to identify which features are GNU 1599extensions given that version of the standard. For example 1600@option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//} 1601comments, while @option{-std=gnu99 -Wpedantic} does not. 1602 1603A value for this option must be provided; possible values are 1604 1605@table @samp 1606@item c90 1607@itemx c89 1608@itemx iso9899:1990 1609Support all ISO C90 programs (certain GNU extensions that conflict 1610with ISO C90 are disabled). Same as @option{-ansi} for C code. 1611 1612@item iso9899:199409 1613ISO C90 as modified in amendment 1. 1614 1615@item c99 1616@itemx c9x 1617@itemx iso9899:1999 1618@itemx iso9899:199x 1619ISO C99. Note that this standard is not yet fully supported; see 1620@w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The 1621names @samp{c9x} and @samp{iso9899:199x} are deprecated. 1622 1623@item c11 1624@itemx c1x 1625@itemx iso9899:2011 1626ISO C11, the 2011 revision of the ISO C standard. 1627Support is incomplete and experimental. The name @samp{c1x} is 1628deprecated. 1629 1630@item gnu90 1631@itemx gnu89 1632GNU dialect of ISO C90 (including some C99 features). This 1633is the default for C code. 1634 1635@item gnu99 1636@itemx gnu9x 1637GNU dialect of ISO C99. When ISO C99 is fully implemented in GCC, 1638this will become the default. The name @samp{gnu9x} is deprecated. 1639 1640@item gnu11 1641@itemx gnu1x 1642GNU dialect of ISO C11. Support is incomplete and experimental. The 1643name @samp{gnu1x} is deprecated. 1644 1645@item c++98 1646@itemx c++03 1647The 1998 ISO C++ standard plus the 2003 technical corrigendum and some 1648additional defect reports. Same as @option{-ansi} for C++ code. 1649 1650@item gnu++98 1651@itemx gnu++03 1652GNU dialect of @option{-std=c++98}. This is the default for 1653C++ code. 1654 1655@item c++11 1656@itemx c++0x 1657The 2011 ISO C++ standard plus amendments. Support for C++11 is still 1658experimental, and may change in incompatible ways in future releases. 1659The name @samp{c++0x} is deprecated. 1660 1661@item gnu++11 1662@itemx gnu++0x 1663GNU dialect of @option{-std=c++11}. Support for C++11 is still 1664experimental, and may change in incompatible ways in future releases. 1665The name @samp{gnu++0x} is deprecated. 1666 1667@item c++1y 1668The next revision of the ISO C++ standard, tentatively planned for 16692017. Support is highly experimental, and will almost certainly 1670change in incompatible ways in future releases. 1671 1672@item gnu++1y 1673GNU dialect of @option{-std=c++1y}. Support is highly experimental, 1674and will almost certainly change in incompatible ways in future 1675releases. 1676@end table 1677 1678@item -fgnu89-inline 1679@opindex fgnu89-inline 1680The option @option{-fgnu89-inline} tells GCC to use the traditional 1681GNU semantics for @code{inline} functions when in C99 mode. 1682@xref{Inline,,An Inline Function is As Fast As a Macro}. This option 1683is accepted and ignored by GCC versions 4.1.3 up to but not including 16844.3. In GCC versions 4.3 and later it changes the behavior of GCC in 1685C99 mode. Using this option is roughly equivalent to adding the 1686@code{gnu_inline} function attribute to all inline functions 1687(@pxref{Function Attributes}). 1688 1689The option @option{-fno-gnu89-inline} explicitly tells GCC to use the 1690C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it 1691specifies the default behavior). This option was first supported in 1692GCC 4.3. This option is not supported in @option{-std=c90} or 1693@option{-std=gnu90} mode. 1694 1695The preprocessor macros @code{__GNUC_GNU_INLINE__} and 1696@code{__GNUC_STDC_INLINE__} may be used to check which semantics are 1697in effect for @code{inline} functions. @xref{Common Predefined 1698Macros,,,cpp,The C Preprocessor}. 1699 1700@item -aux-info @var{filename} 1701@opindex aux-info 1702Output to the given filename prototyped declarations for all functions 1703declared and/or defined in a translation unit, including those in header 1704files. This option is silently ignored in any language other than C@. 1705 1706Besides declarations, the file indicates, in comments, the origin of 1707each declaration (source file and line), whether the declaration was 1708implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or 1709@samp{O} for old, respectively, in the first character after the line 1710number and the colon), and whether it came from a declaration or a 1711definition (@samp{C} or @samp{F}, respectively, in the following 1712character). In the case of function definitions, a K&R-style list of 1713arguments followed by their declarations is also provided, inside 1714comments, after the declaration. 1715 1716@item -fallow-parameterless-variadic-functions 1717Accept variadic functions without named parameters. 1718 1719Although it is possible to define such a function, this is not very 1720useful as it is not possible to read the arguments. This is only 1721supported for C as this construct is allowed by C++. 1722 1723@item -fno-asm 1724@opindex fno-asm 1725Do not recognize @code{asm}, @code{inline} or @code{typeof} as a 1726keyword, so that code can use these words as identifiers. You can use 1727the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__} 1728instead. @option{-ansi} implies @option{-fno-asm}. 1729 1730In C++, this switch only affects the @code{typeof} keyword, since 1731@code{asm} and @code{inline} are standard keywords. You may want to 1732use the @option{-fno-gnu-keywords} flag instead, which has the same 1733effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this 1734switch only affects the @code{asm} and @code{typeof} keywords, since 1735@code{inline} is a standard keyword in ISO C99. 1736 1737@item -fno-builtin 1738@itemx -fno-builtin-@var{function} 1739@opindex fno-builtin 1740@cindex built-in functions 1741Don't recognize built-in functions that do not begin with 1742@samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in 1743functions provided by GCC}, for details of the functions affected, 1744including those which are not built-in functions when @option{-ansi} or 1745@option{-std} options for strict ISO C conformance are used because they 1746do not have an ISO standard meaning. 1747 1748GCC normally generates special code to handle certain built-in functions 1749more efficiently; for instance, calls to @code{alloca} may become single 1750instructions which adjust the stack directly, and calls to @code{memcpy} 1751may become inline copy loops. The resulting code is often both smaller 1752and faster, but since the function calls no longer appear as such, you 1753cannot set a breakpoint on those calls, nor can you change the behavior 1754of the functions by linking with a different library. In addition, 1755when a function is recognized as a built-in function, GCC may use 1756information about that function to warn about problems with calls to 1757that function, or to generate more efficient code, even if the 1758resulting code still contains calls to that function. For example, 1759warnings are given with @option{-Wformat} for bad calls to 1760@code{printf} when @code{printf} is built in and @code{strlen} is 1761known not to modify global memory. 1762 1763With the @option{-fno-builtin-@var{function}} option 1764only the built-in function @var{function} is 1765disabled. @var{function} must not begin with @samp{__builtin_}. If a 1766function is named that is not built-in in this version of GCC, this 1767option is ignored. There is no corresponding 1768@option{-fbuiltin-@var{function}} option; if you wish to enable 1769built-in functions selectively when using @option{-fno-builtin} or 1770@option{-ffreestanding}, you may define macros such as: 1771 1772@smallexample 1773#define abs(n) __builtin_abs ((n)) 1774#define strcpy(d, s) __builtin_strcpy ((d), (s)) 1775@end smallexample 1776 1777@item -fhosted 1778@opindex fhosted 1779@cindex hosted environment 1780 1781Assert that compilation targets a hosted environment. This implies 1782@option{-fbuiltin}. A hosted environment is one in which the 1783entire standard library is available, and in which @code{main} has a return 1784type of @code{int}. Examples are nearly everything except a kernel. 1785This is equivalent to @option{-fno-freestanding}. 1786 1787@item -ffreestanding 1788@opindex ffreestanding 1789@cindex hosted environment 1790 1791Assert that compilation targets a freestanding environment. This 1792implies @option{-fno-builtin}. A freestanding environment 1793is one in which the standard library may not exist, and program startup may 1794not necessarily be at @code{main}. The most obvious example is an OS kernel. 1795This is equivalent to @option{-fno-hosted}. 1796 1797@xref{Standards,,Language Standards Supported by GCC}, for details of 1798freestanding and hosted environments. 1799 1800@item -fopenmp 1801@opindex fopenmp 1802@cindex OpenMP parallel 1803Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and 1804@code{!$omp} in Fortran. When @option{-fopenmp} is specified, the 1805compiler generates parallel code according to the OpenMP Application 1806Program Interface v3.0 @w{@uref{http://www.openmp.org/}}. This option 1807implies @option{-pthread}, and thus is only supported on targets that 1808have support for @option{-pthread}. 1809 1810@item -fgnu-tm 1811@opindex fgnu-tm 1812When the option @option{-fgnu-tm} is specified, the compiler 1813generates code for the Linux variant of Intel's current Transactional 1814Memory ABI specification document (Revision 1.1, May 6 2009). This is 1815an experimental feature whose interface may change in future versions 1816of GCC, as the official specification changes. Please note that not 1817all architectures are supported for this feature. 1818 1819For more information on GCC's support for transactional memory, 1820@xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU 1821Transactional Memory Library}. 1822 1823Note that the transactional memory feature is not supported with 1824non-call exceptions (@option{-fnon-call-exceptions}). 1825 1826@item -fms-extensions 1827@opindex fms-extensions 1828Accept some non-standard constructs used in Microsoft header files. 1829 1830In C++ code, this allows member names in structures to be similar 1831to previous types declarations. 1832 1833@smallexample 1834typedef int UOW; 1835struct ABC @{ 1836 UOW UOW; 1837@}; 1838@end smallexample 1839 1840Some cases of unnamed fields in structures and unions are only 1841accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union 1842fields within structs/unions}, for details. 1843 1844@item -fplan9-extensions 1845Accept some non-standard constructs used in Plan 9 code. 1846 1847This enables @option{-fms-extensions}, permits passing pointers to 1848structures with anonymous fields to functions that expect pointers to 1849elements of the type of the field, and permits referring to anonymous 1850fields declared using a typedef. @xref{Unnamed Fields,,Unnamed 1851struct/union fields within structs/unions}, for details. This is only 1852supported for C, not C++. 1853 1854@item -trigraphs 1855@opindex trigraphs 1856Support ISO C trigraphs. The @option{-ansi} option (and @option{-std} 1857options for strict ISO C conformance) implies @option{-trigraphs}. 1858 1859@cindex traditional C language 1860@cindex C language, traditional 1861@item -traditional 1862@itemx -traditional-cpp 1863@opindex traditional-cpp 1864@opindex traditional 1865Formerly, these options caused GCC to attempt to emulate a pre-standard 1866C compiler. They are now only supported with the @option{-E} switch. 1867The preprocessor continues to support a pre-standard mode. See the GNU 1868CPP manual for details. 1869 1870@item -fcond-mismatch 1871@opindex fcond-mismatch 1872Allow conditional expressions with mismatched types in the second and 1873third arguments. The value of such an expression is void. This option 1874is not supported for C++. 1875 1876@item -flax-vector-conversions 1877@opindex flax-vector-conversions 1878Allow implicit conversions between vectors with differing numbers of 1879elements and/or incompatible element types. This option should not be 1880used for new code. 1881 1882@item -funsigned-char 1883@opindex funsigned-char 1884Let the type @code{char} be unsigned, like @code{unsigned char}. 1885 1886Each kind of machine has a default for what @code{char} should 1887be. It is either like @code{unsigned char} by default or like 1888@code{signed char} by default. 1889 1890Ideally, a portable program should always use @code{signed char} or 1891@code{unsigned char} when it depends on the signedness of an object. 1892But many programs have been written to use plain @code{char} and 1893expect it to be signed, or expect it to be unsigned, depending on the 1894machines they were written for. This option, and its inverse, let you 1895make such a program work with the opposite default. 1896 1897The type @code{char} is always a distinct type from each of 1898@code{signed char} or @code{unsigned char}, even though its behavior 1899is always just like one of those two. 1900 1901@item -fsigned-char 1902@opindex fsigned-char 1903Let the type @code{char} be signed, like @code{signed char}. 1904 1905Note that this is equivalent to @option{-fno-unsigned-char}, which is 1906the negative form of @option{-funsigned-char}. Likewise, the option 1907@option{-fno-signed-char} is equivalent to @option{-funsigned-char}. 1908 1909@item -fsigned-bitfields 1910@itemx -funsigned-bitfields 1911@itemx -fno-signed-bitfields 1912@itemx -fno-unsigned-bitfields 1913@opindex fsigned-bitfields 1914@opindex funsigned-bitfields 1915@opindex fno-signed-bitfields 1916@opindex fno-unsigned-bitfields 1917These options control whether a bit-field is signed or unsigned, when the 1918declaration does not use either @code{signed} or @code{unsigned}. By 1919default, such a bit-field is signed, because this is consistent: the 1920basic integer types such as @code{int} are signed types. 1921@end table 1922 1923@node C++ Dialect Options 1924@section Options Controlling C++ Dialect 1925 1926@cindex compiler options, C++ 1927@cindex C++ options, command-line 1928@cindex options, C++ 1929This section describes the command-line options that are only meaningful 1930for C++ programs. You can also use most of the GNU compiler options 1931regardless of what language your program is in. For example, you 1932might compile a file @code{firstClass.C} like this: 1933 1934@smallexample 1935g++ -g -frepo -O -c firstClass.C 1936@end smallexample 1937 1938@noindent 1939In this example, only @option{-frepo} is an option meant 1940only for C++ programs; you can use the other options with any 1941language supported by GCC@. 1942 1943Here is a list of options that are @emph{only} for compiling C++ programs: 1944 1945@table @gcctabopt 1946 1947@item -fabi-version=@var{n} 1948@opindex fabi-version 1949Use version @var{n} of the C++ ABI@. The default is version 2. 1950 1951Version 0 refers to the version conforming most closely to 1952the C++ ABI specification. Therefore, the ABI obtained using version 0 1953will change in different versions of G++ as ABI bugs are fixed. 1954 1955Version 1 is the version of the C++ ABI that first appeared in G++ 3.2. 1956 1957Version 2 is the version of the C++ ABI that first appeared in G++ 3.4. 1958 1959Version 3 corrects an error in mangling a constant address as a 1960template argument. 1961 1962Version 4, which first appeared in G++ 4.5, implements a standard 1963mangling for vector types. 1964 1965Version 5, which first appeared in G++ 4.6, corrects the mangling of 1966attribute const/volatile on function pointer types, decltype of a 1967plain decl, and use of a function parameter in the declaration of 1968another parameter. 1969 1970Version 6, which first appeared in G++ 4.7, corrects the promotion 1971behavior of C++11 scoped enums and the mangling of template argument 1972packs, const/static_cast, prefix ++ and --, and a class scope function 1973used as a template argument. 1974 1975See also @option{-Wabi}. 1976 1977@item -fno-access-control 1978@opindex fno-access-control 1979Turn off all access checking. This switch is mainly useful for working 1980around bugs in the access control code. 1981 1982@item -fcheck-new 1983@opindex fcheck-new 1984Check that the pointer returned by @code{operator new} is non-null 1985before attempting to modify the storage allocated. This check is 1986normally unnecessary because the C++ standard specifies that 1987@code{operator new} only returns @code{0} if it is declared 1988@samp{throw()}, in which case the compiler always checks the 1989return value even without this option. In all other cases, when 1990@code{operator new} has a non-empty exception specification, memory 1991exhaustion is signalled by throwing @code{std::bad_alloc}. See also 1992@samp{new (nothrow)}. 1993 1994@item -fconstexpr-depth=@var{n} 1995@opindex fconstexpr-depth 1996Set the maximum nested evaluation depth for C++11 constexpr functions 1997to @var{n}. A limit is needed to detect endless recursion during 1998constant expression evaluation. The minimum specified by the standard 1999is 512. 2000 2001@item -fdeduce-init-list 2002@opindex fdeduce-init-list 2003Enable deduction of a template type parameter as 2004@code{std::initializer_list} from a brace-enclosed initializer list, i.e.@: 2005 2006@smallexample 2007template <class T> auto forward(T t) -> decltype (realfn (t)) 2008@{ 2009 return realfn (t); 2010@} 2011 2012void f() 2013@{ 2014 forward(@{1,2@}); // call forward<std::initializer_list<int>> 2015@} 2016@end smallexample 2017 2018This deduction was implemented as a possible extension to the 2019originally proposed semantics for the C++11 standard, but was not part 2020of the final standard, so it is disabled by default. This option is 2021deprecated, and may be removed in a future version of G++. 2022 2023@item -ffriend-injection 2024@opindex ffriend-injection 2025Inject friend functions into the enclosing namespace, so that they are 2026visible outside the scope of the class in which they are declared. 2027Friend functions were documented to work this way in the old Annotated 2028C++ Reference Manual, and versions of G++ before 4.1 always worked 2029that way. However, in ISO C++ a friend function that is not declared 2030in an enclosing scope can only be found using argument dependent 2031lookup. This option causes friends to be injected as they were in 2032earlier releases. 2033 2034This option is for compatibility, and may be removed in a future 2035release of G++. 2036 2037@item -fno-elide-constructors 2038@opindex fno-elide-constructors 2039The C++ standard allows an implementation to omit creating a temporary 2040that is only used to initialize another object of the same type. 2041Specifying this option disables that optimization, and forces G++ to 2042call the copy constructor in all cases. 2043 2044@item -fno-enforce-eh-specs 2045@opindex fno-enforce-eh-specs 2046Don't generate code to check for violation of exception specifications 2047at run time. This option violates the C++ standard, but may be useful 2048for reducing code size in production builds, much like defining 2049@samp{NDEBUG}. This does not give user code permission to throw 2050exceptions in violation of the exception specifications; the compiler 2051still optimizes based on the specifications, so throwing an 2052unexpected exception results in undefined behavior at run time. 2053 2054@item -fextern-tls-init 2055@itemx -fno-extern-tls-init 2056@opindex fextern-tls-init 2057@opindex fno-extern-tls-init 2058The C++11 and OpenMP standards allow @samp{thread_local} and 2059@samp{threadprivate} variables to have dynamic (runtime) 2060initialization. To support this, any use of such a variable goes 2061through a wrapper function that performs any necessary initialization. 2062When the use and definition of the variable are in the same 2063translation unit, this overhead can be optimized away, but when the 2064use is in a different translation unit there is significant overhead 2065even if the variable doesn't actually need dynamic initialization. If 2066the programmer can be sure that no use of the variable in a 2067non-defining TU needs to trigger dynamic initialization (either 2068because the variable is statically initialized, or a use of the 2069variable in the defining TU will be executed before any uses in 2070another TU), they can avoid this overhead with the 2071@option{-fno-extern-tls-init} option. 2072 2073On targets that support symbol aliases, the default is 2074@option{-fextern-tls-init}. On targets that do not support symbol 2075aliases, the default is @option{-fno-extern-tls-init}. 2076 2077@item -ffor-scope 2078@itemx -fno-for-scope 2079@opindex ffor-scope 2080@opindex fno-for-scope 2081If @option{-ffor-scope} is specified, the scope of variables declared in 2082a @i{for-init-statement} is limited to the @samp{for} loop itself, 2083as specified by the C++ standard. 2084If @option{-fno-for-scope} is specified, the scope of variables declared in 2085a @i{for-init-statement} extends to the end of the enclosing scope, 2086as was the case in old versions of G++, and other (traditional) 2087implementations of C++. 2088 2089If neither flag is given, the default is to follow the standard, 2090but to allow and give a warning for old-style code that would 2091otherwise be invalid, or have different behavior. 2092 2093@item -fno-gnu-keywords 2094@opindex fno-gnu-keywords 2095Do not recognize @code{typeof} as a keyword, so that code can use this 2096word as an identifier. You can use the keyword @code{__typeof__} instead. 2097@option{-ansi} implies @option{-fno-gnu-keywords}. 2098 2099@item -fno-implicit-templates 2100@opindex fno-implicit-templates 2101Never emit code for non-inline templates that are instantiated 2102implicitly (i.e.@: by use); only emit code for explicit instantiations. 2103@xref{Template Instantiation}, for more information. 2104 2105@item -fno-implicit-inline-templates 2106@opindex fno-implicit-inline-templates 2107Don't emit code for implicit instantiations of inline templates, either. 2108The default is to handle inlines differently so that compiles with and 2109without optimization need the same set of explicit instantiations. 2110 2111@item -fno-implement-inlines 2112@opindex fno-implement-inlines 2113To save space, do not emit out-of-line copies of inline functions 2114controlled by @samp{#pragma implementation}. This causes linker 2115errors if these functions are not inlined everywhere they are called. 2116 2117@item -fms-extensions 2118@opindex fms-extensions 2119Disable Wpedantic warnings about constructs used in MFC, such as implicit 2120int and getting a pointer to member function via non-standard syntax. 2121 2122@item -fno-nonansi-builtins 2123@opindex fno-nonansi-builtins 2124Disable built-in declarations of functions that are not mandated by 2125ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit}, 2126@code{index}, @code{bzero}, @code{conjf}, and other related functions. 2127 2128@item -fnothrow-opt 2129@opindex fnothrow-opt 2130Treat a @code{throw()} exception specification as if it were a 2131@code{noexcept} specification to reduce or eliminate the text size 2132overhead relative to a function with no exception specification. If 2133the function has local variables of types with non-trivial 2134destructors, the exception specification actually makes the 2135function smaller because the EH cleanups for those variables can be 2136optimized away. The semantic effect is that an exception thrown out of 2137a function with such an exception specification results in a call 2138to @code{terminate} rather than @code{unexpected}. 2139 2140@item -fno-operator-names 2141@opindex fno-operator-names 2142Do not treat the operator name keywords @code{and}, @code{bitand}, 2143@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as 2144synonyms as keywords. 2145 2146@item -fno-optional-diags 2147@opindex fno-optional-diags 2148Disable diagnostics that the standard says a compiler does not need to 2149issue. Currently, the only such diagnostic issued by G++ is the one for 2150a name having multiple meanings within a class. 2151 2152@item -fpermissive 2153@opindex fpermissive 2154Downgrade some diagnostics about nonconformant code from errors to 2155warnings. Thus, using @option{-fpermissive} allows some 2156nonconforming code to compile. 2157 2158@item -fno-pretty-templates 2159@opindex fno-pretty-templates 2160When an error message refers to a specialization of a function 2161template, the compiler normally prints the signature of the 2162template followed by the template arguments and any typedefs or 2163typenames in the signature (e.g. @code{void f(T) [with T = int]} 2164rather than @code{void f(int)}) so that it's clear which template is 2165involved. When an error message refers to a specialization of a class 2166template, the compiler omits any template arguments that match 2167the default template arguments for that template. If either of these 2168behaviors make it harder to understand the error message rather than 2169easier, you can use @option{-fno-pretty-templates} to disable them. 2170 2171@item -frepo 2172@opindex frepo 2173Enable automatic template instantiation at link time. This option also 2174implies @option{-fno-implicit-templates}. @xref{Template 2175Instantiation}, for more information. 2176 2177@item -fno-rtti 2178@opindex fno-rtti 2179Disable generation of information about every class with virtual 2180functions for use by the C++ run-time type identification features 2181(@samp{dynamic_cast} and @samp{typeid}). If you don't use those parts 2182of the language, you can save some space by using this flag. Note that 2183exception handling uses the same information, but G++ generates it as 2184needed. The @samp{dynamic_cast} operator can still be used for casts that 2185do not require run-time type information, i.e.@: casts to @code{void *} or to 2186unambiguous base classes. 2187 2188@item -fstats 2189@opindex fstats 2190Emit statistics about front-end processing at the end of the compilation. 2191This information is generally only useful to the G++ development team. 2192 2193@item -fstrict-enums 2194@opindex fstrict-enums 2195Allow the compiler to optimize using the assumption that a value of 2196enumerated type can only be one of the values of the enumeration (as 2197defined in the C++ standard; basically, a value that can be 2198represented in the minimum number of bits needed to represent all the 2199enumerators). This assumption may not be valid if the program uses a 2200cast to convert an arbitrary integer value to the enumerated type. 2201 2202@item -ftemplate-backtrace-limit=@var{n} 2203@opindex ftemplate-backtrace-limit 2204Set the maximum number of template instantiation notes for a single 2205warning or error to @var{n}. The default value is 10. 2206 2207@item -ftemplate-depth=@var{n} 2208@opindex ftemplate-depth 2209Set the maximum instantiation depth for template classes to @var{n}. 2210A limit on the template instantiation depth is needed to detect 2211endless recursions during template class instantiation. ANSI/ISO C++ 2212conforming programs must not rely on a maximum depth greater than 17 2213(changed to 1024 in C++11). The default value is 900, as the compiler 2214can run out of stack space before hitting 1024 in some situations. 2215 2216@item -fno-threadsafe-statics 2217@opindex fno-threadsafe-statics 2218Do not emit the extra code to use the routines specified in the C++ 2219ABI for thread-safe initialization of local statics. You can use this 2220option to reduce code size slightly in code that doesn't need to be 2221thread-safe. 2222 2223@item -fuse-cxa-atexit 2224@opindex fuse-cxa-atexit 2225Register destructors for objects with static storage duration with the 2226@code{__cxa_atexit} function rather than the @code{atexit} function. 2227This option is required for fully standards-compliant handling of static 2228destructors, but only works if your C library supports 2229@code{__cxa_atexit}. 2230 2231@item -fno-use-cxa-get-exception-ptr 2232@opindex fno-use-cxa-get-exception-ptr 2233Don't use the @code{__cxa_get_exception_ptr} runtime routine. This 2234causes @code{std::uncaught_exception} to be incorrect, but is necessary 2235if the runtime routine is not available. 2236 2237@item -fvisibility-inlines-hidden 2238@opindex fvisibility-inlines-hidden 2239This switch declares that the user does not attempt to compare 2240pointers to inline functions or methods where the addresses of the two functions 2241are taken in different shared objects. 2242 2243The effect of this is that GCC may, effectively, mark inline methods with 2244@code{__attribute__ ((visibility ("hidden")))} so that they do not 2245appear in the export table of a DSO and do not require a PLT indirection 2246when used within the DSO@. Enabling this option can have a dramatic effect 2247on load and link times of a DSO as it massively reduces the size of the 2248dynamic export table when the library makes heavy use of templates. 2249 2250The behavior of this switch is not quite the same as marking the 2251methods as hidden directly, because it does not affect static variables 2252local to the function or cause the compiler to deduce that 2253the function is defined in only one shared object. 2254 2255You may mark a method as having a visibility explicitly to negate the 2256effect of the switch for that method. For example, if you do want to 2257compare pointers to a particular inline method, you might mark it as 2258having default visibility. Marking the enclosing class with explicit 2259visibility has no effect. 2260 2261Explicitly instantiated inline methods are unaffected by this option 2262as their linkage might otherwise cross a shared library boundary. 2263@xref{Template Instantiation}. 2264 2265@item -fvisibility-ms-compat 2266@opindex fvisibility-ms-compat 2267This flag attempts to use visibility settings to make GCC's C++ 2268linkage model compatible with that of Microsoft Visual Studio. 2269 2270The flag makes these changes to GCC's linkage model: 2271 2272@enumerate 2273@item 2274It sets the default visibility to @code{hidden}, like 2275@option{-fvisibility=hidden}. 2276 2277@item 2278Types, but not their members, are not hidden by default. 2279 2280@item 2281The One Definition Rule is relaxed for types without explicit 2282visibility specifications that are defined in more than one 2283shared object: those declarations are permitted if they are 2284permitted when this option is not used. 2285@end enumerate 2286 2287In new code it is better to use @option{-fvisibility=hidden} and 2288export those classes that are intended to be externally visible. 2289Unfortunately it is possible for code to rely, perhaps accidentally, 2290on the Visual Studio behavior. 2291 2292Among the consequences of these changes are that static data members 2293of the same type with the same name but defined in different shared 2294objects are different, so changing one does not change the other; 2295and that pointers to function members defined in different shared 2296objects may not compare equal. When this flag is given, it is a 2297violation of the ODR to define types with the same name differently. 2298 2299@item -fno-weak 2300@opindex fno-weak 2301Do not use weak symbol support, even if it is provided by the linker. 2302By default, G++ uses weak symbols if they are available. This 2303option exists only for testing, and should not be used by end-users; 2304it results in inferior code and has no benefits. This option may 2305be removed in a future release of G++. 2306 2307@item -nostdinc++ 2308@opindex nostdinc++ 2309Do not search for header files in the standard directories specific to 2310C++, but do still search the other standard directories. (This option 2311is used when building the C++ library.) 2312@end table 2313 2314In addition, these optimization, warning, and code generation options 2315have meanings only for C++ programs: 2316 2317@table @gcctabopt 2318@item -fno-default-inline 2319@opindex fno-default-inline 2320Do not assume @samp{inline} for functions defined inside a class scope. 2321@xref{Optimize Options,,Options That Control Optimization}. Note that these 2322functions have linkage like inline functions; they just aren't 2323inlined by default. 2324 2325@item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)} 2326@opindex Wabi 2327@opindex Wno-abi 2328Warn when G++ generates code that is probably not compatible with the 2329vendor-neutral C++ ABI@. Although an effort has been made to warn about 2330all such cases, there are probably some cases that are not warned about, 2331even though G++ is generating incompatible code. There may also be 2332cases where warnings are emitted even though the code that is generated 2333is compatible. 2334 2335You should rewrite your code to avoid these warnings if you are 2336concerned about the fact that code generated by G++ may not be binary 2337compatible with code generated by other compilers. 2338 2339The known incompatibilities in @option{-fabi-version=2} (the default) include: 2340 2341@itemize @bullet 2342 2343@item 2344A template with a non-type template parameter of reference type is 2345mangled incorrectly: 2346@smallexample 2347extern int N; 2348template <int &> struct S @{@}; 2349void n (S<N>) @{2@} 2350@end smallexample 2351 2352This is fixed in @option{-fabi-version=3}. 2353 2354@item 2355SIMD vector types declared using @code{__attribute ((vector_size))} are 2356mangled in a non-standard way that does not allow for overloading of 2357functions taking vectors of different sizes. 2358 2359The mangling is changed in @option{-fabi-version=4}. 2360@end itemize 2361 2362The known incompatibilities in @option{-fabi-version=1} include: 2363 2364@itemize @bullet 2365 2366@item 2367Incorrect handling of tail-padding for bit-fields. G++ may attempt to 2368pack data into the same byte as a base class. For example: 2369 2370@smallexample 2371struct A @{ virtual void f(); int f1 : 1; @}; 2372struct B : public A @{ int f2 : 1; @}; 2373@end smallexample 2374 2375@noindent 2376In this case, G++ places @code{B::f2} into the same byte 2377as @code{A::f1}; other compilers do not. You can avoid this problem 2378by explicitly padding @code{A} so that its size is a multiple of the 2379byte size on your platform; that causes G++ and other compilers to 2380lay out @code{B} identically. 2381 2382@item 2383Incorrect handling of tail-padding for virtual bases. G++ does not use 2384tail padding when laying out virtual bases. For example: 2385 2386@smallexample 2387struct A @{ virtual void f(); char c1; @}; 2388struct B @{ B(); char c2; @}; 2389struct C : public A, public virtual B @{@}; 2390@end smallexample 2391 2392@noindent 2393In this case, G++ does not place @code{B} into the tail-padding for 2394@code{A}; other compilers do. You can avoid this problem by 2395explicitly padding @code{A} so that its size is a multiple of its 2396alignment (ignoring virtual base classes); that causes G++ and other 2397compilers to lay out @code{C} identically. 2398 2399@item 2400Incorrect handling of bit-fields with declared widths greater than that 2401of their underlying types, when the bit-fields appear in a union. For 2402example: 2403 2404@smallexample 2405union U @{ int i : 4096; @}; 2406@end smallexample 2407 2408@noindent 2409Assuming that an @code{int} does not have 4096 bits, G++ makes the 2410union too small by the number of bits in an @code{int}. 2411 2412@item 2413Empty classes can be placed at incorrect offsets. For example: 2414 2415@smallexample 2416struct A @{@}; 2417 2418struct B @{ 2419 A a; 2420 virtual void f (); 2421@}; 2422 2423struct C : public B, public A @{@}; 2424@end smallexample 2425 2426@noindent 2427G++ places the @code{A} base class of @code{C} at a nonzero offset; 2428it should be placed at offset zero. G++ mistakenly believes that the 2429@code{A} data member of @code{B} is already at offset zero. 2430 2431@item 2432Names of template functions whose types involve @code{typename} or 2433template template parameters can be mangled incorrectly. 2434 2435@smallexample 2436template <typename Q> 2437void f(typename Q::X) @{@} 2438 2439template <template <typename> class Q> 2440void f(typename Q<int>::X) @{@} 2441@end smallexample 2442 2443@noindent 2444Instantiations of these templates may be mangled incorrectly. 2445 2446@end itemize 2447 2448It also warns about psABI-related changes. The known psABI changes at this 2449point include: 2450 2451@itemize @bullet 2452 2453@item 2454For SysV/x86-64, unions with @code{long double} members are 2455passed in memory as specified in psABI. For example: 2456 2457@smallexample 2458union U @{ 2459 long double ld; 2460 int i; 2461@}; 2462@end smallexample 2463 2464@noindent 2465@code{union U} is always passed in memory. 2466 2467@end itemize 2468 2469@item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)} 2470@opindex Wctor-dtor-privacy 2471@opindex Wno-ctor-dtor-privacy 2472Warn when a class seems unusable because all the constructors or 2473destructors in that class are private, and it has neither friends nor 2474public static member functions. Also warn if there are no non-private 2475methods, and there's at least one private member function that isn't 2476a constructor or destructor. 2477 2478@item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)} 2479@opindex Wdelete-non-virtual-dtor 2480@opindex Wno-delete-non-virtual-dtor 2481Warn when @samp{delete} is used to destroy an instance of a class that 2482has virtual functions and non-virtual destructor. It is unsafe to delete 2483an instance of a derived class through a pointer to a base class if the 2484base class does not have a virtual destructor. This warning is enabled 2485by @option{-Wall}. 2486 2487@item -Wliteral-suffix @r{(C++ and Objective-C++ only)} 2488@opindex Wliteral-suffix 2489@opindex Wno-literal-suffix 2490Warn when a string or character literal is followed by a ud-suffix which does 2491not begin with an underscore. As a conforming extension, GCC treats such 2492suffixes as separate preprocessing tokens in order to maintain backwards 2493compatibility with code that uses formatting macros from @code{<inttypes.h>}. 2494For example: 2495 2496@smallexample 2497#define __STDC_FORMAT_MACROS 2498#include <inttypes.h> 2499#include <stdio.h> 2500 2501int main() @{ 2502 int64_t i64 = 123; 2503 printf("My int64: %"PRId64"\n", i64); 2504@} 2505@end smallexample 2506 2507In this case, @code{PRId64} is treated as a separate preprocessing token. 2508 2509This warning is enabled by default. 2510 2511@item -Wnarrowing @r{(C++ and Objective-C++ only)} 2512@opindex Wnarrowing 2513@opindex Wno-narrowing 2514Warn when a narrowing conversion prohibited by C++11 occurs within 2515@samp{@{ @}}, e.g. 2516 2517@smallexample 2518int i = @{ 2.2 @}; // error: narrowing from double to int 2519@end smallexample 2520 2521This flag is included in @option{-Wall} and @option{-Wc++11-compat}. 2522 2523With @option{-std=c++11}, @option{-Wno-narrowing} suppresses the diagnostic 2524required by the standard. Note that this does not affect the meaning 2525of well-formed code; narrowing conversions are still considered 2526ill-formed in SFINAE context. 2527 2528@item -Wnoexcept @r{(C++ and Objective-C++ only)} 2529@opindex Wnoexcept 2530@opindex Wno-noexcept 2531Warn when a noexcept-expression evaluates to false because of a call 2532to a function that does not have a non-throwing exception 2533specification (i.e. @samp{throw()} or @samp{noexcept}) but is known by 2534the compiler to never throw an exception. 2535 2536@item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)} 2537@opindex Wnon-virtual-dtor 2538@opindex Wno-non-virtual-dtor 2539Warn when a class has virtual functions and an accessible non-virtual 2540destructor, in which case it is possible but unsafe to delete 2541an instance of a derived class through a pointer to the base class. 2542This warning is also enabled if @option{-Weffc++} is specified. 2543 2544@item -Wreorder @r{(C++ and Objective-C++ only)} 2545@opindex Wreorder 2546@opindex Wno-reorder 2547@cindex reordering, warning 2548@cindex warning for reordering of member initializers 2549Warn when the order of member initializers given in the code does not 2550match the order in which they must be executed. For instance: 2551 2552@smallexample 2553struct A @{ 2554 int i; 2555 int j; 2556 A(): j (0), i (1) @{ @} 2557@}; 2558@end smallexample 2559 2560@noindent 2561The compiler rearranges the member initializers for @samp{i} 2562and @samp{j} to match the declaration order of the members, emitting 2563a warning to that effect. This warning is enabled by @option{-Wall}. 2564 2565@item -fext-numeric-literals @r{(C++ and Objective-C++ only)} 2566@opindex fext-numeric-literals 2567@opindex fno-ext-numeric-literals 2568Accept imaginary, fixed-point, or machine-defined 2569literal number suffixes as GNU extensions. 2570When this option is turned off these suffixes are treated 2571as C++11 user-defined literal numeric suffixes. 2572This is on by default for all pre-C++11 dialects and all GNU dialects: 2573@option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11}, 2574@option{-std=gnu++1y}. 2575This option is off by default 2576for ISO C++11 onwards (@option{-std=c++11}, ...). 2577@end table 2578 2579The following @option{-W@dots{}} options are not affected by @option{-Wall}. 2580 2581@table @gcctabopt 2582@item -Weffc++ @r{(C++ and Objective-C++ only)} 2583@opindex Weffc++ 2584@opindex Wno-effc++ 2585Warn about violations of the following style guidelines from Scott Meyers' 2586@cite{Effective C++, Second Edition} book: 2587 2588@itemize @bullet 2589@item 2590Item 11: Define a copy constructor and an assignment operator for classes 2591with dynamically-allocated memory. 2592 2593@item 2594Item 12: Prefer initialization to assignment in constructors. 2595 2596@item 2597Item 14: Make destructors virtual in base classes. 2598 2599@item 2600Item 15: Have @code{operator=} return a reference to @code{*this}. 2601 2602@item 2603Item 23: Don't try to return a reference when you must return an object. 2604 2605@end itemize 2606 2607Also warn about violations of the following style guidelines from 2608Scott Meyers' @cite{More Effective C++} book: 2609 2610@itemize @bullet 2611@item 2612Item 6: Distinguish between prefix and postfix forms of increment and 2613decrement operators. 2614 2615@item 2616Item 7: Never overload @code{&&}, @code{||}, or @code{,}. 2617 2618@end itemize 2619 2620When selecting this option, be aware that the standard library 2621headers do not obey all of these guidelines; use @samp{grep -v} 2622to filter out those warnings. 2623 2624@item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)} 2625@opindex Wstrict-null-sentinel 2626@opindex Wno-strict-null-sentinel 2627Warn about the use of an uncasted @code{NULL} as sentinel. When 2628compiling only with GCC this is a valid sentinel, as @code{NULL} is defined 2629to @code{__null}. Although it is a null pointer constant rather than a 2630null pointer, it is guaranteed to be of the same size as a pointer. 2631But this use is not portable across different compilers. 2632 2633@item -Wno-non-template-friend @r{(C++ and Objective-C++ only)} 2634@opindex Wno-non-template-friend 2635@opindex Wnon-template-friend 2636Disable warnings when non-templatized friend functions are declared 2637within a template. Since the advent of explicit template specification 2638support in G++, if the name of the friend is an unqualified-id (i.e., 2639@samp{friend foo(int)}), the C++ language specification demands that the 2640friend declare or define an ordinary, nontemplate function. (Section 264114.5.3). Before G++ implemented explicit specification, unqualified-ids 2642could be interpreted as a particular specialization of a templatized 2643function. Because this non-conforming behavior is no longer the default 2644behavior for G++, @option{-Wnon-template-friend} allows the compiler to 2645check existing code for potential trouble spots and is on by default. 2646This new compiler behavior can be turned off with 2647@option{-Wno-non-template-friend}, which keeps the conformant compiler code 2648but disables the helpful warning. 2649 2650@item -Wold-style-cast @r{(C++ and Objective-C++ only)} 2651@opindex Wold-style-cast 2652@opindex Wno-old-style-cast 2653Warn if an old-style (C-style) cast to a non-void type is used within 2654a C++ program. The new-style casts (@samp{dynamic_cast}, 2655@samp{static_cast}, @samp{reinterpret_cast}, and @samp{const_cast}) are 2656less vulnerable to unintended effects and much easier to search for. 2657 2658@item -Woverloaded-virtual @r{(C++ and Objective-C++ only)} 2659@opindex Woverloaded-virtual 2660@opindex Wno-overloaded-virtual 2661@cindex overloaded virtual function, warning 2662@cindex warning for overloaded virtual function 2663Warn when a function declaration hides virtual functions from a 2664base class. For example, in: 2665 2666@smallexample 2667struct A @{ 2668 virtual void f(); 2669@}; 2670 2671struct B: public A @{ 2672 void f(int); 2673@}; 2674@end smallexample 2675 2676the @code{A} class version of @code{f} is hidden in @code{B}, and code 2677like: 2678 2679@smallexample 2680B* b; 2681b->f(); 2682@end smallexample 2683 2684@noindent 2685fails to compile. 2686 2687@item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)} 2688@opindex Wno-pmf-conversions 2689@opindex Wpmf-conversions 2690Disable the diagnostic for converting a bound pointer to member function 2691to a plain pointer. 2692 2693@item -Wsign-promo @r{(C++ and Objective-C++ only)} 2694@opindex Wsign-promo 2695@opindex Wno-sign-promo 2696Warn when overload resolution chooses a promotion from unsigned or 2697enumerated type to a signed type, over a conversion to an unsigned type of 2698the same size. Previous versions of G++ tried to preserve 2699unsignedness, but the standard mandates the current behavior. 2700@end table 2701 2702@node Objective-C and Objective-C++ Dialect Options 2703@section Options Controlling Objective-C and Objective-C++ Dialects 2704 2705@cindex compiler options, Objective-C and Objective-C++ 2706@cindex Objective-C and Objective-C++ options, command-line 2707@cindex options, Objective-C and Objective-C++ 2708(NOTE: This manual does not describe the Objective-C and Objective-C++ 2709languages themselves. @xref{Standards,,Language Standards 2710Supported by GCC}, for references.) 2711 2712This section describes the command-line options that are only meaningful 2713for Objective-C and Objective-C++ programs. You can also use most of 2714the language-independent GNU compiler options. 2715For example, you might compile a file @code{some_class.m} like this: 2716 2717@smallexample 2718gcc -g -fgnu-runtime -O -c some_class.m 2719@end smallexample 2720 2721@noindent 2722In this example, @option{-fgnu-runtime} is an option meant only for 2723Objective-C and Objective-C++ programs; you can use the other options with 2724any language supported by GCC@. 2725 2726Note that since Objective-C is an extension of the C language, Objective-C 2727compilations may also use options specific to the C front-end (e.g., 2728@option{-Wtraditional}). Similarly, Objective-C++ compilations may use 2729C++-specific options (e.g., @option{-Wabi}). 2730 2731Here is a list of options that are @emph{only} for compiling Objective-C 2732and Objective-C++ programs: 2733 2734@table @gcctabopt 2735@item -fconstant-string-class=@var{class-name} 2736@opindex fconstant-string-class 2737Use @var{class-name} as the name of the class to instantiate for each 2738literal string specified with the syntax @code{@@"@dots{}"}. The default 2739class name is @code{NXConstantString} if the GNU runtime is being used, and 2740@code{NSConstantString} if the NeXT runtime is being used (see below). The 2741@option{-fconstant-cfstrings} option, if also present, overrides the 2742@option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals 2743to be laid out as constant CoreFoundation strings. 2744 2745@item -fgnu-runtime 2746@opindex fgnu-runtime 2747Generate object code compatible with the standard GNU Objective-C 2748runtime. This is the default for most types of systems. 2749 2750@item -fnext-runtime 2751@opindex fnext-runtime 2752Generate output compatible with the NeXT runtime. This is the default 2753for NeXT-based systems, including Darwin and Mac OS X@. The macro 2754@code{__NEXT_RUNTIME__} is predefined if (and only if) this option is 2755used. 2756 2757@item -fno-nil-receivers 2758@opindex fno-nil-receivers 2759Assume that all Objective-C message dispatches (@code{[receiver 2760message:arg]}) in this translation unit ensure that the receiver is 2761not @code{nil}. This allows for more efficient entry points in the 2762runtime to be used. This option is only available in conjunction with 2763the NeXT runtime and ABI version 0 or 1. 2764 2765@item -fobjc-abi-version=@var{n} 2766@opindex fobjc-abi-version 2767Use version @var{n} of the Objective-C ABI for the selected runtime. 2768This option is currently supported only for the NeXT runtime. In that 2769case, Version 0 is the traditional (32-bit) ABI without support for 2770properties and other Objective-C 2.0 additions. Version 1 is the 2771traditional (32-bit) ABI with support for properties and other 2772Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If 2773nothing is specified, the default is Version 0 on 32-bit target 2774machines, and Version 2 on 64-bit target machines. 2775 2776@item -fobjc-call-cxx-cdtors 2777@opindex fobjc-call-cxx-cdtors 2778For each Objective-C class, check if any of its instance variables is a 2779C++ object with a non-trivial default constructor. If so, synthesize a 2780special @code{- (id) .cxx_construct} instance method which runs 2781non-trivial default constructors on any such instance variables, in order, 2782and then return @code{self}. Similarly, check if any instance variable 2783is a C++ object with a non-trivial destructor, and if so, synthesize a 2784special @code{- (void) .cxx_destruct} method which runs 2785all such default destructors, in reverse order. 2786 2787The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct} 2788methods thusly generated only operate on instance variables 2789declared in the current Objective-C class, and not those inherited 2790from superclasses. It is the responsibility of the Objective-C 2791runtime to invoke all such methods in an object's inheritance 2792hierarchy. The @code{- (id) .cxx_construct} methods are invoked 2793by the runtime immediately after a new object instance is allocated; 2794the @code{- (void) .cxx_destruct} methods are invoked immediately 2795before the runtime deallocates an object instance. 2796 2797As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has 2798support for invoking the @code{- (id) .cxx_construct} and 2799@code{- (void) .cxx_destruct} methods. 2800 2801@item -fobjc-direct-dispatch 2802@opindex fobjc-direct-dispatch 2803Allow fast jumps to the message dispatcher. On Darwin this is 2804accomplished via the comm page. 2805 2806@item -fobjc-exceptions 2807@opindex fobjc-exceptions 2808Enable syntactic support for structured exception handling in 2809Objective-C, similar to what is offered by C++ and Java. This option 2810is required to use the Objective-C keywords @code{@@try}, 2811@code{@@throw}, @code{@@catch}, @code{@@finally} and 2812@code{@@synchronized}. This option is available with both the GNU 2813runtime and the NeXT runtime (but not available in conjunction with 2814the NeXT runtime on Mac OS X 10.2 and earlier). 2815 2816@item -fobjc-gc 2817@opindex fobjc-gc 2818Enable garbage collection (GC) in Objective-C and Objective-C++ 2819programs. This option is only available with the NeXT runtime; the 2820GNU runtime has a different garbage collection implementation that 2821does not require special compiler flags. 2822 2823@item -fobjc-nilcheck 2824@opindex fobjc-nilcheck 2825For the NeXT runtime with version 2 of the ABI, check for a nil 2826receiver in method invocations before doing the actual method call. 2827This is the default and can be disabled using 2828@option{-fno-objc-nilcheck}. Class methods and super calls are never 2829checked for nil in this way no matter what this flag is set to. 2830Currently this flag does nothing when the GNU runtime, or an older 2831version of the NeXT runtime ABI, is used. 2832 2833@item -fobjc-std=objc1 2834@opindex fobjc-std 2835Conform to the language syntax of Objective-C 1.0, the language 2836recognized by GCC 4.0. This only affects the Objective-C additions to 2837the C/C++ language; it does not affect conformance to C/C++ standards, 2838which is controlled by the separate C/C++ dialect option flags. When 2839this option is used with the Objective-C or Objective-C++ compiler, 2840any Objective-C syntax that is not recognized by GCC 4.0 is rejected. 2841This is useful if you need to make sure that your Objective-C code can 2842be compiled with older versions of GCC@. 2843 2844@item -freplace-objc-classes 2845@opindex freplace-objc-classes 2846Emit a special marker instructing @command{ld(1)} not to statically link in 2847the resulting object file, and allow @command{dyld(1)} to load it in at 2848run time instead. This is used in conjunction with the Fix-and-Continue 2849debugging mode, where the object file in question may be recompiled and 2850dynamically reloaded in the course of program execution, without the need 2851to restart the program itself. Currently, Fix-and-Continue functionality 2852is only available in conjunction with the NeXT runtime on Mac OS X 10.3 2853and later. 2854 2855@item -fzero-link 2856@opindex fzero-link 2857When compiling for the NeXT runtime, the compiler ordinarily replaces calls 2858to @code{objc_getClass("@dots{}")} (when the name of the class is known at 2859compile time) with static class references that get initialized at load time, 2860which improves run-time performance. Specifying the @option{-fzero-link} flag 2861suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")} 2862to be retained. This is useful in Zero-Link debugging mode, since it allows 2863for individual class implementations to be modified during program execution. 2864The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")} 2865regardless of command-line options. 2866 2867@item -gen-decls 2868@opindex gen-decls 2869Dump interface declarations for all classes seen in the source file to a 2870file named @file{@var{sourcename}.decl}. 2871 2872@item -Wassign-intercept @r{(Objective-C and Objective-C++ only)} 2873@opindex Wassign-intercept 2874@opindex Wno-assign-intercept 2875Warn whenever an Objective-C assignment is being intercepted by the 2876garbage collector. 2877 2878@item -Wno-protocol @r{(Objective-C and Objective-C++ only)} 2879@opindex Wno-protocol 2880@opindex Wprotocol 2881If a class is declared to implement a protocol, a warning is issued for 2882every method in the protocol that is not implemented by the class. The 2883default behavior is to issue a warning for every method not explicitly 2884implemented in the class, even if a method implementation is inherited 2885from the superclass. If you use the @option{-Wno-protocol} option, then 2886methods inherited from the superclass are considered to be implemented, 2887and no warning is issued for them. 2888 2889@item -Wselector @r{(Objective-C and Objective-C++ only)} 2890@opindex Wselector 2891@opindex Wno-selector 2892Warn if multiple methods of different types for the same selector are 2893found during compilation. The check is performed on the list of methods 2894in the final stage of compilation. Additionally, a check is performed 2895for each selector appearing in a @code{@@selector(@dots{})} 2896expression, and a corresponding method for that selector has been found 2897during compilation. Because these checks scan the method table only at 2898the end of compilation, these warnings are not produced if the final 2899stage of compilation is not reached, for example because an error is 2900found during compilation, or because the @option{-fsyntax-only} option is 2901being used. 2902 2903@item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)} 2904@opindex Wstrict-selector-match 2905@opindex Wno-strict-selector-match 2906Warn if multiple methods with differing argument and/or return types are 2907found for a given selector when attempting to send a message using this 2908selector to a receiver of type @code{id} or @code{Class}. When this flag 2909is off (which is the default behavior), the compiler omits such warnings 2910if any differences found are confined to types that share the same size 2911and alignment. 2912 2913@item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)} 2914@opindex Wundeclared-selector 2915@opindex Wno-undeclared-selector 2916Warn if a @code{@@selector(@dots{})} expression referring to an 2917undeclared selector is found. A selector is considered undeclared if no 2918method with that name has been declared before the 2919@code{@@selector(@dots{})} expression, either explicitly in an 2920@code{@@interface} or @code{@@protocol} declaration, or implicitly in 2921an @code{@@implementation} section. This option always performs its 2922checks as soon as a @code{@@selector(@dots{})} expression is found, 2923while @option{-Wselector} only performs its checks in the final stage of 2924compilation. This also enforces the coding style convention 2925that methods and selectors must be declared before being used. 2926 2927@item -print-objc-runtime-info 2928@opindex print-objc-runtime-info 2929Generate C header describing the largest structure that is passed by 2930value, if any. 2931 2932@end table 2933 2934@node Language Independent Options 2935@section Options to Control Diagnostic Messages Formatting 2936@cindex options to control diagnostics formatting 2937@cindex diagnostic messages 2938@cindex message formatting 2939 2940Traditionally, diagnostic messages have been formatted irrespective of 2941the output device's aspect (e.g.@: its width, @dots{}). You can use the 2942options described below 2943to control the formatting algorithm for diagnostic messages, 2944e.g.@: how many characters per line, how often source location 2945information should be reported. Note that some language front ends may not 2946honor these options. 2947 2948@table @gcctabopt 2949@item -fmessage-length=@var{n} 2950@opindex fmessage-length 2951Try to format error messages so that they fit on lines of about @var{n} 2952characters. The default is 72 characters for @command{g++} and 0 for the rest of 2953the front ends supported by GCC@. If @var{n} is zero, then no 2954line-wrapping is done; each error message appears on a single 2955line. 2956 2957@item -fdiagnostics-show-location=once 2958@opindex fdiagnostics-show-location 2959Only meaningful in line-wrapping mode. Instructs the diagnostic messages 2960reporter to emit source location information @emph{once}; that is, in 2961case the message is too long to fit on a single physical line and has to 2962be wrapped, the source location won't be emitted (as prefix) again, 2963over and over, in subsequent continuation lines. This is the default 2964behavior. 2965 2966@item -fdiagnostics-show-location=every-line 2967Only meaningful in line-wrapping mode. Instructs the diagnostic 2968messages reporter to emit the same source location information (as 2969prefix) for physical lines that result from the process of breaking 2970a message which is too long to fit on a single line. 2971 2972@item -fno-diagnostics-show-option 2973@opindex fno-diagnostics-show-option 2974@opindex fdiagnostics-show-option 2975By default, each diagnostic emitted includes text indicating the 2976command-line option that directly controls the diagnostic (if such an 2977option is known to the diagnostic machinery). Specifying the 2978@option{-fno-diagnostics-show-option} flag suppresses that behavior. 2979 2980@item -fno-diagnostics-show-caret 2981@opindex fno-diagnostics-show-caret 2982@opindex fdiagnostics-show-caret 2983By default, each diagnostic emitted includes the original source line 2984and a caret '^' indicating the column. This option suppresses this 2985information. 2986 2987@end table 2988 2989@node Warning Options 2990@section Options to Request or Suppress Warnings 2991@cindex options to control warnings 2992@cindex warning messages 2993@cindex messages, warning 2994@cindex suppressing warnings 2995 2996Warnings are diagnostic messages that report constructions that 2997are not inherently erroneous but that are risky or suggest there 2998may have been an error. 2999 3000The following language-independent options do not enable specific 3001warnings but control the kinds of diagnostics produced by GCC@. 3002 3003@table @gcctabopt 3004@cindex syntax checking 3005@item -fsyntax-only 3006@opindex fsyntax-only 3007Check the code for syntax errors, but don't do anything beyond that. 3008 3009@item -fmax-errors=@var{n} 3010@opindex fmax-errors 3011Limits the maximum number of error messages to @var{n}, at which point 3012GCC bails out rather than attempting to continue processing the source 3013code. If @var{n} is 0 (the default), there is no limit on the number 3014of error messages produced. If @option{-Wfatal-errors} is also 3015specified, then @option{-Wfatal-errors} takes precedence over this 3016option. 3017 3018@item -w 3019@opindex w 3020Inhibit all warning messages. 3021 3022@item -Werror 3023@opindex Werror 3024@opindex Wno-error 3025Make all warnings into errors. 3026 3027@item -Werror= 3028@opindex Werror= 3029@opindex Wno-error= 3030Make the specified warning into an error. The specifier for a warning 3031is appended; for example @option{-Werror=switch} turns the warnings 3032controlled by @option{-Wswitch} into errors. This switch takes a 3033negative form, to be used to negate @option{-Werror} for specific 3034warnings; for example @option{-Wno-error=switch} makes 3035@option{-Wswitch} warnings not be errors, even when @option{-Werror} 3036is in effect. 3037 3038The warning message for each controllable warning includes the 3039option that controls the warning. That option can then be used with 3040@option{-Werror=} and @option{-Wno-error=} as described above. 3041(Printing of the option in the warning message can be disabled using the 3042@option{-fno-diagnostics-show-option} flag.) 3043 3044Note that specifying @option{-Werror=}@var{foo} automatically implies 3045@option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not 3046imply anything. 3047 3048@item -Wfatal-errors 3049@opindex Wfatal-errors 3050@opindex Wno-fatal-errors 3051This option causes the compiler to abort compilation on the first error 3052occurred rather than trying to keep going and printing further error 3053messages. 3054 3055@end table 3056 3057You can request many specific warnings with options beginning with 3058@samp{-W}, for example @option{-Wimplicit} to request warnings on 3059implicit declarations. Each of these specific warning options also 3060has a negative form beginning @samp{-Wno-} to turn off warnings; for 3061example, @option{-Wno-implicit}. This manual lists only one of the 3062two forms, whichever is not the default. For further 3063language-specific options also refer to @ref{C++ Dialect Options} and 3064@ref{Objective-C and Objective-C++ Dialect Options}. 3065 3066When an unrecognized warning option is requested (e.g., 3067@option{-Wunknown-warning}), GCC emits a diagnostic stating 3068that the option is not recognized. However, if the @option{-Wno-} form 3069is used, the behavior is slightly different: no diagnostic is 3070produced for @option{-Wno-unknown-warning} unless other diagnostics 3071are being produced. This allows the use of new @option{-Wno-} options 3072with old compilers, but if something goes wrong, the compiler 3073warns that an unrecognized option is present. 3074 3075@table @gcctabopt 3076@item -Wpedantic 3077@itemx -pedantic 3078@opindex pedantic 3079@opindex Wpedantic 3080Issue all the warnings demanded by strict ISO C and ISO C++; 3081reject all programs that use forbidden extensions, and some other 3082programs that do not follow ISO C and ISO C++. For ISO C, follows the 3083version of the ISO C standard specified by any @option{-std} option used. 3084 3085Valid ISO C and ISO C++ programs should compile properly with or without 3086this option (though a rare few require @option{-ansi} or a 3087@option{-std} option specifying the required version of ISO C)@. However, 3088without this option, certain GNU extensions and traditional C and C++ 3089features are supported as well. With this option, they are rejected. 3090 3091@option{-Wpedantic} does not cause warning messages for use of the 3092alternate keywords whose names begin and end with @samp{__}. Pedantic 3093warnings are also disabled in the expression that follows 3094@code{__extension__}. However, only system header files should use 3095these escape routes; application programs should avoid them. 3096@xref{Alternate Keywords}. 3097 3098Some users try to use @option{-Wpedantic} to check programs for strict ISO 3099C conformance. They soon find that it does not do quite what they want: 3100it finds some non-ISO practices, but not all---only those for which 3101ISO C @emph{requires} a diagnostic, and some others for which 3102diagnostics have been added. 3103 3104A feature to report any failure to conform to ISO C might be useful in 3105some instances, but would require considerable additional work and would 3106be quite different from @option{-Wpedantic}. We don't have plans to 3107support such a feature in the near future. 3108 3109Where the standard specified with @option{-std} represents a GNU 3110extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a 3111corresponding @dfn{base standard}, the version of ISO C on which the GNU 3112extended dialect is based. Warnings from @option{-Wpedantic} are given 3113where they are required by the base standard. (It does not make sense 3114for such warnings to be given only for features not in the specified GNU 3115C dialect, since by definition the GNU dialects of C include all 3116features the compiler supports with the given option, and there would be 3117nothing to warn about.) 3118 3119@item -pedantic-errors 3120@opindex pedantic-errors 3121Like @option{-Wpedantic}, except that errors are produced rather than 3122warnings. 3123 3124@item -Wall 3125@opindex Wall 3126@opindex Wno-all 3127This enables all the warnings about constructions that some users 3128consider questionable, and that are easy to avoid (or modify to 3129prevent the warning), even in conjunction with macros. This also 3130enables some language-specific warnings described in @ref{C++ Dialect 3131Options} and @ref{Objective-C and Objective-C++ Dialect Options}. 3132 3133@option{-Wall} turns on the following warning flags: 3134 3135@gccoptlist{-Waddress @gol 3136-Warray-bounds @r{(only with} @option{-O2}@r{)} @gol 3137-Wc++11-compat @gol 3138-Wchar-subscripts @gol 3139-Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol 3140-Wimplicit-int @r{(C and Objective-C only)} @gol 3141-Wimplicit-function-declaration @r{(C and Objective-C only)} @gol 3142-Wcomment @gol 3143-Wformat @gol 3144-Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol 3145-Wmaybe-uninitialized @gol 3146-Wmissing-braces @r{(only for C/ObjC)} @gol 3147-Wnonnull @gol 3148-Wparentheses @gol 3149-Wpointer-sign @gol 3150-Wreorder @gol 3151-Wreturn-type @gol 3152-Wsequence-point @gol 3153-Wsign-compare @r{(only in C++)} @gol 3154-Wstrict-aliasing @gol 3155-Wstrict-overflow=1 @gol 3156-Wswitch @gol 3157-Wtrigraphs @gol 3158-Wuninitialized @gol 3159-Wunknown-pragmas @gol 3160-Wunused-function @gol 3161-Wunused-label @gol 3162-Wunused-value @gol 3163-Wunused-variable @gol 3164-Wvolatile-register-var @gol 3165} 3166 3167Note that some warning flags are not implied by @option{-Wall}. Some of 3168them warn about constructions that users generally do not consider 3169questionable, but which occasionally you might wish to check for; 3170others warn about constructions that are necessary or hard to avoid in 3171some cases, and there is no simple way to modify the code to suppress 3172the warning. Some of them are enabled by @option{-Wextra} but many of 3173them must be enabled individually. 3174 3175@item -Wextra 3176@opindex W 3177@opindex Wextra 3178@opindex Wno-extra 3179This enables some extra warning flags that are not enabled by 3180@option{-Wall}. (This option used to be called @option{-W}. The older 3181name is still supported, but the newer name is more descriptive.) 3182 3183@gccoptlist{-Wclobbered @gol 3184-Wempty-body @gol 3185-Wignored-qualifiers @gol 3186-Wmissing-field-initializers @gol 3187-Wmissing-parameter-type @r{(C only)} @gol 3188-Wold-style-declaration @r{(C only)} @gol 3189-Woverride-init @gol 3190-Wsign-compare @gol 3191-Wtype-limits @gol 3192-Wuninitialized @gol 3193-Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol 3194-Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol 3195} 3196 3197The option @option{-Wextra} also prints warning messages for the 3198following cases: 3199 3200@itemize @bullet 3201 3202@item 3203A pointer is compared against integer zero with @samp{<}, @samp{<=}, 3204@samp{>}, or @samp{>=}. 3205 3206@item 3207(C++ only) An enumerator and a non-enumerator both appear in a 3208conditional expression. 3209 3210@item 3211(C++ only) Ambiguous virtual bases. 3212 3213@item 3214(C++ only) Subscripting an array that has been declared @samp{register}. 3215 3216@item 3217(C++ only) Taking the address of a variable that has been declared 3218@samp{register}. 3219 3220@item 3221(C++ only) A base class is not initialized in a derived class's copy 3222constructor. 3223 3224@end itemize 3225 3226@item -Wchar-subscripts 3227@opindex Wchar-subscripts 3228@opindex Wno-char-subscripts 3229Warn if an array subscript has type @code{char}. This is a common cause 3230of error, as programmers often forget that this type is signed on some 3231machines. 3232This warning is enabled by @option{-Wall}. 3233 3234@item -Wcomment 3235@opindex Wcomment 3236@opindex Wno-comment 3237Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*} 3238comment, or whenever a Backslash-Newline appears in a @samp{//} comment. 3239This warning is enabled by @option{-Wall}. 3240 3241@item -Wno-coverage-mismatch 3242@opindex Wno-coverage-mismatch 3243Warn if feedback profiles do not match when using the 3244@option{-fprofile-use} option. 3245If a source file is changed between compiling with @option{-fprofile-gen} and 3246with @option{-fprofile-use}, the files with the profile feedback can fail 3247to match the source file and GCC cannot use the profile feedback 3248information. By default, this warning is enabled and is treated as an 3249error. @option{-Wno-coverage-mismatch} can be used to disable the 3250warning or @option{-Wno-error=coverage-mismatch} can be used to 3251disable the error. Disabling the error for this warning can result in 3252poorly optimized code and is useful only in the 3253case of very minor changes such as bug fixes to an existing code-base. 3254Completely disabling the warning is not recommended. 3255 3256@item -Wno-cpp 3257@r{(C, Objective-C, C++, Objective-C++ and Fortran only)} 3258 3259Suppress warning messages emitted by @code{#warning} directives. 3260 3261@item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)} 3262@opindex Wdouble-promotion 3263@opindex Wno-double-promotion 3264Give a warning when a value of type @code{float} is implicitly 3265promoted to @code{double}. CPUs with a 32-bit ``single-precision'' 3266floating-point unit implement @code{float} in hardware, but emulate 3267@code{double} in software. On such a machine, doing computations 3268using @code{double} values is much more expensive because of the 3269overhead required for software emulation. 3270 3271It is easy to accidentally do computations with @code{double} because 3272floating-point literals are implicitly of type @code{double}. For 3273example, in: 3274@smallexample 3275@group 3276float area(float radius) 3277@{ 3278 return 3.14159 * radius * radius; 3279@} 3280@end group 3281@end smallexample 3282the compiler performs the entire computation with @code{double} 3283because the floating-point literal is a @code{double}. 3284 3285@item -Wformat 3286@itemx -Wformat=@var{n} 3287@opindex Wformat 3288@opindex Wno-format 3289@opindex ffreestanding 3290@opindex fno-builtin 3291@opindex Wformat= 3292Check calls to @code{printf} and @code{scanf}, etc., to make sure that 3293the arguments supplied have types appropriate to the format string 3294specified, and that the conversions specified in the format string make 3295sense. This includes standard functions, and others specified by format 3296attributes (@pxref{Function Attributes}), in the @code{printf}, 3297@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension, 3298not in the C standard) families (or other target-specific families). 3299Which functions are checked without format attributes having been 3300specified depends on the standard version selected, and such checks of 3301functions without the attribute specified are disabled by 3302@option{-ffreestanding} or @option{-fno-builtin}. 3303 3304The formats are checked against the format features supported by GNU 3305libc version 2.2. These include all ISO C90 and C99 features, as well 3306as features from the Single Unix Specification and some BSD and GNU 3307extensions. Other library implementations may not support all these 3308features; GCC does not support warning about features that go beyond a 3309particular library's limitations. However, if @option{-Wpedantic} is used 3310with @option{-Wformat}, warnings are given about format features not 3311in the selected standard version (but not for @code{strfmon} formats, 3312since those are not in any version of the C standard). @xref{C Dialect 3313Options,,Options Controlling C Dialect}. 3314 3315@table @gcctabopt 3316@item -Wformat=1 3317@itemx -Wformat 3318Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and 3319@option{-Wno-format} is equivalent to @option{-Wformat=0}. Since 3320@option{-Wformat} also checks for null format arguments for several 3321functions, @option{-Wformat} also implies @option{-Wnonnull}. Some 3322aspects of this level of format checking can be disabled by the 3323options: @option{-Wno-format-contains-nul}, 3324@option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}. 3325@option{-Wformat} is enabled by @option{-Wall}. 3326 3327@item -Wno-format-contains-nul 3328@opindex Wno-format-contains-nul 3329@opindex Wformat-contains-nul 3330If @option{-Wformat} is specified, do not warn about format strings that 3331contain NUL bytes. 3332 3333@item -Wno-format-extra-args 3334@opindex Wno-format-extra-args 3335@opindex Wformat-extra-args 3336If @option{-Wformat} is specified, do not warn about excess arguments to a 3337@code{printf} or @code{scanf} format function. The C standard specifies 3338that such arguments are ignored. 3339 3340Where the unused arguments lie between used arguments that are 3341specified with @samp{$} operand number specifications, normally 3342warnings are still given, since the implementation could not know what 3343type to pass to @code{va_arg} to skip the unused arguments. However, 3344in the case of @code{scanf} formats, this option suppresses the 3345warning if the unused arguments are all pointers, since the Single 3346Unix Specification says that such unused arguments are allowed. 3347 3348@item -Wno-format-zero-length 3349@opindex Wno-format-zero-length 3350@opindex Wformat-zero-length 3351If @option{-Wformat} is specified, do not warn about zero-length formats. 3352The C standard specifies that zero-length formats are allowed. 3353 3354 3355@item -Wformat=2 3356Enable @option{-Wformat} plus additional format checks. Currently 3357equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security 3358-Wformat-y2k}. 3359 3360@item -Wformat-nonliteral 3361@opindex Wformat-nonliteral 3362@opindex Wno-format-nonliteral 3363If @option{-Wformat} is specified, also warn if the format string is not a 3364string literal and so cannot be checked, unless the format function 3365takes its format arguments as a @code{va_list}. 3366 3367@item -Wformat-security 3368@opindex Wformat-security 3369@opindex Wno-format-security 3370If @option{-Wformat} is specified, also warn about uses of format 3371functions that represent possible security problems. At present, this 3372warns about calls to @code{printf} and @code{scanf} functions where the 3373format string is not a string literal and there are no format arguments, 3374as in @code{printf (foo);}. This may be a security hole if the format 3375string came from untrusted input and contains @samp{%n}. (This is 3376currently a subset of what @option{-Wformat-nonliteral} warns about, but 3377in future warnings may be added to @option{-Wformat-security} that are not 3378included in @option{-Wformat-nonliteral}.) 3379 3380@item -Wformat-y2k 3381@opindex Wformat-y2k 3382@opindex Wno-format-y2k 3383If @option{-Wformat} is specified, also warn about @code{strftime} 3384formats that may yield only a two-digit year. 3385@end table 3386 3387@item -Wnonnull 3388@opindex Wnonnull 3389@opindex Wno-nonnull 3390Warn about passing a null pointer for arguments marked as 3391requiring a non-null value by the @code{nonnull} function attribute. 3392 3393@option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It 3394can be disabled with the @option{-Wno-nonnull} option. 3395 3396@item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)} 3397@opindex Winit-self 3398@opindex Wno-init-self 3399Warn about uninitialized variables that are initialized with themselves. 3400Note this option can only be used with the @option{-Wuninitialized} option. 3401 3402For example, GCC warns about @code{i} being uninitialized in the 3403following snippet only when @option{-Winit-self} has been specified: 3404@smallexample 3405@group 3406int f() 3407@{ 3408 int i = i; 3409 return i; 3410@} 3411@end group 3412@end smallexample 3413 3414This warning is enabled by @option{-Wall} in C++. 3415 3416@item -Wimplicit-int @r{(C and Objective-C only)} 3417@opindex Wimplicit-int 3418@opindex Wno-implicit-int 3419Warn when a declaration does not specify a type. 3420This warning is enabled by @option{-Wall}. 3421 3422@item -Wimplicit-function-declaration @r{(C and Objective-C only)} 3423@opindex Wimplicit-function-declaration 3424@opindex Wno-implicit-function-declaration 3425Give a warning whenever a function is used before being declared. In 3426C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is 3427enabled by default and it is made into an error by 3428@option{-pedantic-errors}. This warning is also enabled by 3429@option{-Wall}. 3430 3431@item -Wimplicit @r{(C and Objective-C only)} 3432@opindex Wimplicit 3433@opindex Wno-implicit 3434Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}. 3435This warning is enabled by @option{-Wall}. 3436 3437@item -Wignored-qualifiers @r{(C and C++ only)} 3438@opindex Wignored-qualifiers 3439@opindex Wno-ignored-qualifiers 3440Warn if the return type of a function has a type qualifier 3441such as @code{const}. For ISO C such a type qualifier has no effect, 3442since the value returned by a function is not an lvalue. 3443For C++, the warning is only emitted for scalar types or @code{void}. 3444ISO C prohibits qualified @code{void} return types on function 3445definitions, so such return types always receive a warning 3446even without this option. 3447 3448This warning is also enabled by @option{-Wextra}. 3449 3450@item -Wmain 3451@opindex Wmain 3452@opindex Wno-main 3453Warn if the type of @samp{main} is suspicious. @samp{main} should be 3454a function with external linkage, returning int, taking either zero 3455arguments, two, or three arguments of appropriate types. This warning 3456is enabled by default in C++ and is enabled by either @option{-Wall} 3457or @option{-Wpedantic}. 3458 3459@item -Wmissing-braces 3460@opindex Wmissing-braces 3461@opindex Wno-missing-braces 3462Warn if an aggregate or union initializer is not fully bracketed. In 3463the following example, the initializer for @samp{a} is not fully 3464bracketed, but that for @samp{b} is fully bracketed. This warning is 3465enabled by @option{-Wall} in C. 3466 3467@smallexample 3468int a[2][2] = @{ 0, 1, 2, 3 @}; 3469int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @}; 3470@end smallexample 3471 3472This warning is enabled by @option{-Wall}. 3473 3474@item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)} 3475@opindex Wmissing-include-dirs 3476@opindex Wno-missing-include-dirs 3477Warn if a user-supplied include directory does not exist. 3478 3479@item -Wparentheses 3480@opindex Wparentheses 3481@opindex Wno-parentheses 3482Warn if parentheses are omitted in certain contexts, such 3483as when there is an assignment in a context where a truth value 3484is expected, or when operators are nested whose precedence people 3485often get confused about. 3486 3487Also warn if a comparison like @samp{x<=y<=z} appears; this is 3488equivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different 3489interpretation from that of ordinary mathematical notation. 3490 3491Also warn about constructions where there may be confusion to which 3492@code{if} statement an @code{else} branch belongs. Here is an example of 3493such a case: 3494 3495@smallexample 3496@group 3497@{ 3498 if (a) 3499 if (b) 3500 foo (); 3501 else 3502 bar (); 3503@} 3504@end group 3505@end smallexample 3506 3507In C/C++, every @code{else} branch belongs to the innermost possible 3508@code{if} statement, which in this example is @code{if (b)}. This is 3509often not what the programmer expected, as illustrated in the above 3510example by indentation the programmer chose. When there is the 3511potential for this confusion, GCC issues a warning when this flag 3512is specified. To eliminate the warning, add explicit braces around 3513the innermost @code{if} statement so there is no way the @code{else} 3514can belong to the enclosing @code{if}. The resulting code 3515looks like this: 3516 3517@smallexample 3518@group 3519@{ 3520 if (a) 3521 @{ 3522 if (b) 3523 foo (); 3524 else 3525 bar (); 3526 @} 3527@} 3528@end group 3529@end smallexample 3530 3531Also warn for dangerous uses of the GNU extension to 3532@code{?:} with omitted middle operand. When the condition 3533in the @code{?}: operator is a boolean expression, the omitted value is 3534always 1. Often programmers expect it to be a value computed 3535inside the conditional expression instead. 3536 3537This warning is enabled by @option{-Wall}. 3538 3539@item -Wsequence-point 3540@opindex Wsequence-point 3541@opindex Wno-sequence-point 3542Warn about code that may have undefined semantics because of violations 3543of sequence point rules in the C and C++ standards. 3544 3545The C and C++ standards define the order in which expressions in a C/C++ 3546program are evaluated in terms of @dfn{sequence points}, which represent 3547a partial ordering between the execution of parts of the program: those 3548executed before the sequence point, and those executed after it. These 3549occur after the evaluation of a full expression (one which is not part 3550of a larger expression), after the evaluation of the first operand of a 3551@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a 3552function is called (but after the evaluation of its arguments and the 3553expression denoting the called function), and in certain other places. 3554Other than as expressed by the sequence point rules, the order of 3555evaluation of subexpressions of an expression is not specified. All 3556these rules describe only a partial order rather than a total order, 3557since, for example, if two functions are called within one expression 3558with no sequence point between them, the order in which the functions 3559are called is not specified. However, the standards committee have 3560ruled that function calls do not overlap. 3561 3562It is not specified when between sequence points modifications to the 3563values of objects take effect. Programs whose behavior depends on this 3564have undefined behavior; the C and C++ standards specify that ``Between 3565the previous and next sequence point an object shall have its stored 3566value modified at most once by the evaluation of an expression. 3567Furthermore, the prior value shall be read only to determine the value 3568to be stored.''. If a program breaks these rules, the results on any 3569particular implementation are entirely unpredictable. 3570 3571Examples of code with undefined behavior are @code{a = a++;}, @code{a[n] 3572= b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not 3573diagnosed by this option, and it may give an occasional false positive 3574result, but in general it has been found fairly effective at detecting 3575this sort of problem in programs. 3576 3577The standard is worded confusingly, therefore there is some debate 3578over the precise meaning of the sequence point rules in subtle cases. 3579Links to discussions of the problem, including proposed formal 3580definitions, may be found on the GCC readings page, at 3581@uref{http://gcc.gnu.org/@/readings.html}. 3582 3583This warning is enabled by @option{-Wall} for C and C++. 3584 3585@item -Wno-return-local-addr 3586@opindex Wno-return-local-addr 3587@opindex Wreturn-local-addr 3588Do not warn about returning a pointer (or in C++, a reference) to a 3589variable that goes out of scope after the function returns. 3590 3591@item -Wreturn-type 3592@opindex Wreturn-type 3593@opindex Wno-return-type 3594Warn whenever a function is defined with a return type that defaults 3595to @code{int}. Also warn about any @code{return} statement with no 3596return value in a function whose return type is not @code{void} 3597(falling off the end of the function body is considered returning 3598without a value), and about a @code{return} statement with an 3599expression in a function whose return type is @code{void}. 3600 3601For C++, a function without return type always produces a diagnostic 3602message, even when @option{-Wno-return-type} is specified. The only 3603exceptions are @samp{main} and functions defined in system headers. 3604 3605This warning is enabled by @option{-Wall}. 3606 3607@item -Wswitch 3608@opindex Wswitch 3609@opindex Wno-switch 3610Warn whenever a @code{switch} statement has an index of enumerated type 3611and lacks a @code{case} for one or more of the named codes of that 3612enumeration. (The presence of a @code{default} label prevents this 3613warning.) @code{case} labels outside the enumeration range also 3614provoke warnings when this option is used (even if there is a 3615@code{default} label). 3616This warning is enabled by @option{-Wall}. 3617 3618@item -Wswitch-default 3619@opindex Wswitch-default 3620@opindex Wno-switch-default 3621Warn whenever a @code{switch} statement does not have a @code{default} 3622case. 3623 3624@item -Wswitch-enum 3625@opindex Wswitch-enum 3626@opindex Wno-switch-enum 3627Warn whenever a @code{switch} statement has an index of enumerated type 3628and lacks a @code{case} for one or more of the named codes of that 3629enumeration. @code{case} labels outside the enumeration range also 3630provoke warnings when this option is used. The only difference 3631between @option{-Wswitch} and this option is that this option gives a 3632warning about an omitted enumeration code even if there is a 3633@code{default} label. 3634 3635@item -Wsync-nand @r{(C and C++ only)} 3636@opindex Wsync-nand 3637@opindex Wno-sync-nand 3638Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch} 3639built-in functions are used. These functions changed semantics in GCC 4.4. 3640 3641@item -Wtrigraphs 3642@opindex Wtrigraphs 3643@opindex Wno-trigraphs 3644Warn if any trigraphs are encountered that might change the meaning of 3645the program (trigraphs within comments are not warned about). 3646This warning is enabled by @option{-Wall}. 3647 3648@item -Wunused-but-set-parameter 3649@opindex Wunused-but-set-parameter 3650@opindex Wno-unused-but-set-parameter 3651Warn whenever a function parameter is assigned to, but otherwise unused 3652(aside from its declaration). 3653 3654To suppress this warning use the @samp{unused} attribute 3655(@pxref{Variable Attributes}). 3656 3657This warning is also enabled by @option{-Wunused} together with 3658@option{-Wextra}. 3659 3660@item -Wunused-but-set-variable 3661@opindex Wunused-but-set-variable 3662@opindex Wno-unused-but-set-variable 3663Warn whenever a local variable is assigned to, but otherwise unused 3664(aside from its declaration). 3665This warning is enabled by @option{-Wall}. 3666 3667To suppress this warning use the @samp{unused} attribute 3668(@pxref{Variable Attributes}). 3669 3670This warning is also enabled by @option{-Wunused}, which is enabled 3671by @option{-Wall}. 3672 3673@item -Wunused-function 3674@opindex Wunused-function 3675@opindex Wno-unused-function 3676Warn whenever a static function is declared but not defined or a 3677non-inline static function is unused. 3678This warning is enabled by @option{-Wall}. 3679 3680@item -Wunused-label 3681@opindex Wunused-label 3682@opindex Wno-unused-label 3683Warn whenever a label is declared but not used. 3684This warning is enabled by @option{-Wall}. 3685 3686To suppress this warning use the @samp{unused} attribute 3687(@pxref{Variable Attributes}). 3688 3689@item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)} 3690@opindex Wunused-local-typedefs 3691Warn when a typedef locally defined in a function is not used. 3692This warning is enabled by @option{-Wall}. 3693 3694@item -Wunused-parameter 3695@opindex Wunused-parameter 3696@opindex Wno-unused-parameter 3697Warn whenever a function parameter is unused aside from its declaration. 3698 3699To suppress this warning use the @samp{unused} attribute 3700(@pxref{Variable Attributes}). 3701 3702@item -Wno-unused-result 3703@opindex Wunused-result 3704@opindex Wno-unused-result 3705Do not warn if a caller of a function marked with attribute 3706@code{warn_unused_result} (@pxref{Function Attributes}) does not use 3707its return value. The default is @option{-Wunused-result}. 3708 3709@item -Wunused-variable 3710@opindex Wunused-variable 3711@opindex Wno-unused-variable 3712Warn whenever a local variable or non-constant static variable is unused 3713aside from its declaration. 3714This warning is enabled by @option{-Wall}. 3715 3716To suppress this warning use the @samp{unused} attribute 3717(@pxref{Variable Attributes}). 3718 3719@item -Wunused-value 3720@opindex Wunused-value 3721@opindex Wno-unused-value 3722Warn whenever a statement computes a result that is explicitly not 3723used. To suppress this warning cast the unused expression to 3724@samp{void}. This includes an expression-statement or the left-hand 3725side of a comma expression that contains no side effects. For example, 3726an expression such as @samp{x[i,j]} causes a warning, while 3727@samp{x[(void)i,j]} does not. 3728 3729This warning is enabled by @option{-Wall}. 3730 3731@item -Wunused 3732@opindex Wunused 3733@opindex Wno-unused 3734All the above @option{-Wunused} options combined. 3735 3736In order to get a warning about an unused function parameter, you must 3737either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies 3738@option{-Wunused}), or separately specify @option{-Wunused-parameter}. 3739 3740@item -Wuninitialized 3741@opindex Wuninitialized 3742@opindex Wno-uninitialized 3743Warn if an automatic variable is used without first being initialized 3744or if a variable may be clobbered by a @code{setjmp} call. In C++, 3745warn if a non-static reference or non-static @samp{const} member 3746appears in a class without constructors. 3747 3748If you want to warn about code that uses the uninitialized value of the 3749variable in its own initializer, use the @option{-Winit-self} option. 3750 3751These warnings occur for individual uninitialized or clobbered 3752elements of structure, union or array variables as well as for 3753variables that are uninitialized or clobbered as a whole. They do 3754not occur for variables or elements declared @code{volatile}. Because 3755these warnings depend on optimization, the exact variables or elements 3756for which there are warnings depends on the precise optimization 3757options and version of GCC used. 3758 3759Note that there may be no warning about a variable that is used only 3760to compute a value that itself is never used, because such 3761computations may be deleted by data flow analysis before the warnings 3762are printed. 3763 3764@item -Wmaybe-uninitialized 3765@opindex Wmaybe-uninitialized 3766@opindex Wno-maybe-uninitialized 3767For an automatic variable, if there exists a path from the function 3768entry to a use of the variable that is initialized, but there exist 3769some other paths for which the variable is not initialized, the compiler 3770emits a warning if it cannot prove the uninitialized paths are not 3771executed at run time. These warnings are made optional because GCC is 3772not smart enough to see all the reasons why the code might be correct 3773in spite of appearing to have an error. Here is one example of how 3774this can happen: 3775 3776@smallexample 3777@group 3778@{ 3779 int x; 3780 switch (y) 3781 @{ 3782 case 1: x = 1; 3783 break; 3784 case 2: x = 4; 3785 break; 3786 case 3: x = 5; 3787 @} 3788 foo (x); 3789@} 3790@end group 3791@end smallexample 3792 3793@noindent 3794If the value of @code{y} is always 1, 2 or 3, then @code{x} is 3795always initialized, but GCC doesn't know this. To suppress the 3796warning, you need to provide a default case with assert(0) or 3797similar code. 3798 3799@cindex @code{longjmp} warnings 3800This option also warns when a non-volatile automatic variable might be 3801changed by a call to @code{longjmp}. These warnings as well are possible 3802only in optimizing compilation. 3803 3804The compiler sees only the calls to @code{setjmp}. It cannot know 3805where @code{longjmp} will be called; in fact, a signal handler could 3806call it at any point in the code. As a result, you may get a warning 3807even when there is in fact no problem because @code{longjmp} cannot 3808in fact be called at the place that would cause a problem. 3809 3810Some spurious warnings can be avoided if you declare all the functions 3811you use that never return as @code{noreturn}. @xref{Function 3812Attributes}. 3813 3814This warning is enabled by @option{-Wall} or @option{-Wextra}. 3815 3816@item -Wunknown-pragmas 3817@opindex Wunknown-pragmas 3818@opindex Wno-unknown-pragmas 3819@cindex warning for unknown pragmas 3820@cindex unknown pragmas, warning 3821@cindex pragmas, warning of unknown 3822Warn when a @code{#pragma} directive is encountered that is not understood by 3823GCC@. If this command-line option is used, warnings are even issued 3824for unknown pragmas in system header files. This is not the case if 3825the warnings are only enabled by the @option{-Wall} command-line option. 3826 3827@item -Wno-pragmas 3828@opindex Wno-pragmas 3829@opindex Wpragmas 3830Do not warn about misuses of pragmas, such as incorrect parameters, 3831invalid syntax, or conflicts between pragmas. See also 3832@option{-Wunknown-pragmas}. 3833 3834@item -Wstrict-aliasing 3835@opindex Wstrict-aliasing 3836@opindex Wno-strict-aliasing 3837This option is only active when @option{-fstrict-aliasing} is active. 3838It warns about code that might break the strict aliasing rules that the 3839compiler is using for optimization. The warning does not catch all 3840cases, but does attempt to catch the more common pitfalls. It is 3841included in @option{-Wall}. 3842It is equivalent to @option{-Wstrict-aliasing=3} 3843 3844@item -Wstrict-aliasing=n 3845@opindex Wstrict-aliasing=n 3846This option is only active when @option{-fstrict-aliasing} is active. 3847It warns about code that might break the strict aliasing rules that the 3848compiler is using for optimization. 3849Higher levels correspond to higher accuracy (fewer false positives). 3850Higher levels also correspond to more effort, similar to the way @option{-O} 3851works. 3852@option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}. 3853 3854Level 1: Most aggressive, quick, least accurate. 3855Possibly useful when higher levels 3856do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few 3857false negatives. However, it has many false positives. 3858Warns for all pointer conversions between possibly incompatible types, 3859even if never dereferenced. Runs in the front end only. 3860 3861Level 2: Aggressive, quick, not too precise. 3862May still have many false positives (not as many as level 1 though), 3863and few false negatives (but possibly more than level 1). 3864Unlike level 1, it only warns when an address is taken. Warns about 3865incomplete types. Runs in the front end only. 3866 3867Level 3 (default for @option{-Wstrict-aliasing}): 3868Should have very few false positives and few false 3869negatives. Slightly slower than levels 1 or 2 when optimization is enabled. 3870Takes care of the common pun+dereference pattern in the front end: 3871@code{*(int*)&some_float}. 3872If optimization is enabled, it also runs in the back end, where it deals 3873with multiple statement cases using flow-sensitive points-to information. 3874Only warns when the converted pointer is dereferenced. 3875Does not warn about incomplete types. 3876 3877@item -Wstrict-overflow 3878@itemx -Wstrict-overflow=@var{n} 3879@opindex Wstrict-overflow 3880@opindex Wno-strict-overflow 3881This option is only active when @option{-fstrict-overflow} is active. 3882It warns about cases where the compiler optimizes based on the 3883assumption that signed overflow does not occur. Note that it does not 3884warn about all cases where the code might overflow: it only warns 3885about cases where the compiler implements some optimization. Thus 3886this warning depends on the optimization level. 3887 3888An optimization that assumes that signed overflow does not occur is 3889perfectly safe if the values of the variables involved are such that 3890overflow never does, in fact, occur. Therefore this warning can 3891easily give a false positive: a warning about code that is not 3892actually a problem. To help focus on important issues, several 3893warning levels are defined. No warnings are issued for the use of 3894undefined signed overflow when estimating how many iterations a loop 3895requires, in particular when determining whether a loop will be 3896executed at all. 3897 3898@table @gcctabopt 3899@item -Wstrict-overflow=1 3900Warn about cases that are both questionable and easy to avoid. For 3901example, with @option{-fstrict-overflow}, the compiler simplifies 3902@code{x + 1 > x} to @code{1}. This level of 3903@option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels 3904are not, and must be explicitly requested. 3905 3906@item -Wstrict-overflow=2 3907Also warn about other cases where a comparison is simplified to a 3908constant. For example: @code{abs (x) >= 0}. This can only be 3909simplified when @option{-fstrict-overflow} is in effect, because 3910@code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than 3911zero. @option{-Wstrict-overflow} (with no level) is the same as 3912@option{-Wstrict-overflow=2}. 3913 3914@item -Wstrict-overflow=3 3915Also warn about other cases where a comparison is simplified. For 3916example: @code{x + 1 > 1} is simplified to @code{x > 0}. 3917 3918@item -Wstrict-overflow=4 3919Also warn about other simplifications not covered by the above cases. 3920For example: @code{(x * 10) / 5} is simplified to @code{x * 2}. 3921 3922@item -Wstrict-overflow=5 3923Also warn about cases where the compiler reduces the magnitude of a 3924constant involved in a comparison. For example: @code{x + 2 > y} is 3925simplified to @code{x + 1 >= y}. This is reported only at the 3926highest warning level because this simplification applies to many 3927comparisons, so this warning level gives a very large number of 3928false positives. 3929@end table 3930 3931@item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]} 3932@opindex Wsuggest-attribute= 3933@opindex Wno-suggest-attribute= 3934Warn for cases where adding an attribute may be beneficial. The 3935attributes currently supported are listed below. 3936 3937@table @gcctabopt 3938@item -Wsuggest-attribute=pure 3939@itemx -Wsuggest-attribute=const 3940@itemx -Wsuggest-attribute=noreturn 3941@opindex Wsuggest-attribute=pure 3942@opindex Wno-suggest-attribute=pure 3943@opindex Wsuggest-attribute=const 3944@opindex Wno-suggest-attribute=const 3945@opindex Wsuggest-attribute=noreturn 3946@opindex Wno-suggest-attribute=noreturn 3947 3948Warn about functions that might be candidates for attributes 3949@code{pure}, @code{const} or @code{noreturn}. The compiler only warns for 3950functions visible in other compilation units or (in the case of @code{pure} and 3951@code{const}) if it cannot prove that the function returns normally. A function 3952returns normally if it doesn't contain an infinite loop or return abnormally 3953by throwing, calling @code{abort()} or trapping. This analysis requires option 3954@option{-fipa-pure-const}, which is enabled by default at @option{-O} and 3955higher. Higher optimization levels improve the accuracy of the analysis. 3956 3957@item -Wsuggest-attribute=format 3958@itemx -Wmissing-format-attribute 3959@opindex Wsuggest-attribute=format 3960@opindex Wmissing-format-attribute 3961@opindex Wno-suggest-attribute=format 3962@opindex Wno-missing-format-attribute 3963@opindex Wformat 3964@opindex Wno-format 3965 3966Warn about function pointers that might be candidates for @code{format} 3967attributes. Note these are only possible candidates, not absolute ones. 3968GCC guesses that function pointers with @code{format} attributes that 3969are used in assignment, initialization, parameter passing or return 3970statements should have a corresponding @code{format} attribute in the 3971resulting type. I.e.@: the left-hand side of the assignment or 3972initialization, the type of the parameter variable, or the return type 3973of the containing function respectively should also have a @code{format} 3974attribute to avoid the warning. 3975 3976GCC also warns about function definitions that might be 3977candidates for @code{format} attributes. Again, these are only 3978possible candidates. GCC guesses that @code{format} attributes 3979might be appropriate for any function that calls a function like 3980@code{vprintf} or @code{vscanf}, but this might not always be the 3981case, and some functions for which @code{format} attributes are 3982appropriate may not be detected. 3983@end table 3984 3985@item -Warray-bounds 3986@opindex Wno-array-bounds 3987@opindex Warray-bounds 3988This option is only active when @option{-ftree-vrp} is active 3989(default for @option{-O2} and above). It warns about subscripts to arrays 3990that are always out of bounds. This warning is enabled by @option{-Wall}. 3991 3992@item -Wno-div-by-zero 3993@opindex Wno-div-by-zero 3994@opindex Wdiv-by-zero 3995Do not warn about compile-time integer division by zero. Floating-point 3996division by zero is not warned about, as it can be a legitimate way of 3997obtaining infinities and NaNs. 3998 3999@item -Wsystem-headers 4000@opindex Wsystem-headers 4001@opindex Wno-system-headers 4002@cindex warnings from system headers 4003@cindex system headers, warnings from 4004Print warning messages for constructs found in system header files. 4005Warnings from system headers are normally suppressed, on the assumption 4006that they usually do not indicate real problems and would only make the 4007compiler output harder to read. Using this command-line option tells 4008GCC to emit warnings from system headers as if they occurred in user 4009code. However, note that using @option{-Wall} in conjunction with this 4010option does @emph{not} warn about unknown pragmas in system 4011headers---for that, @option{-Wunknown-pragmas} must also be used. 4012 4013@item -Wtrampolines 4014@opindex Wtrampolines 4015@opindex Wno-trampolines 4016 Warn about trampolines generated for pointers to nested functions. 4017 4018 A trampoline is a small piece of data or code that is created at run 4019 time on the stack when the address of a nested function is taken, and 4020 is used to call the nested function indirectly. For some targets, it 4021 is made up of data only and thus requires no special treatment. But, 4022 for most targets, it is made up of code and thus requires the stack 4023 to be made executable in order for the program to work properly. 4024 4025@item -Wfloat-equal 4026@opindex Wfloat-equal 4027@opindex Wno-float-equal 4028Warn if floating-point values are used in equality comparisons. 4029 4030The idea behind this is that sometimes it is convenient (for the 4031programmer) to consider floating-point values as approximations to 4032infinitely precise real numbers. If you are doing this, then you need 4033to compute (by analyzing the code, or in some other way) the maximum or 4034likely maximum error that the computation introduces, and allow for it 4035when performing comparisons (and when producing output, but that's a 4036different problem). In particular, instead of testing for equality, you 4037should check to see whether the two values have ranges that overlap; and 4038this is done with the relational operators, so equality comparisons are 4039probably mistaken. 4040 4041@item -Wtraditional @r{(C and Objective-C only)} 4042@opindex Wtraditional 4043@opindex Wno-traditional 4044Warn about certain constructs that behave differently in traditional and 4045ISO C@. Also warn about ISO C constructs that have no traditional C 4046equivalent, and/or problematic constructs that should be avoided. 4047 4048@itemize @bullet 4049@item 4050Macro parameters that appear within string literals in the macro body. 4051In traditional C macro replacement takes place within string literals, 4052but in ISO C it does not. 4053 4054@item 4055In traditional C, some preprocessor directives did not exist. 4056Traditional preprocessors only considered a line to be a directive 4057if the @samp{#} appeared in column 1 on the line. Therefore 4058@option{-Wtraditional} warns about directives that traditional C 4059understands but ignores because the @samp{#} does not appear as the 4060first character on the line. It also suggests you hide directives like 4061@samp{#pragma} not understood by traditional C by indenting them. Some 4062traditional implementations do not recognize @samp{#elif}, so this option 4063suggests avoiding it altogether. 4064 4065@item 4066A function-like macro that appears without arguments. 4067 4068@item 4069The unary plus operator. 4070 4071@item 4072The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point 4073constant suffixes. (Traditional C does support the @samp{L} suffix on integer 4074constants.) Note, these suffixes appear in macros defined in the system 4075headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}. 4076Use of these macros in user code might normally lead to spurious 4077warnings, however GCC's integrated preprocessor has enough context to 4078avoid warning in these cases. 4079 4080@item 4081A function declared external in one block and then used after the end of 4082the block. 4083 4084@item 4085A @code{switch} statement has an operand of type @code{long}. 4086 4087@item 4088A non-@code{static} function declaration follows a @code{static} one. 4089This construct is not accepted by some traditional C compilers. 4090 4091@item 4092The ISO type of an integer constant has a different width or 4093signedness from its traditional type. This warning is only issued if 4094the base of the constant is ten. I.e.@: hexadecimal or octal values, which 4095typically represent bit patterns, are not warned about. 4096 4097@item 4098Usage of ISO string concatenation is detected. 4099 4100@item 4101Initialization of automatic aggregates. 4102 4103@item 4104Identifier conflicts with labels. Traditional C lacks a separate 4105namespace for labels. 4106 4107@item 4108Initialization of unions. If the initializer is zero, the warning is 4109omitted. This is done under the assumption that the zero initializer in 4110user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing 4111initializer warnings and relies on default initialization to zero in the 4112traditional C case. 4113 4114@item 4115Conversions by prototypes between fixed/floating-point values and vice 4116versa. The absence of these prototypes when compiling with traditional 4117C causes serious problems. This is a subset of the possible 4118conversion warnings; for the full set use @option{-Wtraditional-conversion}. 4119 4120@item 4121Use of ISO C style function definitions. This warning intentionally is 4122@emph{not} issued for prototype declarations or variadic functions 4123because these ISO C features appear in your code when using 4124libiberty's traditional C compatibility macros, @code{PARAMS} and 4125@code{VPARAMS}. This warning is also bypassed for nested functions 4126because that feature is already a GCC extension and thus not relevant to 4127traditional C compatibility. 4128@end itemize 4129 4130@item -Wtraditional-conversion @r{(C and Objective-C only)} 4131@opindex Wtraditional-conversion 4132@opindex Wno-traditional-conversion 4133Warn if a prototype causes a type conversion that is different from what 4134would happen to the same argument in the absence of a prototype. This 4135includes conversions of fixed point to floating and vice versa, and 4136conversions changing the width or signedness of a fixed-point argument 4137except when the same as the default promotion. 4138 4139@item -Wdeclaration-after-statement @r{(C and Objective-C only)} 4140@opindex Wdeclaration-after-statement 4141@opindex Wno-declaration-after-statement 4142Warn when a declaration is found after a statement in a block. This 4143construct, known from C++, was introduced with ISO C99 and is by default 4144allowed in GCC@. It is not supported by ISO C90 and was not supported by 4145GCC versions before GCC 3.0. @xref{Mixed Declarations}. 4146 4147@item -Wundef 4148@opindex Wundef 4149@opindex Wno-undef 4150Warn if an undefined identifier is evaluated in an @samp{#if} directive. 4151 4152@item -Wno-endif-labels 4153@opindex Wno-endif-labels 4154@opindex Wendif-labels 4155Do not warn whenever an @samp{#else} or an @samp{#endif} are followed by text. 4156 4157@item -Wshadow 4158@opindex Wshadow 4159@opindex Wno-shadow 4160Warn whenever a local variable or type declaration shadows another variable, 4161parameter, type, or class member (in C++), or whenever a built-in function 4162is shadowed. Note that in C++, the compiler warns if a local variable 4163shadows an explicit typedef, but not if it shadows a struct/class/enum. 4164 4165@item -Wlarger-than=@var{len} 4166@opindex Wlarger-than=@var{len} 4167@opindex Wlarger-than-@var{len} 4168Warn whenever an object of larger than @var{len} bytes is defined. 4169 4170@item -Wframe-larger-than=@var{len} 4171@opindex Wframe-larger-than 4172Warn if the size of a function frame is larger than @var{len} bytes. 4173The computation done to determine the stack frame size is approximate 4174and not conservative. 4175The actual requirements may be somewhat greater than @var{len} 4176even if you do not get a warning. In addition, any space allocated 4177via @code{alloca}, variable-length arrays, or related constructs 4178is not included by the compiler when determining 4179whether or not to issue a warning. 4180 4181@item -Wno-free-nonheap-object 4182@opindex Wno-free-nonheap-object 4183@opindex Wfree-nonheap-object 4184Do not warn when attempting to free an object that was not allocated 4185on the heap. 4186 4187@item -Wstack-usage=@var{len} 4188@opindex Wstack-usage 4189Warn if the stack usage of a function might be larger than @var{len} bytes. 4190The computation done to determine the stack usage is conservative. 4191Any space allocated via @code{alloca}, variable-length arrays, or related 4192constructs is included by the compiler when determining whether or not to 4193issue a warning. 4194 4195The message is in keeping with the output of @option{-fstack-usage}. 4196 4197@itemize 4198@item 4199If the stack usage is fully static but exceeds the specified amount, it's: 4200 4201@smallexample 4202 warning: stack usage is 1120 bytes 4203@end smallexample 4204@item 4205If the stack usage is (partly) dynamic but bounded, it's: 4206 4207@smallexample 4208 warning: stack usage might be 1648 bytes 4209@end smallexample 4210@item 4211If the stack usage is (partly) dynamic and not bounded, it's: 4212 4213@smallexample 4214 warning: stack usage might be unbounded 4215@end smallexample 4216@end itemize 4217 4218@item -Wunsafe-loop-optimizations 4219@opindex Wunsafe-loop-optimizations 4220@opindex Wno-unsafe-loop-optimizations 4221Warn if the loop cannot be optimized because the compiler cannot 4222assume anything on the bounds of the loop indices. With 4223@option{-funsafe-loop-optimizations} warn if the compiler makes 4224such assumptions. 4225 4226@item -Wno-pedantic-ms-format @r{(MinGW targets only)} 4227@opindex Wno-pedantic-ms-format 4228@opindex Wpedantic-ms-format 4229When used in combination with @option{-Wformat} 4230and @option{-pedantic} without GNU extensions, this option 4231disables the warnings about non-ISO @code{printf} / @code{scanf} format 4232width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets, 4233which depend on the MS runtime. 4234 4235@item -Wpointer-arith 4236@opindex Wpointer-arith 4237@opindex Wno-pointer-arith 4238Warn about anything that depends on the ``size of'' a function type or 4239of @code{void}. GNU C assigns these types a size of 1, for 4240convenience in calculations with @code{void *} pointers and pointers 4241to functions. In C++, warn also when an arithmetic operation involves 4242@code{NULL}. This warning is also enabled by @option{-Wpedantic}. 4243 4244@item -Wtype-limits 4245@opindex Wtype-limits 4246@opindex Wno-type-limits 4247Warn if a comparison is always true or always false due to the limited 4248range of the data type, but do not warn for constant expressions. For 4249example, warn if an unsigned variable is compared against zero with 4250@samp{<} or @samp{>=}. This warning is also enabled by 4251@option{-Wextra}. 4252 4253@item -Wbad-function-cast @r{(C and Objective-C only)} 4254@opindex Wbad-function-cast 4255@opindex Wno-bad-function-cast 4256Warn whenever a function call is cast to a non-matching type. 4257For example, warn if @code{int malloc()} is cast to @code{anything *}. 4258 4259@item -Wc++-compat @r{(C and Objective-C only)} 4260Warn about ISO C constructs that are outside of the common subset of 4261ISO C and ISO C++, e.g.@: request for implicit conversion from 4262@code{void *} to a pointer to non-@code{void} type. 4263 4264@item -Wc++11-compat @r{(C++ and Objective-C++ only)} 4265Warn about C++ constructs whose meaning differs between ISO C++ 1998 4266and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords 4267in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is 4268enabled by @option{-Wall}. 4269 4270@item -Wcast-qual 4271@opindex Wcast-qual 4272@opindex Wno-cast-qual 4273Warn whenever a pointer is cast so as to remove a type qualifier from 4274the target type. For example, warn if a @code{const char *} is cast 4275to an ordinary @code{char *}. 4276 4277Also warn when making a cast that introduces a type qualifier in an 4278unsafe way. For example, casting @code{char **} to @code{const char **} 4279is unsafe, as in this example: 4280 4281@smallexample 4282 /* p is char ** value. */ 4283 const char **q = (const char **) p; 4284 /* Assignment of readonly string to const char * is OK. */ 4285 *q = "string"; 4286 /* Now char** pointer points to read-only memory. */ 4287 **p = 'b'; 4288@end smallexample 4289 4290@item -Wcast-align 4291@opindex Wcast-align 4292@opindex Wno-cast-align 4293Warn whenever a pointer is cast such that the required alignment of the 4294target is increased. For example, warn if a @code{char *} is cast to 4295an @code{int *} on machines where integers can only be accessed at 4296two- or four-byte boundaries. 4297 4298@item -Wwrite-strings 4299@opindex Wwrite-strings 4300@opindex Wno-write-strings 4301When compiling C, give string constants the type @code{const 4302char[@var{length}]} so that copying the address of one into a 4303non-@code{const} @code{char *} pointer produces a warning. These 4304warnings help you find at compile time code that can try to write 4305into a string constant, but only if you have been very careful about 4306using @code{const} in declarations and prototypes. Otherwise, it is 4307just a nuisance. This is why we did not make @option{-Wall} request 4308these warnings. 4309 4310When compiling C++, warn about the deprecated conversion from string 4311literals to @code{char *}. This warning is enabled by default for C++ 4312programs. 4313 4314@item -Wclobbered 4315@opindex Wclobbered 4316@opindex Wno-clobbered 4317Warn for variables that might be changed by @samp{longjmp} or 4318@samp{vfork}. This warning is also enabled by @option{-Wextra}. 4319 4320@item -Wconversion 4321@opindex Wconversion 4322@opindex Wno-conversion 4323Warn for implicit conversions that may alter a value. This includes 4324conversions between real and integer, like @code{abs (x)} when 4325@code{x} is @code{double}; conversions between signed and unsigned, 4326like @code{unsigned ui = -1}; and conversions to smaller types, like 4327@code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs 4328((int) x)} and @code{ui = (unsigned) -1}, or if the value is not 4329changed by the conversion like in @code{abs (2.0)}. Warnings about 4330conversions between signed and unsigned integers can be disabled by 4331using @option{-Wno-sign-conversion}. 4332 4333For C++, also warn for confusing overload resolution for user-defined 4334conversions; and conversions that never use a type conversion 4335operator: conversions to @code{void}, the same type, a base class or a 4336reference to them. Warnings about conversions between signed and 4337unsigned integers are disabled by default in C++ unless 4338@option{-Wsign-conversion} is explicitly enabled. 4339 4340@item -Wno-conversion-null @r{(C++ and Objective-C++ only)} 4341@opindex Wconversion-null 4342@opindex Wno-conversion-null 4343Do not warn for conversions between @code{NULL} and non-pointer 4344types. @option{-Wconversion-null} is enabled by default. 4345 4346@item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)} 4347@opindex Wzero-as-null-pointer-constant 4348@opindex Wno-zero-as-null-pointer-constant 4349Warn when a literal '0' is used as null pointer constant. This can 4350be useful to facilitate the conversion to @code{nullptr} in C++11. 4351 4352@item -Wuseless-cast @r{(C++ and Objective-C++ only)} 4353@opindex Wuseless-cast 4354@opindex Wno-useless-cast 4355Warn when an expression is casted to its own type. 4356 4357@item -Wempty-body 4358@opindex Wempty-body 4359@opindex Wno-empty-body 4360Warn if an empty body occurs in an @samp{if}, @samp{else} or @samp{do 4361while} statement. This warning is also enabled by @option{-Wextra}. 4362 4363@item -Wenum-compare 4364@opindex Wenum-compare 4365@opindex Wno-enum-compare 4366Warn about a comparison between values of different enumerated types. 4367In C++ enumeral mismatches in conditional expressions are also 4368diagnosed and the warning is enabled by default. In C this warning is 4369enabled by @option{-Wall}. 4370 4371@item -Wjump-misses-init @r{(C, Objective-C only)} 4372@opindex Wjump-misses-init 4373@opindex Wno-jump-misses-init 4374Warn if a @code{goto} statement or a @code{switch} statement jumps 4375forward across the initialization of a variable, or jumps backward to a 4376label after the variable has been initialized. This only warns about 4377variables that are initialized when they are declared. This warning is 4378only supported for C and Objective-C; in C++ this sort of branch is an 4379error in any case. 4380 4381@option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It 4382can be disabled with the @option{-Wno-jump-misses-init} option. 4383 4384@item -Wsign-compare 4385@opindex Wsign-compare 4386@opindex Wno-sign-compare 4387@cindex warning for comparison of signed and unsigned values 4388@cindex comparison of signed and unsigned values, warning 4389@cindex signed and unsigned values, comparison warning 4390Warn when a comparison between signed and unsigned values could produce 4391an incorrect result when the signed value is converted to unsigned. 4392This warning is also enabled by @option{-Wextra}; to get the other warnings 4393of @option{-Wextra} without this warning, use @option{-Wextra -Wno-sign-compare}. 4394 4395@item -Wsign-conversion 4396@opindex Wsign-conversion 4397@opindex Wno-sign-conversion 4398Warn for implicit conversions that may change the sign of an integer 4399value, like assigning a signed integer expression to an unsigned 4400integer variable. An explicit cast silences the warning. In C, this 4401option is enabled also by @option{-Wconversion}. 4402 4403@item -Wsizeof-pointer-memaccess 4404@opindex Wsizeof-pointer-memaccess 4405@opindex Wno-sizeof-pointer-memaccess 4406Warn for suspicious length parameters to certain string and memory built-in 4407functions if the argument uses @code{sizeof}. This warning warns e.g.@: 4408about @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not an array, 4409but a pointer, and suggests a possible fix, or about 4410@code{memcpy (&foo, ptr, sizeof (&foo));}. This warning is enabled by 4411@option{-Wall}. 4412 4413@item -Waddress 4414@opindex Waddress 4415@opindex Wno-address 4416Warn about suspicious uses of memory addresses. These include using 4417the address of a function in a conditional expression, such as 4418@code{void func(void); if (func)}, and comparisons against the memory 4419address of a string literal, such as @code{if (x == "abc")}. Such 4420uses typically indicate a programmer error: the address of a function 4421always evaluates to true, so their use in a conditional usually 4422indicate that the programmer forgot the parentheses in a function 4423call; and comparisons against string literals result in unspecified 4424behavior and are not portable in C, so they usually indicate that the 4425programmer intended to use @code{strcmp}. This warning is enabled by 4426@option{-Wall}. 4427 4428@item -Wlogical-op 4429@opindex Wlogical-op 4430@opindex Wno-logical-op 4431Warn about suspicious uses of logical operators in expressions. 4432This includes using logical operators in contexts where a 4433bit-wise operator is likely to be expected. 4434 4435@item -Waggregate-return 4436@opindex Waggregate-return 4437@opindex Wno-aggregate-return 4438Warn if any functions that return structures or unions are defined or 4439called. (In languages where you can return an array, this also elicits 4440a warning.) 4441 4442@item -Wno-aggressive-loop-optimizations 4443@opindex Wno-aggressive-loop-optimizations 4444@opindex Waggressive-loop-optimizations 4445Warn if in a loop with constant number of iterations the compiler detects 4446undefined behavior in some statement during one or more of the iterations. 4447 4448@item -Wno-attributes 4449@opindex Wno-attributes 4450@opindex Wattributes 4451Do not warn if an unexpected @code{__attribute__} is used, such as 4452unrecognized attributes, function attributes applied to variables, 4453etc. This does not stop errors for incorrect use of supported 4454attributes. 4455 4456@item -Wno-builtin-macro-redefined 4457@opindex Wno-builtin-macro-redefined 4458@opindex Wbuiltin-macro-redefined 4459Do not warn if certain built-in macros are redefined. This suppresses 4460warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__}, 4461@code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}. 4462 4463@item -Wstrict-prototypes @r{(C and Objective-C only)} 4464@opindex Wstrict-prototypes 4465@opindex Wno-strict-prototypes 4466Warn if a function is declared or defined without specifying the 4467argument types. (An old-style function definition is permitted without 4468a warning if preceded by a declaration that specifies the argument 4469types.) 4470 4471@item -Wold-style-declaration @r{(C and Objective-C only)} 4472@opindex Wold-style-declaration 4473@opindex Wno-old-style-declaration 4474Warn for obsolescent usages, according to the C Standard, in a 4475declaration. For example, warn if storage-class specifiers like 4476@code{static} are not the first things in a declaration. This warning 4477is also enabled by @option{-Wextra}. 4478 4479@item -Wold-style-definition @r{(C and Objective-C only)} 4480@opindex Wold-style-definition 4481@opindex Wno-old-style-definition 4482Warn if an old-style function definition is used. A warning is given 4483even if there is a previous prototype. 4484 4485@item -Wmissing-parameter-type @r{(C and Objective-C only)} 4486@opindex Wmissing-parameter-type 4487@opindex Wno-missing-parameter-type 4488A function parameter is declared without a type specifier in K&R-style 4489functions: 4490 4491@smallexample 4492void foo(bar) @{ @} 4493@end smallexample 4494 4495This warning is also enabled by @option{-Wextra}. 4496 4497@item -Wmissing-prototypes @r{(C and Objective-C only)} 4498@opindex Wmissing-prototypes 4499@opindex Wno-missing-prototypes 4500Warn if a global function is defined without a previous prototype 4501declaration. This warning is issued even if the definition itself 4502provides a prototype. Use this option to detect global functions 4503that do not have a matching prototype declaration in a header file. 4504This option is not valid for C++ because all function declarations 4505provide prototypes and a non-matching declaration will declare an 4506overload rather than conflict with an earlier declaration. 4507Use @option{-Wmissing-declarations} to detect missing declarations in C++. 4508 4509@item -Wmissing-declarations 4510@opindex Wmissing-declarations 4511@opindex Wno-missing-declarations 4512Warn if a global function is defined without a previous declaration. 4513Do so even if the definition itself provides a prototype. 4514Use this option to detect global functions that are not declared in 4515header files. In C, no warnings are issued for functions with previous 4516non-prototype declarations; use @option{-Wmissing-prototype} to detect 4517missing prototypes. In C++, no warnings are issued for function templates, 4518or for inline functions, or for functions in anonymous namespaces. 4519 4520@item -Wmissing-field-initializers 4521@opindex Wmissing-field-initializers 4522@opindex Wno-missing-field-initializers 4523@opindex W 4524@opindex Wextra 4525@opindex Wno-extra 4526Warn if a structure's initializer has some fields missing. For 4527example, the following code causes such a warning, because 4528@code{x.h} is implicitly zero: 4529 4530@smallexample 4531struct s @{ int f, g, h; @}; 4532struct s x = @{ 3, 4 @}; 4533@end smallexample 4534 4535This option does not warn about designated initializers, so the following 4536modification does not trigger a warning: 4537 4538@smallexample 4539struct s @{ int f, g, h; @}; 4540struct s x = @{ .f = 3, .g = 4 @}; 4541@end smallexample 4542 4543This warning is included in @option{-Wextra}. To get other @option{-Wextra} 4544warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}. 4545 4546@item -Wno-multichar 4547@opindex Wno-multichar 4548@opindex Wmultichar 4549Do not warn if a multicharacter constant (@samp{'FOOF'}) is used. 4550Usually they indicate a typo in the user's code, as they have 4551implementation-defined values, and should not be used in portable code. 4552 4553@item -Wnormalized=<none|id|nfc|nfkc> 4554@opindex Wnormalized= 4555@cindex NFC 4556@cindex NFKC 4557@cindex character set, input normalization 4558In ISO C and ISO C++, two identifiers are different if they are 4559different sequences of characters. However, sometimes when characters 4560outside the basic ASCII character set are used, you can have two 4561different character sequences that look the same. To avoid confusion, 4562the ISO 10646 standard sets out some @dfn{normalization rules} which 4563when applied ensure that two sequences that look the same are turned into 4564the same sequence. GCC can warn you if you are using identifiers that 4565have not been normalized; this option controls that warning. 4566 4567There are four levels of warning supported by GCC@. The default is 4568@option{-Wnormalized=nfc}, which warns about any identifier that is 4569not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the 4570recommended form for most uses. 4571 4572Unfortunately, there are some characters allowed in identifiers by 4573ISO C and ISO C++ that, when turned into NFC, are not allowed in 4574identifiers. That is, there's no way to use these symbols in portable 4575ISO C or C++ and have all your identifiers in NFC@. 4576@option{-Wnormalized=id} suppresses the warning for these characters. 4577It is hoped that future versions of the standards involved will correct 4578this, which is why this option is not the default. 4579 4580You can switch the warning off for all characters by writing 4581@option{-Wnormalized=none}. You should only do this if you 4582are using some other normalization scheme (like ``D''), because 4583otherwise you can easily create bugs that are literally impossible to see. 4584 4585Some characters in ISO 10646 have distinct meanings but look identical 4586in some fonts or display methodologies, especially once formatting has 4587been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL 4588LETTER N'', displays just like a regular @code{n} that has been 4589placed in a superscript. ISO 10646 defines the @dfn{NFKC} 4590normalization scheme to convert all these into a standard form as 4591well, and GCC warns if your code is not in NFKC if you use 4592@option{-Wnormalized=nfkc}. This warning is comparable to warning 4593about every identifier that contains the letter O because it might be 4594confused with the digit 0, and so is not the default, but may be 4595useful as a local coding convention if the programming environment 4596cannot be fixed to display these characters distinctly. 4597 4598@item -Wno-deprecated 4599@opindex Wno-deprecated 4600@opindex Wdeprecated 4601Do not warn about usage of deprecated features. @xref{Deprecated Features}. 4602 4603@item -Wno-deprecated-declarations 4604@opindex Wno-deprecated-declarations 4605@opindex Wdeprecated-declarations 4606Do not warn about uses of functions (@pxref{Function Attributes}), 4607variables (@pxref{Variable Attributes}), and types (@pxref{Type 4608Attributes}) marked as deprecated by using the @code{deprecated} 4609attribute. 4610 4611@item -Wno-overflow 4612@opindex Wno-overflow 4613@opindex Woverflow 4614Do not warn about compile-time overflow in constant expressions. 4615 4616@item -Woverride-init @r{(C and Objective-C only)} 4617@opindex Woverride-init 4618@opindex Wno-override-init 4619@opindex W 4620@opindex Wextra 4621@opindex Wno-extra 4622Warn if an initialized field without side effects is overridden when 4623using designated initializers (@pxref{Designated Inits, , Designated 4624Initializers}). 4625 4626This warning is included in @option{-Wextra}. To get other 4627@option{-Wextra} warnings without this one, use @option{-Wextra 4628-Wno-override-init}. 4629 4630@item -Wpacked 4631@opindex Wpacked 4632@opindex Wno-packed 4633Warn if a structure is given the packed attribute, but the packed 4634attribute has no effect on the layout or size of the structure. 4635Such structures may be mis-aligned for little benefit. For 4636instance, in this code, the variable @code{f.x} in @code{struct bar} 4637is misaligned even though @code{struct bar} does not itself 4638have the packed attribute: 4639 4640@smallexample 4641@group 4642struct foo @{ 4643 int x; 4644 char a, b, c, d; 4645@} __attribute__((packed)); 4646struct bar @{ 4647 char z; 4648 struct foo f; 4649@}; 4650@end group 4651@end smallexample 4652 4653@item -Wpacked-bitfield-compat 4654@opindex Wpacked-bitfield-compat 4655@opindex Wno-packed-bitfield-compat 4656The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute 4657on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but 4658the change can lead to differences in the structure layout. GCC 4659informs you when the offset of such a field has changed in GCC 4.4. 4660For example there is no longer a 4-bit padding between field @code{a} 4661and @code{b} in this structure: 4662 4663@smallexample 4664struct foo 4665@{ 4666 char a:4; 4667 char b:8; 4668@} __attribute__ ((packed)); 4669@end smallexample 4670 4671This warning is enabled by default. Use 4672@option{-Wno-packed-bitfield-compat} to disable this warning. 4673 4674@item -Wpadded 4675@opindex Wpadded 4676@opindex Wno-padded 4677Warn if padding is included in a structure, either to align an element 4678of the structure or to align the whole structure. Sometimes when this 4679happens it is possible to rearrange the fields of the structure to 4680reduce the padding and so make the structure smaller. 4681 4682@item -Wredundant-decls 4683@opindex Wredundant-decls 4684@opindex Wno-redundant-decls 4685Warn if anything is declared more than once in the same scope, even in 4686cases where multiple declaration is valid and changes nothing. 4687 4688@item -Wnested-externs @r{(C and Objective-C only)} 4689@opindex Wnested-externs 4690@opindex Wno-nested-externs 4691Warn if an @code{extern} declaration is encountered within a function. 4692 4693@item -Wno-inherited-variadic-ctor 4694@opindex Winherited-variadic-ctor 4695@opindex Wno-inherited-variadic-ctor 4696Suppress warnings about use of C++11 inheriting constructors when the 4697base class inherited from has a C variadic constructor; the warning is 4698on by default because the ellipsis is not inherited. 4699 4700@item -Winline 4701@opindex Winline 4702@opindex Wno-inline 4703Warn if a function that is declared as inline cannot be inlined. 4704Even with this option, the compiler does not warn about failures to 4705inline functions declared in system headers. 4706 4707The compiler uses a variety of heuristics to determine whether or not 4708to inline a function. For example, the compiler takes into account 4709the size of the function being inlined and the amount of inlining 4710that has already been done in the current function. Therefore, 4711seemingly insignificant changes in the source program can cause the 4712warnings produced by @option{-Winline} to appear or disappear. 4713 4714@item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)} 4715@opindex Wno-invalid-offsetof 4716@opindex Winvalid-offsetof 4717Suppress warnings from applying the @samp{offsetof} macro to a non-POD 4718type. According to the 1998 ISO C++ standard, applying @samp{offsetof} 4719to a non-POD type is undefined. In existing C++ implementations, 4720however, @samp{offsetof} typically gives meaningful results even when 4721applied to certain kinds of non-POD types (such as a simple 4722@samp{struct} that fails to be a POD type only by virtue of having a 4723constructor). This flag is for users who are aware that they are 4724writing nonportable code and who have deliberately chosen to ignore the 4725warning about it. 4726 4727The restrictions on @samp{offsetof} may be relaxed in a future version 4728of the C++ standard. 4729 4730@item -Wno-int-to-pointer-cast 4731@opindex Wno-int-to-pointer-cast 4732@opindex Wint-to-pointer-cast 4733Suppress warnings from casts to pointer type of an integer of a 4734different size. In C++, casting to a pointer type of smaller size is 4735an error. @option{Wint-to-pointer-cast} is enabled by default. 4736 4737 4738@item -Wno-pointer-to-int-cast @r{(C and Objective-C only)} 4739@opindex Wno-pointer-to-int-cast 4740@opindex Wpointer-to-int-cast 4741Suppress warnings from casts from a pointer to an integer type of a 4742different size. 4743 4744@item -Winvalid-pch 4745@opindex Winvalid-pch 4746@opindex Wno-invalid-pch 4747Warn if a precompiled header (@pxref{Precompiled Headers}) is found in 4748the search path but can't be used. 4749 4750@item -Wlong-long 4751@opindex Wlong-long 4752@opindex Wno-long-long 4753Warn if @samp{long long} type is used. This is enabled by either 4754@option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98 4755modes. To inhibit the warning messages, use @option{-Wno-long-long}. 4756 4757@item -Wvariadic-macros 4758@opindex Wvariadic-macros 4759@opindex Wno-variadic-macros 4760Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU 4761alternate syntax when in pedantic ISO C99 mode. This is default. 4762To inhibit the warning messages, use @option{-Wno-variadic-macros}. 4763 4764@item -Wvarargs 4765@opindex Wvarargs 4766@opindex Wno-varargs 4767Warn upon questionable usage of the macros used to handle variable 4768arguments like @samp{va_start}. This is default. To inhibit the 4769warning messages, use @option{-Wno-varargs}. 4770 4771@item -Wvector-operation-performance 4772@opindex Wvector-operation-performance 4773@opindex Wno-vector-operation-performance 4774Warn if vector operation is not implemented via SIMD capabilities of the 4775architecture. Mainly useful for the performance tuning. 4776Vector operation can be implemented @code{piecewise}, which means that the 4777scalar operation is performed on every vector element; 4778@code{in parallel}, which means that the vector operation is implemented 4779using scalars of wider type, which normally is more performance efficient; 4780and @code{as a single scalar}, which means that vector fits into a 4781scalar type. 4782 4783@item -Wno-virtual-move-assign 4784@opindex Wvirtual-move-assign 4785@opindex Wno-virtual-move-assign 4786Suppress warnings about inheriting from a virtual base with a 4787non-trivial C++11 move assignment operator. This is dangerous because 4788if the virtual base is reachable along more than one path, it will be 4789moved multiple times, which can mean both objects end up in the 4790moved-from state. If the move assignment operator is written to avoid 4791moving from a moved-from object, this warning can be disabled. 4792 4793@item -Wvla 4794@opindex Wvla 4795@opindex Wno-vla 4796Warn if variable length array is used in the code. 4797@option{-Wno-vla} prevents the @option{-Wpedantic} warning of 4798the variable length array. 4799 4800@item -Wvolatile-register-var 4801@opindex Wvolatile-register-var 4802@opindex Wno-volatile-register-var 4803Warn if a register variable is declared volatile. The volatile 4804modifier does not inhibit all optimizations that may eliminate reads 4805and/or writes to register variables. This warning is enabled by 4806@option{-Wall}. 4807 4808@item -Wdisabled-optimization 4809@opindex Wdisabled-optimization 4810@opindex Wno-disabled-optimization 4811Warn if a requested optimization pass is disabled. This warning does 4812not generally indicate that there is anything wrong with your code; it 4813merely indicates that GCC's optimizers are unable to handle the code 4814effectively. Often, the problem is that your code is too big or too 4815complex; GCC refuses to optimize programs when the optimization 4816itself is likely to take inordinate amounts of time. 4817 4818@item -Wpointer-sign @r{(C and Objective-C only)} 4819@opindex Wpointer-sign 4820@opindex Wno-pointer-sign 4821Warn for pointer argument passing or assignment with different signedness. 4822This option is only supported for C and Objective-C@. It is implied by 4823@option{-Wall} and by @option{-Wpedantic}, which can be disabled with 4824@option{-Wno-pointer-sign}. 4825 4826@item -Wstack-protector 4827@opindex Wstack-protector 4828@opindex Wno-stack-protector 4829This option is only active when @option{-fstack-protector} is active. It 4830warns about functions that are not protected against stack smashing. 4831 4832@item -Wno-mudflap 4833@opindex Wno-mudflap 4834Suppress warnings about constructs that cannot be instrumented by 4835@option{-fmudflap}. 4836 4837@item -Woverlength-strings 4838@opindex Woverlength-strings 4839@opindex Wno-overlength-strings 4840Warn about string constants that are longer than the ``minimum 4841maximum'' length specified in the C standard. Modern compilers 4842generally allow string constants that are much longer than the 4843standard's minimum limit, but very portable programs should avoid 4844using longer strings. 4845 4846The limit applies @emph{after} string constant concatenation, and does 4847not count the trailing NUL@. In C90, the limit was 509 characters; in 4848C99, it was raised to 4095. C++98 does not specify a normative 4849minimum maximum, so we do not diagnose overlength strings in C++@. 4850 4851This option is implied by @option{-Wpedantic}, and can be disabled with 4852@option{-Wno-overlength-strings}. 4853 4854@item -Wunsuffixed-float-constants @r{(C and Objective-C only)} 4855@opindex Wunsuffixed-float-constants 4856 4857Issue a warning for any floating constant that does not have 4858a suffix. When used together with @option{-Wsystem-headers} it 4859warns about such constants in system header files. This can be useful 4860when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma 4861from the decimal floating-point extension to C99. 4862@end table 4863 4864@node Debugging Options 4865@section Options for Debugging Your Program or GCC 4866@cindex options, debugging 4867@cindex debugging information options 4868 4869GCC has various special options that are used for debugging 4870either your program or GCC: 4871 4872@table @gcctabopt 4873@item -g 4874@opindex g 4875Produce debugging information in the operating system's native format 4876(stabs, COFF, XCOFF, or DWARF 2)@. GDB can work with this debugging 4877information. 4878 4879On most systems that use stabs format, @option{-g} enables use of extra 4880debugging information that only GDB can use; this extra information 4881makes debugging work better in GDB but probably makes other debuggers 4882crash or 4883refuse to read the program. If you want to control for certain whether 4884to generate the extra information, use @option{-gstabs+}, @option{-gstabs}, 4885@option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below). 4886 4887GCC allows you to use @option{-g} with 4888@option{-O}. The shortcuts taken by optimized code may occasionally 4889produce surprising results: some variables you declared may not exist 4890at all; flow of control may briefly move where you did not expect it; 4891some statements may not be executed because they compute constant 4892results or their values are already at hand; some statements may 4893execute in different places because they have been moved out of loops. 4894 4895Nevertheless it proves possible to debug optimized output. This makes 4896it reasonable to use the optimizer for programs that might have bugs. 4897 4898The following options are useful when GCC is generated with the 4899capability for more than one debugging format. 4900 4901@item -gsplit-dwarf 4902@opindex gsplit-dwarf 4903Separate as much dwarf debugging information as possible into a 4904separate output file with the extension .dwo. This option allows 4905the build system to avoid linking files with debug information. To 4906be useful, this option requires a debugger capable of reading .dwo 4907files. 4908 4909@item -ggdb 4910@opindex ggdb 4911Produce debugging information for use by GDB@. This means to use the 4912most expressive format available (DWARF 2, stabs, or the native format 4913if neither of those are supported), including GDB extensions if at all 4914possible. 4915 4916@item -gpubnames 4917@opindex gpubnames 4918Generate dwarf .debug_pubnames and .debug_pubtypes sections. 4919 4920@item -gstabs 4921@opindex gstabs 4922Produce debugging information in stabs format (if that is supported), 4923without GDB extensions. This is the format used by DBX on most BSD 4924systems. On MIPS, Alpha and System V Release 4 systems this option 4925produces stabs debugging output that is not understood by DBX or SDB@. 4926On System V Release 4 systems this option requires the GNU assembler. 4927 4928@item -feliminate-unused-debug-symbols 4929@opindex feliminate-unused-debug-symbols 4930Produce debugging information in stabs format (if that is supported), 4931for only symbols that are actually used. 4932 4933@item -femit-class-debug-always 4934Instead of emitting debugging information for a C++ class in only one 4935object file, emit it in all object files using the class. This option 4936should be used only with debuggers that are unable to handle the way GCC 4937normally emits debugging information for classes because using this 4938option increases the size of debugging information by as much as a 4939factor of two. 4940 4941@item -fdebug-types-section 4942@opindex fdebug-types-section 4943@opindex fno-debug-types-section 4944When using DWARF Version 4 or higher, type DIEs can be put into 4945their own @code{.debug_types} section instead of making them part of the 4946@code{.debug_info} section. It is more efficient to put them in a separate 4947comdat sections since the linker can then remove duplicates. 4948But not all DWARF consumers support @code{.debug_types} sections yet 4949and on some objects @code{.debug_types} produces larger instead of smaller 4950debugging information. 4951 4952@item -gstabs+ 4953@opindex gstabs+ 4954Produce debugging information in stabs format (if that is supported), 4955using GNU extensions understood only by the GNU debugger (GDB)@. The 4956use of these extensions is likely to make other debuggers crash or 4957refuse to read the program. 4958 4959@item -gcoff 4960@opindex gcoff 4961Produce debugging information in COFF format (if that is supported). 4962This is the format used by SDB on most System V systems prior to 4963System V Release 4. 4964 4965@item -gxcoff 4966@opindex gxcoff 4967Produce debugging information in XCOFF format (if that is supported). 4968This is the format used by the DBX debugger on IBM RS/6000 systems. 4969 4970@item -gxcoff+ 4971@opindex gxcoff+ 4972Produce debugging information in XCOFF format (if that is supported), 4973using GNU extensions understood only by the GNU debugger (GDB)@. The 4974use of these extensions is likely to make other debuggers crash or 4975refuse to read the program, and may cause assemblers other than the GNU 4976assembler (GAS) to fail with an error. 4977 4978@item -gdwarf-@var{version} 4979@opindex gdwarf-@var{version} 4980Produce debugging information in DWARF format (if that is supported). 4981The value of @var{version} may be either 2, 3 or 4; the default version 4982for most targets is 4. 4983 4984Note that with DWARF Version 2, some ports require and always 4985use some non-conflicting DWARF 3 extensions in the unwind tables. 4986 4987Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments} 4988for maximum benefit. 4989 4990@item -grecord-gcc-switches 4991@opindex grecord-gcc-switches 4992This switch causes the command-line options used to invoke the 4993compiler that may affect code generation to be appended to the 4994DW_AT_producer attribute in DWARF debugging information. The options 4995are concatenated with spaces separating them from each other and from 4996the compiler version. See also @option{-frecord-gcc-switches} for another 4997way of storing compiler options into the object file. This is the default. 4998 4999@item -gno-record-gcc-switches 5000@opindex gno-record-gcc-switches 5001Disallow appending command-line options to the DW_AT_producer attribute 5002in DWARF debugging information. 5003 5004@item -gstrict-dwarf 5005@opindex gstrict-dwarf 5006Disallow using extensions of later DWARF standard version than selected 5007with @option{-gdwarf-@var{version}}. On most targets using non-conflicting 5008DWARF extensions from later standard versions is allowed. 5009 5010@item -gno-strict-dwarf 5011@opindex gno-strict-dwarf 5012Allow using extensions of later DWARF standard version than selected with 5013@option{-gdwarf-@var{version}}. 5014 5015@item -gvms 5016@opindex gvms 5017Produce debugging information in Alpha/VMS debug format (if that is 5018supported). This is the format used by DEBUG on Alpha/VMS systems. 5019 5020@item -g@var{level} 5021@itemx -ggdb@var{level} 5022@itemx -gstabs@var{level} 5023@itemx -gcoff@var{level} 5024@itemx -gxcoff@var{level} 5025@itemx -gvms@var{level} 5026Request debugging information and also use @var{level} to specify how 5027much information. The default level is 2. 5028 5029Level 0 produces no debug information at all. Thus, @option{-g0} negates 5030@option{-g}. 5031 5032Level 1 produces minimal information, enough for making backtraces in 5033parts of the program that you don't plan to debug. This includes 5034descriptions of functions and external variables, but no information 5035about local variables and no line numbers. 5036 5037Level 3 includes extra information, such as all the macro definitions 5038present in the program. Some debuggers support macro expansion when 5039you use @option{-g3}. 5040 5041@option{-gdwarf-2} does not accept a concatenated debug level, because 5042GCC used to support an option @option{-gdwarf} that meant to generate 5043debug information in version 1 of the DWARF format (which is very 5044different from version 2), and it would have been too confusing. That 5045debug format is long obsolete, but the option cannot be changed now. 5046Instead use an additional @option{-g@var{level}} option to change the 5047debug level for DWARF. 5048 5049@item -gtoggle 5050@opindex gtoggle 5051Turn off generation of debug info, if leaving out this option 5052generates it, or turn it on at level 2 otherwise. The position of this 5053argument in the command line does not matter; it takes effect after all 5054other options are processed, and it does so only once, no matter how 5055many times it is given. This is mainly intended to be used with 5056@option{-fcompare-debug}. 5057 5058@item -fsanitize=address 5059Enable AddressSanitizer, a fast memory error detector. 5060Memory access instructions will be instrumented to detect 5061out-of-bounds and use-after-free bugs. 5062See @uref{http://code.google.com/p/address-sanitizer/} for more details. 5063 5064@item -fsanitize=thread 5065Enable ThreadSanitizer, a fast data race detector. 5066Memory access instructions will be instrumented to detect 5067data race bugs. 5068See @uref{http://code.google.com/p/data-race-test/wiki/ThreadSanitizer} for more details. 5069 5070@item -fdump-final-insns@r{[}=@var{file}@r{]} 5071@opindex fdump-final-insns 5072Dump the final internal representation (RTL) to @var{file}. If the 5073optional argument is omitted (or if @var{file} is @code{.}), the name 5074of the dump file is determined by appending @code{.gkd} to the 5075compilation output file name. 5076 5077@item -fcompare-debug@r{[}=@var{opts}@r{]} 5078@opindex fcompare-debug 5079@opindex fno-compare-debug 5080If no error occurs during compilation, run the compiler a second time, 5081adding @var{opts} and @option{-fcompare-debug-second} to the arguments 5082passed to the second compilation. Dump the final internal 5083representation in both compilations, and print an error if they differ. 5084 5085If the equal sign is omitted, the default @option{-gtoggle} is used. 5086 5087The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty 5088and nonzero, implicitly enables @option{-fcompare-debug}. If 5089@env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash, 5090then it is used for @var{opts}, otherwise the default @option{-gtoggle} 5091is used. 5092 5093@option{-fcompare-debug=}, with the equal sign but without @var{opts}, 5094is equivalent to @option{-fno-compare-debug}, which disables the dumping 5095of the final representation and the second compilation, preventing even 5096@env{GCC_COMPARE_DEBUG} from taking effect. 5097 5098To verify full coverage during @option{-fcompare-debug} testing, set 5099@env{GCC_COMPARE_DEBUG} to say @samp{-fcompare-debug-not-overridden}, 5100which GCC rejects as an invalid option in any actual compilation 5101(rather than preprocessing, assembly or linking). To get just a 5102warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug 5103not overridden} will do. 5104 5105@item -fcompare-debug-second 5106@opindex fcompare-debug-second 5107This option is implicitly passed to the compiler for the second 5108compilation requested by @option{-fcompare-debug}, along with options to 5109silence warnings, and omitting other options that would cause 5110side-effect compiler outputs to files or to the standard output. Dump 5111files and preserved temporary files are renamed so as to contain the 5112@code{.gk} additional extension during the second compilation, to avoid 5113overwriting those generated by the first. 5114 5115When this option is passed to the compiler driver, it causes the 5116@emph{first} compilation to be skipped, which makes it useful for little 5117other than debugging the compiler proper. 5118 5119@item -feliminate-dwarf2-dups 5120@opindex feliminate-dwarf2-dups 5121Compress DWARF 2 debugging information by eliminating duplicated 5122information about each symbol. This option only makes sense when 5123generating DWARF 2 debugging information with @option{-gdwarf-2}. 5124 5125@item -femit-struct-debug-baseonly 5126Emit debug information for struct-like types 5127only when the base name of the compilation source file 5128matches the base name of file in which the struct is defined. 5129 5130This option substantially reduces the size of debugging information, 5131but at significant potential loss in type information to the debugger. 5132See @option{-femit-struct-debug-reduced} for a less aggressive option. 5133See @option{-femit-struct-debug-detailed} for more detailed control. 5134 5135This option works only with DWARF 2. 5136 5137@item -femit-struct-debug-reduced 5138Emit debug information for struct-like types 5139only when the base name of the compilation source file 5140matches the base name of file in which the type is defined, 5141unless the struct is a template or defined in a system header. 5142 5143This option significantly reduces the size of debugging information, 5144with some potential loss in type information to the debugger. 5145See @option{-femit-struct-debug-baseonly} for a more aggressive option. 5146See @option{-femit-struct-debug-detailed} for more detailed control. 5147 5148This option works only with DWARF 2. 5149 5150@item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} 5151Specify the struct-like types 5152for which the compiler generates debug information. 5153The intent is to reduce duplicate struct debug information 5154between different object files within the same program. 5155 5156This option is a detailed version of 5157@option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly}, 5158which serves for most needs. 5159 5160A specification has the syntax@* 5161[@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none}) 5162 5163The optional first word limits the specification to 5164structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}). 5165A struct type is used directly when it is the type of a variable, member. 5166Indirect uses arise through pointers to structs. 5167That is, when use of an incomplete struct is valid, the use is indirect. 5168An example is 5169@samp{struct one direct; struct two * indirect;}. 5170 5171The optional second word limits the specification to 5172ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}). 5173Generic structs are a bit complicated to explain. 5174For C++, these are non-explicit specializations of template classes, 5175or non-template classes within the above. 5176Other programming languages have generics, 5177but @option{-femit-struct-debug-detailed} does not yet implement them. 5178 5179The third word specifies the source files for those 5180structs for which the compiler should emit debug information. 5181The values @samp{none} and @samp{any} have the normal meaning. 5182The value @samp{base} means that 5183the base of name of the file in which the type declaration appears 5184must match the base of the name of the main compilation file. 5185In practice, this means that when compiling @file{foo.c}, debug information 5186is generated for types declared in that file and @file{foo.h}, 5187but not other header files. 5188The value @samp{sys} means those types satisfying @samp{base} 5189or declared in system or compiler headers. 5190 5191You may need to experiment to determine the best settings for your application. 5192 5193The default is @option{-femit-struct-debug-detailed=all}. 5194 5195This option works only with DWARF 2. 5196 5197@item -fno-merge-debug-strings 5198@opindex fmerge-debug-strings 5199@opindex fno-merge-debug-strings 5200Direct the linker to not merge together strings in the debugging 5201information that are identical in different object files. Merging is 5202not supported by all assemblers or linkers. Merging decreases the size 5203of the debug information in the output file at the cost of increasing 5204link processing time. Merging is enabled by default. 5205 5206@item -fdebug-prefix-map=@var{old}=@var{new} 5207@opindex fdebug-prefix-map 5208When compiling files in directory @file{@var{old}}, record debugging 5209information describing them as in @file{@var{new}} instead. 5210 5211@item -fno-dwarf2-cfi-asm 5212@opindex fdwarf2-cfi-asm 5213@opindex fno-dwarf2-cfi-asm 5214Emit DWARF 2 unwind info as compiler generated @code{.eh_frame} section 5215instead of using GAS @code{.cfi_*} directives. 5216 5217@cindex @command{prof} 5218@item -p 5219@opindex p 5220Generate extra code to write profile information suitable for the 5221analysis program @command{prof}. You must use this option when compiling 5222the source files you want data about, and you must also use it when 5223linking. 5224 5225@cindex @command{gprof} 5226@item -pg 5227@opindex pg 5228Generate extra code to write profile information suitable for the 5229analysis program @command{gprof}. You must use this option when compiling 5230the source files you want data about, and you must also use it when 5231linking. 5232 5233@item -Q 5234@opindex Q 5235Makes the compiler print out each function name as it is compiled, and 5236print some statistics about each pass when it finishes. 5237 5238@item -ftime-report 5239@opindex ftime-report 5240Makes the compiler print some statistics about the time consumed by each 5241pass when it finishes. 5242 5243@item -fmem-report 5244@opindex fmem-report 5245Makes the compiler print some statistics about permanent memory 5246allocation when it finishes. 5247 5248@item -fmem-report-wpa 5249@opindex fmem-report-wpa 5250Makes the compiler print some statistics about permanent memory 5251allocation for the WPA phase only. 5252 5253@item -fpre-ipa-mem-report 5254@opindex fpre-ipa-mem-report 5255@item -fpost-ipa-mem-report 5256@opindex fpost-ipa-mem-report 5257Makes the compiler print some statistics about permanent memory 5258allocation before or after interprocedural optimization. 5259 5260@item -fprofile-report 5261@opindex fprofile-report 5262Makes the compiler print some statistics about consistency of the 5263(estimated) profile and effect of individual passes. 5264 5265@item -fstack-usage 5266@opindex fstack-usage 5267Makes the compiler output stack usage information for the program, on a 5268per-function basis. The filename for the dump is made by appending 5269@file{.su} to the @var{auxname}. @var{auxname} is generated from the name of 5270the output file, if explicitly specified and it is not an executable, 5271otherwise it is the basename of the source file. An entry is made up 5272of three fields: 5273 5274@itemize 5275@item 5276The name of the function. 5277@item 5278A number of bytes. 5279@item 5280One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}. 5281@end itemize 5282 5283The qualifier @code{static} means that the function manipulates the stack 5284statically: a fixed number of bytes are allocated for the frame on function 5285entry and released on function exit; no stack adjustments are otherwise made 5286in the function. The second field is this fixed number of bytes. 5287 5288The qualifier @code{dynamic} means that the function manipulates the stack 5289dynamically: in addition to the static allocation described above, stack 5290adjustments are made in the body of the function, for example to push/pop 5291arguments around function calls. If the qualifier @code{bounded} is also 5292present, the amount of these adjustments is bounded at compile time and 5293the second field is an upper bound of the total amount of stack used by 5294the function. If it is not present, the amount of these adjustments is 5295not bounded at compile time and the second field only represents the 5296bounded part. 5297 5298@item -fprofile-arcs 5299@opindex fprofile-arcs 5300Add code so that program flow @dfn{arcs} are instrumented. During 5301execution the program records how many times each branch and call is 5302executed and how many times it is taken or returns. When the compiled 5303program exits it saves this data to a file called 5304@file{@var{auxname}.gcda} for each source file. The data may be used for 5305profile-directed optimizations (@option{-fbranch-probabilities}), or for 5306test coverage analysis (@option{-ftest-coverage}). Each object file's 5307@var{auxname} is generated from the name of the output file, if 5308explicitly specified and it is not the final executable, otherwise it is 5309the basename of the source file. In both cases any suffix is removed 5310(e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or 5311@file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}). 5312@xref{Cross-profiling}. 5313 5314@cindex @command{gcov} 5315@item --coverage 5316@opindex coverage 5317 5318This option is used to compile and link code instrumented for coverage 5319analysis. The option is a synonym for @option{-fprofile-arcs} 5320@option{-ftest-coverage} (when compiling) and @option{-lgcov} (when 5321linking). See the documentation for those options for more details. 5322 5323@itemize 5324 5325@item 5326Compile the source files with @option{-fprofile-arcs} plus optimization 5327and code generation options. For test coverage analysis, use the 5328additional @option{-ftest-coverage} option. You do not need to profile 5329every source file in a program. 5330 5331@item 5332Link your object files with @option{-lgcov} or @option{-fprofile-arcs} 5333(the latter implies the former). 5334 5335@item 5336Run the program on a representative workload to generate the arc profile 5337information. This may be repeated any number of times. You can run 5338concurrent instances of your program, and provided that the file system 5339supports locking, the data files will be correctly updated. Also 5340@code{fork} calls are detected and correctly handled (double counting 5341will not happen). 5342 5343@item 5344For profile-directed optimizations, compile the source files again with 5345the same optimization and code generation options plus 5346@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that 5347Control Optimization}). 5348 5349@item 5350For test coverage analysis, use @command{gcov} to produce human readable 5351information from the @file{.gcno} and @file{.gcda} files. Refer to the 5352@command{gcov} documentation for further information. 5353 5354@end itemize 5355 5356With @option{-fprofile-arcs}, for each function of your program GCC 5357creates a program flow graph, then finds a spanning tree for the graph. 5358Only arcs that are not on the spanning tree have to be instrumented: the 5359compiler adds code to count the number of times that these arcs are 5360executed. When an arc is the only exit or only entrance to a block, the 5361instrumentation code can be added to the block; otherwise, a new basic 5362block must be created to hold the instrumentation code. 5363 5364@need 2000 5365@item -ftest-coverage 5366@opindex ftest-coverage 5367Produce a notes file that the @command{gcov} code-coverage utility 5368(@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to 5369show program coverage. Each source file's note file is called 5370@file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option 5371above for a description of @var{auxname} and instructions on how to 5372generate test coverage data. Coverage data matches the source files 5373more closely if you do not optimize. 5374 5375@item -fdbg-cnt-list 5376@opindex fdbg-cnt-list 5377Print the name and the counter upper bound for all debug counters. 5378 5379 5380@item -fdbg-cnt=@var{counter-value-list} 5381@opindex fdbg-cnt 5382Set the internal debug counter upper bound. @var{counter-value-list} 5383is a comma-separated list of @var{name}:@var{value} pairs 5384which sets the upper bound of each debug counter @var{name} to @var{value}. 5385All debug counters have the initial upper bound of @code{UINT_MAX}; 5386thus @code{dbg_cnt()} returns true always unless the upper bound 5387is set by this option. 5388For example, with @option{-fdbg-cnt=dce:10,tail_call:0}, 5389@code{dbg_cnt(dce)} returns true only for first 10 invocations. 5390 5391@item -fenable-@var{kind}-@var{pass} 5392@itemx -fdisable-@var{kind}-@var{pass}=@var{range-list} 5393@opindex fdisable- 5394@opindex fenable- 5395 5396This is a set of options that are used to explicitly disable/enable 5397optimization passes. These options are intended for use for debugging GCC. 5398Compiler users should use regular options for enabling/disabling 5399passes instead. 5400 5401@table @gcctabopt 5402 5403@item -fdisable-ipa-@var{pass} 5404Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is 5405statically invoked in the compiler multiple times, the pass name should be 5406appended with a sequential number starting from 1. 5407 5408@item -fdisable-rtl-@var{pass} 5409@itemx -fdisable-rtl-@var{pass}=@var{range-list} 5410Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is 5411statically invoked in the compiler multiple times, the pass name should be 5412appended with a sequential number starting from 1. @var{range-list} is a 5413comma-separated list of function ranges or assembler names. Each range is a number 5414pair separated by a colon. The range is inclusive in both ends. If the range 5415is trivial, the number pair can be simplified as a single number. If the 5416function's call graph node's @var{uid} falls within one of the specified ranges, 5417the @var{pass} is disabled for that function. The @var{uid} is shown in the 5418function header of a dump file, and the pass names can be dumped by using 5419option @option{-fdump-passes}. 5420 5421@item -fdisable-tree-@var{pass} 5422@itemx -fdisable-tree-@var{pass}=@var{range-list} 5423Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of 5424option arguments. 5425 5426@item -fenable-ipa-@var{pass} 5427Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is 5428statically invoked in the compiler multiple times, the pass name should be 5429appended with a sequential number starting from 1. 5430 5431@item -fenable-rtl-@var{pass} 5432@itemx -fenable-rtl-@var{pass}=@var{range-list} 5433Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument 5434description and examples. 5435 5436@item -fenable-tree-@var{pass} 5437@itemx -fenable-tree-@var{pass}=@var{range-list} 5438Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description 5439of option arguments. 5440 5441@end table 5442 5443Here are some examples showing uses of these options. 5444 5445@smallexample 5446 5447# disable ccp1 for all functions 5448 -fdisable-tree-ccp1 5449# disable complete unroll for function whose cgraph node uid is 1 5450 -fenable-tree-cunroll=1 5451# disable gcse2 for functions at the following ranges [1,1], 5452# [300,400], and [400,1000] 5453# disable gcse2 for functions foo and foo2 5454 -fdisable-rtl-gcse2=foo,foo2 5455# disable early inlining 5456 -fdisable-tree-einline 5457# disable ipa inlining 5458 -fdisable-ipa-inline 5459# enable tree full unroll 5460 -fenable-tree-unroll 5461 5462@end smallexample 5463 5464@item -d@var{letters} 5465@itemx -fdump-rtl-@var{pass} 5466@itemx -fdump-rtl-@var{pass}=@var{filename} 5467@opindex d 5468Says to make debugging dumps during compilation at times specified by 5469@var{letters}. This is used for debugging the RTL-based passes of the 5470compiler. The file names for most of the dumps are made by appending 5471a pass number and a word to the @var{dumpname}, and the files are 5472created in the directory of the output file. In case of 5473@option{=@var{filename}} option, the dump is output on the given file 5474instead of the pass numbered dump files. Note that the pass number is 5475computed statically as passes get registered into the pass manager. 5476Thus the numbering is not related to the dynamic order of execution of 5477passes. In particular, a pass installed by a plugin could have a 5478number over 200 even if it executed quite early. @var{dumpname} is 5479generated from the name of the output file, if explicitly specified 5480and it is not an executable, otherwise it is the basename of the 5481source file. These switches may have different effects when 5482@option{-E} is used for preprocessing. 5483 5484Debug dumps can be enabled with a @option{-fdump-rtl} switch or some 5485@option{-d} option @var{letters}. Here are the possible 5486letters for use in @var{pass} and @var{letters}, and their meanings: 5487 5488@table @gcctabopt 5489 5490@item -fdump-rtl-alignments 5491@opindex fdump-rtl-alignments 5492Dump after branch alignments have been computed. 5493 5494@item -fdump-rtl-asmcons 5495@opindex fdump-rtl-asmcons 5496Dump after fixing rtl statements that have unsatisfied in/out constraints. 5497 5498@item -fdump-rtl-auto_inc_dec 5499@opindex fdump-rtl-auto_inc_dec 5500Dump after auto-inc-dec discovery. This pass is only run on 5501architectures that have auto inc or auto dec instructions. 5502 5503@item -fdump-rtl-barriers 5504@opindex fdump-rtl-barriers 5505Dump after cleaning up the barrier instructions. 5506 5507@item -fdump-rtl-bbpart 5508@opindex fdump-rtl-bbpart 5509Dump after partitioning hot and cold basic blocks. 5510 5511@item -fdump-rtl-bbro 5512@opindex fdump-rtl-bbro 5513Dump after block reordering. 5514 5515@item -fdump-rtl-btl1 5516@itemx -fdump-rtl-btl2 5517@opindex fdump-rtl-btl2 5518@opindex fdump-rtl-btl2 5519@option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping 5520after the two branch 5521target load optimization passes. 5522 5523@item -fdump-rtl-bypass 5524@opindex fdump-rtl-bypass 5525Dump after jump bypassing and control flow optimizations. 5526 5527@item -fdump-rtl-combine 5528@opindex fdump-rtl-combine 5529Dump after the RTL instruction combination pass. 5530 5531@item -fdump-rtl-compgotos 5532@opindex fdump-rtl-compgotos 5533Dump after duplicating the computed gotos. 5534 5535@item -fdump-rtl-ce1 5536@itemx -fdump-rtl-ce2 5537@itemx -fdump-rtl-ce3 5538@opindex fdump-rtl-ce1 5539@opindex fdump-rtl-ce2 5540@opindex fdump-rtl-ce3 5541@option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and 5542@option{-fdump-rtl-ce3} enable dumping after the three 5543if conversion passes. 5544 5545@item -fdump-rtl-cprop_hardreg 5546@opindex fdump-rtl-cprop_hardreg 5547Dump after hard register copy propagation. 5548 5549@item -fdump-rtl-csa 5550@opindex fdump-rtl-csa 5551Dump after combining stack adjustments. 5552 5553@item -fdump-rtl-cse1 5554@itemx -fdump-rtl-cse2 5555@opindex fdump-rtl-cse1 5556@opindex fdump-rtl-cse2 5557@option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after 5558the two common subexpression elimination passes. 5559 5560@item -fdump-rtl-dce 5561@opindex fdump-rtl-dce 5562Dump after the standalone dead code elimination passes. 5563 5564@item -fdump-rtl-dbr 5565@opindex fdump-rtl-dbr 5566Dump after delayed branch scheduling. 5567 5568@item -fdump-rtl-dce1 5569@itemx -fdump-rtl-dce2 5570@opindex fdump-rtl-dce1 5571@opindex fdump-rtl-dce2 5572@option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after 5573the two dead store elimination passes. 5574 5575@item -fdump-rtl-eh 5576@opindex fdump-rtl-eh 5577Dump after finalization of EH handling code. 5578 5579@item -fdump-rtl-eh_ranges 5580@opindex fdump-rtl-eh_ranges 5581Dump after conversion of EH handling range regions. 5582 5583@item -fdump-rtl-expand 5584@opindex fdump-rtl-expand 5585Dump after RTL generation. 5586 5587@item -fdump-rtl-fwprop1 5588@itemx -fdump-rtl-fwprop2 5589@opindex fdump-rtl-fwprop1 5590@opindex fdump-rtl-fwprop2 5591@option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable 5592dumping after the two forward propagation passes. 5593 5594@item -fdump-rtl-gcse1 5595@itemx -fdump-rtl-gcse2 5596@opindex fdump-rtl-gcse1 5597@opindex fdump-rtl-gcse2 5598@option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping 5599after global common subexpression elimination. 5600 5601@item -fdump-rtl-init-regs 5602@opindex fdump-rtl-init-regs 5603Dump after the initialization of the registers. 5604 5605@item -fdump-rtl-initvals 5606@opindex fdump-rtl-initvals 5607Dump after the computation of the initial value sets. 5608 5609@item -fdump-rtl-into_cfglayout 5610@opindex fdump-rtl-into_cfglayout 5611Dump after converting to cfglayout mode. 5612 5613@item -fdump-rtl-ira 5614@opindex fdump-rtl-ira 5615Dump after iterated register allocation. 5616 5617@item -fdump-rtl-jump 5618@opindex fdump-rtl-jump 5619Dump after the second jump optimization. 5620 5621@item -fdump-rtl-loop2 5622@opindex fdump-rtl-loop2 5623@option{-fdump-rtl-loop2} enables dumping after the rtl 5624loop optimization passes. 5625 5626@item -fdump-rtl-mach 5627@opindex fdump-rtl-mach 5628Dump after performing the machine dependent reorganization pass, if that 5629pass exists. 5630 5631@item -fdump-rtl-mode_sw 5632@opindex fdump-rtl-mode_sw 5633Dump after removing redundant mode switches. 5634 5635@item -fdump-rtl-rnreg 5636@opindex fdump-rtl-rnreg 5637Dump after register renumbering. 5638 5639@item -fdump-rtl-outof_cfglayout 5640@opindex fdump-rtl-outof_cfglayout 5641Dump after converting from cfglayout mode. 5642 5643@item -fdump-rtl-peephole2 5644@opindex fdump-rtl-peephole2 5645Dump after the peephole pass. 5646 5647@item -fdump-rtl-postreload 5648@opindex fdump-rtl-postreload 5649Dump after post-reload optimizations. 5650 5651@item -fdump-rtl-pro_and_epilogue 5652@opindex fdump-rtl-pro_and_epilogue 5653Dump after generating the function prologues and epilogues. 5654 5655@item -fdump-rtl-regmove 5656@opindex fdump-rtl-regmove 5657Dump after the register move pass. 5658 5659@item -fdump-rtl-sched1 5660@itemx -fdump-rtl-sched2 5661@opindex fdump-rtl-sched1 5662@opindex fdump-rtl-sched2 5663@option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping 5664after the basic block scheduling passes. 5665 5666@item -fdump-rtl-see 5667@opindex fdump-rtl-see 5668Dump after sign extension elimination. 5669 5670@item -fdump-rtl-seqabstr 5671@opindex fdump-rtl-seqabstr 5672Dump after common sequence discovery. 5673 5674@item -fdump-rtl-shorten 5675@opindex fdump-rtl-shorten 5676Dump after shortening branches. 5677 5678@item -fdump-rtl-sibling 5679@opindex fdump-rtl-sibling 5680Dump after sibling call optimizations. 5681 5682@item -fdump-rtl-split1 5683@itemx -fdump-rtl-split2 5684@itemx -fdump-rtl-split3 5685@itemx -fdump-rtl-split4 5686@itemx -fdump-rtl-split5 5687@opindex fdump-rtl-split1 5688@opindex fdump-rtl-split2 5689@opindex fdump-rtl-split3 5690@opindex fdump-rtl-split4 5691@opindex fdump-rtl-split5 5692@option{-fdump-rtl-split1}, @option{-fdump-rtl-split2}, 5693@option{-fdump-rtl-split3}, @option{-fdump-rtl-split4} and 5694@option{-fdump-rtl-split5} enable dumping after five rounds of 5695instruction splitting. 5696 5697@item -fdump-rtl-sms 5698@opindex fdump-rtl-sms 5699Dump after modulo scheduling. This pass is only run on some 5700architectures. 5701 5702@item -fdump-rtl-stack 5703@opindex fdump-rtl-stack 5704Dump after conversion from GCC's ``flat register file'' registers to the 5705x87's stack-like registers. This pass is only run on x86 variants. 5706 5707@item -fdump-rtl-subreg1 5708@itemx -fdump-rtl-subreg2 5709@opindex fdump-rtl-subreg1 5710@opindex fdump-rtl-subreg2 5711@option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after 5712the two subreg expansion passes. 5713 5714@item -fdump-rtl-unshare 5715@opindex fdump-rtl-unshare 5716Dump after all rtl has been unshared. 5717 5718@item -fdump-rtl-vartrack 5719@opindex fdump-rtl-vartrack 5720Dump after variable tracking. 5721 5722@item -fdump-rtl-vregs 5723@opindex fdump-rtl-vregs 5724Dump after converting virtual registers to hard registers. 5725 5726@item -fdump-rtl-web 5727@opindex fdump-rtl-web 5728Dump after live range splitting. 5729 5730@item -fdump-rtl-regclass 5731@itemx -fdump-rtl-subregs_of_mode_init 5732@itemx -fdump-rtl-subregs_of_mode_finish 5733@itemx -fdump-rtl-dfinit 5734@itemx -fdump-rtl-dfinish 5735@opindex fdump-rtl-regclass 5736@opindex fdump-rtl-subregs_of_mode_init 5737@opindex fdump-rtl-subregs_of_mode_finish 5738@opindex fdump-rtl-dfinit 5739@opindex fdump-rtl-dfinish 5740These dumps are defined but always produce empty files. 5741 5742@item -da 5743@itemx -fdump-rtl-all 5744@opindex da 5745@opindex fdump-rtl-all 5746Produce all the dumps listed above. 5747 5748@item -dA 5749@opindex dA 5750Annotate the assembler output with miscellaneous debugging information. 5751 5752@item -dD 5753@opindex dD 5754Dump all macro definitions, at the end of preprocessing, in addition to 5755normal output. 5756 5757@item -dH 5758@opindex dH 5759Produce a core dump whenever an error occurs. 5760 5761@item -dp 5762@opindex dp 5763Annotate the assembler output with a comment indicating which 5764pattern and alternative is used. The length of each instruction is 5765also printed. 5766 5767@item -dP 5768@opindex dP 5769Dump the RTL in the assembler output as a comment before each instruction. 5770Also turns on @option{-dp} annotation. 5771 5772@item -dx 5773@opindex dx 5774Just generate RTL for a function instead of compiling it. Usually used 5775with @option{-fdump-rtl-expand}. 5776@end table 5777 5778@item -fdump-noaddr 5779@opindex fdump-noaddr 5780When doing debugging dumps, suppress address output. This makes it more 5781feasible to use diff on debugging dumps for compiler invocations with 5782different compiler binaries and/or different 5783text / bss / data / heap / stack / dso start locations. 5784 5785@item -fdump-unnumbered 5786@opindex fdump-unnumbered 5787When doing debugging dumps, suppress instruction numbers and address output. 5788This makes it more feasible to use diff on debugging dumps for compiler 5789invocations with different options, in particular with and without 5790@option{-g}. 5791 5792@item -fdump-unnumbered-links 5793@opindex fdump-unnumbered-links 5794When doing debugging dumps (see @option{-d} option above), suppress 5795instruction numbers for the links to the previous and next instructions 5796in a sequence. 5797 5798@item -fdump-translation-unit @r{(C++ only)} 5799@itemx -fdump-translation-unit-@var{options} @r{(C++ only)} 5800@opindex fdump-translation-unit 5801Dump a representation of the tree structure for the entire translation 5802unit to a file. The file name is made by appending @file{.tu} to the 5803source file name, and the file is created in the same directory as the 5804output file. If the @samp{-@var{options}} form is used, @var{options} 5805controls the details of the dump as described for the 5806@option{-fdump-tree} options. 5807 5808@item -fdump-class-hierarchy @r{(C++ only)} 5809@itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)} 5810@opindex fdump-class-hierarchy 5811Dump a representation of each class's hierarchy and virtual function 5812table layout to a file. The file name is made by appending 5813@file{.class} to the source file name, and the file is created in the 5814same directory as the output file. If the @samp{-@var{options}} form 5815is used, @var{options} controls the details of the dump as described 5816for the @option{-fdump-tree} options. 5817 5818@item -fdump-ipa-@var{switch} 5819@opindex fdump-ipa 5820Control the dumping at various stages of inter-procedural analysis 5821language tree to a file. The file name is generated by appending a 5822switch specific suffix to the source file name, and the file is created 5823in the same directory as the output file. The following dumps are 5824possible: 5825 5826@table @samp 5827@item all 5828Enables all inter-procedural analysis dumps. 5829 5830@item cgraph 5831Dumps information about call-graph optimization, unused function removal, 5832and inlining decisions. 5833 5834@item inline 5835Dump after function inlining. 5836 5837@end table 5838 5839@item -fdump-passes 5840@opindex fdump-passes 5841Dump the list of optimization passes that are turned on and off by 5842the current command-line options. 5843 5844@item -fdump-statistics-@var{option} 5845@opindex fdump-statistics 5846Enable and control dumping of pass statistics in a separate file. The 5847file name is generated by appending a suffix ending in 5848@samp{.statistics} to the source file name, and the file is created in 5849the same directory as the output file. If the @samp{-@var{option}} 5850form is used, @samp{-stats} causes counters to be summed over the 5851whole compilation unit while @samp{-details} dumps every event as 5852the passes generate them. The default with no option is to sum 5853counters for each function compiled. 5854 5855@item -fdump-tree-@var{switch} 5856@itemx -fdump-tree-@var{switch}-@var{options} 5857@itemx -fdump-tree-@var{switch}-@var{options}=@var{filename} 5858@opindex fdump-tree 5859Control the dumping at various stages of processing the intermediate 5860language tree to a file. The file name is generated by appending a 5861switch-specific suffix to the source file name, and the file is 5862created in the same directory as the output file. In case of 5863@option{=@var{filename}} option, the dump is output on the given file 5864instead of the auto named dump files. If the @samp{-@var{options}} 5865form is used, @var{options} is a list of @samp{-} separated options 5866which control the details of the dump. Not all options are applicable 5867to all dumps; those that are not meaningful are ignored. The 5868following options are available 5869 5870@table @samp 5871@item address 5872Print the address of each node. Usually this is not meaningful as it 5873changes according to the environment and source file. Its primary use 5874is for tying up a dump file with a debug environment. 5875@item asmname 5876If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that 5877in the dump instead of @code{DECL_NAME}. Its primary use is ease of 5878use working backward from mangled names in the assembly file. 5879@item slim 5880When dumping front-end intermediate representations, inhibit dumping 5881of members of a scope or body of a function merely because that scope 5882has been reached. Only dump such items when they are directly reachable 5883by some other path. 5884 5885When dumping pretty-printed trees, this option inhibits dumping the 5886bodies of control structures. 5887 5888When dumping RTL, print the RTL in slim (condensed) form instead of 5889the default LISP-like representation. 5890@item raw 5891Print a raw representation of the tree. By default, trees are 5892pretty-printed into a C-like representation. 5893@item details 5894Enable more detailed dumps (not honored by every dump option). Also 5895include information from the optimization passes. 5896@item stats 5897Enable dumping various statistics about the pass (not honored by every dump 5898option). 5899@item blocks 5900Enable showing basic block boundaries (disabled in raw dumps). 5901@item graph 5902For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}), 5903dump a representation of the control flow graph suitable for viewing with 5904GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in 5905the file is pretty-printed as a subgraph, so that GraphViz can render them 5906all in a single plot. 5907 5908This option currently only works for RTL dumps, and the RTL is always 5909dumped in slim form. 5910@item vops 5911Enable showing virtual operands for every statement. 5912@item lineno 5913Enable showing line numbers for statements. 5914@item uid 5915Enable showing the unique ID (@code{DECL_UID}) for each variable. 5916@item verbose 5917Enable showing the tree dump for each statement. 5918@item eh 5919Enable showing the EH region number holding each statement. 5920@item scev 5921Enable showing scalar evolution analysis details. 5922@item optimized 5923Enable showing optimization information (only available in certain 5924passes). 5925@item missed 5926Enable showing missed optimization information (only available in certain 5927passes). 5928@item notes 5929Enable other detailed optimization information (only available in 5930certain passes). 5931@item =@var{filename} 5932Instead of an auto named dump file, output into the given file 5933name. The file names @file{stdout} and @file{stderr} are treated 5934specially and are considered already open standard streams. For 5935example, 5936 5937@smallexample 5938gcc -O2 -ftree-vectorize -fdump-tree-vect-blocks=foo.dump 5939 -fdump-tree-pre=stderr file.c 5940@end smallexample 5941 5942outputs vectorizer dump into @file{foo.dump}, while the PRE dump is 5943output on to @file{stderr}. If two conflicting dump filenames are 5944given for the same pass, then the latter option overrides the earlier 5945one. 5946 5947@item all 5948Turn on all options, except @option{raw}, @option{slim}, @option{verbose} 5949and @option{lineno}. 5950 5951@item optall 5952Turn on all optimization options, i.e., @option{optimized}, 5953@option{missed}, and @option{note}. 5954@end table 5955 5956The following tree dumps are possible: 5957@table @samp 5958 5959@item original 5960@opindex fdump-tree-original 5961Dump before any tree based optimization, to @file{@var{file}.original}. 5962 5963@item optimized 5964@opindex fdump-tree-optimized 5965Dump after all tree based optimization, to @file{@var{file}.optimized}. 5966 5967@item gimple 5968@opindex fdump-tree-gimple 5969Dump each function before and after the gimplification pass to a file. The 5970file name is made by appending @file{.gimple} to the source file name. 5971 5972@item cfg 5973@opindex fdump-tree-cfg 5974Dump the control flow graph of each function to a file. The file name is 5975made by appending @file{.cfg} to the source file name. 5976 5977@item ch 5978@opindex fdump-tree-ch 5979Dump each function after copying loop headers. The file name is made by 5980appending @file{.ch} to the source file name. 5981 5982@item ssa 5983@opindex fdump-tree-ssa 5984Dump SSA related information to a file. The file name is made by appending 5985@file{.ssa} to the source file name. 5986 5987@item alias 5988@opindex fdump-tree-alias 5989Dump aliasing information for each function. The file name is made by 5990appending @file{.alias} to the source file name. 5991 5992@item ccp 5993@opindex fdump-tree-ccp 5994Dump each function after CCP@. The file name is made by appending 5995@file{.ccp} to the source file name. 5996 5997@item storeccp 5998@opindex fdump-tree-storeccp 5999Dump each function after STORE-CCP@. The file name is made by appending 6000@file{.storeccp} to the source file name. 6001 6002@item pre 6003@opindex fdump-tree-pre 6004Dump trees after partial redundancy elimination. The file name is made 6005by appending @file{.pre} to the source file name. 6006 6007@item fre 6008@opindex fdump-tree-fre 6009Dump trees after full redundancy elimination. The file name is made 6010by appending @file{.fre} to the source file name. 6011 6012@item copyprop 6013@opindex fdump-tree-copyprop 6014Dump trees after copy propagation. The file name is made 6015by appending @file{.copyprop} to the source file name. 6016 6017@item store_copyprop 6018@opindex fdump-tree-store_copyprop 6019Dump trees after store copy-propagation. The file name is made 6020by appending @file{.store_copyprop} to the source file name. 6021 6022@item dce 6023@opindex fdump-tree-dce 6024Dump each function after dead code elimination. The file name is made by 6025appending @file{.dce} to the source file name. 6026 6027@item mudflap 6028@opindex fdump-tree-mudflap 6029Dump each function after adding mudflap instrumentation. The file name is 6030made by appending @file{.mudflap} to the source file name. 6031 6032@item sra 6033@opindex fdump-tree-sra 6034Dump each function after performing scalar replacement of aggregates. The 6035file name is made by appending @file{.sra} to the source file name. 6036 6037@item sink 6038@opindex fdump-tree-sink 6039Dump each function after performing code sinking. The file name is made 6040by appending @file{.sink} to the source file name. 6041 6042@item dom 6043@opindex fdump-tree-dom 6044Dump each function after applying dominator tree optimizations. The file 6045name is made by appending @file{.dom} to the source file name. 6046 6047@item dse 6048@opindex fdump-tree-dse 6049Dump each function after applying dead store elimination. The file 6050name is made by appending @file{.dse} to the source file name. 6051 6052@item phiopt 6053@opindex fdump-tree-phiopt 6054Dump each function after optimizing PHI nodes into straightline code. The file 6055name is made by appending @file{.phiopt} to the source file name. 6056 6057@item forwprop 6058@opindex fdump-tree-forwprop 6059Dump each function after forward propagating single use variables. The file 6060name is made by appending @file{.forwprop} to the source file name. 6061 6062@item copyrename 6063@opindex fdump-tree-copyrename 6064Dump each function after applying the copy rename optimization. The file 6065name is made by appending @file{.copyrename} to the source file name. 6066 6067@item nrv 6068@opindex fdump-tree-nrv 6069Dump each function after applying the named return value optimization on 6070generic trees. The file name is made by appending @file{.nrv} to the source 6071file name. 6072 6073@item vect 6074@opindex fdump-tree-vect 6075Dump each function after applying vectorization of loops. The file name is 6076made by appending @file{.vect} to the source file name. 6077 6078@item slp 6079@opindex fdump-tree-slp 6080Dump each function after applying vectorization of basic blocks. The file name 6081is made by appending @file{.slp} to the source file name. 6082 6083@item vrp 6084@opindex fdump-tree-vrp 6085Dump each function after Value Range Propagation (VRP). The file name 6086is made by appending @file{.vrp} to the source file name. 6087 6088@item all 6089@opindex fdump-tree-all 6090Enable all the available tree dumps with the flags provided in this option. 6091@end table 6092 6093@item -fopt-info 6094@itemx -fopt-info-@var{options} 6095@itemx -fopt-info-@var{options}=@var{filename} 6096@opindex fopt-info 6097Controls optimization dumps from various optimization passes. If the 6098@samp{-@var{options}} form is used, @var{options} is a list of 6099@samp{-} separated options to select the dump details and 6100optimizations. If @var{options} is not specified, it defaults to 6101@option{all} for details and @option{optall} for optimization 6102groups. If the @var{filename} is not specified, it defaults to 6103@file{stderr}. Note that the output @var{filename} will be overwritten 6104in case of multiple translation units. If a combined output from 6105multiple translation units is desired, @file{stderr} should be used 6106instead. 6107 6108The options can be divided into two groups, 1) options describing the 6109verbosity of the dump, and 2) options describing which optimizations 6110should be included. The options from both the groups can be freely 6111mixed as they are non-overlapping. However, in case of any conflicts, 6112the latter options override the earlier options on the command 6113line. Though multiple -fopt-info options are accepted, only one of 6114them can have @option{=filename}. If other filenames are provided then 6115all but the first one are ignored. 6116 6117The dump verbosity has the following options 6118 6119@table @samp 6120@item optimized 6121Print information when an optimization is successfully applied. It is 6122up to a pass to decide which information is relevant. For example, the 6123vectorizer passes print the source location of loops which got 6124successfully vectorized. 6125@item missed 6126Print information about missed optimizations. Individual passes 6127control which information to include in the output. For example, 6128 6129@smallexample 6130gcc -O2 -ftree-vectorize -fopt-info-vec-missed 6131@end smallexample 6132 6133will print information about missed optimization opportunities from 6134vectorization passes on stderr. 6135@item note 6136Print verbose information about optimizations, such as certain 6137transformations, more detailed messages about decisions etc. 6138@item all 6139Print detailed optimization information. This includes 6140@var{optimized}, @var{missed}, and @var{note}. 6141@end table 6142 6143The second set of options describes a group of optimizations and may 6144include one or more of the following. 6145 6146@table @samp 6147@item ipa 6148Enable dumps from all interprocedural optimizations. 6149@item loop 6150Enable dumps from all loop optimizations. 6151@item inline 6152Enable dumps from all inlining optimizations. 6153@item vec 6154Enable dumps from all vectorization optimizations. 6155@end table 6156 6157For example, 6158@smallexample 6159gcc -O3 -fopt-info-missed=missed.all 6160@end smallexample 6161 6162outputs missed optimization report from all the passes into 6163@file{missed.all}. 6164 6165As another example, 6166@smallexample 6167gcc -O3 -fopt-info-inline-optimized-missed=inline.txt 6168@end smallexample 6169 6170will output information about missed optimizations as well as 6171optimized locations from all the inlining passes into 6172@file{inline.txt}. 6173 6174If the @var{filename} is provided, then the dumps from all the 6175applicable optimizations are concatenated into the @file{filename}. 6176Otherwise the dump is output onto @file{stderr}. If @var{options} is 6177omitted, it defaults to @option{all-optall}, which means dump all 6178available optimization info from all the passes. In the following 6179example, all optimization info is output on to @file{stderr}. 6180 6181@smallexample 6182gcc -O3 -fopt-info 6183@end smallexample 6184 6185Note that @option{-fopt-info-vec-missed} behaves the same as 6186@option{-fopt-info-missed-vec}. 6187 6188As another example, consider 6189 6190@smallexample 6191gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt 6192@end smallexample 6193 6194Here the two output filenames @file{vec.miss} and @file{loop.opt} are 6195in conflict since only one output file is allowed. In this case, only 6196the first option takes effect and the subsequent options are 6197ignored. Thus only the @file{vec.miss} is produced which cotaints 6198dumps from the vectorizer about missed opportunities. 6199 6200@item -ftree-vectorizer-verbose=@var{n} 6201@opindex ftree-vectorizer-verbose 6202This option is deprecated and is implemented in terms of 6203@option{-fopt-info}. Please use @option{-fopt-info-@var{kind}} form 6204instead, where @var{kind} is one of the valid opt-info options. It 6205prints additional optimization information. For @var{n}=0 no 6206diagnostic information is reported. If @var{n}=1 the vectorizer 6207reports each loop that got vectorized, and the total number of loops 6208that got vectorized. If @var{n}=2 the vectorizer reports locations 6209which could not be vectorized and the reasons for those. For any 6210higher verbosity levels all the analysis and transformation 6211information from the vectorizer is reported. 6212 6213Note that the information output by @option{-ftree-vectorizer-verbose} 6214option is sent to @file{stderr}. If the equivalent form 6215@option{-fopt-info-@var{options}=@var{filename}} is used then the 6216output is sent into @var{filename} instead. 6217 6218@item -frandom-seed=@var{string} 6219@opindex frandom-seed 6220This option provides a seed that GCC uses in place of 6221random numbers in generating certain symbol names 6222that have to be different in every compiled file. It is also used to 6223place unique stamps in coverage data files and the object files that 6224produce them. You can use the @option{-frandom-seed} option to produce 6225reproducibly identical object files. 6226 6227The @var{string} should be different for every file you compile. 6228 6229@item -fsched-verbose=@var{n} 6230@opindex fsched-verbose 6231On targets that use instruction scheduling, this option controls the 6232amount of debugging output the scheduler prints. This information is 6233written to standard error, unless @option{-fdump-rtl-sched1} or 6234@option{-fdump-rtl-sched2} is specified, in which case it is output 6235to the usual dump listing file, @file{.sched1} or @file{.sched2} 6236respectively. However for @var{n} greater than nine, the output is 6237always printed to standard error. 6238 6239For @var{n} greater than zero, @option{-fsched-verbose} outputs the 6240same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}. 6241For @var{n} greater than one, it also output basic block probabilities, 6242detailed ready list information and unit/insn info. For @var{n} greater 6243than two, it includes RTL at abort point, control-flow and regions info. 6244And for @var{n} over four, @option{-fsched-verbose} also includes 6245dependence info. 6246 6247@item -save-temps 6248@itemx -save-temps=cwd 6249@opindex save-temps 6250Store the usual ``temporary'' intermediate files permanently; place them 6251in the current directory and name them based on the source file. Thus, 6252compiling @file{foo.c} with @option{-c -save-temps} produces files 6253@file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a 6254preprocessed @file{foo.i} output file even though the compiler now 6255normally uses an integrated preprocessor. 6256 6257When used in combination with the @option{-x} command-line option, 6258@option{-save-temps} is sensible enough to avoid over writing an 6259input source file with the same extension as an intermediate file. 6260The corresponding intermediate file may be obtained by renaming the 6261source file before using @option{-save-temps}. 6262 6263If you invoke GCC in parallel, compiling several different source 6264files that share a common base name in different subdirectories or the 6265same source file compiled for multiple output destinations, it is 6266likely that the different parallel compilers will interfere with each 6267other, and overwrite the temporary files. For instance: 6268 6269@smallexample 6270gcc -save-temps -o outdir1/foo.o indir1/foo.c& 6271gcc -save-temps -o outdir2/foo.o indir2/foo.c& 6272@end smallexample 6273 6274may result in @file{foo.i} and @file{foo.o} being written to 6275simultaneously by both compilers. 6276 6277@item -save-temps=obj 6278@opindex save-temps=obj 6279Store the usual ``temporary'' intermediate files permanently. If the 6280@option{-o} option is used, the temporary files are based on the 6281object file. If the @option{-o} option is not used, the 6282@option{-save-temps=obj} switch behaves like @option{-save-temps}. 6283 6284For example: 6285 6286@smallexample 6287gcc -save-temps=obj -c foo.c 6288gcc -save-temps=obj -c bar.c -o dir/xbar.o 6289gcc -save-temps=obj foobar.c -o dir2/yfoobar 6290@end smallexample 6291 6292@noindent 6293creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i}, 6294@file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and 6295@file{dir2/yfoobar.o}. 6296 6297@item -time@r{[}=@var{file}@r{]} 6298@opindex time 6299Report the CPU time taken by each subprocess in the compilation 6300sequence. For C source files, this is the compiler proper and assembler 6301(plus the linker if linking is done). 6302 6303Without the specification of an output file, the output looks like this: 6304 6305@smallexample 6306# cc1 0.12 0.01 6307# as 0.00 0.01 6308@end smallexample 6309 6310The first number on each line is the ``user time'', that is time spent 6311executing the program itself. The second number is ``system time'', 6312time spent executing operating system routines on behalf of the program. 6313Both numbers are in seconds. 6314 6315With the specification of an output file, the output is appended to the 6316named file, and it looks like this: 6317 6318@smallexample 63190.12 0.01 cc1 @var{options} 63200.00 0.01 as @var{options} 6321@end smallexample 6322 6323The ``user time'' and the ``system time'' are moved before the program 6324name, and the options passed to the program are displayed, so that one 6325can later tell what file was being compiled, and with which options. 6326 6327@item -fvar-tracking 6328@opindex fvar-tracking 6329Run variable tracking pass. It computes where variables are stored at each 6330position in code. Better debugging information is then generated 6331(if the debugging information format supports this information). 6332 6333It is enabled by default when compiling with optimization (@option{-Os}, 6334@option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and 6335the debug info format supports it. 6336 6337@item -fvar-tracking-assignments 6338@opindex fvar-tracking-assignments 6339@opindex fno-var-tracking-assignments 6340Annotate assignments to user variables early in the compilation and 6341attempt to carry the annotations over throughout the compilation all the 6342way to the end, in an attempt to improve debug information while 6343optimizing. Use of @option{-gdwarf-4} is recommended along with it. 6344 6345It can be enabled even if var-tracking is disabled, in which case 6346annotations are created and maintained, but discarded at the end. 6347 6348@item -fvar-tracking-assignments-toggle 6349@opindex fvar-tracking-assignments-toggle 6350@opindex fno-var-tracking-assignments-toggle 6351Toggle @option{-fvar-tracking-assignments}, in the same way that 6352@option{-gtoggle} toggles @option{-g}. 6353 6354@item -print-file-name=@var{library} 6355@opindex print-file-name 6356Print the full absolute name of the library file @var{library} that 6357would be used when linking---and don't do anything else. With this 6358option, GCC does not compile or link anything; it just prints the 6359file name. 6360 6361@item -print-multi-directory 6362@opindex print-multi-directory 6363Print the directory name corresponding to the multilib selected by any 6364other switches present in the command line. This directory is supposed 6365to exist in @env{GCC_EXEC_PREFIX}. 6366 6367@item -print-multi-lib 6368@opindex print-multi-lib 6369Print the mapping from multilib directory names to compiler switches 6370that enable them. The directory name is separated from the switches by 6371@samp{;}, and each switch starts with an @samp{@@} instead of the 6372@samp{-}, without spaces between multiple switches. This is supposed to 6373ease shell processing. 6374 6375@item -print-multi-os-directory 6376@opindex print-multi-os-directory 6377Print the path to OS libraries for the selected 6378multilib, relative to some @file{lib} subdirectory. If OS libraries are 6379present in the @file{lib} subdirectory and no multilibs are used, this is 6380usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}} 6381sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or 6382@file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}} 6383subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}. 6384 6385@item -print-multiarch 6386@opindex print-multiarch 6387Print the path to OS libraries for the selected multiarch, 6388relative to some @file{lib} subdirectory. 6389 6390@item -print-prog-name=@var{program} 6391@opindex print-prog-name 6392Like @option{-print-file-name}, but searches for a program such as @samp{cpp}. 6393 6394@item -print-libgcc-file-name 6395@opindex print-libgcc-file-name 6396Same as @option{-print-file-name=libgcc.a}. 6397 6398This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs} 6399but you do want to link with @file{libgcc.a}. You can do: 6400 6401@smallexample 6402gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name` 6403@end smallexample 6404 6405@item -print-search-dirs 6406@opindex print-search-dirs 6407Print the name of the configured installation directory and a list of 6408program and library directories @command{gcc} searches---and don't do anything else. 6409 6410This is useful when @command{gcc} prints the error message 6411@samp{installation problem, cannot exec cpp0: No such file or directory}. 6412To resolve this you either need to put @file{cpp0} and the other compiler 6413components where @command{gcc} expects to find them, or you can set the environment 6414variable @env{GCC_EXEC_PREFIX} to the directory where you installed them. 6415Don't forget the trailing @samp{/}. 6416@xref{Environment Variables}. 6417 6418@item -print-sysroot 6419@opindex print-sysroot 6420Print the target sysroot directory that is used during 6421compilation. This is the target sysroot specified either at configure 6422time or using the @option{--sysroot} option, possibly with an extra 6423suffix that depends on compilation options. If no target sysroot is 6424specified, the option prints nothing. 6425 6426@item -print-sysroot-headers-suffix 6427@opindex print-sysroot-headers-suffix 6428Print the suffix added to the target sysroot when searching for 6429headers, or give an error if the compiler is not configured with such 6430a suffix---and don't do anything else. 6431 6432@item -dumpmachine 6433@opindex dumpmachine 6434Print the compiler's target machine (for example, 6435@samp{i686-pc-linux-gnu})---and don't do anything else. 6436 6437@item -dumpversion 6438@opindex dumpversion 6439Print the compiler version (for example, @samp{3.0})---and don't do 6440anything else. 6441 6442@item -dumpspecs 6443@opindex dumpspecs 6444Print the compiler's built-in specs---and don't do anything else. (This 6445is used when GCC itself is being built.) @xref{Spec Files}. 6446 6447@item -fno-eliminate-unused-debug-types 6448@opindex feliminate-unused-debug-types 6449@opindex fno-eliminate-unused-debug-types 6450Normally, when producing DWARF 2 output, GCC avoids producing debug symbol 6451output for types that are nowhere used in the source file being compiled. 6452Sometimes it is useful to have GCC emit debugging 6453information for all types declared in a compilation 6454unit, regardless of whether or not they are actually used 6455in that compilation unit, for example 6456if, in the debugger, you want to cast a value to a type that is 6457not actually used in your program (but is declared). More often, 6458however, this results in a significant amount of wasted space. 6459@end table 6460 6461@node Optimize Options 6462@section Options That Control Optimization 6463@cindex optimize options 6464@cindex options, optimization 6465 6466These options control various sorts of optimizations. 6467 6468Without any optimization option, the compiler's goal is to reduce the 6469cost of compilation and to make debugging produce the expected 6470results. Statements are independent: if you stop the program with a 6471breakpoint between statements, you can then assign a new value to any 6472variable or change the program counter to any other statement in the 6473function and get exactly the results you expect from the source 6474code. 6475 6476Turning on optimization flags makes the compiler attempt to improve 6477the performance and/or code size at the expense of compilation time 6478and possibly the ability to debug the program. 6479 6480The compiler performs optimization based on the knowledge it has of the 6481program. Compiling multiple files at once to a single output file mode allows 6482the compiler to use information gained from all of the files when compiling 6483each of them. 6484 6485Not all optimizations are controlled directly by a flag. Only 6486optimizations that have a flag are listed in this section. 6487 6488Most optimizations are only enabled if an @option{-O} level is set on 6489the command line. Otherwise they are disabled, even if individual 6490optimization flags are specified. 6491 6492Depending on the target and how GCC was configured, a slightly different 6493set of optimizations may be enabled at each @option{-O} level than 6494those listed here. You can invoke GCC with @option{-Q --help=optimizers} 6495to find out the exact set of optimizations that are enabled at each level. 6496@xref{Overall Options}, for examples. 6497 6498@table @gcctabopt 6499@item -O 6500@itemx -O1 6501@opindex O 6502@opindex O1 6503Optimize. Optimizing compilation takes somewhat more time, and a lot 6504more memory for a large function. 6505 6506With @option{-O}, the compiler tries to reduce code size and execution 6507time, without performing any optimizations that take a great deal of 6508compilation time. 6509 6510@option{-O} turns on the following optimization flags: 6511@gccoptlist{ 6512-fauto-inc-dec @gol 6513-fcompare-elim @gol 6514-fcprop-registers @gol 6515-fdce @gol 6516-fdefer-pop @gol 6517-fdelayed-branch @gol 6518-fdse @gol 6519-fguess-branch-probability @gol 6520-fif-conversion2 @gol 6521-fif-conversion @gol 6522-fipa-pure-const @gol 6523-fipa-profile @gol 6524-fipa-reference @gol 6525-fmerge-constants 6526-fsplit-wide-types @gol 6527-ftree-bit-ccp @gol 6528-ftree-builtin-call-dce @gol 6529-ftree-ccp @gol 6530-ftree-ch @gol 6531-ftree-copyrename @gol 6532-ftree-dce @gol 6533-ftree-dominator-opts @gol 6534-ftree-dse @gol 6535-ftree-forwprop @gol 6536-ftree-fre @gol 6537-ftree-phiprop @gol 6538-ftree-slsr @gol 6539-ftree-sra @gol 6540-ftree-pta @gol 6541-ftree-ter @gol 6542-funit-at-a-time} 6543 6544@option{-O} also turns on @option{-fomit-frame-pointer} on machines 6545where doing so does not interfere with debugging. 6546 6547@item -O2 6548@opindex O2 6549Optimize even more. GCC performs nearly all supported optimizations 6550that do not involve a space-speed tradeoff. 6551As compared to @option{-O}, this option increases both compilation time 6552and the performance of the generated code. 6553 6554@option{-O2} turns on all optimization flags specified by @option{-O}. It 6555also turns on the following optimization flags: 6556@gccoptlist{-fthread-jumps @gol 6557-falign-functions -falign-jumps @gol 6558-falign-loops -falign-labels @gol 6559-fcaller-saves @gol 6560-fcrossjumping @gol 6561-fcse-follow-jumps -fcse-skip-blocks @gol 6562-fdelete-null-pointer-checks @gol 6563-fdevirtualize @gol 6564-fexpensive-optimizations @gol 6565-fgcse -fgcse-lm @gol 6566-fhoist-adjacent-loads @gol 6567-finline-small-functions @gol 6568-findirect-inlining @gol 6569-fipa-sra @gol 6570-foptimize-sibling-calls @gol 6571-fpartial-inlining @gol 6572-fpeephole2 @gol 6573-fregmove @gol 6574-freorder-blocks -freorder-functions @gol 6575-frerun-cse-after-loop @gol 6576-fsched-interblock -fsched-spec @gol 6577-fschedule-insns -fschedule-insns2 @gol 6578-fstrict-aliasing -fstrict-overflow @gol 6579-ftree-switch-conversion -ftree-tail-merge @gol 6580-ftree-pre @gol 6581-ftree-vrp} 6582 6583Please note the warning under @option{-fgcse} about 6584invoking @option{-O2} on programs that use computed gotos. 6585 6586@item -O3 6587@opindex O3 6588Optimize yet more. @option{-O3} turns on all optimizations specified 6589by @option{-O2} and also turns on the @option{-finline-functions}, 6590@option{-funswitch-loops}, @option{-fpredictive-commoning}, 6591@option{-fgcse-after-reload}, @option{-ftree-vectorize}, 6592@option{-fvect-cost-model}, 6593@option{-ftree-partial-pre} and @option{-fipa-cp-clone} options. 6594 6595@item -O0 6596@opindex O0 6597Reduce compilation time and make debugging produce the expected 6598results. This is the default. 6599 6600@item -Os 6601@opindex Os 6602Optimize for size. @option{-Os} enables all @option{-O2} optimizations that 6603do not typically increase code size. It also performs further 6604optimizations designed to reduce code size. 6605 6606@option{-Os} disables the following optimization flags: 6607@gccoptlist{-falign-functions -falign-jumps -falign-loops @gol 6608-falign-labels -freorder-blocks -freorder-blocks-and-partition @gol 6609-fprefetch-loop-arrays -ftree-vect-loop-version} 6610 6611@item -Ofast 6612@opindex Ofast 6613Disregard strict standards compliance. @option{-Ofast} enables all 6614@option{-O3} optimizations. It also enables optimizations that are not 6615valid for all standard-compliant programs. 6616It turns on @option{-ffast-math} and the Fortran-specific 6617@option{-fno-protect-parens} and @option{-fstack-arrays}. 6618 6619@item -Og 6620@opindex Og 6621Optimize debugging experience. @option{-Og} enables optimizations 6622that do not interfere with debugging. It should be the optimization 6623level of choice for the standard edit-compile-debug cycle, offering 6624a reasonable level of optimization while maintaining fast compilation 6625and a good debugging experience. 6626 6627If you use multiple @option{-O} options, with or without level numbers, 6628the last such option is the one that is effective. 6629@end table 6630 6631Options of the form @option{-f@var{flag}} specify machine-independent 6632flags. Most flags have both positive and negative forms; the negative 6633form of @option{-ffoo} is @option{-fno-foo}. In the table 6634below, only one of the forms is listed---the one you typically 6635use. You can figure out the other form by either removing @samp{no-} 6636or adding it. 6637 6638The following options control specific optimizations. They are either 6639activated by @option{-O} options or are related to ones that are. You 6640can use the following flags in the rare cases when ``fine-tuning'' of 6641optimizations to be performed is desired. 6642 6643@table @gcctabopt 6644@item -fno-default-inline 6645@opindex fno-default-inline 6646Do not make member functions inline by default merely because they are 6647defined inside the class scope (C++ only). Otherwise, when you specify 6648@w{@option{-O}}, member functions defined inside class scope are compiled 6649inline by default; i.e., you don't need to add @samp{inline} in front of 6650the member function name. 6651 6652@item -fno-defer-pop 6653@opindex fno-defer-pop 6654Always pop the arguments to each function call as soon as that function 6655returns. For machines that must pop arguments after a function call, 6656the compiler normally lets arguments accumulate on the stack for several 6657function calls and pops them all at once. 6658 6659Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 6660 6661@item -fforward-propagate 6662@opindex fforward-propagate 6663Perform a forward propagation pass on RTL@. The pass tries to combine two 6664instructions and checks if the result can be simplified. If loop unrolling 6665is active, two passes are performed and the second is scheduled after 6666loop unrolling. 6667 6668This option is enabled by default at optimization levels @option{-O}, 6669@option{-O2}, @option{-O3}, @option{-Os}. 6670 6671@item -ffp-contract=@var{style} 6672@opindex ffp-contract 6673@option{-ffp-contract=off} disables floating-point expression contraction. 6674@option{-ffp-contract=fast} enables floating-point expression contraction 6675such as forming of fused multiply-add operations if the target has 6676native support for them. 6677@option{-ffp-contract=on} enables floating-point expression contraction 6678if allowed by the language standard. This is currently not implemented 6679and treated equal to @option{-ffp-contract=off}. 6680 6681The default is @option{-ffp-contract=fast}. 6682 6683@item -fomit-frame-pointer 6684@opindex fomit-frame-pointer 6685Don't keep the frame pointer in a register for functions that 6686don't need one. This avoids the instructions to save, set up and 6687restore frame pointers; it also makes an extra register available 6688in many functions. @strong{It also makes debugging impossible on 6689some machines.} 6690 6691On some machines, such as the VAX, this flag has no effect, because 6692the standard calling sequence automatically handles the frame pointer 6693and nothing is saved by pretending it doesn't exist. The 6694machine-description macro @code{FRAME_POINTER_REQUIRED} controls 6695whether a target machine supports this flag. @xref{Registers,,Register 6696Usage, gccint, GNU Compiler Collection (GCC) Internals}. 6697 6698Starting with GCC version 4.6, the default setting (when not optimizing for 6699size) for 32-bit GNU/Linux x86 and 32-bit Darwin x86 targets has been changed to 6700@option{-fomit-frame-pointer}. The default can be reverted to 6701@option{-fno-omit-frame-pointer} by configuring GCC with the 6702@option{--enable-frame-pointer} configure option. 6703 6704Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 6705 6706@item -foptimize-sibling-calls 6707@opindex foptimize-sibling-calls 6708Optimize sibling and tail recursive calls. 6709 6710Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 6711 6712@item -fno-inline 6713@opindex fno-inline 6714Do not expand any functions inline apart from those marked with 6715the @code{always_inline} attribute. This is the default when not 6716optimizing. 6717 6718Single functions can be exempted from inlining by marking them 6719with the @code{noinline} attribute. 6720 6721@item -finline-small-functions 6722@opindex finline-small-functions 6723Integrate functions into their callers when their body is smaller than expected 6724function call code (so overall size of program gets smaller). The compiler 6725heuristically decides which functions are simple enough to be worth integrating 6726in this way. This inlining applies to all functions, even those not declared 6727inline. 6728 6729Enabled at level @option{-O2}. 6730 6731@item -findirect-inlining 6732@opindex findirect-inlining 6733Inline also indirect calls that are discovered to be known at compile 6734time thanks to previous inlining. This option has any effect only 6735when inlining itself is turned on by the @option{-finline-functions} 6736or @option{-finline-small-functions} options. 6737 6738Enabled at level @option{-O2}. 6739 6740@item -finline-functions 6741@opindex finline-functions 6742Consider all functions for inlining, even if they are not declared inline. 6743The compiler heuristically decides which functions are worth integrating 6744in this way. 6745 6746If all calls to a given function are integrated, and the function is 6747declared @code{static}, then the function is normally not output as 6748assembler code in its own right. 6749 6750Enabled at level @option{-O3}. 6751 6752@item -finline-functions-called-once 6753@opindex finline-functions-called-once 6754Consider all @code{static} functions called once for inlining into their 6755caller even if they are not marked @code{inline}. If a call to a given 6756function is integrated, then the function is not output as assembler code 6757in its own right. 6758 6759Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}. 6760 6761@item -fearly-inlining 6762@opindex fearly-inlining 6763Inline functions marked by @code{always_inline} and functions whose body seems 6764smaller than the function call overhead early before doing 6765@option{-fprofile-generate} instrumentation and real inlining pass. Doing so 6766makes profiling significantly cheaper and usually inlining faster on programs 6767having large chains of nested wrapper functions. 6768 6769Enabled by default. 6770 6771@item -fipa-sra 6772@opindex fipa-sra 6773Perform interprocedural scalar replacement of aggregates, removal of 6774unused parameters and replacement of parameters passed by reference 6775by parameters passed by value. 6776 6777Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}. 6778 6779@item -finline-limit=@var{n} 6780@opindex finline-limit 6781By default, GCC limits the size of functions that can be inlined. This flag 6782allows coarse control of this limit. @var{n} is the size of functions that 6783can be inlined in number of pseudo instructions. 6784 6785Inlining is actually controlled by a number of parameters, which may be 6786specified individually by using @option{--param @var{name}=@var{value}}. 6787The @option{-finline-limit=@var{n}} option sets some of these parameters 6788as follows: 6789 6790@table @gcctabopt 6791@item max-inline-insns-single 6792is set to @var{n}/2. 6793@item max-inline-insns-auto 6794is set to @var{n}/2. 6795@end table 6796 6797See below for a documentation of the individual 6798parameters controlling inlining and for the defaults of these parameters. 6799 6800@emph{Note:} there may be no value to @option{-finline-limit} that results 6801in default behavior. 6802 6803@emph{Note:} pseudo instruction represents, in this particular context, an 6804abstract measurement of function's size. In no way does it represent a count 6805of assembly instructions and as such its exact meaning might change from one 6806release to an another. 6807 6808@item -fno-keep-inline-dllexport 6809@opindex -fno-keep-inline-dllexport 6810This is a more fine-grained version of @option{-fkeep-inline-functions}, 6811which applies only to functions that are declared using the @code{dllexport} 6812attribute or declspec (@xref{Function Attributes,,Declaring Attributes of 6813Functions}.) 6814 6815@item -fkeep-inline-functions 6816@opindex fkeep-inline-functions 6817In C, emit @code{static} functions that are declared @code{inline} 6818into the object file, even if the function has been inlined into all 6819of its callers. This switch does not affect functions using the 6820@code{extern inline} extension in GNU C90@. In C++, emit any and all 6821inline functions into the object file. 6822 6823@item -fkeep-static-consts 6824@opindex fkeep-static-consts 6825Emit variables declared @code{static const} when optimization isn't turned 6826on, even if the variables aren't referenced. 6827 6828GCC enables this option by default. If you want to force the compiler to 6829check if a variable is referenced, regardless of whether or not 6830optimization is turned on, use the @option{-fno-keep-static-consts} option. 6831 6832@item -fmerge-constants 6833@opindex fmerge-constants 6834Attempt to merge identical constants (string constants and floating-point 6835constants) across compilation units. 6836 6837This option is the default for optimized compilation if the assembler and 6838linker support it. Use @option{-fno-merge-constants} to inhibit this 6839behavior. 6840 6841Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 6842 6843@item -fmerge-all-constants 6844@opindex fmerge-all-constants 6845Attempt to merge identical constants and identical variables. 6846 6847This option implies @option{-fmerge-constants}. In addition to 6848@option{-fmerge-constants} this considers e.g.@: even constant initialized 6849arrays or initialized constant variables with integral or floating-point 6850types. Languages like C or C++ require each variable, including multiple 6851instances of the same variable in recursive calls, to have distinct locations, 6852so using this option results in non-conforming 6853behavior. 6854 6855@item -fmodulo-sched 6856@opindex fmodulo-sched 6857Perform swing modulo scheduling immediately before the first scheduling 6858pass. This pass looks at innermost loops and reorders their 6859instructions by overlapping different iterations. 6860 6861@item -fmodulo-sched-allow-regmoves 6862@opindex fmodulo-sched-allow-regmoves 6863Perform more aggressive SMS-based modulo scheduling with register moves 6864allowed. By setting this flag certain anti-dependences edges are 6865deleted, which triggers the generation of reg-moves based on the 6866life-range analysis. This option is effective only with 6867@option{-fmodulo-sched} enabled. 6868 6869@item -fno-branch-count-reg 6870@opindex fno-branch-count-reg 6871Do not use ``decrement and branch'' instructions on a count register, 6872but instead generate a sequence of instructions that decrement a 6873register, compare it against zero, then branch based upon the result. 6874This option is only meaningful on architectures that support such 6875instructions, which include x86, PowerPC, IA-64 and S/390. 6876 6877The default is @option{-fbranch-count-reg}. 6878 6879@item -fno-function-cse 6880@opindex fno-function-cse 6881Do not put function addresses in registers; make each instruction that 6882calls a constant function contain the function's address explicitly. 6883 6884This option results in less efficient code, but some strange hacks 6885that alter the assembler output may be confused by the optimizations 6886performed when this option is not used. 6887 6888The default is @option{-ffunction-cse} 6889 6890@item -fno-zero-initialized-in-bss 6891@opindex fno-zero-initialized-in-bss 6892If the target supports a BSS section, GCC by default puts variables that 6893are initialized to zero into BSS@. This can save space in the resulting 6894code. 6895 6896This option turns off this behavior because some programs explicitly 6897rely on variables going to the data section---e.g., so that the 6898resulting executable can find the beginning of that section and/or make 6899assumptions based on that. 6900 6901The default is @option{-fzero-initialized-in-bss}. 6902 6903@item -fmudflap -fmudflapth -fmudflapir 6904@opindex fmudflap 6905@opindex fmudflapth 6906@opindex fmudflapir 6907@cindex bounds checking 6908@cindex mudflap 6909For front-ends that support it (C and C++), instrument all risky 6910pointer/array dereferencing operations, some standard library 6911string/heap functions, and some other associated constructs with 6912range/validity tests. Modules so instrumented should be immune to 6913buffer overflows, invalid heap use, and some other classes of C/C++ 6914programming errors. The instrumentation relies on a separate runtime 6915library (@file{libmudflap}), which is linked into a program if 6916@option{-fmudflap} is given at link time. Run-time behavior of the 6917instrumented program is controlled by the @env{MUDFLAP_OPTIONS} 6918environment variable. See @code{env MUDFLAP_OPTIONS=-help a.out} 6919for its options. 6920 6921Use @option{-fmudflapth} instead of @option{-fmudflap} to compile and to 6922link if your program is multi-threaded. Use @option{-fmudflapir}, in 6923addition to @option{-fmudflap} or @option{-fmudflapth}, if 6924instrumentation should ignore pointer reads. This produces less 6925instrumentation (and therefore faster execution) and still provides 6926some protection against outright memory corrupting writes, but allows 6927erroneously read data to propagate within a program. 6928 6929@item -fthread-jumps 6930@opindex fthread-jumps 6931Perform optimizations that check to see if a jump branches to a 6932location where another comparison subsumed by the first is found. If 6933so, the first branch is redirected to either the destination of the 6934second branch or a point immediately following it, depending on whether 6935the condition is known to be true or false. 6936 6937Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 6938 6939@item -fsplit-wide-types 6940@opindex fsplit-wide-types 6941When using a type that occupies multiple registers, such as @code{long 6942long} on a 32-bit system, split the registers apart and allocate them 6943independently. This normally generates better code for those types, 6944but may make debugging more difficult. 6945 6946Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, 6947@option{-Os}. 6948 6949@item -fcse-follow-jumps 6950@opindex fcse-follow-jumps 6951In common subexpression elimination (CSE), scan through jump instructions 6952when the target of the jump is not reached by any other path. For 6953example, when CSE encounters an @code{if} statement with an 6954@code{else} clause, CSE follows the jump when the condition 6955tested is false. 6956 6957Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 6958 6959@item -fcse-skip-blocks 6960@opindex fcse-skip-blocks 6961This is similar to @option{-fcse-follow-jumps}, but causes CSE to 6962follow jumps that conditionally skip over blocks. When CSE 6963encounters a simple @code{if} statement with no else clause, 6964@option{-fcse-skip-blocks} causes CSE to follow the jump around the 6965body of the @code{if}. 6966 6967Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 6968 6969@item -frerun-cse-after-loop 6970@opindex frerun-cse-after-loop 6971Re-run common subexpression elimination after loop optimizations are 6972performed. 6973 6974Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 6975 6976@item -fgcse 6977@opindex fgcse 6978Perform a global common subexpression elimination pass. 6979This pass also performs global constant and copy propagation. 6980 6981@emph{Note:} When compiling a program using computed gotos, a GCC 6982extension, you may get better run-time performance if you disable 6983the global common subexpression elimination pass by adding 6984@option{-fno-gcse} to the command line. 6985 6986Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 6987 6988@item -fgcse-lm 6989@opindex fgcse-lm 6990When @option{-fgcse-lm} is enabled, global common subexpression elimination 6991attempts to move loads that are only killed by stores into themselves. This 6992allows a loop containing a load/store sequence to be changed to a load outside 6993the loop, and a copy/store within the loop. 6994 6995Enabled by default when @option{-fgcse} is enabled. 6996 6997@item -fgcse-sm 6998@opindex fgcse-sm 6999When @option{-fgcse-sm} is enabled, a store motion pass is run after 7000global common subexpression elimination. This pass attempts to move 7001stores out of loops. When used in conjunction with @option{-fgcse-lm}, 7002loops containing a load/store sequence can be changed to a load before 7003the loop and a store after the loop. 7004 7005Not enabled at any optimization level. 7006 7007@item -fgcse-las 7008@opindex fgcse-las 7009When @option{-fgcse-las} is enabled, the global common subexpression 7010elimination pass eliminates redundant loads that come after stores to the 7011same memory location (both partial and full redundancies). 7012 7013Not enabled at any optimization level. 7014 7015@item -fgcse-after-reload 7016@opindex fgcse-after-reload 7017When @option{-fgcse-after-reload} is enabled, a redundant load elimination 7018pass is performed after reload. The purpose of this pass is to clean up 7019redundant spilling. 7020 7021@item -faggressive-loop-optimizations 7022@opindex faggressive-loop-optimizations 7023This option tells the loop optimizer to use language constraints to 7024derive bounds for the number of iterations of a loop. This assumes that 7025loop code does not invoke undefined behavior by for example causing signed 7026integer overflows or out-of-bound array accesses. The bounds for the 7027number of iterations of a loop are used to guide loop unrolling and peeling 7028and loop exit test optimizations. 7029This option is enabled by default. 7030 7031@item -funsafe-loop-optimizations 7032@opindex funsafe-loop-optimizations 7033This option tells the loop optimizer to assume that loop indices do not 7034overflow, and that loops with nontrivial exit condition are not 7035infinite. This enables a wider range of loop optimizations even if 7036the loop optimizer itself cannot prove that these assumptions are valid. 7037If you use @option{-Wunsafe-loop-optimizations}, the compiler warns you 7038if it finds this kind of loop. 7039 7040@item -fcrossjumping 7041@opindex fcrossjumping 7042Perform cross-jumping transformation. 7043This transformation unifies equivalent code and saves code size. The 7044resulting code may or may not perform better than without cross-jumping. 7045 7046Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 7047 7048@item -fauto-inc-dec 7049@opindex fauto-inc-dec 7050Combine increments or decrements of addresses with memory accesses. 7051This pass is always skipped on architectures that do not have 7052instructions to support this. Enabled by default at @option{-O} and 7053higher on architectures that support this. 7054 7055@item -fdce 7056@opindex fdce 7057Perform dead code elimination (DCE) on RTL@. 7058Enabled by default at @option{-O} and higher. 7059 7060@item -fdse 7061@opindex fdse 7062Perform dead store elimination (DSE) on RTL@. 7063Enabled by default at @option{-O} and higher. 7064 7065@item -fif-conversion 7066@opindex fif-conversion 7067Attempt to transform conditional jumps into branch-less equivalents. This 7068includes use of conditional moves, min, max, set flags and abs instructions, and 7069some tricks doable by standard arithmetics. The use of conditional execution 7070on chips where it is available is controlled by @code{if-conversion2}. 7071 7072Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 7073 7074@item -fif-conversion2 7075@opindex fif-conversion2 7076Use conditional execution (where available) to transform conditional jumps into 7077branch-less equivalents. 7078 7079Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 7080 7081@item -fdelete-null-pointer-checks 7082@opindex fdelete-null-pointer-checks 7083Assume that programs cannot safely dereference null pointers, and that 7084no code or data element resides there. This enables simple constant 7085folding optimizations at all optimization levels. In addition, other 7086optimization passes in GCC use this flag to control global dataflow 7087analyses that eliminate useless checks for null pointers; these assume 7088that if a pointer is checked after it has already been dereferenced, 7089it cannot be null. 7090 7091Note however that in some environments this assumption is not true. 7092Use @option{-fno-delete-null-pointer-checks} to disable this optimization 7093for programs that depend on that behavior. 7094 7095Some targets, especially embedded ones, disable this option at all levels. 7096Otherwise it is enabled at all levels: @option{-O0}, @option{-O1}, 7097@option{-O2}, @option{-O3}, @option{-Os}. Passes that use the information 7098are enabled independently at different optimization levels. 7099 7100@item -fdevirtualize 7101@opindex fdevirtualize 7102Attempt to convert calls to virtual functions to direct calls. This 7103is done both within a procedure and interprocedurally as part of 7104indirect inlining (@code{-findirect-inlining}) and interprocedural constant 7105propagation (@option{-fipa-cp}). 7106Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 7107 7108@item -fexpensive-optimizations 7109@opindex fexpensive-optimizations 7110Perform a number of minor optimizations that are relatively expensive. 7111 7112Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 7113 7114@item -free 7115@opindex free 7116Attempt to remove redundant extension instructions. This is especially 7117helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit 7118registers after writing to their lower 32-bit half. 7119 7120Enabled for x86 at levels @option{-O2}, @option{-O3}. 7121 7122@item -foptimize-register-move 7123@itemx -fregmove 7124@opindex foptimize-register-move 7125@opindex fregmove 7126Attempt to reassign register numbers in move instructions and as 7127operands of other simple instructions in order to maximize the amount of 7128register tying. This is especially helpful on machines with two-operand 7129instructions. 7130 7131Note @option{-fregmove} and @option{-foptimize-register-move} are the same 7132optimization. 7133 7134Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 7135 7136@item -fira-algorithm=@var{algorithm} 7137Use the specified coloring algorithm for the integrated register 7138allocator. The @var{algorithm} argument can be @samp{priority}, which 7139specifies Chow's priority coloring, or @samp{CB}, which specifies 7140Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented 7141for all architectures, but for those targets that do support it, it is 7142the default because it generates better code. 7143 7144@item -fira-region=@var{region} 7145Use specified regions for the integrated register allocator. The 7146@var{region} argument should be one of the following: 7147 7148@table @samp 7149 7150@item all 7151Use all loops as register allocation regions. 7152This can give the best results for machines with a small and/or 7153irregular register set. 7154 7155@item mixed 7156Use all loops except for loops with small register pressure 7157as the regions. This value usually gives 7158the best results in most cases and for most architectures, 7159and is enabled by default when compiling with optimization for speed 7160(@option{-O}, @option{-O2}, @dots{}). 7161 7162@item one 7163Use all functions as a single region. 7164This typically results in the smallest code size, and is enabled by default for 7165@option{-Os} or @option{-O0}. 7166 7167@end table 7168 7169@item -fira-hoist-pressure 7170@opindex fira-hoist-pressure 7171Use IRA to evaluate register pressure in the code hoisting pass for 7172decisions to hoist expressions. This option usually results in smaller 7173code, but it can slow the compiler down. 7174 7175This option is enabled at level @option{-Os} for all targets. 7176 7177@item -fira-loop-pressure 7178@opindex fira-loop-pressure 7179Use IRA to evaluate register pressure in loops for decisions to move 7180loop invariants. This option usually results in generation 7181of faster and smaller code on machines with large register files (>= 32 7182registers), but it can slow the compiler down. 7183 7184This option is enabled at level @option{-O3} for some targets. 7185 7186@item -fno-ira-share-save-slots 7187@opindex fno-ira-share-save-slots 7188Disable sharing of stack slots used for saving call-used hard 7189registers living through a call. Each hard register gets a 7190separate stack slot, and as a result function stack frames are 7191larger. 7192 7193@item -fno-ira-share-spill-slots 7194@opindex fno-ira-share-spill-slots 7195Disable sharing of stack slots allocated for pseudo-registers. Each 7196pseudo-register that does not get a hard register gets a separate 7197stack slot, and as a result function stack frames are larger. 7198 7199@item -fira-verbose=@var{n} 7200@opindex fira-verbose 7201Control the verbosity of the dump file for the integrated register allocator. 7202The default value is 5. If the value @var{n} is greater or equal to 10, 7203the dump output is sent to stderr using the same format as @var{n} minus 10. 7204 7205@item -fdelayed-branch 7206@opindex fdelayed-branch 7207If supported for the target machine, attempt to reorder instructions 7208to exploit instruction slots available after delayed branch 7209instructions. 7210 7211Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 7212 7213@item -fschedule-insns 7214@opindex fschedule-insns 7215If supported for the target machine, attempt to reorder instructions to 7216eliminate execution stalls due to required data being unavailable. This 7217helps machines that have slow floating point or memory load instructions 7218by allowing other instructions to be issued until the result of the load 7219or floating-point instruction is required. 7220 7221Enabled at levels @option{-O2}, @option{-O3}. 7222 7223@item -fschedule-insns2 7224@opindex fschedule-insns2 7225Similar to @option{-fschedule-insns}, but requests an additional pass of 7226instruction scheduling after register allocation has been done. This is 7227especially useful on machines with a relatively small number of 7228registers and where memory load instructions take more than one cycle. 7229 7230Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 7231 7232@item -fno-sched-interblock 7233@opindex fno-sched-interblock 7234Don't schedule instructions across basic blocks. This is normally 7235enabled by default when scheduling before register allocation, i.e.@: 7236with @option{-fschedule-insns} or at @option{-O2} or higher. 7237 7238@item -fno-sched-spec 7239@opindex fno-sched-spec 7240Don't allow speculative motion of non-load instructions. This is normally 7241enabled by default when scheduling before register allocation, i.e.@: 7242with @option{-fschedule-insns} or at @option{-O2} or higher. 7243 7244@item -fsched-pressure 7245@opindex fsched-pressure 7246Enable register pressure sensitive insn scheduling before register 7247allocation. This only makes sense when scheduling before register 7248allocation is enabled, i.e.@: with @option{-fschedule-insns} or at 7249@option{-O2} or higher. Usage of this option can improve the 7250generated code and decrease its size by preventing register pressure 7251increase above the number of available hard registers and subsequent 7252spills in register allocation. 7253 7254@item -fsched-spec-load 7255@opindex fsched-spec-load 7256Allow speculative motion of some load instructions. This only makes 7257sense when scheduling before register allocation, i.e.@: with 7258@option{-fschedule-insns} or at @option{-O2} or higher. 7259 7260@item -fsched-spec-load-dangerous 7261@opindex fsched-spec-load-dangerous 7262Allow speculative motion of more load instructions. This only makes 7263sense when scheduling before register allocation, i.e.@: with 7264@option{-fschedule-insns} or at @option{-O2} or higher. 7265 7266@item -fsched-stalled-insns 7267@itemx -fsched-stalled-insns=@var{n} 7268@opindex fsched-stalled-insns 7269Define how many insns (if any) can be moved prematurely from the queue 7270of stalled insns into the ready list during the second scheduling pass. 7271@option{-fno-sched-stalled-insns} means that no insns are moved 7272prematurely, @option{-fsched-stalled-insns=0} means there is no limit 7273on how many queued insns can be moved prematurely. 7274@option{-fsched-stalled-insns} without a value is equivalent to 7275@option{-fsched-stalled-insns=1}. 7276 7277@item -fsched-stalled-insns-dep 7278@itemx -fsched-stalled-insns-dep=@var{n} 7279@opindex fsched-stalled-insns-dep 7280Define how many insn groups (cycles) are examined for a dependency 7281on a stalled insn that is a candidate for premature removal from the queue 7282of stalled insns. This has an effect only during the second scheduling pass, 7283and only if @option{-fsched-stalled-insns} is used. 7284@option{-fno-sched-stalled-insns-dep} is equivalent to 7285@option{-fsched-stalled-insns-dep=0}. 7286@option{-fsched-stalled-insns-dep} without a value is equivalent to 7287@option{-fsched-stalled-insns-dep=1}. 7288 7289@item -fsched2-use-superblocks 7290@opindex fsched2-use-superblocks 7291When scheduling after register allocation, use superblock scheduling. 7292This allows motion across basic block boundaries, 7293resulting in faster schedules. This option is experimental, as not all machine 7294descriptions used by GCC model the CPU closely enough to avoid unreliable 7295results from the algorithm. 7296 7297This only makes sense when scheduling after register allocation, i.e.@: with 7298@option{-fschedule-insns2} or at @option{-O2} or higher. 7299 7300@item -fsched-group-heuristic 7301@opindex fsched-group-heuristic 7302Enable the group heuristic in the scheduler. This heuristic favors 7303the instruction that belongs to a schedule group. This is enabled 7304by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns} 7305or @option{-fschedule-insns2} or at @option{-O2} or higher. 7306 7307@item -fsched-critical-path-heuristic 7308@opindex fsched-critical-path-heuristic 7309Enable the critical-path heuristic in the scheduler. This heuristic favors 7310instructions on the critical path. This is enabled by default when 7311scheduling is enabled, i.e.@: with @option{-fschedule-insns} 7312or @option{-fschedule-insns2} or at @option{-O2} or higher. 7313 7314@item -fsched-spec-insn-heuristic 7315@opindex fsched-spec-insn-heuristic 7316Enable the speculative instruction heuristic in the scheduler. This 7317heuristic favors speculative instructions with greater dependency weakness. 7318This is enabled by default when scheduling is enabled, i.e.@: 7319with @option{-fschedule-insns} or @option{-fschedule-insns2} 7320or at @option{-O2} or higher. 7321 7322@item -fsched-rank-heuristic 7323@opindex fsched-rank-heuristic 7324Enable the rank heuristic in the scheduler. This heuristic favors 7325the instruction belonging to a basic block with greater size or frequency. 7326This is enabled by default when scheduling is enabled, i.e.@: 7327with @option{-fschedule-insns} or @option{-fschedule-insns2} or 7328at @option{-O2} or higher. 7329 7330@item -fsched-last-insn-heuristic 7331@opindex fsched-last-insn-heuristic 7332Enable the last-instruction heuristic in the scheduler. This heuristic 7333favors the instruction that is less dependent on the last instruction 7334scheduled. This is enabled by default when scheduling is enabled, 7335i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or 7336at @option{-O2} or higher. 7337 7338@item -fsched-dep-count-heuristic 7339@opindex fsched-dep-count-heuristic 7340Enable the dependent-count heuristic in the scheduler. This heuristic 7341favors the instruction that has more instructions depending on it. 7342This is enabled by default when scheduling is enabled, i.e.@: 7343with @option{-fschedule-insns} or @option{-fschedule-insns2} or 7344at @option{-O2} or higher. 7345 7346@item -freschedule-modulo-scheduled-loops 7347@opindex freschedule-modulo-scheduled-loops 7348Modulo scheduling is performed before traditional scheduling. If a loop 7349is modulo scheduled, later scheduling passes may change its schedule. 7350Use this option to control that behavior. 7351 7352@item -fselective-scheduling 7353@opindex fselective-scheduling 7354Schedule instructions using selective scheduling algorithm. Selective 7355scheduling runs instead of the first scheduler pass. 7356 7357@item -fselective-scheduling2 7358@opindex fselective-scheduling2 7359Schedule instructions using selective scheduling algorithm. Selective 7360scheduling runs instead of the second scheduler pass. 7361 7362@item -fsel-sched-pipelining 7363@opindex fsel-sched-pipelining 7364Enable software pipelining of innermost loops during selective scheduling. 7365This option has no effect unless one of @option{-fselective-scheduling} or 7366@option{-fselective-scheduling2} is turned on. 7367 7368@item -fsel-sched-pipelining-outer-loops 7369@opindex fsel-sched-pipelining-outer-loops 7370When pipelining loops during selective scheduling, also pipeline outer loops. 7371This option has no effect unless @option{-fsel-sched-pipelining} is turned on. 7372 7373@item -fshrink-wrap 7374@opindex fshrink-wrap 7375Emit function prologues only before parts of the function that need it, 7376rather than at the top of the function. This flag is enabled by default at 7377@option{-O} and higher. 7378 7379@item -fcaller-saves 7380@opindex fcaller-saves 7381Enable allocation of values to registers that are clobbered by 7382function calls, by emitting extra instructions to save and restore the 7383registers around such calls. Such allocation is done only when it 7384seems to result in better code. 7385 7386This option is always enabled by default on certain machines, usually 7387those which have no call-preserved registers to use instead. 7388 7389Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 7390 7391@item -fcombine-stack-adjustments 7392@opindex fcombine-stack-adjustments 7393Tracks stack adjustments (pushes and pops) and stack memory references 7394and then tries to find ways to combine them. 7395 7396Enabled by default at @option{-O1} and higher. 7397 7398@item -fconserve-stack 7399@opindex fconserve-stack 7400Attempt to minimize stack usage. The compiler attempts to use less 7401stack space, even if that makes the program slower. This option 7402implies setting the @option{large-stack-frame} parameter to 100 7403and the @option{large-stack-frame-growth} parameter to 400. 7404 7405@item -ftree-reassoc 7406@opindex ftree-reassoc 7407Perform reassociation on trees. This flag is enabled by default 7408at @option{-O} and higher. 7409 7410@item -ftree-pre 7411@opindex ftree-pre 7412Perform partial redundancy elimination (PRE) on trees. This flag is 7413enabled by default at @option{-O2} and @option{-O3}. 7414 7415@item -ftree-partial-pre 7416@opindex ftree-partial-pre 7417Make partial redundancy elimination (PRE) more aggressive. This flag is 7418enabled by default at @option{-O3}. 7419 7420@item -ftree-forwprop 7421@opindex ftree-forwprop 7422Perform forward propagation on trees. This flag is enabled by default 7423at @option{-O} and higher. 7424 7425@item -ftree-fre 7426@opindex ftree-fre 7427Perform full redundancy elimination (FRE) on trees. The difference 7428between FRE and PRE is that FRE only considers expressions 7429that are computed on all paths leading to the redundant computation. 7430This analysis is faster than PRE, though it exposes fewer redundancies. 7431This flag is enabled by default at @option{-O} and higher. 7432 7433@item -ftree-phiprop 7434@opindex ftree-phiprop 7435Perform hoisting of loads from conditional pointers on trees. This 7436pass is enabled by default at @option{-O} and higher. 7437 7438@item -fhoist-adjacent-loads 7439@opindex hoist-adjacent-loads 7440Speculatively hoist loads from both branches of an if-then-else if the 7441loads are from adjacent locations in the same structure and the target 7442architecture has a conditional move instruction. This flag is enabled 7443by default at @option{-O2} and higher. 7444 7445@item -ftree-copy-prop 7446@opindex ftree-copy-prop 7447Perform copy propagation on trees. This pass eliminates unnecessary 7448copy operations. This flag is enabled by default at @option{-O} and 7449higher. 7450 7451@item -fipa-pure-const 7452@opindex fipa-pure-const 7453Discover which functions are pure or constant. 7454Enabled by default at @option{-O} and higher. 7455 7456@item -fipa-reference 7457@opindex fipa-reference 7458Discover which static variables do not escape the 7459compilation unit. 7460Enabled by default at @option{-O} and higher. 7461 7462@item -fipa-pta 7463@opindex fipa-pta 7464Perform interprocedural pointer analysis and interprocedural modification 7465and reference analysis. This option can cause excessive memory and 7466compile-time usage on large compilation units. It is not enabled by 7467default at any optimization level. 7468 7469@item -fipa-profile 7470@opindex fipa-profile 7471Perform interprocedural profile propagation. The functions called only from 7472cold functions are marked as cold. Also functions executed once (such as 7473@code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold 7474functions and loop less parts of functions executed once are then optimized for 7475size. 7476Enabled by default at @option{-O} and higher. 7477 7478@item -fipa-cp 7479@opindex fipa-cp 7480Perform interprocedural constant propagation. 7481This optimization analyzes the program to determine when values passed 7482to functions are constants and then optimizes accordingly. 7483This optimization can substantially increase performance 7484if the application has constants passed to functions. 7485This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}. 7486 7487@item -fipa-cp-clone 7488@opindex fipa-cp-clone 7489Perform function cloning to make interprocedural constant propagation stronger. 7490When enabled, interprocedural constant propagation performs function cloning 7491when externally visible function can be called with constant arguments. 7492Because this optimization can create multiple copies of functions, 7493it may significantly increase code size 7494(see @option{--param ipcp-unit-growth=@var{value}}). 7495This flag is enabled by default at @option{-O3}. 7496 7497@item -ftree-sink 7498@opindex ftree-sink 7499Perform forward store motion on trees. This flag is 7500enabled by default at @option{-O} and higher. 7501 7502@item -ftree-bit-ccp 7503@opindex ftree-bit-ccp 7504Perform sparse conditional bit constant propagation on trees and propagate 7505pointer alignment information. 7506This pass only operates on local scalar variables and is enabled by default 7507at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled. 7508 7509@item -ftree-ccp 7510@opindex ftree-ccp 7511Perform sparse conditional constant propagation (CCP) on trees. This 7512pass only operates on local scalar variables and is enabled by default 7513at @option{-O} and higher. 7514 7515@item -ftree-switch-conversion 7516Perform conversion of simple initializations in a switch to 7517initializations from a scalar array. This flag is enabled by default 7518at @option{-O2} and higher. 7519 7520@item -ftree-tail-merge 7521Look for identical code sequences. When found, replace one with a jump to the 7522other. This optimization is known as tail merging or cross jumping. This flag 7523is enabled by default at @option{-O2} and higher. The compilation time 7524in this pass can 7525be limited using @option{max-tail-merge-comparisons} parameter and 7526@option{max-tail-merge-iterations} parameter. 7527 7528@item -ftree-dce 7529@opindex ftree-dce 7530Perform dead code elimination (DCE) on trees. This flag is enabled by 7531default at @option{-O} and higher. 7532 7533@item -ftree-builtin-call-dce 7534@opindex ftree-builtin-call-dce 7535Perform conditional dead code elimination (DCE) for calls to built-in functions 7536that may set @code{errno} but are otherwise side-effect free. This flag is 7537enabled by default at @option{-O2} and higher if @option{-Os} is not also 7538specified. 7539 7540@item -ftree-dominator-opts 7541@opindex ftree-dominator-opts 7542Perform a variety of simple scalar cleanups (constant/copy 7543propagation, redundancy elimination, range propagation and expression 7544simplification) based on a dominator tree traversal. This also 7545performs jump threading (to reduce jumps to jumps). This flag is 7546enabled by default at @option{-O} and higher. 7547 7548@item -ftree-dse 7549@opindex ftree-dse 7550Perform dead store elimination (DSE) on trees. A dead store is a store into 7551a memory location that is later overwritten by another store without 7552any intervening loads. In this case the earlier store can be deleted. This 7553flag is enabled by default at @option{-O} and higher. 7554 7555@item -ftree-ch 7556@opindex ftree-ch 7557Perform loop header copying on trees. This is beneficial since it increases 7558effectiveness of code motion optimizations. It also saves one jump. This flag 7559is enabled by default at @option{-O} and higher. It is not enabled 7560for @option{-Os}, since it usually increases code size. 7561 7562@item -ftree-loop-optimize 7563@opindex ftree-loop-optimize 7564Perform loop optimizations on trees. This flag is enabled by default 7565at @option{-O} and higher. 7566 7567@item -ftree-loop-linear 7568@opindex ftree-loop-linear 7569Perform loop interchange transformations on tree. Same as 7570@option{-floop-interchange}. To use this code transformation, GCC has 7571to be configured with @option{--with-ppl} and @option{--with-cloog} to 7572enable the Graphite loop transformation infrastructure. 7573 7574@item -floop-interchange 7575@opindex floop-interchange 7576Perform loop interchange transformations on loops. Interchanging two 7577nested loops switches the inner and outer loops. For example, given a 7578loop like: 7579@smallexample 7580DO J = 1, M 7581 DO I = 1, N 7582 A(J, I) = A(J, I) * C 7583 ENDDO 7584ENDDO 7585@end smallexample 7586loop interchange transforms the loop as if it were written: 7587@smallexample 7588DO I = 1, N 7589 DO J = 1, M 7590 A(J, I) = A(J, I) * C 7591 ENDDO 7592ENDDO 7593@end smallexample 7594which can be beneficial when @code{N} is larger than the caches, 7595because in Fortran, the elements of an array are stored in memory 7596contiguously by column, and the original loop iterates over rows, 7597potentially creating at each access a cache miss. This optimization 7598applies to all the languages supported by GCC and is not limited to 7599Fortran. To use this code transformation, GCC has to be configured 7600with @option{--with-ppl} and @option{--with-cloog} to enable the 7601Graphite loop transformation infrastructure. 7602 7603@item -floop-strip-mine 7604@opindex floop-strip-mine 7605Perform loop strip mining transformations on loops. Strip mining 7606splits a loop into two nested loops. The outer loop has strides 7607equal to the strip size and the inner loop has strides of the 7608original loop within a strip. The strip length can be changed 7609using the @option{loop-block-tile-size} parameter. For example, 7610given a loop like: 7611@smallexample 7612DO I = 1, N 7613 A(I) = A(I) + C 7614ENDDO 7615@end smallexample 7616loop strip mining transforms the loop as if it were written: 7617@smallexample 7618DO II = 1, N, 51 7619 DO I = II, min (II + 50, N) 7620 A(I) = A(I) + C 7621 ENDDO 7622ENDDO 7623@end smallexample 7624This optimization applies to all the languages supported by GCC and is 7625not limited to Fortran. To use this code transformation, GCC has to 7626be configured with @option{--with-ppl} and @option{--with-cloog} to 7627enable the Graphite loop transformation infrastructure. 7628 7629@item -floop-block 7630@opindex floop-block 7631Perform loop blocking transformations on loops. Blocking strip mines 7632each loop in the loop nest such that the memory accesses of the 7633element loops fit inside caches. The strip length can be changed 7634using the @option{loop-block-tile-size} parameter. For example, given 7635a loop like: 7636@smallexample 7637DO I = 1, N 7638 DO J = 1, M 7639 A(J, I) = B(I) + C(J) 7640 ENDDO 7641ENDDO 7642@end smallexample 7643loop blocking transforms the loop as if it were written: 7644@smallexample 7645DO II = 1, N, 51 7646 DO JJ = 1, M, 51 7647 DO I = II, min (II + 50, N) 7648 DO J = JJ, min (JJ + 50, M) 7649 A(J, I) = B(I) + C(J) 7650 ENDDO 7651 ENDDO 7652 ENDDO 7653ENDDO 7654@end smallexample 7655which can be beneficial when @code{M} is larger than the caches, 7656because the innermost loop iterates over a smaller amount of data 7657which can be kept in the caches. This optimization applies to all the 7658languages supported by GCC and is not limited to Fortran. To use this 7659code transformation, GCC has to be configured with @option{--with-ppl} 7660and @option{--with-cloog} to enable the Graphite loop transformation 7661infrastructure. 7662 7663@item -fgraphite-identity 7664@opindex fgraphite-identity 7665Enable the identity transformation for graphite. For every SCoP we generate 7666the polyhedral representation and transform it back to gimple. Using 7667@option{-fgraphite-identity} we can check the costs or benefits of the 7668GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations 7669are also performed by the code generator CLooG, like index splitting and 7670dead code elimination in loops. 7671 7672@item -floop-nest-optimize 7673@opindex floop-nest-optimize 7674Enable the ISL based loop nest optimizer. This is a generic loop nest 7675optimizer based on the Pluto optimization algorithms. It calculates a loop 7676structure optimized for data-locality and parallelism. This option 7677is experimental. 7678 7679@item -floop-parallelize-all 7680@opindex floop-parallelize-all 7681Use the Graphite data dependence analysis to identify loops that can 7682be parallelized. Parallelize all the loops that can be analyzed to 7683not contain loop carried dependences without checking that it is 7684profitable to parallelize the loops. 7685 7686@item -fcheck-data-deps 7687@opindex fcheck-data-deps 7688Compare the results of several data dependence analyzers. This option 7689is used for debugging the data dependence analyzers. 7690 7691@item -ftree-loop-if-convert 7692Attempt to transform conditional jumps in the innermost loops to 7693branch-less equivalents. The intent is to remove control-flow from 7694the innermost loops in order to improve the ability of the 7695vectorization pass to handle these loops. This is enabled by default 7696if vectorization is enabled. 7697 7698@item -ftree-loop-if-convert-stores 7699Attempt to also if-convert conditional jumps containing memory writes. 7700This transformation can be unsafe for multi-threaded programs as it 7701transforms conditional memory writes into unconditional memory writes. 7702For example, 7703@smallexample 7704for (i = 0; i < N; i++) 7705 if (cond) 7706 A[i] = expr; 7707@end smallexample 7708is transformed to 7709@smallexample 7710for (i = 0; i < N; i++) 7711 A[i] = cond ? expr : A[i]; 7712@end smallexample 7713potentially producing data races. 7714 7715@item -ftree-loop-distribution 7716Perform loop distribution. This flag can improve cache performance on 7717big loop bodies and allow further loop optimizations, like 7718parallelization or vectorization, to take place. For example, the loop 7719@smallexample 7720DO I = 1, N 7721 A(I) = B(I) + C 7722 D(I) = E(I) * F 7723ENDDO 7724@end smallexample 7725is transformed to 7726@smallexample 7727DO I = 1, N 7728 A(I) = B(I) + C 7729ENDDO 7730DO I = 1, N 7731 D(I) = E(I) * F 7732ENDDO 7733@end smallexample 7734 7735@item -ftree-loop-distribute-patterns 7736Perform loop distribution of patterns that can be code generated with 7737calls to a library. This flag is enabled by default at @option{-O3}. 7738 7739This pass distributes the initialization loops and generates a call to 7740memset zero. For example, the loop 7741@smallexample 7742DO I = 1, N 7743 A(I) = 0 7744 B(I) = A(I) + I 7745ENDDO 7746@end smallexample 7747is transformed to 7748@smallexample 7749DO I = 1, N 7750 A(I) = 0 7751ENDDO 7752DO I = 1, N 7753 B(I) = A(I) + I 7754ENDDO 7755@end smallexample 7756and the initialization loop is transformed into a call to memset zero. 7757 7758@item -ftree-loop-im 7759@opindex ftree-loop-im 7760Perform loop invariant motion on trees. This pass moves only invariants that 7761are hard to handle at RTL level (function calls, operations that expand to 7762nontrivial sequences of insns). With @option{-funswitch-loops} it also moves 7763operands of conditions that are invariant out of the loop, so that we can use 7764just trivial invariantness analysis in loop unswitching. The pass also includes 7765store motion. 7766 7767@item -ftree-loop-ivcanon 7768@opindex ftree-loop-ivcanon 7769Create a canonical counter for number of iterations in loops for which 7770determining number of iterations requires complicated analysis. Later 7771optimizations then may determine the number easily. Useful especially 7772in connection with unrolling. 7773 7774@item -fivopts 7775@opindex fivopts 7776Perform induction variable optimizations (strength reduction, induction 7777variable merging and induction variable elimination) on trees. 7778 7779@item -ftree-parallelize-loops=n 7780@opindex ftree-parallelize-loops 7781Parallelize loops, i.e., split their iteration space to run in n threads. 7782This is only possible for loops whose iterations are independent 7783and can be arbitrarily reordered. The optimization is only 7784profitable on multiprocessor machines, for loops that are CPU-intensive, 7785rather than constrained e.g.@: by memory bandwidth. This option 7786implies @option{-pthread}, and thus is only supported on targets 7787that have support for @option{-pthread}. 7788 7789@item -ftree-pta 7790@opindex ftree-pta 7791Perform function-local points-to analysis on trees. This flag is 7792enabled by default at @option{-O} and higher. 7793 7794@item -ftree-sra 7795@opindex ftree-sra 7796Perform scalar replacement of aggregates. This pass replaces structure 7797references with scalars to prevent committing structures to memory too 7798early. This flag is enabled by default at @option{-O} and higher. 7799 7800@item -ftree-copyrename 7801@opindex ftree-copyrename 7802Perform copy renaming on trees. This pass attempts to rename compiler 7803temporaries to other variables at copy locations, usually resulting in 7804variable names which more closely resemble the original variables. This flag 7805is enabled by default at @option{-O} and higher. 7806 7807@item -ftree-coalesce-inlined-vars 7808Tell the copyrename pass (see @option{-ftree-copyrename}) to attempt to 7809combine small user-defined variables too, but only if they were inlined 7810from other functions. It is a more limited form of 7811@option{-ftree-coalesce-vars}. This may harm debug information of such 7812inlined variables, but it will keep variables of the inlined-into 7813function apart from each other, such that they are more likely to 7814contain the expected values in a debugging session. This was the 7815default in GCC versions older than 4.7. 7816 7817@item -ftree-coalesce-vars 7818Tell the copyrename pass (see @option{-ftree-copyrename}) to attempt to 7819combine small user-defined variables too, instead of just compiler 7820temporaries. This may severely limit the ability to debug an optimized 7821program compiled with @option{-fno-var-tracking-assignments}. In the 7822negated form, this flag prevents SSA coalescing of user variables, 7823including inlined ones. This option is enabled by default. 7824 7825@item -ftree-ter 7826@opindex ftree-ter 7827Perform temporary expression replacement during the SSA->normal phase. Single 7828use/single def temporaries are replaced at their use location with their 7829defining expression. This results in non-GIMPLE code, but gives the expanders 7830much more complex trees to work on resulting in better RTL generation. This is 7831enabled by default at @option{-O} and higher. 7832 7833@item -ftree-slsr 7834@opindex ftree-slsr 7835Perform straight-line strength reduction on trees. This recognizes related 7836expressions involving multiplications and replaces them by less expensive 7837calculations when possible. This is enabled by default at @option{-O} and 7838higher. 7839 7840@item -ftree-vectorize 7841@opindex ftree-vectorize 7842Perform loop vectorization on trees. This flag is enabled by default at 7843@option{-O3}. 7844 7845@item -ftree-slp-vectorize 7846@opindex ftree-slp-vectorize 7847Perform basic block vectorization on trees. This flag is enabled by default at 7848@option{-O3} and when @option{-ftree-vectorize} is enabled. 7849 7850@item -ftree-vect-loop-version 7851@opindex ftree-vect-loop-version 7852Perform loop versioning when doing loop vectorization on trees. When a loop 7853appears to be vectorizable except that data alignment or data dependence cannot 7854be determined at compile time, then vectorized and non-vectorized versions of 7855the loop are generated along with run-time checks for alignment or dependence 7856to control which version is executed. This option is enabled by default 7857except at level @option{-Os} where it is disabled. 7858 7859@item -fvect-cost-model 7860@opindex fvect-cost-model 7861Enable cost model for vectorization. This option is enabled by default at 7862@option{-O3}. 7863 7864@item -ftree-vrp 7865@opindex ftree-vrp 7866Perform Value Range Propagation on trees. This is similar to the 7867constant propagation pass, but instead of values, ranges of values are 7868propagated. This allows the optimizers to remove unnecessary range 7869checks like array bound checks and null pointer checks. This is 7870enabled by default at @option{-O2} and higher. Null pointer check 7871elimination is only done if @option{-fdelete-null-pointer-checks} is 7872enabled. 7873 7874@item -ftracer 7875@opindex ftracer 7876Perform tail duplication to enlarge superblock size. This transformation 7877simplifies the control flow of the function allowing other optimizations to do 7878a better job. 7879 7880@item -funroll-loops 7881@opindex funroll-loops 7882Unroll loops whose number of iterations can be determined at compile 7883time or upon entry to the loop. @option{-funroll-loops} implies 7884@option{-frerun-cse-after-loop}. This option makes code larger, 7885and may or may not make it run faster. 7886 7887@item -funroll-all-loops 7888@opindex funroll-all-loops 7889Unroll all loops, even if their number of iterations is uncertain when 7890the loop is entered. This usually makes programs run more slowly. 7891@option{-funroll-all-loops} implies the same options as 7892@option{-funroll-loops}, 7893 7894@item -fsplit-ivs-in-unroller 7895@opindex fsplit-ivs-in-unroller 7896Enables expression of values of induction variables in later iterations 7897of the unrolled loop using the value in the first iteration. This breaks 7898long dependency chains, thus improving efficiency of the scheduling passes. 7899 7900A combination of @option{-fweb} and CSE is often sufficient to obtain the 7901same effect. However, that is not reliable in cases where the loop body 7902is more complicated than a single basic block. It also does not work at all 7903on some architectures due to restrictions in the CSE pass. 7904 7905This optimization is enabled by default. 7906 7907@item -fvariable-expansion-in-unroller 7908@opindex fvariable-expansion-in-unroller 7909With this option, the compiler creates multiple copies of some 7910local variables when unrolling a loop, which can result in superior code. 7911 7912@item -fpartial-inlining 7913@opindex fpartial-inlining 7914Inline parts of functions. This option has any effect only 7915when inlining itself is turned on by the @option{-finline-functions} 7916or @option{-finline-small-functions} options. 7917 7918Enabled at level @option{-O2}. 7919 7920@item -fpredictive-commoning 7921@opindex fpredictive-commoning 7922Perform predictive commoning optimization, i.e., reusing computations 7923(especially memory loads and stores) performed in previous 7924iterations of loops. 7925 7926This option is enabled at level @option{-O3}. 7927 7928@item -fprefetch-loop-arrays 7929@opindex fprefetch-loop-arrays 7930If supported by the target machine, generate instructions to prefetch 7931memory to improve the performance of loops that access large arrays. 7932 7933This option may generate better or worse code; results are highly 7934dependent on the structure of loops within the source code. 7935 7936Disabled at level @option{-Os}. 7937 7938@item -fno-peephole 7939@itemx -fno-peephole2 7940@opindex fno-peephole 7941@opindex fno-peephole2 7942Disable any machine-specific peephole optimizations. The difference 7943between @option{-fno-peephole} and @option{-fno-peephole2} is in how they 7944are implemented in the compiler; some targets use one, some use the 7945other, a few use both. 7946 7947@option{-fpeephole} is enabled by default. 7948@option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 7949 7950@item -fno-guess-branch-probability 7951@opindex fno-guess-branch-probability 7952Do not guess branch probabilities using heuristics. 7953 7954GCC uses heuristics to guess branch probabilities if they are 7955not provided by profiling feedback (@option{-fprofile-arcs}). These 7956heuristics are based on the control flow graph. If some branch probabilities 7957are specified by @samp{__builtin_expect}, then the heuristics are 7958used to guess branch probabilities for the rest of the control flow graph, 7959taking the @samp{__builtin_expect} info into account. The interactions 7960between the heuristics and @samp{__builtin_expect} can be complex, and in 7961some cases, it may be useful to disable the heuristics so that the effects 7962of @samp{__builtin_expect} are easier to understand. 7963 7964The default is @option{-fguess-branch-probability} at levels 7965@option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 7966 7967@item -freorder-blocks 7968@opindex freorder-blocks 7969Reorder basic blocks in the compiled function in order to reduce number of 7970taken branches and improve code locality. 7971 7972Enabled at levels @option{-O2}, @option{-O3}. 7973 7974@item -freorder-blocks-and-partition 7975@opindex freorder-blocks-and-partition 7976In addition to reordering basic blocks in the compiled function, in order 7977to reduce number of taken branches, partitions hot and cold basic blocks 7978into separate sections of the assembly and .o files, to improve 7979paging and cache locality performance. 7980 7981This optimization is automatically turned off in the presence of 7982exception handling, for linkonce sections, for functions with a user-defined 7983section attribute and on any architecture that does not support named 7984sections. 7985 7986@item -freorder-functions 7987@opindex freorder-functions 7988Reorder functions in the object file in order to 7989improve code locality. This is implemented by using special 7990subsections @code{.text.hot} for most frequently executed functions and 7991@code{.text.unlikely} for unlikely executed functions. Reordering is done by 7992the linker so object file format must support named sections and linker must 7993place them in a reasonable way. 7994 7995Also profile feedback must be available to make this option effective. See 7996@option{-fprofile-arcs} for details. 7997 7998Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 7999 8000@item -fstrict-aliasing 8001@opindex fstrict-aliasing 8002Allow the compiler to assume the strictest aliasing rules applicable to 8003the language being compiled. For C (and C++), this activates 8004optimizations based on the type of expressions. In particular, an 8005object of one type is assumed never to reside at the same address as an 8006object of a different type, unless the types are almost the same. For 8007example, an @code{unsigned int} can alias an @code{int}, but not a 8008@code{void*} or a @code{double}. A character type may alias any other 8009type. 8010 8011@anchor{Type-punning}Pay special attention to code like this: 8012@smallexample 8013union a_union @{ 8014 int i; 8015 double d; 8016@}; 8017 8018int f() @{ 8019 union a_union t; 8020 t.d = 3.0; 8021 return t.i; 8022@} 8023@end smallexample 8024The practice of reading from a different union member than the one most 8025recently written to (called ``type-punning'') is common. Even with 8026@option{-fstrict-aliasing}, type-punning is allowed, provided the memory 8027is accessed through the union type. So, the code above works as 8028expected. @xref{Structures unions enumerations and bit-fields 8029implementation}. However, this code might not: 8030@smallexample 8031int f() @{ 8032 union a_union t; 8033 int* ip; 8034 t.d = 3.0; 8035 ip = &t.i; 8036 return *ip; 8037@} 8038@end smallexample 8039 8040Similarly, access by taking the address, casting the resulting pointer 8041and dereferencing the result has undefined behavior, even if the cast 8042uses a union type, e.g.: 8043@smallexample 8044int f() @{ 8045 double d = 3.0; 8046 return ((union a_union *) &d)->i; 8047@} 8048@end smallexample 8049 8050The @option{-fstrict-aliasing} option is enabled at levels 8051@option{-O2}, @option{-O3}, @option{-Os}. 8052 8053@item -fstrict-overflow 8054@opindex fstrict-overflow 8055Allow the compiler to assume strict signed overflow rules, depending 8056on the language being compiled. For C (and C++) this means that 8057overflow when doing arithmetic with signed numbers is undefined, which 8058means that the compiler may assume that it does not happen. This 8059permits various optimizations. For example, the compiler assumes 8060that an expression like @code{i + 10 > i} is always true for 8061signed @code{i}. This assumption is only valid if signed overflow is 8062undefined, as the expression is false if @code{i + 10} overflows when 8063using twos complement arithmetic. When this option is in effect any 8064attempt to determine whether an operation on signed numbers 8065overflows must be written carefully to not actually involve overflow. 8066 8067This option also allows the compiler to assume strict pointer 8068semantics: given a pointer to an object, if adding an offset to that 8069pointer does not produce a pointer to the same object, the addition is 8070undefined. This permits the compiler to conclude that @code{p + u > 8071p} is always true for a pointer @code{p} and unsigned integer 8072@code{u}. This assumption is only valid because pointer wraparound is 8073undefined, as the expression is false if @code{p + u} overflows using 8074twos complement arithmetic. 8075 8076See also the @option{-fwrapv} option. Using @option{-fwrapv} means 8077that integer signed overflow is fully defined: it wraps. When 8078@option{-fwrapv} is used, there is no difference between 8079@option{-fstrict-overflow} and @option{-fno-strict-overflow} for 8080integers. With @option{-fwrapv} certain types of overflow are 8081permitted. For example, if the compiler gets an overflow when doing 8082arithmetic on constants, the overflowed value can still be used with 8083@option{-fwrapv}, but not otherwise. 8084 8085The @option{-fstrict-overflow} option is enabled at levels 8086@option{-O2}, @option{-O3}, @option{-Os}. 8087 8088@item -falign-functions 8089@itemx -falign-functions=@var{n} 8090@opindex falign-functions 8091Align the start of functions to the next power-of-two greater than 8092@var{n}, skipping up to @var{n} bytes. For instance, 8093@option{-falign-functions=32} aligns functions to the next 32-byte 8094boundary, but @option{-falign-functions=24} aligns to the next 809532-byte boundary only if this can be done by skipping 23 bytes or less. 8096 8097@option{-fno-align-functions} and @option{-falign-functions=1} are 8098equivalent and mean that functions are not aligned. 8099 8100Some assemblers only support this flag when @var{n} is a power of two; 8101in that case, it is rounded up. 8102 8103If @var{n} is not specified or is zero, use a machine-dependent default. 8104 8105Enabled at levels @option{-O2}, @option{-O3}. 8106 8107@item -falign-labels 8108@itemx -falign-labels=@var{n} 8109@opindex falign-labels 8110Align all branch targets to a power-of-two boundary, skipping up to 8111@var{n} bytes like @option{-falign-functions}. This option can easily 8112make code slower, because it must insert dummy operations for when the 8113branch target is reached in the usual flow of the code. 8114 8115@option{-fno-align-labels} and @option{-falign-labels=1} are 8116equivalent and mean that labels are not aligned. 8117 8118If @option{-falign-loops} or @option{-falign-jumps} are applicable and 8119are greater than this value, then their values are used instead. 8120 8121If @var{n} is not specified or is zero, use a machine-dependent default 8122which is very likely to be @samp{1}, meaning no alignment. 8123 8124Enabled at levels @option{-O2}, @option{-O3}. 8125 8126@item -falign-loops 8127@itemx -falign-loops=@var{n} 8128@opindex falign-loops 8129Align loops to a power-of-two boundary, skipping up to @var{n} bytes 8130like @option{-falign-functions}. If the loops are 8131executed many times, this makes up for any execution of the dummy 8132operations. 8133 8134@option{-fno-align-loops} and @option{-falign-loops=1} are 8135equivalent and mean that loops are not aligned. 8136 8137If @var{n} is not specified or is zero, use a machine-dependent default. 8138 8139Enabled at levels @option{-O2}, @option{-O3}. 8140 8141@item -falign-jumps 8142@itemx -falign-jumps=@var{n} 8143@opindex falign-jumps 8144Align branch targets to a power-of-two boundary, for branch targets 8145where the targets can only be reached by jumping, skipping up to @var{n} 8146bytes like @option{-falign-functions}. In this case, no dummy operations 8147need be executed. 8148 8149@option{-fno-align-jumps} and @option{-falign-jumps=1} are 8150equivalent and mean that loops are not aligned. 8151 8152If @var{n} is not specified or is zero, use a machine-dependent default. 8153 8154Enabled at levels @option{-O2}, @option{-O3}. 8155 8156@item -funit-at-a-time 8157@opindex funit-at-a-time 8158This option is left for compatibility reasons. @option{-funit-at-a-time} 8159has no effect, while @option{-fno-unit-at-a-time} implies 8160@option{-fno-toplevel-reorder} and @option{-fno-section-anchors}. 8161 8162Enabled by default. 8163 8164@item -fno-toplevel-reorder 8165@opindex fno-toplevel-reorder 8166Do not reorder top-level functions, variables, and @code{asm} 8167statements. Output them in the same order that they appear in the 8168input file. When this option is used, unreferenced static variables 8169are not removed. This option is intended to support existing code 8170that relies on a particular ordering. For new code, it is better to 8171use attributes. 8172 8173Enabled at level @option{-O0}. When disabled explicitly, it also implies 8174@option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some 8175targets. 8176 8177@item -fweb 8178@opindex fweb 8179Constructs webs as commonly used for register allocation purposes and assign 8180each web individual pseudo register. This allows the register allocation pass 8181to operate on pseudos directly, but also strengthens several other optimization 8182passes, such as CSE, loop optimizer and trivial dead code remover. It can, 8183however, make debugging impossible, since variables no longer stay in a 8184``home register''. 8185 8186Enabled by default with @option{-funroll-loops}. 8187 8188@item -fwhole-program 8189@opindex fwhole-program 8190Assume that the current compilation unit represents the whole program being 8191compiled. All public functions and variables with the exception of @code{main} 8192and those merged by attribute @code{externally_visible} become static functions 8193and in effect are optimized more aggressively by interprocedural optimizers. 8194 8195This option should not be used in combination with @code{-flto}. 8196Instead relying on a linker plugin should provide safer and more precise 8197information. 8198 8199@item -flto[=@var{n}] 8200@opindex flto 8201This option runs the standard link-time optimizer. When invoked 8202with source code, it generates GIMPLE (one of GCC's internal 8203representations) and writes it to special ELF sections in the object 8204file. When the object files are linked together, all the function 8205bodies are read from these ELF sections and instantiated as if they 8206had been part of the same translation unit. 8207 8208To use the link-time optimizer, @option{-flto} needs to be specified at 8209compile time and during the final link. For example: 8210 8211@smallexample 8212gcc -c -O2 -flto foo.c 8213gcc -c -O2 -flto bar.c 8214gcc -o myprog -flto -O2 foo.o bar.o 8215@end smallexample 8216 8217The first two invocations to GCC save a bytecode representation 8218of GIMPLE into special ELF sections inside @file{foo.o} and 8219@file{bar.o}. The final invocation reads the GIMPLE bytecode from 8220@file{foo.o} and @file{bar.o}, merges the two files into a single 8221internal image, and compiles the result as usual. Since both 8222@file{foo.o} and @file{bar.o} are merged into a single image, this 8223causes all the interprocedural analyses and optimizations in GCC to 8224work across the two files as if they were a single one. This means, 8225for example, that the inliner is able to inline functions in 8226@file{bar.o} into functions in @file{foo.o} and vice-versa. 8227 8228Another (simpler) way to enable link-time optimization is: 8229 8230@smallexample 8231gcc -o myprog -flto -O2 foo.c bar.c 8232@end smallexample 8233 8234The above generates bytecode for @file{foo.c} and @file{bar.c}, 8235merges them together into a single GIMPLE representation and optimizes 8236them as usual to produce @file{myprog}. 8237 8238The only important thing to keep in mind is that to enable link-time 8239optimizations the @option{-flto} flag needs to be passed to both the 8240compile and the link commands. 8241 8242To make whole program optimization effective, it is necessary to make 8243certain whole program assumptions. The compiler needs to know 8244what functions and variables can be accessed by libraries and runtime 8245outside of the link-time optimized unit. When supported by the linker, 8246the linker plugin (see @option{-fuse-linker-plugin}) passes information 8247to the compiler about used and externally visible symbols. When 8248the linker plugin is not available, @option{-fwhole-program} should be 8249used to allow the compiler to make these assumptions, which leads 8250to more aggressive optimization decisions. 8251 8252Note that when a file is compiled with @option{-flto}, the generated 8253object file is larger than a regular object file because it 8254contains GIMPLE bytecodes and the usual final code. This means that 8255object files with LTO information can be linked as normal object 8256files; if @option{-flto} is not passed to the linker, no 8257interprocedural optimizations are applied. 8258 8259Additionally, the optimization flags used to compile individual files 8260are not necessarily related to those used at link time. For instance, 8261 8262@smallexample 8263gcc -c -O0 -flto foo.c 8264gcc -c -O0 -flto bar.c 8265gcc -o myprog -flto -O3 foo.o bar.o 8266@end smallexample 8267 8268This produces individual object files with unoptimized assembler 8269code, but the resulting binary @file{myprog} is optimized at 8270@option{-O3}. If, instead, the final binary is generated without 8271@option{-flto}, then @file{myprog} is not optimized. 8272 8273When producing the final binary with @option{-flto}, GCC only 8274applies link-time optimizations to those files that contain bytecode. 8275Therefore, you can mix and match object files and libraries with 8276GIMPLE bytecodes and final object code. GCC automatically selects 8277which files to optimize in LTO mode and which files to link without 8278further processing. 8279 8280There are some code generation flags preserved by GCC when 8281generating bytecodes, as they need to be used during the final link 8282stage. Currently, the following options are saved into the GIMPLE 8283bytecode files: @option{-fPIC}, @option{-fcommon} and all the 8284@option{-m} target flags. 8285 8286At link time, these options are read in and reapplied. Note that the 8287current implementation makes no attempt to recognize conflicting 8288values for these options. If different files have conflicting option 8289values (e.g., one file is compiled with @option{-fPIC} and another 8290isn't), the compiler simply uses the last value read from the 8291bytecode files. It is recommended, then, that you compile all the files 8292participating in the same link with the same options. 8293 8294If LTO encounters objects with C linkage declared with incompatible 8295types in separate translation units to be linked together (undefined 8296behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be 8297issued. The behavior is still undefined at run time. 8298 8299Another feature of LTO is that it is possible to apply interprocedural 8300optimizations on files written in different languages. This requires 8301support in the language front end. Currently, the C, C++ and 8302Fortran front ends are capable of emitting GIMPLE bytecodes, so 8303something like this should work: 8304 8305@smallexample 8306gcc -c -flto foo.c 8307g++ -c -flto bar.cc 8308gfortran -c -flto baz.f90 8309g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran 8310@end smallexample 8311 8312Notice that the final link is done with @command{g++} to get the C++ 8313runtime libraries and @option{-lgfortran} is added to get the Fortran 8314runtime libraries. In general, when mixing languages in LTO mode, you 8315should use the same link command options as when mixing languages in a 8316regular (non-LTO) compilation; all you need to add is @option{-flto} to 8317all the compile and link commands. 8318 8319If object files containing GIMPLE bytecode are stored in a library archive, say 8320@file{libfoo.a}, it is possible to extract and use them in an LTO link if you 8321are using a linker with plugin support. To enable this feature, use 8322the flag @option{-fuse-linker-plugin} at link time: 8323 8324@smallexample 8325gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo 8326@end smallexample 8327 8328With the linker plugin enabled, the linker extracts the needed 8329GIMPLE files from @file{libfoo.a} and passes them on to the running GCC 8330to make them part of the aggregated GIMPLE image to be optimized. 8331 8332If you are not using a linker with plugin support and/or do not 8333enable the linker plugin, then the objects inside @file{libfoo.a} 8334are extracted and linked as usual, but they do not participate 8335in the LTO optimization process. 8336 8337Link-time optimizations do not require the presence of the whole program to 8338operate. If the program does not require any symbols to be exported, it is 8339possible to combine @option{-flto} and @option{-fwhole-program} to allow 8340the interprocedural optimizers to use more aggressive assumptions which may 8341lead to improved optimization opportunities. 8342Use of @option{-fwhole-program} is not needed when linker plugin is 8343active (see @option{-fuse-linker-plugin}). 8344 8345The current implementation of LTO makes no 8346attempt to generate bytecode that is portable between different 8347types of hosts. The bytecode files are versioned and there is a 8348strict version check, so bytecode files generated in one version of 8349GCC will not work with an older/newer version of GCC@. 8350 8351Link-time optimization does not work well with generation of debugging 8352information. Combining @option{-flto} with 8353@option{-g} is currently experimental and expected to produce wrong 8354results. 8355 8356If you specify the optional @var{n}, the optimization and code 8357generation done at link time is executed in parallel using @var{n} 8358parallel jobs by utilizing an installed @command{make} program. The 8359environment variable @env{MAKE} may be used to override the program 8360used. The default value for @var{n} is 1. 8361 8362You can also specify @option{-flto=jobserver} to use GNU make's 8363job server mode to determine the number of parallel jobs. This 8364is useful when the Makefile calling GCC is already executing in parallel. 8365You must prepend a @samp{+} to the command recipe in the parent Makefile 8366for this to work. This option likely only works if @env{MAKE} is 8367GNU make. 8368 8369This option is disabled by default. 8370 8371@item -flto-partition=@var{alg} 8372@opindex flto-partition 8373Specify the partitioning algorithm used by the link-time optimizer. 8374The value is either @code{1to1} to specify a partitioning mirroring 8375the original source files or @code{balanced} to specify partitioning 8376into equally sized chunks (whenever possible) or @code{max} to create 8377new partition for every symbol where possible. Specifying @code{none} 8378as an algorithm disables partitioning and streaming completely. 8379The default value is @code{balanced}. While @code{1to1} can be used 8380as an workaround for various code ordering issues, the @code{max} 8381partitioning is intended for internal testing only. 8382 8383@item -flto-compression-level=@var{n} 8384This option specifies the level of compression used for intermediate 8385language written to LTO object files, and is only meaningful in 8386conjunction with LTO mode (@option{-flto}). Valid 8387values are 0 (no compression) to 9 (maximum compression). Values 8388outside this range are clamped to either 0 or 9. If the option is not 8389given, a default balanced compression setting is used. 8390 8391@item -flto-report 8392Prints a report with internal details on the workings of the link-time 8393optimizer. The contents of this report vary from version to version. 8394It is meant to be useful to GCC developers when processing object 8395files in LTO mode (via @option{-flto}). 8396 8397Disabled by default. 8398 8399@item -fuse-linker-plugin 8400Enables the use of a linker plugin during link-time optimization. This 8401option relies on plugin support in the linker, which is available in gold 8402or in GNU ld 2.21 or newer. 8403 8404This option enables the extraction of object files with GIMPLE bytecode out 8405of library archives. This improves the quality of optimization by exposing 8406more code to the link-time optimizer. This information specifies what 8407symbols can be accessed externally (by non-LTO object or during dynamic 8408linking). Resulting code quality improvements on binaries (and shared 8409libraries that use hidden visibility) are similar to @code{-fwhole-program}. 8410See @option{-flto} for a description of the effect of this flag and how to 8411use it. 8412 8413This option is enabled by default when LTO support in GCC is enabled 8414and GCC was configured for use with 8415a linker supporting plugins (GNU ld 2.21 or newer or gold). 8416 8417@item -ffat-lto-objects 8418@opindex ffat-lto-objects 8419Fat LTO objects are object files that contain both the intermediate language 8420and the object code. This makes them usable for both LTO linking and normal 8421linking. This option is effective only when compiling with @option{-flto} 8422and is ignored at link time. 8423 8424@option{-fno-fat-lto-objects} improves compilation time over plain LTO, but 8425requires the complete toolchain to be aware of LTO. It requires a linker with 8426linker plugin support for basic functionality. Additionally, 8427@command{nm}, @command{ar} and @command{ranlib} 8428need to support linker plugins to allow a full-featured build environment 8429(capable of building static libraries etc). GCC provides the @command{gcc-ar}, 8430@command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options 8431to these tools. With non fat LTO makefiles need to be modified to use them. 8432 8433The default is @option{-ffat-lto-objects} but this default is intended to 8434change in future releases when linker plugin enabled environments become more 8435common. 8436 8437@item -fcompare-elim 8438@opindex fcompare-elim 8439After register allocation and post-register allocation instruction splitting, 8440identify arithmetic instructions that compute processor flags similar to a 8441comparison operation based on that arithmetic. If possible, eliminate the 8442explicit comparison operation. 8443 8444This pass only applies to certain targets that cannot explicitly represent 8445the comparison operation before register allocation is complete. 8446 8447Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 8448 8449@item -fuse-ld=bfd 8450Use the @command{bfd} linker instead of the default linker. 8451 8452@item -fuse-ld=gold 8453Use the @command{gold} linker instead of the default linker. 8454 8455@item -fcprop-registers 8456@opindex fcprop-registers 8457After register allocation and post-register allocation instruction splitting, 8458perform a copy-propagation pass to try to reduce scheduling dependencies 8459and occasionally eliminate the copy. 8460 8461Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 8462 8463@item -fprofile-correction 8464@opindex fprofile-correction 8465Profiles collected using an instrumented binary for multi-threaded programs may 8466be inconsistent due to missed counter updates. When this option is specified, 8467GCC uses heuristics to correct or smooth out such inconsistencies. By 8468default, GCC emits an error message when an inconsistent profile is detected. 8469 8470@item -fprofile-dir=@var{path} 8471@opindex fprofile-dir 8472 8473Set the directory to search for the profile data files in to @var{path}. 8474This option affects only the profile data generated by 8475@option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs} 8476and used by @option{-fprofile-use} and @option{-fbranch-probabilities} 8477and its related options. Both absolute and relative paths can be used. 8478By default, GCC uses the current directory as @var{path}, thus the 8479profile data file appears in the same directory as the object file. 8480 8481@item -fprofile-generate 8482@itemx -fprofile-generate=@var{path} 8483@opindex fprofile-generate 8484 8485Enable options usually used for instrumenting application to produce 8486profile useful for later recompilation with profile feedback based 8487optimization. You must use @option{-fprofile-generate} both when 8488compiling and when linking your program. 8489 8490The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}. 8491 8492If @var{path} is specified, GCC looks at the @var{path} to find 8493the profile feedback data files. See @option{-fprofile-dir}. 8494 8495@item -fprofile-use 8496@itemx -fprofile-use=@var{path} 8497@opindex fprofile-use 8498Enable profile feedback directed optimizations, and optimizations 8499generally profitable only with profile feedback available. 8500 8501The following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt}, 8502@code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}, @code{-ftree-vectorize}, 8503@code{ftree-loop-distribute-patterns} 8504 8505By default, GCC emits an error message if the feedback profiles do not 8506match the source code. This error can be turned into a warning by using 8507@option{-Wcoverage-mismatch}. Note this may result in poorly optimized 8508code. 8509 8510If @var{path} is specified, GCC looks at the @var{path} to find 8511the profile feedback data files. See @option{-fprofile-dir}. 8512@end table 8513 8514The following options control compiler behavior regarding floating-point 8515arithmetic. These options trade off between speed and 8516correctness. All must be specifically enabled. 8517 8518@table @gcctabopt 8519@item -ffloat-store 8520@opindex ffloat-store 8521Do not store floating-point variables in registers, and inhibit other 8522options that might change whether a floating-point value is taken from a 8523register or memory. 8524 8525@cindex floating-point precision 8526This option prevents undesirable excess precision on machines such as 8527the 68000 where the floating registers (of the 68881) keep more 8528precision than a @code{double} is supposed to have. Similarly for the 8529x86 architecture. For most programs, the excess precision does only 8530good, but a few programs rely on the precise definition of IEEE floating 8531point. Use @option{-ffloat-store} for such programs, after modifying 8532them to store all pertinent intermediate computations into variables. 8533 8534@item -fexcess-precision=@var{style} 8535@opindex fexcess-precision 8536This option allows further control over excess precision on machines 8537where floating-point registers have more precision than the IEEE 8538@code{float} and @code{double} types and the processor does not 8539support operations rounding to those types. By default, 8540@option{-fexcess-precision=fast} is in effect; this means that 8541operations are carried out in the precision of the registers and that 8542it is unpredictable when rounding to the types specified in the source 8543code takes place. When compiling C, if 8544@option{-fexcess-precision=standard} is specified then excess 8545precision follows the rules specified in ISO C99; in particular, 8546both casts and assignments cause values to be rounded to their 8547semantic types (whereas @option{-ffloat-store} only affects 8548assignments). This option is enabled by default for C if a strict 8549conformance option such as @option{-std=c99} is used. 8550 8551@opindex mfpmath 8552@option{-fexcess-precision=standard} is not implemented for languages 8553other than C, and has no effect if 8554@option{-funsafe-math-optimizations} or @option{-ffast-math} is 8555specified. On the x86, it also has no effect if @option{-mfpmath=sse} 8556or @option{-mfpmath=sse+387} is specified; in the former case, IEEE 8557semantics apply without excess precision, and in the latter, rounding 8558is unpredictable. 8559 8560@item -ffast-math 8561@opindex ffast-math 8562Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, 8563@option{-ffinite-math-only}, @option{-fno-rounding-math}, 8564@option{-fno-signaling-nans} and @option{-fcx-limited-range}. 8565 8566This option causes the preprocessor macro @code{__FAST_MATH__} to be defined. 8567 8568This option is not turned on by any @option{-O} option besides 8569@option{-Ofast} since it can result in incorrect output for programs 8570that depend on an exact implementation of IEEE or ISO rules/specifications 8571for math functions. It may, however, yield faster code for programs 8572that do not require the guarantees of these specifications. 8573 8574@item -fno-math-errno 8575@opindex fno-math-errno 8576Do not set @code{errno} after calling math functions that are executed 8577with a single instruction, e.g., @code{sqrt}. A program that relies on 8578IEEE exceptions for math error handling may want to use this flag 8579for speed while maintaining IEEE arithmetic compatibility. 8580 8581This option is not turned on by any @option{-O} option since 8582it can result in incorrect output for programs that depend on 8583an exact implementation of IEEE or ISO rules/specifications for 8584math functions. It may, however, yield faster code for programs 8585that do not require the guarantees of these specifications. 8586 8587The default is @option{-fmath-errno}. 8588 8589On Darwin systems, the math library never sets @code{errno}. There is 8590therefore no reason for the compiler to consider the possibility that 8591it might, and @option{-fno-math-errno} is the default. 8592 8593@item -funsafe-math-optimizations 8594@opindex funsafe-math-optimizations 8595 8596Allow optimizations for floating-point arithmetic that (a) assume 8597that arguments and results are valid and (b) may violate IEEE or 8598ANSI standards. When used at link-time, it may include libraries 8599or startup files that change the default FPU control word or other 8600similar optimizations. 8601 8602This option is not turned on by any @option{-O} option since 8603it can result in incorrect output for programs that depend on 8604an exact implementation of IEEE or ISO rules/specifications for 8605math functions. It may, however, yield faster code for programs 8606that do not require the guarantees of these specifications. 8607Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math}, 8608@option{-fassociative-math} and @option{-freciprocal-math}. 8609 8610The default is @option{-fno-unsafe-math-optimizations}. 8611 8612@item -fassociative-math 8613@opindex fassociative-math 8614 8615Allow re-association of operands in series of floating-point operations. 8616This violates the ISO C and C++ language standard by possibly changing 8617computation result. NOTE: re-ordering may change the sign of zero as 8618well as ignore NaNs and inhibit or create underflow or overflow (and 8619thus cannot be used on code that relies on rounding behavior like 8620@code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons 8621and thus may not be used when ordered comparisons are required. 8622This option requires that both @option{-fno-signed-zeros} and 8623@option{-fno-trapping-math} be in effect. Moreover, it doesn't make 8624much sense with @option{-frounding-math}. For Fortran the option 8625is automatically enabled when both @option{-fno-signed-zeros} and 8626@option{-fno-trapping-math} are in effect. 8627 8628The default is @option{-fno-associative-math}. 8629 8630@item -freciprocal-math 8631@opindex freciprocal-math 8632 8633Allow the reciprocal of a value to be used instead of dividing by 8634the value if this enables optimizations. For example @code{x / y} 8635can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)} 8636is subject to common subexpression elimination. Note that this loses 8637precision and increases the number of flops operating on the value. 8638 8639The default is @option{-fno-reciprocal-math}. 8640 8641@item -ffinite-math-only 8642@opindex ffinite-math-only 8643Allow optimizations for floating-point arithmetic that assume 8644that arguments and results are not NaNs or +-Infs. 8645 8646This option is not turned on by any @option{-O} option since 8647it can result in incorrect output for programs that depend on 8648an exact implementation of IEEE or ISO rules/specifications for 8649math functions. It may, however, yield faster code for programs 8650that do not require the guarantees of these specifications. 8651 8652The default is @option{-fno-finite-math-only}. 8653 8654@item -fno-signed-zeros 8655@opindex fno-signed-zeros 8656Allow optimizations for floating-point arithmetic that ignore the 8657signedness of zero. IEEE arithmetic specifies the behavior of 8658distinct +0.0 and @minus{}0.0 values, which then prohibits simplification 8659of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}). 8660This option implies that the sign of a zero result isn't significant. 8661 8662The default is @option{-fsigned-zeros}. 8663 8664@item -fno-trapping-math 8665@opindex fno-trapping-math 8666Compile code assuming that floating-point operations cannot generate 8667user-visible traps. These traps include division by zero, overflow, 8668underflow, inexact result and invalid operation. This option requires 8669that @option{-fno-signaling-nans} be in effect. Setting this option may 8670allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example. 8671 8672This option should never be turned on by any @option{-O} option since 8673it can result in incorrect output for programs that depend on 8674an exact implementation of IEEE or ISO rules/specifications for 8675math functions. 8676 8677The default is @option{-ftrapping-math}. 8678 8679@item -frounding-math 8680@opindex frounding-math 8681Disable transformations and optimizations that assume default floating-point 8682rounding behavior. This is round-to-zero for all floating point 8683to integer conversions, and round-to-nearest for all other arithmetic 8684truncations. This option should be specified for programs that change 8685the FP rounding mode dynamically, or that may be executed with a 8686non-default rounding mode. This option disables constant folding of 8687floating-point expressions at compile time (which may be affected by 8688rounding mode) and arithmetic transformations that are unsafe in the 8689presence of sign-dependent rounding modes. 8690 8691The default is @option{-fno-rounding-math}. 8692 8693This option is experimental and does not currently guarantee to 8694disable all GCC optimizations that are affected by rounding mode. 8695Future versions of GCC may provide finer control of this setting 8696using C99's @code{FENV_ACCESS} pragma. This command-line option 8697will be used to specify the default state for @code{FENV_ACCESS}. 8698 8699@item -fsignaling-nans 8700@opindex fsignaling-nans 8701Compile code assuming that IEEE signaling NaNs may generate user-visible 8702traps during floating-point operations. Setting this option disables 8703optimizations that may change the number of exceptions visible with 8704signaling NaNs. This option implies @option{-ftrapping-math}. 8705 8706This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to 8707be defined. 8708 8709The default is @option{-fno-signaling-nans}. 8710 8711This option is experimental and does not currently guarantee to 8712disable all GCC optimizations that affect signaling NaN behavior. 8713 8714@item -fsingle-precision-constant 8715@opindex fsingle-precision-constant 8716Treat floating-point constants as single precision instead of 8717implicitly converting them to double-precision constants. 8718 8719@item -fcx-limited-range 8720@opindex fcx-limited-range 8721When enabled, this option states that a range reduction step is not 8722needed when performing complex division. Also, there is no checking 8723whether the result of a complex multiplication or division is @code{NaN 8724+ I*NaN}, with an attempt to rescue the situation in that case. The 8725default is @option{-fno-cx-limited-range}, but is enabled by 8726@option{-ffast-math}. 8727 8728This option controls the default setting of the ISO C99 8729@code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to 8730all languages. 8731 8732@item -fcx-fortran-rules 8733@opindex fcx-fortran-rules 8734Complex multiplication and division follow Fortran rules. Range 8735reduction is done as part of complex division, but there is no checking 8736whether the result of a complex multiplication or division is @code{NaN 8737+ I*NaN}, with an attempt to rescue the situation in that case. 8738 8739The default is @option{-fno-cx-fortran-rules}. 8740 8741@end table 8742 8743The following options control optimizations that may improve 8744performance, but are not enabled by any @option{-O} options. This 8745section includes experimental options that may produce broken code. 8746 8747@table @gcctabopt 8748@item -fbranch-probabilities 8749@opindex fbranch-probabilities 8750After running a program compiled with @option{-fprofile-arcs} 8751(@pxref{Debugging Options,, Options for Debugging Your Program or 8752@command{gcc}}), you can compile it a second time using 8753@option{-fbranch-probabilities}, to improve optimizations based on 8754the number of times each branch was taken. When a program 8755compiled with @option{-fprofile-arcs} exits, it saves arc execution 8756counts to a file called @file{@var{sourcename}.gcda} for each source 8757file. The information in this data file is very dependent on the 8758structure of the generated code, so you must use the same source code 8759and the same optimization options for both compilations. 8760 8761With @option{-fbranch-probabilities}, GCC puts a 8762@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}. 8763These can be used to improve optimization. Currently, they are only 8764used in one place: in @file{reorg.c}, instead of guessing which path a 8765branch is most likely to take, the @samp{REG_BR_PROB} values are used to 8766exactly determine which path is taken more often. 8767 8768@item -fprofile-values 8769@opindex fprofile-values 8770If combined with @option{-fprofile-arcs}, it adds code so that some 8771data about values of expressions in the program is gathered. 8772 8773With @option{-fbranch-probabilities}, it reads back the data gathered 8774from profiling values of expressions for usage in optimizations. 8775 8776Enabled with @option{-fprofile-generate} and @option{-fprofile-use}. 8777 8778@item -fvpt 8779@opindex fvpt 8780If combined with @option{-fprofile-arcs}, this option instructs the compiler 8781to add code to gather information about values of expressions. 8782 8783With @option{-fbranch-probabilities}, it reads back the data gathered 8784and actually performs the optimizations based on them. 8785Currently the optimizations include specialization of division operations 8786using the knowledge about the value of the denominator. 8787 8788@item -frename-registers 8789@opindex frename-registers 8790Attempt to avoid false dependencies in scheduled code by making use 8791of registers left over after register allocation. This optimization 8792most benefits processors with lots of registers. Depending on the 8793debug information format adopted by the target, however, it can 8794make debugging impossible, since variables no longer stay in 8795a ``home register''. 8796 8797Enabled by default with @option{-funroll-loops} and @option{-fpeel-loops}. 8798 8799@item -ftracer 8800@opindex ftracer 8801Perform tail duplication to enlarge superblock size. This transformation 8802simplifies the control flow of the function allowing other optimizations to do 8803a better job. 8804 8805Enabled with @option{-fprofile-use}. 8806 8807@item -funroll-loops 8808@opindex funroll-loops 8809Unroll loops whose number of iterations can be determined at compile time or 8810upon entry to the loop. @option{-funroll-loops} implies 8811@option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}. 8812It also turns on complete loop peeling (i.e.@: complete removal of loops with 8813a small constant number of iterations). This option makes code larger, and may 8814or may not make it run faster. 8815 8816Enabled with @option{-fprofile-use}. 8817 8818@item -funroll-all-loops 8819@opindex funroll-all-loops 8820Unroll all loops, even if their number of iterations is uncertain when 8821the loop is entered. This usually makes programs run more slowly. 8822@option{-funroll-all-loops} implies the same options as 8823@option{-funroll-loops}. 8824 8825@item -fpeel-loops 8826@opindex fpeel-loops 8827Peels loops for which there is enough information that they do not 8828roll much (from profile feedback). It also turns on complete loop peeling 8829(i.e.@: complete removal of loops with small constant number of iterations). 8830 8831Enabled with @option{-fprofile-use}. 8832 8833@item -fmove-loop-invariants 8834@opindex fmove-loop-invariants 8835Enables the loop invariant motion pass in the RTL loop optimizer. Enabled 8836at level @option{-O1} 8837 8838@item -funswitch-loops 8839@opindex funswitch-loops 8840Move branches with loop invariant conditions out of the loop, with duplicates 8841of the loop on both branches (modified according to result of the condition). 8842 8843@item -ffunction-sections 8844@itemx -fdata-sections 8845@opindex ffunction-sections 8846@opindex fdata-sections 8847Place each function or data item into its own section in the output 8848file if the target supports arbitrary sections. The name of the 8849function or the name of the data item determines the section's name 8850in the output file. 8851 8852Use these options on systems where the linker can perform optimizations 8853to improve locality of reference in the instruction space. Most systems 8854using the ELF object format and SPARC processors running Solaris 2 have 8855linkers with such optimizations. AIX may have these optimizations in 8856the future. 8857 8858Only use these options when there are significant benefits from doing 8859so. When you specify these options, the assembler and linker 8860create larger object and executable files and are also slower. 8861You cannot use @code{gprof} on all systems if you 8862specify this option, and you may have problems with debugging if 8863you specify both this option and @option{-g}. 8864 8865@item -fbranch-target-load-optimize 8866@opindex fbranch-target-load-optimize 8867Perform branch target register load optimization before prologue / epilogue 8868threading. 8869The use of target registers can typically be exposed only during reload, 8870thus hoisting loads out of loops and doing inter-block scheduling needs 8871a separate optimization pass. 8872 8873@item -fbranch-target-load-optimize2 8874@opindex fbranch-target-load-optimize2 8875Perform branch target register load optimization after prologue / epilogue 8876threading. 8877 8878@item -fbtr-bb-exclusive 8879@opindex fbtr-bb-exclusive 8880When performing branch target register load optimization, don't reuse 8881branch target registers within any basic block. 8882 8883@item -fstack-protector 8884@opindex fstack-protector 8885Emit extra code to check for buffer overflows, such as stack smashing 8886attacks. This is done by adding a guard variable to functions with 8887vulnerable objects. This includes functions that call @code{alloca}, and 8888functions with buffers larger than 8 bytes. The guards are initialized 8889when a function is entered and then checked when the function exits. 8890If a guard check fails, an error message is printed and the program exits. 8891 8892@item -fstack-protector-all 8893@opindex fstack-protector-all 8894Like @option{-fstack-protector} except that all functions are protected. 8895 8896@item -fstack-protector-strong 8897@opindex fstack-protector-strong 8898Like @option{-fstack-protector} but includes additional functions to 8899be protected --- those that have local array definitions, or have 8900references to local frame addresses. 8901 8902@item -fsection-anchors 8903@opindex fsection-anchors 8904Try to reduce the number of symbolic address calculations by using 8905shared ``anchor'' symbols to address nearby objects. This transformation 8906can help to reduce the number of GOT entries and GOT accesses on some 8907targets. 8908 8909For example, the implementation of the following function @code{foo}: 8910 8911@smallexample 8912static int a, b, c; 8913int foo (void) @{ return a + b + c; @} 8914@end smallexample 8915 8916@noindent 8917usually calculates the addresses of all three variables, but if you 8918compile it with @option{-fsection-anchors}, it accesses the variables 8919from a common anchor point instead. The effect is similar to the 8920following pseudocode (which isn't valid C): 8921 8922@smallexample 8923int foo (void) 8924@{ 8925 register int *xr = &x; 8926 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x]; 8927@} 8928@end smallexample 8929 8930Not all targets support this option. 8931 8932@item --param @var{name}=@var{value} 8933@opindex param 8934In some places, GCC uses various constants to control the amount of 8935optimization that is done. For example, GCC does not inline functions 8936that contain more than a certain number of instructions. You can 8937control some of these constants on the command line using the 8938@option{--param} option. 8939 8940The names of specific parameters, and the meaning of the values, are 8941tied to the internals of the compiler, and are subject to change 8942without notice in future releases. 8943 8944In each case, the @var{value} is an integer. The allowable choices for 8945@var{name} are: 8946 8947@table @gcctabopt 8948@item predictable-branch-outcome 8949When branch is predicted to be taken with probability lower than this threshold 8950(in percent), then it is considered well predictable. The default is 10. 8951 8952@item max-crossjump-edges 8953The maximum number of incoming edges to consider for cross-jumping. 8954The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in 8955the number of edges incoming to each block. Increasing values mean 8956more aggressive optimization, making the compilation time increase with 8957probably small improvement in executable size. 8958 8959@item min-crossjump-insns 8960The minimum number of instructions that must be matched at the end 8961of two blocks before cross-jumping is performed on them. This 8962value is ignored in the case where all instructions in the block being 8963cross-jumped from are matched. The default value is 5. 8964 8965@item max-grow-copy-bb-insns 8966The maximum code size expansion factor when copying basic blocks 8967instead of jumping. The expansion is relative to a jump instruction. 8968The default value is 8. 8969 8970@item max-goto-duplication-insns 8971The maximum number of instructions to duplicate to a block that jumps 8972to a computed goto. To avoid @math{O(N^2)} behavior in a number of 8973passes, GCC factors computed gotos early in the compilation process, 8974and unfactors them as late as possible. Only computed jumps at the 8975end of a basic blocks with no more than max-goto-duplication-insns are 8976unfactored. The default value is 8. 8977 8978@item max-delay-slot-insn-search 8979The maximum number of instructions to consider when looking for an 8980instruction to fill a delay slot. If more than this arbitrary number of 8981instructions are searched, the time savings from filling the delay slot 8982are minimal, so stop searching. Increasing values mean more 8983aggressive optimization, making the compilation time increase with probably 8984small improvement in execution time. 8985 8986@item max-delay-slot-live-search 8987When trying to fill delay slots, the maximum number of instructions to 8988consider when searching for a block with valid live register 8989information. Increasing this arbitrarily chosen value means more 8990aggressive optimization, increasing the compilation time. This parameter 8991should be removed when the delay slot code is rewritten to maintain the 8992control-flow graph. 8993 8994@item max-gcse-memory 8995The approximate maximum amount of memory that can be allocated in 8996order to perform the global common subexpression elimination 8997optimization. If more memory than specified is required, the 8998optimization is not done. 8999 9000@item max-gcse-insertion-ratio 9001If the ratio of expression insertions to deletions is larger than this value 9002for any expression, then RTL PRE inserts or removes the expression and thus 9003leaves partially redundant computations in the instruction stream. The default value is 20. 9004 9005@item max-pending-list-length 9006The maximum number of pending dependencies scheduling allows 9007before flushing the current state and starting over. Large functions 9008with few branches or calls can create excessively large lists which 9009needlessly consume memory and resources. 9010 9011@item max-modulo-backtrack-attempts 9012The maximum number of backtrack attempts the scheduler should make 9013when modulo scheduling a loop. Larger values can exponentially increase 9014compilation time. 9015 9016@item max-inline-insns-single 9017Several parameters control the tree inliner used in GCC@. 9018This number sets the maximum number of instructions (counted in GCC's 9019internal representation) in a single function that the tree inliner 9020considers for inlining. This only affects functions declared 9021inline and methods implemented in a class declaration (C++). 9022The default value is 400. 9023 9024@item max-inline-insns-auto 9025When you use @option{-finline-functions} (included in @option{-O3}), 9026a lot of functions that would otherwise not be considered for inlining 9027by the compiler are investigated. To those functions, a different 9028(more restrictive) limit compared to functions declared inline can 9029be applied. 9030The default value is 40. 9031 9032@item inline-min-speedup 9033When estimated performance improvement of caller + callee runtime exceeds this 9034threshold (in precent), the function can be inlined regardless the limit on 9035@option{--param max-inline-insns-single} and @option{--param 9036max-inline-insns-auto}. 9037 9038@item large-function-insns 9039The limit specifying really large functions. For functions larger than this 9040limit after inlining, inlining is constrained by 9041@option{--param large-function-growth}. This parameter is useful primarily 9042to avoid extreme compilation time caused by non-linear algorithms used by the 9043back end. 9044The default value is 2700. 9045 9046@item large-function-growth 9047Specifies maximal growth of large function caused by inlining in percents. 9048The default value is 100 which limits large function growth to 2.0 times 9049the original size. 9050 9051@item large-unit-insns 9052The limit specifying large translation unit. Growth caused by inlining of 9053units larger than this limit is limited by @option{--param inline-unit-growth}. 9054For small units this might be too tight. 9055For example, consider a unit consisting of function A 9056that is inline and B that just calls A three times. If B is small relative to 9057A, the growth of unit is 300\% and yet such inlining is very sane. For very 9058large units consisting of small inlineable functions, however, the overall unit 9059growth limit is needed to avoid exponential explosion of code size. Thus for 9060smaller units, the size is increased to @option{--param large-unit-insns} 9061before applying @option{--param inline-unit-growth}. The default is 10000. 9062 9063@item inline-unit-growth 9064Specifies maximal overall growth of the compilation unit caused by inlining. 9065The default value is 30 which limits unit growth to 1.3 times the original 9066size. 9067 9068@item ipcp-unit-growth 9069Specifies maximal overall growth of the compilation unit caused by 9070interprocedural constant propagation. The default value is 10 which limits 9071unit growth to 1.1 times the original size. 9072 9073@item large-stack-frame 9074The limit specifying large stack frames. While inlining the algorithm is trying 9075to not grow past this limit too much. The default value is 256 bytes. 9076 9077@item large-stack-frame-growth 9078Specifies maximal growth of large stack frames caused by inlining in percents. 9079The default value is 1000 which limits large stack frame growth to 11 times 9080the original size. 9081 9082@item max-inline-insns-recursive 9083@itemx max-inline-insns-recursive-auto 9084Specifies the maximum number of instructions an out-of-line copy of a 9085self-recursive inline 9086function can grow into by performing recursive inlining. 9087 9088For functions declared inline, @option{--param max-inline-insns-recursive} is 9089taken into account. For functions not declared inline, recursive inlining 9090happens only when @option{-finline-functions} (included in @option{-O3}) is 9091enabled and @option{--param max-inline-insns-recursive-auto} is used. The 9092default value is 450. 9093 9094@item max-inline-recursive-depth 9095@itemx max-inline-recursive-depth-auto 9096Specifies the maximum recursion depth used for recursive inlining. 9097 9098For functions declared inline, @option{--param max-inline-recursive-depth} is 9099taken into account. For functions not declared inline, recursive inlining 9100happens only when @option{-finline-functions} (included in @option{-O3}) is 9101enabled and @option{--param max-inline-recursive-depth-auto} is used. The 9102default value is 8. 9103 9104@item min-inline-recursive-probability 9105Recursive inlining is profitable only for function having deep recursion 9106in average and can hurt for function having little recursion depth by 9107increasing the prologue size or complexity of function body to other 9108optimizers. 9109 9110When profile feedback is available (see @option{-fprofile-generate}) the actual 9111recursion depth can be guessed from probability that function recurses via a 9112given call expression. This parameter limits inlining only to call expressions 9113whose probability exceeds the given threshold (in percents). 9114The default value is 10. 9115 9116@item early-inlining-insns 9117Specify growth that the early inliner can make. In effect it increases 9118the amount of inlining for code having a large abstraction penalty. 9119The default value is 10. 9120 9121@item max-early-inliner-iterations 9122@itemx max-early-inliner-iterations 9123Limit of iterations of the early inliner. This basically bounds 9124the number of nested indirect calls the early inliner can resolve. 9125Deeper chains are still handled by late inlining. 9126 9127@item comdat-sharing-probability 9128@itemx comdat-sharing-probability 9129Probability (in percent) that C++ inline function with comdat visibility 9130are shared across multiple compilation units. The default value is 20. 9131 9132@item min-vect-loop-bound 9133The minimum number of iterations under which loops are not vectorized 9134when @option{-ftree-vectorize} is used. The number of iterations after 9135vectorization needs to be greater than the value specified by this option 9136to allow vectorization. The default value is 0. 9137 9138@item gcse-cost-distance-ratio 9139Scaling factor in calculation of maximum distance an expression 9140can be moved by GCSE optimizations. This is currently supported only in the 9141code hoisting pass. The bigger the ratio, the more aggressive code hoisting 9142is with simple expressions, i.e., the expressions that have cost 9143less than @option{gcse-unrestricted-cost}. Specifying 0 disables 9144hoisting of simple expressions. The default value is 10. 9145 9146@item gcse-unrestricted-cost 9147Cost, roughly measured as the cost of a single typical machine 9148instruction, at which GCSE optimizations do not constrain 9149the distance an expression can travel. This is currently 9150supported only in the code hoisting pass. The lesser the cost, 9151the more aggressive code hoisting is. Specifying 0 9152allows all expressions to travel unrestricted distances. 9153The default value is 3. 9154 9155@item max-hoist-depth 9156The depth of search in the dominator tree for expressions to hoist. 9157This is used to avoid quadratic behavior in hoisting algorithm. 9158The value of 0 does not limit on the search, but may slow down compilation 9159of huge functions. The default value is 30. 9160 9161@item max-tail-merge-comparisons 9162The maximum amount of similar bbs to compare a bb with. This is used to 9163avoid quadratic behavior in tree tail merging. The default value is 10. 9164 9165@item max-tail-merge-iterations 9166The maximum amount of iterations of the pass over the function. This is used to 9167limit compilation time in tree tail merging. The default value is 2. 9168 9169@item max-unrolled-insns 9170The maximum number of instructions that a loop may have to be unrolled. 9171If a loop is unrolled, this parameter also determines how many times 9172the loop code is unrolled. 9173 9174@item max-average-unrolled-insns 9175The maximum number of instructions biased by probabilities of their execution 9176that a loop may have to be unrolled. If a loop is unrolled, 9177this parameter also determines how many times the loop code is unrolled. 9178 9179@item max-unroll-times 9180The maximum number of unrollings of a single loop. 9181 9182@item max-peeled-insns 9183The maximum number of instructions that a loop may have to be peeled. 9184If a loop is peeled, this parameter also determines how many times 9185the loop code is peeled. 9186 9187@item max-peel-times 9188The maximum number of peelings of a single loop. 9189 9190@item max-peel-branches 9191The maximum number of branches on the hot path through the peeled sequence. 9192 9193@item max-completely-peeled-insns 9194The maximum number of insns of a completely peeled loop. 9195 9196@item max-completely-peel-times 9197The maximum number of iterations of a loop to be suitable for complete peeling. 9198 9199@item max-completely-peel-loop-nest-depth 9200The maximum depth of a loop nest suitable for complete peeling. 9201 9202@item max-unswitch-insns 9203The maximum number of insns of an unswitched loop. 9204 9205@item max-unswitch-level 9206The maximum number of branches unswitched in a single loop. 9207 9208@item lim-expensive 9209The minimum cost of an expensive expression in the loop invariant motion. 9210 9211@item iv-consider-all-candidates-bound 9212Bound on number of candidates for induction variables, below which 9213all candidates are considered for each use in induction variable 9214optimizations. If there are more candidates than this, 9215only the most relevant ones are considered to avoid quadratic time complexity. 9216 9217@item iv-max-considered-uses 9218The induction variable optimizations give up on loops that contain more 9219induction variable uses. 9220 9221@item iv-always-prune-cand-set-bound 9222If the number of candidates in the set is smaller than this value, 9223always try to remove unnecessary ivs from the set 9224when adding a new one. 9225 9226@item scev-max-expr-size 9227Bound on size of expressions used in the scalar evolutions analyzer. 9228Large expressions slow the analyzer. 9229 9230@item scev-max-expr-complexity 9231Bound on the complexity of the expressions in the scalar evolutions analyzer. 9232Complex expressions slow the analyzer. 9233 9234@item omega-max-vars 9235The maximum number of variables in an Omega constraint system. 9236The default value is 128. 9237 9238@item omega-max-geqs 9239The maximum number of inequalities in an Omega constraint system. 9240The default value is 256. 9241 9242@item omega-max-eqs 9243The maximum number of equalities in an Omega constraint system. 9244The default value is 128. 9245 9246@item omega-max-wild-cards 9247The maximum number of wildcard variables that the Omega solver is 9248able to insert. The default value is 18. 9249 9250@item omega-hash-table-size 9251The size of the hash table in the Omega solver. The default value is 9252550. 9253 9254@item omega-max-keys 9255The maximal number of keys used by the Omega solver. The default 9256value is 500. 9257 9258@item omega-eliminate-redundant-constraints 9259When set to 1, use expensive methods to eliminate all redundant 9260constraints. The default value is 0. 9261 9262@item vect-max-version-for-alignment-checks 9263The maximum number of run-time checks that can be performed when 9264doing loop versioning for alignment in the vectorizer. See option 9265@option{-ftree-vect-loop-version} for more information. 9266 9267@item vect-max-version-for-alias-checks 9268The maximum number of run-time checks that can be performed when 9269doing loop versioning for alias in the vectorizer. See option 9270@option{-ftree-vect-loop-version} for more information. 9271 9272@item max-iterations-to-track 9273The maximum number of iterations of a loop the brute-force algorithm 9274for analysis of the number of iterations of the loop tries to evaluate. 9275 9276@item hot-bb-count-ws-permille 9277A basic block profile count is considered hot if it contributes to 9278the given permillage (i.e. 0...1000) of the entire profiled execution. 9279 9280@item hot-bb-frequency-fraction 9281Select fraction of the entry block frequency of executions of basic block in 9282function given basic block needs to have to be considered hot. 9283 9284@item max-predicted-iterations 9285The maximum number of loop iterations we predict statically. This is useful 9286in cases where a function contains a single loop with known bound and 9287another loop with unknown bound. 9288The known number of iterations is predicted correctly, while 9289the unknown number of iterations average to roughly 10. This means that the 9290loop without bounds appears artificially cold relative to the other one. 9291 9292@item align-threshold 9293 9294Select fraction of the maximal frequency of executions of a basic block in 9295a function to align the basic block. 9296 9297@item align-loop-iterations 9298 9299A loop expected to iterate at least the selected number of iterations is 9300aligned. 9301 9302@item tracer-dynamic-coverage 9303@itemx tracer-dynamic-coverage-feedback 9304 9305This value is used to limit superblock formation once the given percentage of 9306executed instructions is covered. This limits unnecessary code size 9307expansion. 9308 9309The @option{tracer-dynamic-coverage-feedback} is used only when profile 9310feedback is available. The real profiles (as opposed to statically estimated 9311ones) are much less balanced allowing the threshold to be larger value. 9312 9313@item tracer-max-code-growth 9314Stop tail duplication once code growth has reached given percentage. This is 9315a rather artificial limit, as most of the duplicates are eliminated later in 9316cross jumping, so it may be set to much higher values than is the desired code 9317growth. 9318 9319@item tracer-min-branch-ratio 9320 9321Stop reverse growth when the reverse probability of best edge is less than this 9322threshold (in percent). 9323 9324@item tracer-min-branch-ratio 9325@itemx tracer-min-branch-ratio-feedback 9326 9327Stop forward growth if the best edge has probability lower than this 9328threshold. 9329 9330Similarly to @option{tracer-dynamic-coverage} two values are present, one for 9331compilation for profile feedback and one for compilation without. The value 9332for compilation with profile feedback needs to be more conservative (higher) in 9333order to make tracer effective. 9334 9335@item max-cse-path-length 9336 9337The maximum number of basic blocks on path that CSE considers. 9338The default is 10. 9339 9340@item max-cse-insns 9341The maximum number of instructions CSE processes before flushing. 9342The default is 1000. 9343 9344@item ggc-min-expand 9345 9346GCC uses a garbage collector to manage its own memory allocation. This 9347parameter specifies the minimum percentage by which the garbage 9348collector's heap should be allowed to expand between collections. 9349Tuning this may improve compilation speed; it has no effect on code 9350generation. 9351 9352The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when 9353RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is 9354the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If 9355GCC is not able to calculate RAM on a particular platform, the lower 9356bound of 30% is used. Setting this parameter and 9357@option{ggc-min-heapsize} to zero causes a full collection to occur at 9358every opportunity. This is extremely slow, but can be useful for 9359debugging. 9360 9361@item ggc-min-heapsize 9362 9363Minimum size of the garbage collector's heap before it begins bothering 9364to collect garbage. The first collection occurs after the heap expands 9365by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again, 9366tuning this may improve compilation speed, and has no effect on code 9367generation. 9368 9369The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that 9370tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but 9371with a lower bound of 4096 (four megabytes) and an upper bound of 9372131072 (128 megabytes). If GCC is not able to calculate RAM on a 9373particular platform, the lower bound is used. Setting this parameter 9374very large effectively disables garbage collection. Setting this 9375parameter and @option{ggc-min-expand} to zero causes a full collection 9376to occur at every opportunity. 9377 9378@item max-reload-search-insns 9379The maximum number of instruction reload should look backward for equivalent 9380register. Increasing values mean more aggressive optimization, making the 9381compilation time increase with probably slightly better performance. 9382The default value is 100. 9383 9384@item max-cselib-memory-locations 9385The maximum number of memory locations cselib should take into account. 9386Increasing values mean more aggressive optimization, making the compilation time 9387increase with probably slightly better performance. The default value is 500. 9388 9389@item reorder-blocks-duplicate 9390@itemx reorder-blocks-duplicate-feedback 9391 9392Used by the basic block reordering pass to decide whether to use unconditional 9393branch or duplicate the code on its destination. Code is duplicated when its 9394estimated size is smaller than this value multiplied by the estimated size of 9395unconditional jump in the hot spots of the program. 9396 9397The @option{reorder-block-duplicate-feedback} is used only when profile 9398feedback is available. It may be set to higher values than 9399@option{reorder-block-duplicate} since information about the hot spots is more 9400accurate. 9401 9402@item max-sched-ready-insns 9403The maximum number of instructions ready to be issued the scheduler should 9404consider at any given time during the first scheduling pass. Increasing 9405values mean more thorough searches, making the compilation time increase 9406with probably little benefit. The default value is 100. 9407 9408@item max-sched-region-blocks 9409The maximum number of blocks in a region to be considered for 9410interblock scheduling. The default value is 10. 9411 9412@item max-pipeline-region-blocks 9413The maximum number of blocks in a region to be considered for 9414pipelining in the selective scheduler. The default value is 15. 9415 9416@item max-sched-region-insns 9417The maximum number of insns in a region to be considered for 9418interblock scheduling. The default value is 100. 9419 9420@item max-pipeline-region-insns 9421The maximum number of insns in a region to be considered for 9422pipelining in the selective scheduler. The default value is 200. 9423 9424@item min-spec-prob 9425The minimum probability (in percents) of reaching a source block 9426for interblock speculative scheduling. The default value is 40. 9427 9428@item max-sched-extend-regions-iters 9429The maximum number of iterations through CFG to extend regions. 9430A value of 0 (the default) disables region extensions. 9431 9432@item max-sched-insn-conflict-delay 9433The maximum conflict delay for an insn to be considered for speculative motion. 9434The default value is 3. 9435 9436@item sched-spec-prob-cutoff 9437The minimal probability of speculation success (in percents), so that 9438speculative insns are scheduled. 9439The default value is 40. 9440 9441@item sched-spec-state-edge-prob-cutoff 9442The minimum probability an edge must have for the scheduler to save its 9443state across it. 9444The default value is 10. 9445 9446@item sched-mem-true-dep-cost 9447Minimal distance (in CPU cycles) between store and load targeting same 9448memory locations. The default value is 1. 9449 9450@item selsched-max-lookahead 9451The maximum size of the lookahead window of selective scheduling. It is a 9452depth of search for available instructions. 9453The default value is 50. 9454 9455@item selsched-max-sched-times 9456The maximum number of times that an instruction is scheduled during 9457selective scheduling. This is the limit on the number of iterations 9458through which the instruction may be pipelined. The default value is 2. 9459 9460@item selsched-max-insns-to-rename 9461The maximum number of best instructions in the ready list that are considered 9462for renaming in the selective scheduler. The default value is 2. 9463 9464@item sms-min-sc 9465The minimum value of stage count that swing modulo scheduler 9466generates. The default value is 2. 9467 9468@item max-last-value-rtl 9469The maximum size measured as number of RTLs that can be recorded in an expression 9470in combiner for a pseudo register as last known value of that register. The default 9471is 10000. 9472 9473@item integer-share-limit 9474Small integer constants can use a shared data structure, reducing the 9475compiler's memory usage and increasing its speed. This sets the maximum 9476value of a shared integer constant. The default value is 256. 9477 9478@item ssp-buffer-size 9479The minimum size of buffers (i.e.@: arrays) that receive stack smashing 9480protection when @option{-fstack-protection} is used. 9481 9482@item max-jump-thread-duplication-stmts 9483Maximum number of statements allowed in a block that needs to be 9484duplicated when threading jumps. 9485 9486@item max-fields-for-field-sensitive 9487Maximum number of fields in a structure treated in 9488a field sensitive manner during pointer analysis. The default is zero 9489for @option{-O0} and @option{-O1}, 9490and 100 for @option{-Os}, @option{-O2}, and @option{-O3}. 9491 9492@item prefetch-latency 9493Estimate on average number of instructions that are executed before 9494prefetch finishes. The distance prefetched ahead is proportional 9495to this constant. Increasing this number may also lead to less 9496streams being prefetched (see @option{simultaneous-prefetches}). 9497 9498@item simultaneous-prefetches 9499Maximum number of prefetches that can run at the same time. 9500 9501@item l1-cache-line-size 9502The size of cache line in L1 cache, in bytes. 9503 9504@item l1-cache-size 9505The size of L1 cache, in kilobytes. 9506 9507@item l2-cache-size 9508The size of L2 cache, in kilobytes. 9509 9510@item min-insn-to-prefetch-ratio 9511The minimum ratio between the number of instructions and the 9512number of prefetches to enable prefetching in a loop. 9513 9514@item prefetch-min-insn-to-mem-ratio 9515The minimum ratio between the number of instructions and the 9516number of memory references to enable prefetching in a loop. 9517 9518@item use-canonical-types 9519Whether the compiler should use the ``canonical'' type system. By 9520default, this should always be 1, which uses a more efficient internal 9521mechanism for comparing types in C++ and Objective-C++. However, if 9522bugs in the canonical type system are causing compilation failures, 9523set this value to 0 to disable canonical types. 9524 9525@item switch-conversion-max-branch-ratio 9526Switch initialization conversion refuses to create arrays that are 9527bigger than @option{switch-conversion-max-branch-ratio} times the number of 9528branches in the switch. 9529 9530@item max-partial-antic-length 9531Maximum length of the partial antic set computed during the tree 9532partial redundancy elimination optimization (@option{-ftree-pre}) when 9533optimizing at @option{-O3} and above. For some sorts of source code 9534the enhanced partial redundancy elimination optimization can run away, 9535consuming all of the memory available on the host machine. This 9536parameter sets a limit on the length of the sets that are computed, 9537which prevents the runaway behavior. Setting a value of 0 for 9538this parameter allows an unlimited set length. 9539 9540@item sccvn-max-scc-size 9541Maximum size of a strongly connected component (SCC) during SCCVN 9542processing. If this limit is hit, SCCVN processing for the whole 9543function is not done and optimizations depending on it are 9544disabled. The default maximum SCC size is 10000. 9545 9546@item sccvn-max-alias-queries-per-access 9547Maximum number of alias-oracle queries we perform when looking for 9548redundancies for loads and stores. If this limit is hit the search 9549is aborted and the load or store is not considered redundant. The 9550number of queries is algorithmically limited to the number of 9551stores on all paths from the load to the function entry. 9552The default maxmimum number of queries is 1000. 9553 9554@item ira-max-loops-num 9555IRA uses regional register allocation by default. If a function 9556contains more loops than the number given by this parameter, only at most 9557the given number of the most frequently-executed loops form regions 9558for regional register allocation. The default value of the 9559parameter is 100. 9560 9561@item ira-max-conflict-table-size 9562Although IRA uses a sophisticated algorithm to compress the conflict 9563table, the table can still require excessive amounts of memory for 9564huge functions. If the conflict table for a function could be more 9565than the size in MB given by this parameter, the register allocator 9566instead uses a faster, simpler, and lower-quality 9567algorithm that does not require building a pseudo-register conflict table. 9568The default value of the parameter is 2000. 9569 9570@item ira-loop-reserved-regs 9571IRA can be used to evaluate more accurate register pressure in loops 9572for decisions to move loop invariants (see @option{-O3}). The number 9573of available registers reserved for some other purposes is given 9574by this parameter. The default value of the parameter is 2, which is 9575the minimal number of registers needed by typical instructions. 9576This value is the best found from numerous experiments. 9577 9578@item loop-invariant-max-bbs-in-loop 9579Loop invariant motion can be very expensive, both in compilation time and 9580in amount of needed compile-time memory, with very large loops. Loops 9581with more basic blocks than this parameter won't have loop invariant 9582motion optimization performed on them. The default value of the 9583parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above. 9584 9585@item loop-max-datarefs-for-datadeps 9586Building data dapendencies is expensive for very large loops. This 9587parameter limits the number of data references in loops that are 9588considered for data dependence analysis. These large loops are no 9589handled by the optimizations using loop data dependencies. 9590The default value is 1000. 9591 9592@item max-vartrack-size 9593Sets a maximum number of hash table slots to use during variable 9594tracking dataflow analysis of any function. If this limit is exceeded 9595with variable tracking at assignments enabled, analysis for that 9596function is retried without it, after removing all debug insns from 9597the function. If the limit is exceeded even without debug insns, var 9598tracking analysis is completely disabled for the function. Setting 9599the parameter to zero makes it unlimited. 9600 9601@item max-vartrack-expr-depth 9602Sets a maximum number of recursion levels when attempting to map 9603variable names or debug temporaries to value expressions. This trades 9604compilation time for more complete debug information. If this is set too 9605low, value expressions that are available and could be represented in 9606debug information may end up not being used; setting this higher may 9607enable the compiler to find more complex debug expressions, but compile 9608time and memory use may grow. The default is 12. 9609 9610@item min-nondebug-insn-uid 9611Use uids starting at this parameter for nondebug insns. The range below 9612the parameter is reserved exclusively for debug insns created by 9613@option{-fvar-tracking-assignments}, but debug insns may get 9614(non-overlapping) uids above it if the reserved range is exhausted. 9615 9616@item ipa-sra-ptr-growth-factor 9617IPA-SRA replaces a pointer to an aggregate with one or more new 9618parameters only when their cumulative size is less or equal to 9619@option{ipa-sra-ptr-growth-factor} times the size of the original 9620pointer parameter. 9621 9622@item tm-max-aggregate-size 9623When making copies of thread-local variables in a transaction, this 9624parameter specifies the size in bytes after which variables are 9625saved with the logging functions as opposed to save/restore code 9626sequence pairs. This option only applies when using 9627@option{-fgnu-tm}. 9628 9629@item graphite-max-nb-scop-params 9630To avoid exponential effects in the Graphite loop transforms, the 9631number of parameters in a Static Control Part (SCoP) is bounded. The 9632default value is 10 parameters. A variable whose value is unknown at 9633compilation time and defined outside a SCoP is a parameter of the SCoP. 9634 9635@item graphite-max-bbs-per-function 9636To avoid exponential effects in the detection of SCoPs, the size of 9637the functions analyzed by Graphite is bounded. The default value is 9638100 basic blocks. 9639 9640@item loop-block-tile-size 9641Loop blocking or strip mining transforms, enabled with 9642@option{-floop-block} or @option{-floop-strip-mine}, strip mine each 9643loop in the loop nest by a given number of iterations. The strip 9644length can be changed using the @option{loop-block-tile-size} 9645parameter. The default value is 51 iterations. 9646 9647@item ipa-cp-value-list-size 9648IPA-CP attempts to track all possible values and types passed to a function's 9649parameter in order to propagate them and perform devirtualization. 9650@option{ipa-cp-value-list-size} is the maximum number of values and types it 9651stores per one formal parameter of a function. 9652 9653@item lto-partitions 9654Specify desired number of partitions produced during WHOPR compilation. 9655The number of partitions should exceed the number of CPUs used for compilation. 9656The default value is 32. 9657 9658@item lto-minpartition 9659Size of minimal partition for WHOPR (in estimated instructions). 9660This prevents expenses of splitting very small programs into too many 9661partitions. 9662 9663@item cxx-max-namespaces-for-diagnostic-help 9664The maximum number of namespaces to consult for suggestions when C++ 9665name lookup fails for an identifier. The default is 1000. 9666 9667@item sink-frequency-threshold 9668The maximum relative execution frequency (in percents) of the target block 9669relative to a statement's original block to allow statement sinking of a 9670statement. Larger numbers result in more aggressive statement sinking. 9671The default value is 75. A small positive adjustment is applied for 9672statements with memory operands as those are even more profitable so sink. 9673 9674@item max-stores-to-sink 9675The maximum number of conditional stores paires that can be sunk. Set to 0 9676if either vectorization (@option{-ftree-vectorize}) or if-conversion 9677(@option{-ftree-loop-if-convert}) is disabled. The default is 2. 9678 9679@item allow-load-data-races 9680Allow optimizers to introduce new data races on loads. 9681Set to 1 to allow, otherwise to 0. This option is enabled by default 9682unless implicitly set by the @option{-fmemory-model=} option. 9683 9684@item allow-store-data-races 9685Allow optimizers to introduce new data races on stores. 9686Set to 1 to allow, otherwise to 0. This option is enabled by default 9687unless implicitly set by the @option{-fmemory-model=} option. 9688 9689@item allow-packed-load-data-races 9690Allow optimizers to introduce new data races on packed data loads. 9691Set to 1 to allow, otherwise to 0. This option is enabled by default 9692unless implicitly set by the @option{-fmemory-model=} option. 9693 9694@item allow-packed-store-data-races 9695Allow optimizers to introduce new data races on packed data stores. 9696Set to 1 to allow, otherwise to 0. This option is enabled by default 9697unless implicitly set by the @option{-fmemory-model=} option. 9698 9699@item case-values-threshold 9700The smallest number of different values for which it is best to use a 9701jump-table instead of a tree of conditional branches. If the value is 97020, use the default for the machine. The default is 0. 9703 9704@item tree-reassoc-width 9705Set the maximum number of instructions executed in parallel in 9706reassociated tree. This parameter overrides target dependent 9707heuristics used by default if has non zero value. 9708 9709@item sched-pressure-algorithm 9710Choose between the two available implementations of 9711@option{-fsched-pressure}. Algorithm 1 is the original implementation 9712and is the more likely to prevent instructions from being reordered. 9713Algorithm 2 was designed to be a compromise between the relatively 9714conservative approach taken by algorithm 1 and the rather aggressive 9715approach taken by the default scheduler. It relies more heavily on 9716having a regular register file and accurate register pressure classes. 9717See @file{haifa-sched.c} in the GCC sources for more details. 9718 9719The default choice depends on the target. 9720 9721@item max-slsr-cand-scan 9722Set the maximum number of existing candidates that will be considered when 9723seeking a basis for a new straight-line strength reduction candidate. 9724 9725@end table 9726@end table 9727 9728@node Preprocessor Options 9729@section Options Controlling the Preprocessor 9730@cindex preprocessor options 9731@cindex options, preprocessor 9732 9733These options control the C preprocessor, which is run on each C source 9734file before actual compilation. 9735 9736If you use the @option{-E} option, nothing is done except preprocessing. 9737Some of these options make sense only together with @option{-E} because 9738they cause the preprocessor output to be unsuitable for actual 9739compilation. 9740 9741@table @gcctabopt 9742@item -Wp,@var{option} 9743@opindex Wp 9744You can use @option{-Wp,@var{option}} to bypass the compiler driver 9745and pass @var{option} directly through to the preprocessor. If 9746@var{option} contains commas, it is split into multiple options at the 9747commas. However, many options are modified, translated or interpreted 9748by the compiler driver before being passed to the preprocessor, and 9749@option{-Wp} forcibly bypasses this phase. The preprocessor's direct 9750interface is undocumented and subject to change, so whenever possible 9751you should avoid using @option{-Wp} and let the driver handle the 9752options instead. 9753 9754@item -Xpreprocessor @var{option} 9755@opindex Xpreprocessor 9756Pass @var{option} as an option to the preprocessor. You can use this to 9757supply system-specific preprocessor options that GCC does not 9758recognize. 9759 9760If you want to pass an option that takes an argument, you must use 9761@option{-Xpreprocessor} twice, once for the option and once for the argument. 9762 9763@item -no-integrated-cpp 9764@opindex no-integrated-cpp 9765Perform preprocessing as a separate pass before compilation. 9766By default, GCC performs preprocessing as an integrated part of 9767input tokenization and parsing. 9768If this option is provided, the appropriate language front end 9769(@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++, 9770and Objective-C, respectively) is instead invoked twice, 9771once for preprocessing only and once for actual compilation 9772of the preprocessed input. 9773This option may be useful in conjunction with the @option{-B} or 9774@option{-wrapper} options to specify an alternate preprocessor or 9775perform additional processing of the program source between 9776normal preprocessing and compilation. 9777@end table 9778 9779@include cppopts.texi 9780 9781@node Assembler Options 9782@section Passing Options to the Assembler 9783 9784@c prevent bad page break with this line 9785You can pass options to the assembler. 9786 9787@table @gcctabopt 9788@item -Wa,@var{option} 9789@opindex Wa 9790Pass @var{option} as an option to the assembler. If @var{option} 9791contains commas, it is split into multiple options at the commas. 9792 9793@item -Xassembler @var{option} 9794@opindex Xassembler 9795Pass @var{option} as an option to the assembler. You can use this to 9796supply system-specific assembler options that GCC does not 9797recognize. 9798 9799If you want to pass an option that takes an argument, you must use 9800@option{-Xassembler} twice, once for the option and once for the argument. 9801 9802@end table 9803 9804@node Link Options 9805@section Options for Linking 9806@cindex link options 9807@cindex options, linking 9808 9809These options come into play when the compiler links object files into 9810an executable output file. They are meaningless if the compiler is 9811not doing a link step. 9812 9813@table @gcctabopt 9814@cindex file names 9815@item @var{object-file-name} 9816A file name that does not end in a special recognized suffix is 9817considered to name an object file or library. (Object files are 9818distinguished from libraries by the linker according to the file 9819contents.) If linking is done, these object files are used as input 9820to the linker. 9821 9822@item -c 9823@itemx -S 9824@itemx -E 9825@opindex c 9826@opindex S 9827@opindex E 9828If any of these options is used, then the linker is not run, and 9829object file names should not be used as arguments. @xref{Overall 9830Options}. 9831 9832@cindex Libraries 9833@item -l@var{library} 9834@itemx -l @var{library} 9835@opindex l 9836Search the library named @var{library} when linking. (The second 9837alternative with the library as a separate argument is only for 9838POSIX compliance and is not recommended.) 9839 9840It makes a difference where in the command you write this option; the 9841linker searches and processes libraries and object files in the order they 9842are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z} 9843after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers 9844to functions in @samp{z}, those functions may not be loaded. 9845 9846The linker searches a standard list of directories for the library, 9847which is actually a file named @file{lib@var{library}.a}. The linker 9848then uses this file as if it had been specified precisely by name. 9849 9850The directories searched include several standard system directories 9851plus any that you specify with @option{-L}. 9852 9853Normally the files found this way are library files---archive files 9854whose members are object files. The linker handles an archive file by 9855scanning through it for members which define symbols that have so far 9856been referenced but not defined. But if the file that is found is an 9857ordinary object file, it is linked in the usual fashion. The only 9858difference between using an @option{-l} option and specifying a file name 9859is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a} 9860and searches several directories. 9861 9862@item -lobjc 9863@opindex lobjc 9864You need this special case of the @option{-l} option in order to 9865link an Objective-C or Objective-C++ program. 9866 9867@item -nostartfiles 9868@opindex nostartfiles 9869Do not use the standard system startup files when linking. 9870The standard system libraries are used normally, unless @option{-nostdlib} 9871or @option{-nodefaultlibs} is used. 9872 9873@item -nodefaultlibs 9874@opindex nodefaultlibs 9875Do not use the standard system libraries when linking. 9876Only the libraries you specify are passed to the linker, and options 9877specifying linkage of the system libraries, such as @code{-static-libgcc} 9878or @code{-shared-libgcc}, are ignored. 9879The standard startup files are used normally, unless @option{-nostartfiles} 9880is used. 9881 9882The compiler may generate calls to @code{memcmp}, 9883@code{memset}, @code{memcpy} and @code{memmove}. 9884These entries are usually resolved by entries in 9885libc. These entry points should be supplied through some other 9886mechanism when this option is specified. 9887 9888@item -nostdlib 9889@opindex nostdlib 9890Do not use the standard system startup files or libraries when linking. 9891No startup files and only the libraries you specify are passed to 9892the linker, and options specifying linkage of the system libraries, such as 9893@code{-static-libgcc} or @code{-shared-libgcc}, are ignored. 9894 9895The compiler may generate calls to @code{memcmp}, @code{memset}, 9896@code{memcpy} and @code{memmove}. 9897These entries are usually resolved by entries in 9898libc. These entry points should be supplied through some other 9899mechanism when this option is specified. 9900 9901@cindex @option{-lgcc}, use with @option{-nostdlib} 9902@cindex @option{-nostdlib} and unresolved references 9903@cindex unresolved references and @option{-nostdlib} 9904@cindex @option{-lgcc}, use with @option{-nodefaultlibs} 9905@cindex @option{-nodefaultlibs} and unresolved references 9906@cindex unresolved references and @option{-nodefaultlibs} 9907One of the standard libraries bypassed by @option{-nostdlib} and 9908@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines 9909which GCC uses to overcome shortcomings of particular machines, or special 9910needs for some languages. 9911(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler 9912Collection (GCC) Internals}, 9913for more discussion of @file{libgcc.a}.) 9914In most cases, you need @file{libgcc.a} even when you want to avoid 9915other standard libraries. In other words, when you specify @option{-nostdlib} 9916or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well. 9917This ensures that you have no unresolved references to internal GCC 9918library subroutines. 9919(An example of such an internal subroutine is @samp{__main}, used to ensure C++ 9920constructors are called; @pxref{Collect2,,@code{collect2}, gccint, 9921GNU Compiler Collection (GCC) Internals}.) 9922 9923@item -pie 9924@opindex pie 9925Produce a position independent executable on targets that support it. 9926For predictable results, you must also specify the same set of options 9927used for compilation (@option{-fpie}, @option{-fPIE}, 9928or model suboptions) when you specify this linker option. 9929 9930@item -rdynamic 9931@opindex rdynamic 9932Pass the flag @option{-export-dynamic} to the ELF linker, on targets 9933that support it. This instructs the linker to add all symbols, not 9934only used ones, to the dynamic symbol table. This option is needed 9935for some uses of @code{dlopen} or to allow obtaining backtraces 9936from within a program. 9937 9938@item -s 9939@opindex s 9940Remove all symbol table and relocation information from the executable. 9941 9942@item -static 9943@opindex static 9944On systems that support dynamic linking, this prevents linking with the shared 9945libraries. On other systems, this option has no effect. 9946 9947@item -shared 9948@opindex shared 9949Produce a shared object which can then be linked with other objects to 9950form an executable. Not all systems support this option. For predictable 9951results, you must also specify the same set of options used for compilation 9952(@option{-fpic}, @option{-fPIC}, or model suboptions) when 9953you specify this linker option.@footnote{On some systems, @samp{gcc -shared} 9954needs to build supplementary stub code for constructors to work. On 9955multi-libbed systems, @samp{gcc -shared} must select the correct support 9956libraries to link against. Failing to supply the correct flags may lead 9957to subtle defects. Supplying them in cases where they are not necessary 9958is innocuous.} 9959 9960@item -shared-libgcc 9961@itemx -static-libgcc 9962@opindex shared-libgcc 9963@opindex static-libgcc 9964On systems that provide @file{libgcc} as a shared library, these options 9965force the use of either the shared or static version, respectively. 9966If no shared version of @file{libgcc} was built when the compiler was 9967configured, these options have no effect. 9968 9969There are several situations in which an application should use the 9970shared @file{libgcc} instead of the static version. The most common 9971of these is when the application wishes to throw and catch exceptions 9972across different shared libraries. In that case, each of the libraries 9973as well as the application itself should use the shared @file{libgcc}. 9974 9975Therefore, the G++ and GCJ drivers automatically add 9976@option{-shared-libgcc} whenever you build a shared library or a main 9977executable, because C++ and Java programs typically use exceptions, so 9978this is the right thing to do. 9979 9980If, instead, you use the GCC driver to create shared libraries, you may 9981find that they are not always linked with the shared @file{libgcc}. 9982If GCC finds, at its configuration time, that you have a non-GNU linker 9983or a GNU linker that does not support option @option{--eh-frame-hdr}, 9984it links the shared version of @file{libgcc} into shared libraries 9985by default. Otherwise, it takes advantage of the linker and optimizes 9986away the linking with the shared version of @file{libgcc}, linking with 9987the static version of libgcc by default. This allows exceptions to 9988propagate through such shared libraries, without incurring relocation 9989costs at library load time. 9990 9991However, if a library or main executable is supposed to throw or catch 9992exceptions, you must link it using the G++ or GCJ driver, as appropriate 9993for the languages used in the program, or using the option 9994@option{-shared-libgcc}, such that it is linked with the shared 9995@file{libgcc}. 9996 9997@item -static-libasan 9998When the @option{-fsanitize=address} option is used to link a program, 9999the GCC driver automatically links against @option{libasan}. If 10000@file{libasan} is available as a shared library, and the @option{-static} 10001option is not used, then this links against the shared version of 10002@file{libasan}. The @option{-static-libasan} option directs the GCC 10003driver to link @file{libasan} statically, without necessarily linking 10004other libraries statically. 10005 10006@item -static-libtsan 10007When the @option{-fsanitize=thread} option is used to link a program, 10008the GCC driver automatically links against @option{libtsan}. If 10009@file{libtsan} is available as a shared library, and the @option{-static} 10010option is not used, then this links against the shared version of 10011@file{libtsan}. The @option{-static-libtsan} option directs the GCC 10012driver to link @file{libtsan} statically, without necessarily linking 10013other libraries statically. 10014 10015@item -static-libstdc++ 10016When the @command{g++} program is used to link a C++ program, it 10017normally automatically links against @option{libstdc++}. If 10018@file{libstdc++} is available as a shared library, and the 10019@option{-static} option is not used, then this links against the 10020shared version of @file{libstdc++}. That is normally fine. However, it 10021is sometimes useful to freeze the version of @file{libstdc++} used by 10022the program without going all the way to a fully static link. The 10023@option{-static-libstdc++} option directs the @command{g++} driver to 10024link @file{libstdc++} statically, without necessarily linking other 10025libraries statically. 10026 10027@item -symbolic 10028@opindex symbolic 10029Bind references to global symbols when building a shared object. Warn 10030about any unresolved references (unless overridden by the link editor 10031option @option{-Xlinker -z -Xlinker defs}). Only a few systems support 10032this option. 10033 10034@item -T @var{script} 10035@opindex T 10036@cindex linker script 10037Use @var{script} as the linker script. This option is supported by most 10038systems using the GNU linker. On some targets, such as bare-board 10039targets without an operating system, the @option{-T} option may be required 10040when linking to avoid references to undefined symbols. 10041 10042@item -Xlinker @var{option} 10043@opindex Xlinker 10044Pass @var{option} as an option to the linker. You can use this to 10045supply system-specific linker options that GCC does not recognize. 10046 10047If you want to pass an option that takes a separate argument, you must use 10048@option{-Xlinker} twice, once for the option and once for the argument. 10049For example, to pass @option{-assert definitions}, you must write 10050@option{-Xlinker -assert -Xlinker definitions}. It does not work to write 10051@option{-Xlinker "-assert definitions"}, because this passes the entire 10052string as a single argument, which is not what the linker expects. 10053 10054When using the GNU linker, it is usually more convenient to pass 10055arguments to linker options using the @option{@var{option}=@var{value}} 10056syntax than as separate arguments. For example, you can specify 10057@option{-Xlinker -Map=output.map} rather than 10058@option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support 10059this syntax for command-line options. 10060 10061@item -Wl,@var{option} 10062@opindex Wl 10063Pass @var{option} as an option to the linker. If @var{option} contains 10064commas, it is split into multiple options at the commas. You can use this 10065syntax to pass an argument to the option. 10066For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the 10067linker. When using the GNU linker, you can also get the same effect with 10068@option{-Wl,-Map=output.map}. 10069 10070@item -u @var{symbol} 10071@opindex u 10072Pretend the symbol @var{symbol} is undefined, to force linking of 10073library modules to define it. You can use @option{-u} multiple times with 10074different symbols to force loading of additional library modules. 10075@end table 10076 10077@node Directory Options 10078@section Options for Directory Search 10079@cindex directory options 10080@cindex options, directory search 10081@cindex search path 10082 10083These options specify directories to search for header files, for 10084libraries and for parts of the compiler: 10085 10086@table @gcctabopt 10087@item -I@var{dir} 10088@opindex I 10089Add the directory @var{dir} to the head of the list of directories to be 10090searched for header files. This can be used to override a system header 10091file, substituting your own version, since these directories are 10092searched before the system header file directories. However, you should 10093not use this option to add directories that contain vendor-supplied 10094system header files (use @option{-isystem} for that). If you use more than 10095one @option{-I} option, the directories are scanned in left-to-right 10096order; the standard system directories come after. 10097 10098If a standard system include directory, or a directory specified with 10099@option{-isystem}, is also specified with @option{-I}, the @option{-I} 10100option is ignored. The directory is still searched but as a 10101system directory at its normal position in the system include chain. 10102This is to ensure that GCC's procedure to fix buggy system headers and 10103the ordering for the @code{include_next} directive are not inadvertently changed. 10104If you really need to change the search order for system directories, 10105use the @option{-nostdinc} and/or @option{-isystem} options. 10106 10107@item -iplugindir=@var{dir} 10108Set the directory to search for plugins that are passed 10109by @option{-fplugin=@var{name}} instead of 10110@option{-fplugin=@var{path}/@var{name}.so}. This option is not meant 10111to be used by the user, but only passed by the driver. 10112 10113@item -iquote@var{dir} 10114@opindex iquote 10115Add the directory @var{dir} to the head of the list of directories to 10116be searched for header files only for the case of @samp{#include 10117"@var{file}"}; they are not searched for @samp{#include <@var{file}>}, 10118otherwise just like @option{-I}. 10119 10120@item -L@var{dir} 10121@opindex L 10122Add directory @var{dir} to the list of directories to be searched 10123for @option{-l}. 10124 10125@item -B@var{prefix} 10126@opindex B 10127This option specifies where to find the executables, libraries, 10128include files, and data files of the compiler itself. 10129 10130The compiler driver program runs one or more of the subprograms 10131@command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries 10132@var{prefix} as a prefix for each program it tries to run, both with and 10133without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}). 10134 10135For each subprogram to be run, the compiler driver first tries the 10136@option{-B} prefix, if any. If that name is not found, or if @option{-B} 10137is not specified, the driver tries two standard prefixes, 10138@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of 10139those results in a file name that is found, the unmodified program 10140name is searched for using the directories specified in your 10141@env{PATH} environment variable. 10142 10143The compiler checks to see if the path provided by the @option{-B} 10144refers to a directory, and if necessary it adds a directory 10145separator character at the end of the path. 10146 10147@option{-B} prefixes that effectively specify directory names also apply 10148to libraries in the linker, because the compiler translates these 10149options into @option{-L} options for the linker. They also apply to 10150includes files in the preprocessor, because the compiler translates these 10151options into @option{-isystem} options for the preprocessor. In this case, 10152the compiler appends @samp{include} to the prefix. 10153 10154The runtime support file @file{libgcc.a} can also be searched for using 10155the @option{-B} prefix, if needed. If it is not found there, the two 10156standard prefixes above are tried, and that is all. The file is left 10157out of the link if it is not found by those means. 10158 10159Another way to specify a prefix much like the @option{-B} prefix is to use 10160the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment 10161Variables}. 10162 10163As a special kludge, if the path provided by @option{-B} is 10164@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to 101659, then it is replaced by @file{[dir/]include}. This is to help 10166with boot-strapping the compiler. 10167 10168@item -specs=@var{file} 10169@opindex specs 10170Process @var{file} after the compiler reads in the standard @file{specs} 10171file, in order to override the defaults which the @command{gcc} driver 10172program uses when determining what switches to pass to @command{cc1}, 10173@command{cc1plus}, @command{as}, @command{ld}, etc. More than one 10174@option{-specs=@var{file}} can be specified on the command line, and they 10175are processed in order, from left to right. 10176 10177@item --sysroot=@var{dir} 10178@opindex sysroot 10179Use @var{dir} as the logical root directory for headers and libraries. 10180For example, if the compiler normally searches for headers in 10181@file{/usr/include} and libraries in @file{/usr/lib}, it instead 10182searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}. 10183 10184If you use both this option and the @option{-isysroot} option, then 10185the @option{--sysroot} option applies to libraries, but the 10186@option{-isysroot} option applies to header files. 10187 10188The GNU linker (beginning with version 2.16) has the necessary support 10189for this option. If your linker does not support this option, the 10190header file aspect of @option{--sysroot} still works, but the 10191library aspect does not. 10192 10193@item --no-sysroot-suffix 10194@opindex no-sysroot-suffix 10195For some targets, a suffix is added to the root directory specified 10196with @option{--sysroot}, depending on the other options used, so that 10197headers may for example be found in 10198@file{@var{dir}/@var{suffix}/usr/include} instead of 10199@file{@var{dir}/usr/include}. This option disables the addition of 10200such a suffix. 10201 10202@item -I- 10203@opindex I- 10204This option has been deprecated. Please use @option{-iquote} instead for 10205@option{-I} directories before the @option{-I-} and remove the @option{-I-}. 10206Any directories you specify with @option{-I} options before the @option{-I-} 10207option are searched only for the case of @samp{#include "@var{file}"}; 10208they are not searched for @samp{#include <@var{file}>}. 10209 10210If additional directories are specified with @option{-I} options after 10211the @option{-I-}, these directories are searched for all @samp{#include} 10212directives. (Ordinarily @emph{all} @option{-I} directories are used 10213this way.) 10214 10215In addition, the @option{-I-} option inhibits the use of the current 10216directory (where the current input file came from) as the first search 10217directory for @samp{#include "@var{file}"}. There is no way to 10218override this effect of @option{-I-}. With @option{-I.} you can specify 10219searching the directory that is current when the compiler is 10220invoked. That is not exactly the same as what the preprocessor does 10221by default, but it is often satisfactory. 10222 10223@option{-I-} does not inhibit the use of the standard system directories 10224for header files. Thus, @option{-I-} and @option{-nostdinc} are 10225independent. 10226@end table 10227 10228@c man end 10229 10230@node Spec Files 10231@section Specifying subprocesses and the switches to pass to them 10232@cindex Spec Files 10233 10234@command{gcc} is a driver program. It performs its job by invoking a 10235sequence of other programs to do the work of compiling, assembling and 10236linking. GCC interprets its command-line parameters and uses these to 10237deduce which programs it should invoke, and which command-line options 10238it ought to place on their command lines. This behavior is controlled 10239by @dfn{spec strings}. In most cases there is one spec string for each 10240program that GCC can invoke, but a few programs have multiple spec 10241strings to control their behavior. The spec strings built into GCC can 10242be overridden by using the @option{-specs=} command-line switch to specify 10243a spec file. 10244 10245@dfn{Spec files} are plaintext files that are used to construct spec 10246strings. They consist of a sequence of directives separated by blank 10247lines. The type of directive is determined by the first non-whitespace 10248character on the line, which can be one of the following: 10249 10250@table @code 10251@item %@var{command} 10252Issues a @var{command} to the spec file processor. The commands that can 10253appear here are: 10254 10255@table @code 10256@item %include <@var{file}> 10257@cindex @code{%include} 10258Search for @var{file} and insert its text at the current point in the 10259specs file. 10260 10261@item %include_noerr <@var{file}> 10262@cindex @code{%include_noerr} 10263Just like @samp{%include}, but do not generate an error message if the include 10264file cannot be found. 10265 10266@item %rename @var{old_name} @var{new_name} 10267@cindex @code{%rename} 10268Rename the spec string @var{old_name} to @var{new_name}. 10269 10270@end table 10271 10272@item *[@var{spec_name}]: 10273This tells the compiler to create, override or delete the named spec 10274string. All lines after this directive up to the next directive or 10275blank line are considered to be the text for the spec string. If this 10276results in an empty string then the spec is deleted. (Or, if the 10277spec did not exist, then nothing happens.) Otherwise, if the spec 10278does not currently exist a new spec is created. If the spec does 10279exist then its contents are overridden by the text of this 10280directive, unless the first character of that text is the @samp{+} 10281character, in which case the text is appended to the spec. 10282 10283@item [@var{suffix}]: 10284Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive 10285and up to the next directive or blank line are considered to make up the 10286spec string for the indicated suffix. When the compiler encounters an 10287input file with the named suffix, it processes the spec string in 10288order to work out how to compile that file. For example: 10289 10290@smallexample 10291.ZZ: 10292z-compile -input %i 10293@end smallexample 10294 10295This says that any input file whose name ends in @samp{.ZZ} should be 10296passed to the program @samp{z-compile}, which should be invoked with the 10297command-line switch @option{-input} and with the result of performing the 10298@samp{%i} substitution. (See below.) 10299 10300As an alternative to providing a spec string, the text following a 10301suffix directive can be one of the following: 10302 10303@table @code 10304@item @@@var{language} 10305This says that the suffix is an alias for a known @var{language}. This is 10306similar to using the @option{-x} command-line switch to GCC to specify a 10307language explicitly. For example: 10308 10309@smallexample 10310.ZZ: 10311@@c++ 10312@end smallexample 10313 10314Says that .ZZ files are, in fact, C++ source files. 10315 10316@item #@var{name} 10317This causes an error messages saying: 10318 10319@smallexample 10320@var{name} compiler not installed on this system. 10321@end smallexample 10322@end table 10323 10324GCC already has an extensive list of suffixes built into it. 10325This directive adds an entry to the end of the list of suffixes, but 10326since the list is searched from the end backwards, it is effectively 10327possible to override earlier entries using this technique. 10328 10329@end table 10330 10331GCC has the following spec strings built into it. Spec files can 10332override these strings or create their own. Note that individual 10333targets can also add their own spec strings to this list. 10334 10335@smallexample 10336asm Options to pass to the assembler 10337asm_final Options to pass to the assembler post-processor 10338cpp Options to pass to the C preprocessor 10339cc1 Options to pass to the C compiler 10340cc1plus Options to pass to the C++ compiler 10341endfile Object files to include at the end of the link 10342link Options to pass to the linker 10343lib Libraries to include on the command line to the linker 10344libgcc Decides which GCC support library to pass to the linker 10345linker Sets the name of the linker 10346predefines Defines to be passed to the C preprocessor 10347signed_char Defines to pass to CPP to say whether @code{char} is signed 10348 by default 10349startfile Object files to include at the start of the link 10350@end smallexample 10351 10352Here is a small example of a spec file: 10353 10354@smallexample 10355%rename lib old_lib 10356 10357*lib: 10358--start-group -lgcc -lc -leval1 --end-group %(old_lib) 10359@end smallexample 10360 10361This example renames the spec called @samp{lib} to @samp{old_lib} and 10362then overrides the previous definition of @samp{lib} with a new one. 10363The new definition adds in some extra command-line options before 10364including the text of the old definition. 10365 10366@dfn{Spec strings} are a list of command-line options to be passed to their 10367corresponding program. In addition, the spec strings can contain 10368@samp{%}-prefixed sequences to substitute variable text or to 10369conditionally insert text into the command line. Using these constructs 10370it is possible to generate quite complex command lines. 10371 10372Here is a table of all defined @samp{%}-sequences for spec 10373strings. Note that spaces are not generated automatically around the 10374results of expanding these sequences. Therefore you can concatenate them 10375together or combine them with constant text in a single argument. 10376 10377@table @code 10378@item %% 10379Substitute one @samp{%} into the program name or argument. 10380 10381@item %i 10382Substitute the name of the input file being processed. 10383 10384@item %b 10385Substitute the basename of the input file being processed. 10386This is the substring up to (and not including) the last period 10387and not including the directory. 10388 10389@item %B 10390This is the same as @samp{%b}, but include the file suffix (text after 10391the last period). 10392 10393@item %d 10394Marks the argument containing or following the @samp{%d} as a 10395temporary file name, so that that file is deleted if GCC exits 10396successfully. Unlike @samp{%g}, this contributes no text to the 10397argument. 10398 10399@item %g@var{suffix} 10400Substitute a file name that has suffix @var{suffix} and is chosen 10401once per compilation, and mark the argument in the same way as 10402@samp{%d}. To reduce exposure to denial-of-service attacks, the file 10403name is now chosen in a way that is hard to predict even when previously 10404chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s} 10405might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches 10406the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is 10407treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g} 10408was simply substituted with a file name chosen once per compilation, 10409without regard to any appended suffix (which was therefore treated 10410just like ordinary text), making such attacks more likely to succeed. 10411 10412@item %u@var{suffix} 10413Like @samp{%g}, but generates a new temporary file name 10414each time it appears instead of once per compilation. 10415 10416@item %U@var{suffix} 10417Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a 10418new one if there is no such last file name. In the absence of any 10419@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share 10420the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s} 10421involves the generation of two distinct file names, one 10422for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was 10423simply substituted with a file name chosen for the previous @samp{%u}, 10424without regard to any appended suffix. 10425 10426@item %j@var{suffix} 10427Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is 10428writable, and if @option{-save-temps} is not used; 10429otherwise, substitute the name 10430of a temporary file, just like @samp{%u}. This temporary file is not 10431meant for communication between processes, but rather as a junk 10432disposal mechanism. 10433 10434@item %|@var{suffix} 10435@itemx %m@var{suffix} 10436Like @samp{%g}, except if @option{-pipe} is in effect. In that case 10437@samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at 10438all. These are the two most common ways to instruct a program that it 10439should read from standard input or write to standard output. If you 10440need something more elaborate you can use an @samp{%@{pipe:@code{X}@}} 10441construct: see for example @file{f/lang-specs.h}. 10442 10443@item %.@var{SUFFIX} 10444Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args 10445when it is subsequently output with @samp{%*}. @var{SUFFIX} is 10446terminated by the next space or %. 10447 10448@item %w 10449Marks the argument containing or following the @samp{%w} as the 10450designated output file of this compilation. This puts the argument 10451into the sequence of arguments that @samp{%o} substitutes. 10452 10453@item %o 10454Substitutes the names of all the output files, with spaces 10455automatically placed around them. You should write spaces 10456around the @samp{%o} as well or the results are undefined. 10457@samp{%o} is for use in the specs for running the linker. 10458Input files whose names have no recognized suffix are not compiled 10459at all, but they are included among the output files, so they are 10460linked. 10461 10462@item %O 10463Substitutes the suffix for object files. Note that this is 10464handled specially when it immediately follows @samp{%g, %u, or %U}, 10465because of the need for those to form complete file names. The 10466handling is such that @samp{%O} is treated exactly as if it had already 10467been substituted, except that @samp{%g, %u, and %U} do not currently 10468support additional @var{suffix} characters following @samp{%O} as they do 10469following, for example, @samp{.o}. 10470 10471@item %p 10472Substitutes the standard macro predefinitions for the 10473current target machine. Use this when running @code{cpp}. 10474 10475@item %P 10476Like @samp{%p}, but puts @samp{__} before and after the name of each 10477predefined macro, except for macros that start with @samp{__} or with 10478@samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO 10479C@. 10480 10481@item %I 10482Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}), 10483@option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}), 10484@option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options) 10485and @option{-imultilib} as necessary. 10486 10487@item %s 10488Current argument is the name of a library or startup file of some sort. 10489Search for that file in a standard list of directories and substitute 10490the full name found. The current working directory is included in the 10491list of directories scanned. 10492 10493@item %T 10494Current argument is the name of a linker script. Search for that file 10495in the current list of directories to scan for libraries. If the file 10496is located insert a @option{--script} option into the command line 10497followed by the full path name found. If the file is not found then 10498generate an error message. Note: the current working directory is not 10499searched. 10500 10501@item %e@var{str} 10502Print @var{str} as an error message. @var{str} is terminated by a newline. 10503Use this when inconsistent options are detected. 10504 10505@item %(@var{name}) 10506Substitute the contents of spec string @var{name} at this point. 10507 10508@item %x@{@var{option}@} 10509Accumulate an option for @samp{%X}. 10510 10511@item %X 10512Output the accumulated linker options specified by @option{-Wl} or a @samp{%x} 10513spec string. 10514 10515@item %Y 10516Output the accumulated assembler options specified by @option{-Wa}. 10517 10518@item %Z 10519Output the accumulated preprocessor options specified by @option{-Wp}. 10520 10521@item %a 10522Process the @code{asm} spec. This is used to compute the 10523switches to be passed to the assembler. 10524 10525@item %A 10526Process the @code{asm_final} spec. This is a spec string for 10527passing switches to an assembler post-processor, if such a program is 10528needed. 10529 10530@item %l 10531Process the @code{link} spec. This is the spec for computing the 10532command line passed to the linker. Typically it makes use of the 10533@samp{%L %G %S %D and %E} sequences. 10534 10535@item %D 10536Dump out a @option{-L} option for each directory that GCC believes might 10537contain startup files. If the target supports multilibs then the 10538current multilib directory is prepended to each of these paths. 10539 10540@item %L 10541Process the @code{lib} spec. This is a spec string for deciding which 10542libraries are included on the command line to the linker. 10543 10544@item %G 10545Process the @code{libgcc} spec. This is a spec string for deciding 10546which GCC support library is included on the command line to the linker. 10547 10548@item %S 10549Process the @code{startfile} spec. This is a spec for deciding which 10550object files are the first ones passed to the linker. Typically 10551this might be a file named @file{crt0.o}. 10552 10553@item %E 10554Process the @code{endfile} spec. This is a spec string that specifies 10555the last object files that are passed to the linker. 10556 10557@item %C 10558Process the @code{cpp} spec. This is used to construct the arguments 10559to be passed to the C preprocessor. 10560 10561@item %1 10562Process the @code{cc1} spec. This is used to construct the options to be 10563passed to the actual C compiler (@samp{cc1}). 10564 10565@item %2 10566Process the @code{cc1plus} spec. This is used to construct the options to be 10567passed to the actual C++ compiler (@samp{cc1plus}). 10568 10569@item %* 10570Substitute the variable part of a matched option. See below. 10571Note that each comma in the substituted string is replaced by 10572a single space. 10573 10574@item %<@code{S} 10575Remove all occurrences of @code{-S} from the command line. Note---this 10576command is position dependent. @samp{%} commands in the spec string 10577before this one see @code{-S}, @samp{%} commands in the spec string 10578after this one do not. 10579 10580@item %:@var{function}(@var{args}) 10581Call the named function @var{function}, passing it @var{args}. 10582@var{args} is first processed as a nested spec string, then split 10583into an argument vector in the usual fashion. The function returns 10584a string which is processed as if it had appeared literally as part 10585of the current spec. 10586 10587The following built-in spec functions are provided: 10588 10589@table @code 10590@item @code{getenv} 10591The @code{getenv} spec function takes two arguments: an environment 10592variable name and a string. If the environment variable is not 10593defined, a fatal error is issued. Otherwise, the return value is the 10594value of the environment variable concatenated with the string. For 10595example, if @env{TOPDIR} is defined as @file{/path/to/top}, then: 10596 10597@smallexample 10598%:getenv(TOPDIR /include) 10599@end smallexample 10600 10601expands to @file{/path/to/top/include}. 10602 10603@item @code{if-exists} 10604The @code{if-exists} spec function takes one argument, an absolute 10605pathname to a file. If the file exists, @code{if-exists} returns the 10606pathname. Here is a small example of its usage: 10607 10608@smallexample 10609*startfile: 10610crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s 10611@end smallexample 10612 10613@item @code{if-exists-else} 10614The @code{if-exists-else} spec function is similar to the @code{if-exists} 10615spec function, except that it takes two arguments. The first argument is 10616an absolute pathname to a file. If the file exists, @code{if-exists-else} 10617returns the pathname. If it does not exist, it returns the second argument. 10618This way, @code{if-exists-else} can be used to select one file or another, 10619based on the existence of the first. Here is a small example of its usage: 10620 10621@smallexample 10622*startfile: 10623crt0%O%s %:if-exists(crti%O%s) \ 10624%:if-exists-else(crtbeginT%O%s crtbegin%O%s) 10625@end smallexample 10626 10627@item @code{replace-outfile} 10628The @code{replace-outfile} spec function takes two arguments. It looks for the 10629first argument in the outfiles array and replaces it with the second argument. Here 10630is a small example of its usage: 10631 10632@smallexample 10633%@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@} 10634@end smallexample 10635 10636@item @code{remove-outfile} 10637The @code{remove-outfile} spec function takes one argument. It looks for the 10638first argument in the outfiles array and removes it. Here is a small example 10639its usage: 10640 10641@smallexample 10642%:remove-outfile(-lm) 10643@end smallexample 10644 10645@item @code{pass-through-libs} 10646The @code{pass-through-libs} spec function takes any number of arguments. It 10647finds any @option{-l} options and any non-options ending in @file{.a} (which it 10648assumes are the names of linker input library archive files) and returns a 10649result containing all the found arguments each prepended by 10650@option{-plugin-opt=-pass-through=} and joined by spaces. This list is 10651intended to be passed to the LTO linker plugin. 10652 10653@smallexample 10654%:pass-through-libs(%G %L %G) 10655@end smallexample 10656 10657@item @code{print-asm-header} 10658The @code{print-asm-header} function takes no arguments and simply 10659prints a banner like: 10660 10661@smallexample 10662Assembler options 10663================= 10664 10665Use "-Wa,OPTION" to pass "OPTION" to the assembler. 10666@end smallexample 10667 10668It is used to separate compiler options from assembler options 10669in the @option{--target-help} output. 10670@end table 10671 10672@item %@{@code{S}@} 10673Substitutes the @code{-S} switch, if that switch is given to GCC@. 10674If that switch is not specified, this substitutes nothing. Note that 10675the leading dash is omitted when specifying this option, and it is 10676automatically inserted if the substitution is performed. Thus the spec 10677string @samp{%@{foo@}} matches the command-line option @option{-foo} 10678and outputs the command-line option @option{-foo}. 10679 10680@item %W@{@code{S}@} 10681Like %@{@code{S}@} but mark last argument supplied within as a file to be 10682deleted on failure. 10683 10684@item %@{@code{S}*@} 10685Substitutes all the switches specified to GCC whose names start 10686with @code{-S}, but which also take an argument. This is used for 10687switches like @option{-o}, @option{-D}, @option{-I}, etc. 10688GCC considers @option{-o foo} as being 10689one switch whose name starts with @samp{o}. %@{o*@} substitutes this 10690text, including the space. Thus two arguments are generated. 10691 10692@item %@{@code{S}*&@code{T}*@} 10693Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options 10694(the order of @code{S} and @code{T} in the spec is not significant). 10695There can be any number of ampersand-separated variables; for each the 10696wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}. 10697 10698@item %@{@code{S}:@code{X}@} 10699Substitutes @code{X}, if the @option{-S} switch is given to GCC@. 10700 10701@item %@{!@code{S}:@code{X}@} 10702Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@. 10703 10704@item %@{@code{S}*:@code{X}@} 10705Substitutes @code{X} if one or more switches whose names start with 10706@code{-S} are specified to GCC@. Normally @code{X} is substituted only 10707once, no matter how many such switches appeared. However, if @code{%*} 10708appears somewhere in @code{X}, then @code{X} is substituted once 10709for each matching switch, with the @code{%*} replaced by the part of 10710that switch matching the @code{*}. 10711 10712@item %@{.@code{S}:@code{X}@} 10713Substitutes @code{X}, if processing a file with suffix @code{S}. 10714 10715@item %@{!.@code{S}:@code{X}@} 10716Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}. 10717 10718@item %@{,@code{S}:@code{X}@} 10719Substitutes @code{X}, if processing a file for language @code{S}. 10720 10721@item %@{!,@code{S}:@code{X}@} 10722Substitutes @code{X}, if not processing a file for language @code{S}. 10723 10724@item %@{@code{S}|@code{P}:@code{X}@} 10725Substitutes @code{X} if either @code{-S} or @code{-P} is given to 10726GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and 10727@code{*} sequences as well, although they have a stronger binding than 10728the @samp{|}. If @code{%*} appears in @code{X}, all of the 10729alternatives must be starred, and only the first matching alternative 10730is substituted. 10731 10732For example, a spec string like this: 10733 10734@smallexample 10735%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@} 10736@end smallexample 10737 10738@noindent 10739outputs the following command-line options from the following input 10740command-line options: 10741 10742@smallexample 10743fred.c -foo -baz 10744jim.d -bar -boggle 10745-d fred.c -foo -baz -boggle 10746-d jim.d -bar -baz -boggle 10747@end smallexample 10748 10749@item %@{S:X; T:Y; :D@} 10750 10751If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is 10752given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can 10753be as many clauses as you need. This may be combined with @code{.}, 10754@code{,}, @code{!}, @code{|}, and @code{*} as needed. 10755 10756 10757@end table 10758 10759The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar 10760construct may contain other nested @samp{%} constructs or spaces, or 10761even newlines. They are processed as usual, as described above. 10762Trailing white space in @code{X} is ignored. White space may also 10763appear anywhere on the left side of the colon in these constructs, 10764except between @code{.} or @code{*} and the corresponding word. 10765 10766The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are 10767handled specifically in these constructs. If another value of 10768@option{-O} or the negated form of a @option{-f}, @option{-m}, or 10769@option{-W} switch is found later in the command line, the earlier 10770switch value is ignored, except with @{@code{S}*@} where @code{S} is 10771just one letter, which passes all matching options. 10772 10773The character @samp{|} at the beginning of the predicate text is used to 10774indicate that a command should be piped to the following command, but 10775only if @option{-pipe} is specified. 10776 10777It is built into GCC which switches take arguments and which do not. 10778(You might think it would be useful to generalize this to allow each 10779compiler's spec to say which switches take arguments. But this cannot 10780be done in a consistent fashion. GCC cannot even decide which input 10781files have been specified without knowing which switches take arguments, 10782and it must know which input files to compile in order to tell which 10783compilers to run). 10784 10785GCC also knows implicitly that arguments starting in @option{-l} are to be 10786treated as compiler output files, and passed to the linker in their 10787proper position among the other output files. 10788 10789@c man begin OPTIONS 10790 10791@node Target Options 10792@section Specifying Target Machine and Compiler Version 10793@cindex target options 10794@cindex cross compiling 10795@cindex specifying machine version 10796@cindex specifying compiler version and target machine 10797@cindex compiler version, specifying 10798@cindex target machine, specifying 10799 10800The usual way to run GCC is to run the executable called @command{gcc}, or 10801@command{@var{machine}-gcc} when cross-compiling, or 10802@command{@var{machine}-gcc-@var{version}} to run a version other than the 10803one that was installed last. 10804 10805@node Submodel Options 10806@section Hardware Models and Configurations 10807@cindex submodel options 10808@cindex specifying hardware config 10809@cindex hardware models and configurations, specifying 10810@cindex machine dependent options 10811 10812Each target machine types can have its own 10813special options, starting with @samp{-m}, to choose among various 10814hardware models or configurations---for example, 68010 vs 68020, 10815floating coprocessor or none. A single installed version of the 10816compiler can compile for any model or configuration, according to the 10817options specified. 10818 10819Some configurations of the compiler also support additional special 10820options, usually for compatibility with other compilers on the same 10821platform. 10822 10823@c This list is ordered alphanumerically by subsection name. 10824@c It should be the same order and spelling as these options are listed 10825@c in Machine Dependent Options 10826 10827@menu 10828* AArch64 Options:: 10829* Adapteva Epiphany Options:: 10830* ARM Options:: 10831* AVR Options:: 10832* Blackfin Options:: 10833* C6X Options:: 10834* CRIS Options:: 10835* CR16 Options:: 10836* Darwin Options:: 10837* DEC Alpha Options:: 10838* FR30 Options:: 10839* FRV Options:: 10840* GNU/Linux Options:: 10841* H8/300 Options:: 10842* HPPA Options:: 10843* i386 and x86-64 Options:: 10844* i386 and x86-64 Windows Options:: 10845* IA-64 Options:: 10846* LM32 Options:: 10847* M32C Options:: 10848* M32R/D Options:: 10849* M680x0 Options:: 10850* MCore Options:: 10851* MeP Options:: 10852* MicroBlaze Options:: 10853* MIPS Options:: 10854* MMIX Options:: 10855* MN10300 Options:: 10856* Moxie Options:: 10857* PDP-11 Options:: 10858* picoChip Options:: 10859* PowerPC Options:: 10860* RL78 Options:: 10861* RS/6000 and PowerPC Options:: 10862* RX Options:: 10863* S/390 and zSeries Options:: 10864* Score Options:: 10865* SH Options:: 10866* Solaris 2 Options:: 10867* SPARC Options:: 10868* SPU Options:: 10869* System V Options:: 10870* TILE-Gx Options:: 10871* TILEPro Options:: 10872* V850 Options:: 10873* VAX Options:: 10874* VMS Options:: 10875* VxWorks Options:: 10876* x86-64 Options:: 10877* Xstormy16 Options:: 10878* Xtensa Options:: 10879* zSeries Options:: 10880@end menu 10881 10882@node AArch64 Options 10883@subsection AArch64 Options 10884@cindex AArch64 Options 10885 10886These options are defined for AArch64 implementations: 10887 10888@table @gcctabopt 10889 10890@item -mbig-endian 10891@opindex mbig-endian 10892Generate big-endian code. This is the default when GCC is configured for an 10893@samp{aarch64_be-*-*} target. 10894 10895@item -mgeneral-regs-only 10896@opindex mgeneral-regs-only 10897Generate code which uses only the general registers. 10898 10899@item -mlittle-endian 10900@opindex mlittle-endian 10901Generate little-endian code. This is the default when GCC is configured for an 10902@samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target. 10903 10904@item -mcmodel=tiny 10905@opindex mcmodel=tiny 10906Generate code for the tiny code model. The program and its statically defined 10907symbols must be within 1GB of each other. Pointers are 64 bits. Programs can 10908be statically or dynamically linked. This model is not fully implemented and 10909mostly treated as @samp{small}. 10910 10911@item -mcmodel=small 10912@opindex mcmodel=small 10913Generate code for the small code model. The program and its statically defined 10914symbols must be within 4GB of each other. Pointers are 64 bits. Programs can 10915be statically or dynamically linked. This is the default code model. 10916 10917@item -mcmodel=large 10918@opindex mcmodel=large 10919Generate code for the large code model. This makes no assumptions about 10920addresses and sizes of sections. Pointers are 64 bits. Programs can be 10921statically linked only. 10922 10923@item -mstrict-align 10924@opindex mstrict-align 10925Do not assume that unaligned memory references will be handled by the system. 10926 10927@item -momit-leaf-frame-pointer 10928@itemx -mno-omit-leaf-frame-pointer 10929@opindex momit-leaf-frame-pointer 10930@opindex mno-omit-leaf-frame-pointer 10931Omit or keep the frame pointer in leaf functions. The former behaviour is the 10932default. 10933 10934@item -mtls-dialect=desc 10935@opindex mtls-dialect=desc 10936Use TLS descriptors as the thread-local storage mechanism for dynamic accesses 10937of TLS variables. This is the default. 10938 10939@item -mtls-dialect=traditional 10940@opindex mtls-dialect=traditional 10941Use traditional TLS as the thread-local storage mechanism for dynamic accesses 10942of TLS variables. 10943 10944@item -mfix-cortex-a53-835769 10945@itemx -mno-fix-cortex-a53-835769 10946@opindex -mfix-cortex-a53-835769 10947@opindex -mno-fix-cortex-a53-835769 10948Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769. 10949This will involve inserting a NOP instruction between memory instructions and 1095064-bit integer multiply-accumulate instructions. 10951 10952@item -march=@var{name} 10953@opindex march 10954Specify the name of the target architecture, optionally suffixed by one or 10955more feature modifiers. This option has the form 10956@option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where the 10957only value for @var{arch} is @samp{armv8-a}. The possible values for 10958@var{feature} are documented in the sub-section below. 10959 10960Where conflicting feature modifiers are specified, the right-most feature is 10961used. 10962 10963GCC uses this name to determine what kind of instructions it can emit when 10964generating assembly code. This option can be used in conjunction with or 10965instead of the @option{-mcpu=} option. 10966 10967@item -mcpu=@var{name} 10968@opindex mcpu 10969Specify the name of the target processor, optionally suffixed by one or more 10970feature modifiers. This option has the form 10971@option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where the 10972possible values for @var{cpu} are @samp{generic}, @samp{large}. The 10973possible values for @var{feature} are documented in the sub-section 10974below. 10975 10976Where conflicting feature modifiers are specified, the right-most feature is 10977used. 10978 10979GCC uses this name to determine what kind of instructions it can emit when 10980generating assembly code. 10981 10982@item -mtune=@var{name} 10983@opindex mtune 10984Specify the name of the processor to tune the performance for. The code will 10985be tuned as if the target processor were of the type specified in this option, 10986but still using instructions compatible with the target processor specified 10987by a @option{-mcpu=} option. This option cannot be suffixed by feature 10988modifiers. 10989 10990@end table 10991 10992@subsubsection @option{-march} and @option{-mcpu} feature modifiers 10993@cindex @option{-march} feature modifiers 10994@cindex @option{-mcpu} feature modifiers 10995Feature modifiers used with @option{-march} and @option{-mcpu} can be one 10996the following: 10997 10998@table @samp 10999@item crypto 11000Enable Crypto extension. This implies Advanced SIMD is enabled. 11001@item fp 11002Enable floating-point instructions. 11003@item simd 11004Enable Advanced SIMD instructions. This implies floating-point instructions 11005are enabled. This is the default for all current possible values for options 11006@option{-march} and @option{-mcpu=}. 11007@end table 11008 11009@node Adapteva Epiphany Options 11010@subsection Adapteva Epiphany Options 11011 11012These @samp{-m} options are defined for Adapteva Epiphany: 11013 11014@table @gcctabopt 11015@item -mhalf-reg-file 11016@opindex mhalf-reg-file 11017Don't allocate any register in the range @code{r32}@dots{}@code{r63}. 11018That allows code to run on hardware variants that lack these registers. 11019 11020@item -mprefer-short-insn-regs 11021@opindex mprefer-short-insn-regs 11022Preferrentially allocate registers that allow short instruction generation. 11023This can result in increased instruction count, so this may either reduce or 11024increase overall code size. 11025 11026@item -mbranch-cost=@var{num} 11027@opindex mbranch-cost 11028Set the cost of branches to roughly @var{num} ``simple'' instructions. 11029This cost is only a heuristic and is not guaranteed to produce 11030consistent results across releases. 11031 11032@item -mcmove 11033@opindex mcmove 11034Enable the generation of conditional moves. 11035 11036@item -mnops=@var{num} 11037@opindex mnops 11038Emit @var{num} NOPs before every other generated instruction. 11039 11040@item -mno-soft-cmpsf 11041@opindex mno-soft-cmpsf 11042For single-precision floating-point comparisons, emit an @code{fsub} instruction 11043and test the flags. This is faster than a software comparison, but can 11044get incorrect results in the presence of NaNs, or when two different small 11045numbers are compared such that their difference is calculated as zero. 11046The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant, 11047software comparisons. 11048 11049@item -mstack-offset=@var{num} 11050@opindex mstack-offset 11051Set the offset between the top of the stack and the stack pointer. 11052E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7} 11053can be used by leaf functions without stack allocation. 11054Values other than @samp{8} or @samp{16} are untested and unlikely to work. 11055Note also that this option changes the ABI; compiling a program with a 11056different stack offset than the libraries have been compiled with 11057generally does not work. 11058This option can be useful if you want to evaluate if a different stack 11059offset would give you better code, but to actually use a different stack 11060offset to build working programs, it is recommended to configure the 11061toolchain with the appropriate @option{--with-stack-offset=@var{num}} option. 11062 11063@item -mno-round-nearest 11064@opindex mno-round-nearest 11065Make the scheduler assume that the rounding mode has been set to 11066truncating. The default is @option{-mround-nearest}. 11067 11068@item -mlong-calls 11069@opindex mlong-calls 11070If not otherwise specified by an attribute, assume all calls might be beyond 11071the offset range of the @code{b} / @code{bl} instructions, and therefore load the 11072function address into a register before performing a (otherwise direct) call. 11073This is the default. 11074 11075@item -mshort-calls 11076@opindex short-calls 11077If not otherwise specified by an attribute, assume all direct calls are 11078in the range of the @code{b} / @code{bl} instructions, so use these instructions 11079for direct calls. The default is @option{-mlong-calls}. 11080 11081@item -msmall16 11082@opindex msmall16 11083Assume addresses can be loaded as 16-bit unsigned values. This does not 11084apply to function addresses for which @option{-mlong-calls} semantics 11085are in effect. 11086 11087@item -mfp-mode=@var{mode} 11088@opindex mfp-mode 11089Set the prevailing mode of the floating-point unit. 11090This determines the floating-point mode that is provided and expected 11091at function call and return time. Making this mode match the mode you 11092predominantly need at function start can make your programs smaller and 11093faster by avoiding unnecessary mode switches. 11094 11095@var{mode} can be set to one the following values: 11096 11097@table @samp 11098@item caller 11099Any mode at function entry is valid, and retained or restored when 11100the function returns, and when it calls other functions. 11101This mode is useful for compiling libraries or other compilation units 11102you might want to incorporate into different programs with different 11103prevailing FPU modes, and the convenience of being able to use a single 11104object file outweighs the size and speed overhead for any extra 11105mode switching that might be needed, compared with what would be needed 11106with a more specific choice of prevailing FPU mode. 11107 11108@item truncate 11109This is the mode used for floating-point calculations with 11110truncating (i.e.@: round towards zero) rounding mode. That includes 11111conversion from floating point to integer. 11112 11113@item round-nearest 11114This is the mode used for floating-point calculations with 11115round-to-nearest-or-even rounding mode. 11116 11117@item int 11118This is the mode used to perform integer calculations in the FPU, e.g.@: 11119integer multiply, or integer multiply-and-accumulate. 11120@end table 11121 11122The default is @option{-mfp-mode=caller} 11123 11124@item -mnosplit-lohi 11125@itemx -mno-postinc 11126@itemx -mno-postmodify 11127@opindex mnosplit-lohi 11128@opindex mno-postinc 11129@opindex mno-postmodify 11130Code generation tweaks that disable, respectively, splitting of 32-bit 11131loads, generation of post-increment addresses, and generation of 11132post-modify addresses. The defaults are @option{msplit-lohi}, 11133@option{-mpost-inc}, and @option{-mpost-modify}. 11134 11135@item -mnovect-double 11136@opindex mno-vect-double 11137Change the preferred SIMD mode to SImode. The default is 11138@option{-mvect-double}, which uses DImode as preferred SIMD mode. 11139 11140@item -max-vect-align=@var{num} 11141@opindex max-vect-align 11142The maximum alignment for SIMD vector mode types. 11143@var{num} may be 4 or 8. The default is 8. 11144Note that this is an ABI change, even though many library function 11145interfaces are unaffected if they don't use SIMD vector modes 11146in places that affect size and/or alignment of relevant types. 11147 11148@item -msplit-vecmove-early 11149@opindex msplit-vecmove-early 11150Split vector moves into single word moves before reload. In theory this 11151can give better register allocation, but so far the reverse seems to be 11152generally the case. 11153 11154@item -m1reg-@var{reg} 11155@opindex m1reg- 11156Specify a register to hold the constant @minus{}1, which makes loading small negative 11157constants and certain bitmasks faster. 11158Allowable values for @var{reg} are @samp{r43} and @samp{r63}, 11159which specify use of that register as a fixed register, 11160and @samp{none}, which means that no register is used for this 11161purpose. The default is @option{-m1reg-none}. 11162 11163@end table 11164 11165@node ARM Options 11166@subsection ARM Options 11167@cindex ARM options 11168 11169These @samp{-m} options are defined for Advanced RISC Machines (ARM) 11170architectures: 11171 11172@table @gcctabopt 11173@item -mabi=@var{name} 11174@opindex mabi 11175Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu}, 11176@samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}. 11177 11178@item -mapcs-frame 11179@opindex mapcs-frame 11180Generate a stack frame that is compliant with the ARM Procedure Call 11181Standard for all functions, even if this is not strictly necessary for 11182correct execution of the code. Specifying @option{-fomit-frame-pointer} 11183with this option causes the stack frames not to be generated for 11184leaf functions. The default is @option{-mno-apcs-frame}. 11185 11186@item -mapcs 11187@opindex mapcs 11188This is a synonym for @option{-mapcs-frame}. 11189 11190@ignore 11191@c not currently implemented 11192@item -mapcs-stack-check 11193@opindex mapcs-stack-check 11194Generate code to check the amount of stack space available upon entry to 11195every function (that actually uses some stack space). If there is 11196insufficient space available then either the function 11197@samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} is 11198called, depending upon the amount of stack space required. The runtime 11199system is required to provide these functions. The default is 11200@option{-mno-apcs-stack-check}, since this produces smaller code. 11201 11202@c not currently implemented 11203@item -mapcs-float 11204@opindex mapcs-float 11205Pass floating-point arguments using the floating-point registers. This is 11206one of the variants of the APCS@. This option is recommended if the 11207target hardware has a floating-point unit or if a lot of floating-point 11208arithmetic is going to be performed by the code. The default is 11209@option{-mno-apcs-float}, since the size of integer-only code is 11210slightly increased if @option{-mapcs-float} is used. 11211 11212@c not currently implemented 11213@item -mapcs-reentrant 11214@opindex mapcs-reentrant 11215Generate reentrant, position-independent code. The default is 11216@option{-mno-apcs-reentrant}. 11217@end ignore 11218 11219@item -mthumb-interwork 11220@opindex mthumb-interwork 11221Generate code that supports calling between the ARM and Thumb 11222instruction sets. Without this option, on pre-v5 architectures, the 11223two instruction sets cannot be reliably used inside one program. The 11224default is @option{-mno-thumb-interwork}, since slightly larger code 11225is generated when @option{-mthumb-interwork} is specified. In AAPCS 11226configurations this option is meaningless. 11227 11228@item -mno-sched-prolog 11229@opindex mno-sched-prolog 11230Prevent the reordering of instructions in the function prologue, or the 11231merging of those instruction with the instructions in the function's 11232body. This means that all functions start with a recognizable set 11233of instructions (or in fact one of a choice from a small set of 11234different function prologues), and this information can be used to 11235locate the start of functions inside an executable piece of code. The 11236default is @option{-msched-prolog}. 11237 11238@item -mfloat-abi=@var{name} 11239@opindex mfloat-abi 11240Specifies which floating-point ABI to use. Permissible values 11241are: @samp{soft}, @samp{softfp} and @samp{hard}. 11242 11243Specifying @samp{soft} causes GCC to generate output containing 11244library calls for floating-point operations. 11245@samp{softfp} allows the generation of code using hardware floating-point 11246instructions, but still uses the soft-float calling conventions. 11247@samp{hard} allows generation of floating-point instructions 11248and uses FPU-specific calling conventions. 11249 11250The default depends on the specific target configuration. Note that 11251the hard-float and soft-float ABIs are not link-compatible; you must 11252compile your entire program with the same ABI, and link with a 11253compatible set of libraries. 11254 11255@item -mlittle-endian 11256@opindex mlittle-endian 11257Generate code for a processor running in little-endian mode. This is 11258the default for all standard configurations. 11259 11260@item -mbig-endian 11261@opindex mbig-endian 11262Generate code for a processor running in big-endian mode; the default is 11263to compile code for a little-endian processor. 11264 11265@item -mwords-little-endian 11266@opindex mwords-little-endian 11267This option only applies when generating code for big-endian processors. 11268Generate code for a little-endian word order but a big-endian byte 11269order. That is, a byte order of the form @samp{32107654}. Note: this 11270option should only be used if you require compatibility with code for 11271big-endian ARM processors generated by versions of the compiler prior to 112722.8. This option is now deprecated. 11273 11274@item -march=@var{name} 11275@opindex march 11276This specifies the name of the target ARM architecture. GCC uses this 11277name to determine what kind of instructions it can emit when generating 11278assembly code. This option can be used in conjunction with or instead 11279of the @option{-mcpu=} option. Permissible names are: @samp{armv2}, 11280@samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t}, 11281@samp{armv5}, @samp{armv5t}, @samp{armv5e}, @samp{armv5te}, 11282@samp{armv6}, @samp{armv6j}, 11283@samp{armv6t2}, @samp{armv6z}, @samp{armv6zk}, @samp{armv6-m}, 11284@samp{armv7}, @samp{armv7-a}, @samp{armv7-r}, @samp{armv7-m}, @samp{armv7e-m} 11285@samp{armv8-a}, 11286@samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}. 11287 11288@option{-march=native} causes the compiler to auto-detect the architecture 11289of the build computer. At present, this feature is only supported on 11290GNU/Linux, and not all architectures are recognized. If the auto-detect 11291is unsuccessful the option has no effect. 11292 11293@item -mtune=@var{name} 11294@opindex mtune 11295This option specifies the name of the target ARM processor for 11296which GCC should tune the performance of the code. 11297For some ARM implementations better performance can be obtained by using 11298this option. 11299Permissible names are: @samp{arm2}, @samp{arm250}, 11300@samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610}, 11301@samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm}, 11302@samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700}, 11303@samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100}, 11304@samp{arm720}, 11305@samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s}, 11306@samp{arm710t}, @samp{arm720t}, @samp{arm740t}, 11307@samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100}, 11308@samp{strongarm1110}, 11309@samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920}, 11310@samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s}, 11311@samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi}, 11312@samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s}, 11313@samp{arm10e}, @samp{arm1020e}, @samp{arm1022e}, 11314@samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp}, 11315@samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s}, 11316@samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8}, @samp{cortex-a9}, 11317@samp{cortex-a15}, @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5}, 11318@samp{cortex-m4}, @samp{cortex-m3}, 11319@samp{cortex-m1}, 11320@samp{cortex-m0}, 11321@samp{cortex-m0plus}, 11322@samp{marvell-pj4}, 11323@samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, 11324@samp{fa526}, @samp{fa626}, 11325@samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}. 11326 11327@option{-mtune=generic-@var{arch}} specifies that GCC should tune the 11328performance for a blend of processors within architecture @var{arch}. 11329The aim is to generate code that run well on the current most popular 11330processors, balancing between optimizations that benefit some CPUs in the 11331range, and avoiding performance pitfalls of other CPUs. The effects of 11332this option may change in future GCC versions as CPU models come and go. 11333 11334@option{-mtune=native} causes the compiler to auto-detect the CPU 11335of the build computer. At present, this feature is only supported on 11336GNU/Linux, and not all architectures are recognized. If the auto-detect is 11337unsuccessful the option has no effect. 11338 11339@item -mcpu=@var{name} 11340@opindex mcpu 11341This specifies the name of the target ARM processor. GCC uses this name 11342to derive the name of the target ARM architecture (as if specified 11343by @option{-march}) and the ARM processor type for which to tune for 11344performance (as if specified by @option{-mtune}). Where this option 11345is used in conjunction with @option{-march} or @option{-mtune}, 11346those options take precedence over the appropriate part of this option. 11347 11348Permissible names for this option are the same as those for 11349@option{-mtune}. 11350 11351@option{-mcpu=generic-@var{arch}} is also permissible, and is 11352equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}. 11353See @option{-mtune} for more information. 11354 11355@option{-mcpu=native} causes the compiler to auto-detect the CPU 11356of the build computer. At present, this feature is only supported on 11357GNU/Linux, and not all architectures are recognized. If the auto-detect 11358is unsuccessful the option has no effect. 11359 11360@item -mfpu=@var{name} 11361@opindex mfpu 11362This specifies what floating-point hardware (or hardware emulation) is 11363available on the target. Permissible names are: @samp{vfp}, @samp{vfpv3}, 11364@samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd}, 11365@samp{vfpv3xd-fp16}, @samp{neon}, @samp{neon-fp16}, @samp{vfpv4}, 11366@samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4}, 11367@samp{fp-armv8}, @samp{neon-fp-armv8}, and @samp{crypto-neon-fp-armv8}. 11368 11369If @option{-msoft-float} is specified this specifies the format of 11370floating-point values. 11371 11372If the selected floating-point hardware includes the NEON extension 11373(e.g. @option{-mfpu}=@samp{neon}), note that floating-point 11374operations are not generated by GCC's auto-vectorization pass unless 11375@option{-funsafe-math-optimizations} is also specified. This is 11376because NEON hardware does not fully implement the IEEE 754 standard for 11377floating-point arithmetic (in particular denormal values are treated as 11378zero), so the use of NEON instructions may lead to a loss of precision. 11379 11380@item -mfp16-format=@var{name} 11381@opindex mfp16-format 11382Specify the format of the @code{__fp16} half-precision floating-point type. 11383Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative}; 11384the default is @samp{none}, in which case the @code{__fp16} type is not 11385defined. @xref{Half-Precision}, for more information. 11386 11387@item -mstructure-size-boundary=@var{n} 11388@opindex mstructure-size-boundary 11389The sizes of all structures and unions are rounded up to a multiple 11390of the number of bits set by this option. Permissible values are 8, 32 11391and 64. The default value varies for different toolchains. For the COFF 11392targeted toolchain the default value is 8. A value of 64 is only allowed 11393if the underlying ABI supports it. 11394 11395Specifying a larger number can produce faster, more efficient code, but 11396can also increase the size of the program. Different values are potentially 11397incompatible. Code compiled with one value cannot necessarily expect to 11398work with code or libraries compiled with another value, if they exchange 11399information using structures or unions. 11400 11401@item -mabort-on-noreturn 11402@opindex mabort-on-noreturn 11403Generate a call to the function @code{abort} at the end of a 11404@code{noreturn} function. It is executed if the function tries to 11405return. 11406 11407@item -mlong-calls 11408@itemx -mno-long-calls 11409@opindex mlong-calls 11410@opindex mno-long-calls 11411Tells the compiler to perform function calls by first loading the 11412address of the function into a register and then performing a subroutine 11413call on this register. This switch is needed if the target function 11414lies outside of the 64-megabyte addressing range of the offset-based 11415version of subroutine call instruction. 11416 11417Even if this switch is enabled, not all function calls are turned 11418into long calls. The heuristic is that static functions, functions 11419that have the @samp{short-call} attribute, functions that are inside 11420the scope of a @samp{#pragma no_long_calls} directive, and functions whose 11421definitions have already been compiled within the current compilation 11422unit are not turned into long calls. The exceptions to this rule are 11423that weak function definitions, functions with the @samp{long-call} 11424attribute or the @samp{section} attribute, and functions that are within 11425the scope of a @samp{#pragma long_calls} directive are always 11426turned into long calls. 11427 11428This feature is not enabled by default. Specifying 11429@option{-mno-long-calls} restores the default behavior, as does 11430placing the function calls within the scope of a @samp{#pragma 11431long_calls_off} directive. Note these switches have no effect on how 11432the compiler generates code to handle function calls via function 11433pointers. 11434 11435@item -msingle-pic-base 11436@opindex msingle-pic-base 11437Treat the register used for PIC addressing as read-only, rather than 11438loading it in the prologue for each function. The runtime system is 11439responsible for initializing this register with an appropriate value 11440before execution begins. 11441 11442@item -mpic-register=@var{reg} 11443@opindex mpic-register 11444Specify the register to be used for PIC addressing. 11445For standard PIC base case, the default will be any suitable register 11446determined by compiler. For single PIC base case, the default is 11447@samp{R9} if target is EABI based or stack-checking is enabled, 11448otherwise the default is @samp{R10}. 11449 11450@item -mpoke-function-name 11451@opindex mpoke-function-name 11452Write the name of each function into the text section, directly 11453preceding the function prologue. The generated code is similar to this: 11454 11455@smallexample 11456 t0 11457 .ascii "arm_poke_function_name", 0 11458 .align 11459 t1 11460 .word 0xff000000 + (t1 - t0) 11461 arm_poke_function_name 11462 mov ip, sp 11463 stmfd sp!, @{fp, ip, lr, pc@} 11464 sub fp, ip, #4 11465@end smallexample 11466 11467When performing a stack backtrace, code can inspect the value of 11468@code{pc} stored at @code{fp + 0}. If the trace function then looks at 11469location @code{pc - 12} and the top 8 bits are set, then we know that 11470there is a function name embedded immediately preceding this location 11471and has length @code{((pc[-3]) & 0xff000000)}. 11472 11473@item -mthumb 11474@itemx -marm 11475@opindex marm 11476@opindex mthumb 11477 11478Select between generating code that executes in ARM and Thumb 11479states. The default for most configurations is to generate code 11480that executes in ARM state, but the default can be changed by 11481configuring GCC with the @option{--with-mode=}@var{state} 11482configure option. 11483 11484@item -mtpcs-frame 11485@opindex mtpcs-frame 11486Generate a stack frame that is compliant with the Thumb Procedure Call 11487Standard for all non-leaf functions. (A leaf function is one that does 11488not call any other functions.) The default is @option{-mno-tpcs-frame}. 11489 11490@item -mtpcs-leaf-frame 11491@opindex mtpcs-leaf-frame 11492Generate a stack frame that is compliant with the Thumb Procedure Call 11493Standard for all leaf functions. (A leaf function is one that does 11494not call any other functions.) The default is @option{-mno-apcs-leaf-frame}. 11495 11496@item -mcallee-super-interworking 11497@opindex mcallee-super-interworking 11498Gives all externally visible functions in the file being compiled an ARM 11499instruction set header which switches to Thumb mode before executing the 11500rest of the function. This allows these functions to be called from 11501non-interworking code. This option is not valid in AAPCS configurations 11502because interworking is enabled by default. 11503 11504@item -mcaller-super-interworking 11505@opindex mcaller-super-interworking 11506Allows calls via function pointers (including virtual functions) to 11507execute correctly regardless of whether the target code has been 11508compiled for interworking or not. There is a small overhead in the cost 11509of executing a function pointer if this option is enabled. This option 11510is not valid in AAPCS configurations because interworking is enabled 11511by default. 11512 11513@item -mtp=@var{name} 11514@opindex mtp 11515Specify the access model for the thread local storage pointer. The valid 11516models are @option{soft}, which generates calls to @code{__aeabi_read_tp}, 11517@option{cp15}, which fetches the thread pointer from @code{cp15} directly 11518(supported in the arm6k architecture), and @option{auto}, which uses the 11519best available method for the selected processor. The default setting is 11520@option{auto}. 11521 11522@item -mtls-dialect=@var{dialect} 11523@opindex mtls-dialect 11524Specify the dialect to use for accessing thread local storage. Two 11525@var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The 11526@samp{gnu} dialect selects the original GNU scheme for supporting 11527local and global dynamic TLS models. The @samp{gnu2} dialect 11528selects the GNU descriptor scheme, which provides better performance 11529for shared libraries. The GNU descriptor scheme is compatible with 11530the original scheme, but does require new assembler, linker and 11531library support. Initial and local exec TLS models are unaffected by 11532this option and always use the original scheme. 11533 11534@item -mword-relocations 11535@opindex mword-relocations 11536Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32). 11537This is enabled by default on targets (uClinux, SymbianOS) where the runtime 11538loader imposes this restriction, and when @option{-fpic} or @option{-fPIC} 11539is specified. 11540 11541@item -mfix-cortex-m3-ldrd 11542@opindex mfix-cortex-m3-ldrd 11543Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions 11544with overlapping destination and base registers are used. This option avoids 11545generating these instructions. This option is enabled by default when 11546@option{-mcpu=cortex-m3} is specified. 11547 11548@item -munaligned-access 11549@itemx -mno-unaligned-access 11550@opindex munaligned-access 11551@opindex mno-unaligned-access 11552Enables (or disables) reading and writing of 16- and 32- bit values 11553from addresses that are not 16- or 32- bit aligned. By default 11554unaligned access is disabled for all pre-ARMv6 and all ARMv6-M 11555architectures, and enabled for all other architectures. If unaligned 11556access is not enabled then words in packed data structures will be 11557accessed a byte at a time. 11558 11559The ARM attribute @code{Tag_CPU_unaligned_access} will be set in the 11560generated object file to either true or false, depending upon the 11561setting of this option. If unaligned access is enabled then the 11562preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} will also be 11563defined. 11564 11565@end table 11566 11567@node AVR Options 11568@subsection AVR Options 11569@cindex AVR Options 11570 11571These options are defined for AVR implementations: 11572 11573@table @gcctabopt 11574@item -mmcu=@var{mcu} 11575@opindex mmcu 11576Specify Atmel AVR instruction set architectures (ISA) or MCU type. 11577 11578The default for this option is@tie{}@code{avr2}. 11579 11580GCC supports the following AVR devices and ISAs: 11581 11582@include avr-mmcu.texi 11583 11584@item -maccumulate-args 11585@opindex maccumulate-args 11586Accumulate outgoing function arguments and acquire/release the needed 11587stack space for outgoing function arguments once in function 11588prologue/epilogue. Without this option, outgoing arguments are pushed 11589before calling a function and popped afterwards. 11590 11591Popping the arguments after the function call can be expensive on 11592AVR so that accumulating the stack space might lead to smaller 11593executables because arguments need not to be removed from the 11594stack after such a function call. 11595 11596This option can lead to reduced code size for functions that perform 11597several calls to functions that get their arguments on the stack like 11598calls to printf-like functions. 11599 11600@item -mbranch-cost=@var{cost} 11601@opindex mbranch-cost 11602Set the branch costs for conditional branch instructions to 11603@var{cost}. Reasonable values for @var{cost} are small, non-negative 11604integers. The default branch cost is 0. 11605 11606@item -mcall-prologues 11607@opindex mcall-prologues 11608Functions prologues/epilogues are expanded as calls to appropriate 11609subroutines. Code size is smaller. 11610 11611@item -mint8 11612@opindex mint8 11613Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a 11614@code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes, 11615and @code{long long} is 4 bytes. Please note that this option does not 11616conform to the C standards, but it results in smaller code 11617size. 11618 11619@item -mno-interrupts 11620@opindex mno-interrupts 11621Generated code is not compatible with hardware interrupts. 11622Code size is smaller. 11623 11624@item -mrelax 11625@opindex mrelax 11626Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter 11627@code{RCALL} resp.@: @code{RJMP} instruction if applicable. 11628Setting @code{-mrelax} just adds the @code{--relax} option to the 11629linker command line when the linker is called. 11630 11631Jump relaxing is performed by the linker because jump offsets are not 11632known before code is located. Therefore, the assembler code generated by the 11633compiler is the same, but the instructions in the executable may 11634differ from instructions in the assembler code. 11635 11636Relaxing must be turned on if linker stubs are needed, see the 11637section on @code{EIND} and linker stubs below. 11638 11639@item -msp8 11640@opindex msp8 11641Treat the stack pointer register as an 8-bit register, 11642i.e.@: assume the high byte of the stack pointer is zero. 11643In general, you don't need to set this option by hand. 11644 11645This option is used internally by the compiler to select and 11646build multilibs for architectures @code{avr2} and @code{avr25}. 11647These architectures mix devices with and without @code{SPH}. 11648For any setting other than @code{-mmcu=avr2} or @code{-mmcu=avr25} 11649the compiler driver will add or remove this option from the compiler 11650proper's command line, because the compiler then knows if the device 11651or architecture has an 8-bit stack pointer and thus no @code{SPH} 11652register or not. 11653 11654@item -mstrict-X 11655@opindex mstrict-X 11656Use address register @code{X} in a way proposed by the hardware. This means 11657that @code{X} is only used in indirect, post-increment or 11658pre-decrement addressing. 11659 11660Without this option, the @code{X} register may be used in the same way 11661as @code{Y} or @code{Z} which then is emulated by additional 11662instructions. 11663For example, loading a value with @code{X+const} addressing with a 11664small non-negative @code{const < 64} to a register @var{Rn} is 11665performed as 11666 11667@example 11668adiw r26, const ; X += const 11669ld @var{Rn}, X ; @var{Rn} = *X 11670sbiw r26, const ; X -= const 11671@end example 11672 11673@item -mtiny-stack 11674@opindex mtiny-stack 11675Only change the lower 8@tie{}bits of the stack pointer. 11676 11677@item -Waddr-space-convert 11678@opindex Waddr-space-convert 11679Warn about conversions between address spaces in the case where the 11680resulting address space is not contained in the incoming address space. 11681@end table 11682 11683@subsubsection @code{EIND} and Devices with more than 128 Ki Bytes of Flash 11684@cindex @code{EIND} 11685Pointers in the implementation are 16@tie{}bits wide. 11686The address of a function or label is represented as word address so 11687that indirect jumps and calls can target any code address in the 11688range of 64@tie{}Ki words. 11689 11690In order to facilitate indirect jump on devices with more than 128@tie{}Ki 11691bytes of program memory space, there is a special function register called 11692@code{EIND} that serves as most significant part of the target address 11693when @code{EICALL} or @code{EIJMP} instructions are used. 11694 11695Indirect jumps and calls on these devices are handled as follows by 11696the compiler and are subject to some limitations: 11697 11698@itemize @bullet 11699 11700@item 11701The compiler never sets @code{EIND}. 11702 11703@item 11704The compiler uses @code{EIND} implicitely in @code{EICALL}/@code{EIJMP} 11705instructions or might read @code{EIND} directly in order to emulate an 11706indirect call/jump by means of a @code{RET} instruction. 11707 11708@item 11709The compiler assumes that @code{EIND} never changes during the startup 11710code or during the application. In particular, @code{EIND} is not 11711saved/restored in function or interrupt service routine 11712prologue/epilogue. 11713 11714@item 11715For indirect calls to functions and computed goto, the linker 11716generates @emph{stubs}. Stubs are jump pads sometimes also called 11717@emph{trampolines}. Thus, the indirect call/jump jumps to such a stub. 11718The stub contains a direct jump to the desired address. 11719 11720@item 11721Linker relaxation must be turned on so that the linker will generate 11722the stubs correctly an all situaltion. See the compiler option 11723@code{-mrelax} and the linler option @code{--relax}. 11724There are corner cases where the linker is supposed to generate stubs 11725but aborts without relaxation and without a helpful error message. 11726 11727@item 11728The default linker script is arranged for code with @code{EIND = 0}. 11729If code is supposed to work for a setup with @code{EIND != 0}, a custom 11730linker script has to be used in order to place the sections whose 11731name start with @code{.trampolines} into the segment where @code{EIND} 11732points to. 11733 11734@item 11735The startup code from libgcc never sets @code{EIND}. 11736Notice that startup code is a blend of code from libgcc and AVR-LibC. 11737For the impact of AVR-LibC on @code{EIND}, see the 11738@w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}. 11739 11740@item 11741It is legitimate for user-specific startup code to set up @code{EIND} 11742early, for example by means of initialization code located in 11743section @code{.init3}. Such code runs prior to general startup code 11744that initializes RAM and calls constructors, but after the bit 11745of startup code from AVR-LibC that sets @code{EIND} to the segment 11746where the vector table is located. 11747@example 11748#include <avr/io.h> 11749 11750static void 11751__attribute__((section(".init3"),naked,used,no_instrument_function)) 11752init3_set_eind (void) 11753@{ 11754 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t" 11755 "out %i0,r24" :: "n" (&EIND) : "r24","memory"); 11756@} 11757@end example 11758 11759@noindent 11760The @code{__trampolines_start} symbol is defined in the linker script. 11761 11762@item 11763Stubs are generated automatically by the linker if 11764the following two conditions are met: 11765@itemize @minus 11766 11767@item The address of a label is taken by means of the @code{gs} modifier 11768(short for @emph{generate stubs}) like so: 11769@example 11770LDI r24, lo8(gs(@var{func})) 11771LDI r25, hi8(gs(@var{func})) 11772@end example 11773@item The final location of that label is in a code segment 11774@emph{outside} the segment where the stubs are located. 11775@end itemize 11776 11777@item 11778The compiler emits such @code{gs} modifiers for code labels in the 11779following situations: 11780@itemize @minus 11781@item Taking address of a function or code label. 11782@item Computed goto. 11783@item If prologue-save function is used, see @option{-mcall-prologues} 11784command-line option. 11785@item Switch/case dispatch tables. If you do not want such dispatch 11786tables you can specify the @option{-fno-jump-tables} command-line option. 11787@item C and C++ constructors/destructors called during startup/shutdown. 11788@item If the tools hit a @code{gs()} modifier explained above. 11789@end itemize 11790 11791@item 11792Jumping to non-symbolic addresses like so is @emph{not} supported: 11793 11794@example 11795int main (void) 11796@{ 11797 /* Call function at word address 0x2 */ 11798 return ((int(*)(void)) 0x2)(); 11799@} 11800@end example 11801 11802Instead, a stub has to be set up, i.e.@: the function has to be called 11803through a symbol (@code{func_4} in the example): 11804 11805@example 11806int main (void) 11807@{ 11808 extern int func_4 (void); 11809 11810 /* Call function at byte address 0x4 */ 11811 return func_4(); 11812@} 11813@end example 11814 11815and the application be linked with @code{-Wl,--defsym,func_4=0x4}. 11816Alternatively, @code{func_4} can be defined in the linker script. 11817@end itemize 11818 11819@subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers 11820@cindex @code{RAMPD} 11821@cindex @code{RAMPX} 11822@cindex @code{RAMPY} 11823@cindex @code{RAMPZ} 11824Some AVR devices support memories larger than the 64@tie{}KiB range 11825that can be accessed with 16-bit pointers. To access memory locations 11826outside this 64@tie{}KiB range, the contentent of a @code{RAMP} 11827register is used as high part of the address: 11828The @code{X}, @code{Y}, @code{Z} address register is concatenated 11829with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function 11830register, respectively, to get a wide address. Similarly, 11831@code{RAMPD} is used together with direct addressing. 11832 11833@itemize 11834@item 11835The startup code initializes the @code{RAMP} special function 11836registers with zero. 11837 11838@item 11839If a @ref{AVR Named Address Spaces,named address space} other than 11840generic or @code{__flash} is used, then @code{RAMPZ} is set 11841as needed before the operation. 11842 11843@item 11844If the device supports RAM larger than 64@tie{KiB} and the compiler 11845needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ} 11846is reset to zero after the operation. 11847 11848@item 11849If the device comes with a specific @code{RAMP} register, the ISR 11850prologue/epilogue saves/restores that SFR and initializes it with 11851zero in case the ISR code might (implicitly) use it. 11852 11853@item 11854RAM larger than 64@tie{KiB} is not supported by GCC for AVR targets. 11855If you use inline assembler to read from locations outside the 1185616-bit address range and change one of the @code{RAMP} registers, 11857you must reset it to zero after the access. 11858 11859@end itemize 11860 11861@subsubsection AVR Built-in Macros 11862 11863GCC defines several built-in macros so that the user code can test 11864for the presence or absence of features. Almost any of the following 11865built-in macros are deduced from device capabilities and thus 11866triggered by the @code{-mmcu=} command-line option. 11867 11868For even more AVR-specific built-in macros see 11869@ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}. 11870 11871@table @code 11872 11873@item __AVR_ARCH__ 11874Build-in macro that resolves to a decimal number that identifies the 11875architecture and depends on the @code{-mmcu=@var{mcu}} option. 11876Possible values are: 11877 11878@code{2}, @code{25}, @code{3}, @code{31}, @code{35}, 11879@code{4}, @code{5}, @code{51}, @code{6}, @code{102}, @code{104}, 11880@code{105}, @code{106}, @code{107} 11881 11882for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, 11883@code{avr31}, @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, 11884@code{avr6}, @code{avrxmega2}, @code{avrxmega4}, @code{avrxmega5}, 11885@code{avrxmega6}, @code{avrxmega7}, respectively. 11886If @var{mcu} specifies a device, this built-in macro is set 11887accordingly. For example, with @code{-mmcu=atmega8} the macro will be 11888defined to @code{4}. 11889 11890@item __AVR_@var{Device}__ 11891Setting @code{-mmcu=@var{device}} defines this built-in macro which reflects 11892the device's name. For example, @code{-mmcu=atmega8} defines the 11893built-in macro @code{__AVR_ATmega8__}, @code{-mmcu=attiny261a} defines 11894@code{__AVR_ATtiny261A__}, etc. 11895 11896The built-in macros' names follow 11897the scheme @code{__AVR_@var{Device}__} where @var{Device} is 11898the device name as from the AVR user manual. The difference between 11899@var{Device} in the built-in macro and @var{device} in 11900@code{-mmcu=@var{device}} is that the latter is always lowercase. 11901 11902If @var{device} is not a device but only a core architecture like 11903@code{avr51}, this macro will not be defined. 11904 11905@item __AVR_XMEGA__ 11906The device / architecture belongs to the XMEGA family of devices. 11907 11908@item __AVR_HAVE_ELPM__ 11909The device has the the @code{ELPM} instruction. 11910 11911@item __AVR_HAVE_ELPMX__ 11912The device has the @code{ELPM R@var{n},Z} and @code{ELPM 11913R@var{n},Z+} instructions. 11914 11915@item __AVR_HAVE_MOVW__ 11916The device has the @code{MOVW} instruction to perform 16-bit 11917register-register moves. 11918 11919@item __AVR_HAVE_LPMX__ 11920The device has the @code{LPM R@var{n},Z} and 11921@code{LPM R@var{n},Z+} instructions. 11922 11923@item __AVR_HAVE_MUL__ 11924The device has a hardware multiplier. 11925 11926@item __AVR_HAVE_JMP_CALL__ 11927The device has the @code{JMP} and @code{CALL} instructions. 11928This is the case for devices with at least 16@tie{}KiB of program 11929memory. 11930 11931@item __AVR_HAVE_EIJMP_EICALL__ 11932@itemx __AVR_3_BYTE_PC__ 11933The device has the @code{EIJMP} and @code{EICALL} instructions. 11934This is the case for devices with more than 128@tie{}KiB of program memory. 11935This also means that the program counter 11936(PC) is 3@tie{}bytes wide. 11937 11938@item __AVR_2_BYTE_PC__ 11939The program counter (PC) is 2@tie{}bytes wide. This is the case for devices 11940with up to 128@tie{}KiB of program memory. 11941 11942@item __AVR_HAVE_8BIT_SP__ 11943@itemx __AVR_HAVE_16BIT_SP__ 11944The stack pointer (SP) register is treated as 8-bit respectively 1194516-bit register by the compiler. 11946The definition of these macros is affected by @code{-mtiny-stack}. 11947 11948@item __AVR_HAVE_SPH__ 11949@itemx __AVR_SP8__ 11950The device has the SPH (high part of stack pointer) special function 11951register or has an 8-bit stack pointer, respectively. 11952The definition of these macros is affected by @code{-mmcu=} and 11953in the cases of @code{-mmcu=avr2} and @code{-mmcu=avr25} also 11954by @code{-msp8}. 11955 11956@item __AVR_HAVE_RAMPD__ 11957@itemx __AVR_HAVE_RAMPX__ 11958@itemx __AVR_HAVE_RAMPY__ 11959@itemx __AVR_HAVE_RAMPZ__ 11960The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY}, 11961@code{RAMPZ} special function register, respectively. 11962 11963@item __NO_INTERRUPTS__ 11964This macro reflects the @code{-mno-interrupts} command line option. 11965 11966@item __AVR_ERRATA_SKIP__ 11967@itemx __AVR_ERRATA_SKIP_JMP_CALL__ 11968Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit 11969instructions because of a hardware erratum. Skip instructions are 11970@code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}. 11971The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also 11972set. 11973 11974@item __AVR_SFR_OFFSET__=@var{offset} 11975Instructions that can address I/O special function registers directly 11976like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different 11977address as if addressed by an instruction to access RAM like @code{LD} 11978or @code{STS}. This offset depends on the device architecture and has 11979to be subtracted from the RAM address in order to get the 11980respective I/O@tie{}address. 11981 11982@item __WITH_AVRLIBC__ 11983The compiler is configured to be used together with AVR-Libc. 11984See the @code{--with-avrlibc} configure option. 11985 11986@end table 11987 11988@node Blackfin Options 11989@subsection Blackfin Options 11990@cindex Blackfin Options 11991 11992@table @gcctabopt 11993@item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} 11994@opindex mcpu= 11995Specifies the name of the target Blackfin processor. Currently, @var{cpu} 11996can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518}, 11997@samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526}, 11998@samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533}, 11999@samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539}, 12000@samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549}, 12001@samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m}, 12002@samp{bf561}, @samp{bf592}. 12003 12004The optional @var{sirevision} specifies the silicon revision of the target 12005Blackfin processor. Any workarounds available for the targeted silicon revision 12006are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled. 12007If @var{sirevision} is @samp{any}, all workarounds for the targeted processor 12008are enabled. The @code{__SILICON_REVISION__} macro is defined to two 12009hexadecimal digits representing the major and minor numbers in the silicon 12010revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__} 12011is not defined. If @var{sirevision} is @samp{any}, the 12012@code{__SILICON_REVISION__} is defined to be @code{0xffff}. 12013If this optional @var{sirevision} is not used, GCC assumes the latest known 12014silicon revision of the targeted Blackfin processor. 12015 12016GCC defines a preprocessor macro for the specified @var{cpu}. 12017For the @samp{bfin-elf} toolchain, this option causes the hardware BSP 12018provided by libgloss to be linked in if @option{-msim} is not given. 12019 12020Without this option, @samp{bf532} is used as the processor by default. 12021 12022Note that support for @samp{bf561} is incomplete. For @samp{bf561}, 12023only the preprocessor macro is defined. 12024 12025@item -msim 12026@opindex msim 12027Specifies that the program will be run on the simulator. This causes 12028the simulator BSP provided by libgloss to be linked in. This option 12029has effect only for @samp{bfin-elf} toolchain. 12030Certain other options, such as @option{-mid-shared-library} and 12031@option{-mfdpic}, imply @option{-msim}. 12032 12033@item -momit-leaf-frame-pointer 12034@opindex momit-leaf-frame-pointer 12035Don't keep the frame pointer in a register for leaf functions. This 12036avoids the instructions to save, set up and restore frame pointers and 12037makes an extra register available in leaf functions. The option 12038@option{-fomit-frame-pointer} removes the frame pointer for all functions, 12039which might make debugging harder. 12040 12041@item -mspecld-anomaly 12042@opindex mspecld-anomaly 12043When enabled, the compiler ensures that the generated code does not 12044contain speculative loads after jump instructions. If this option is used, 12045@code{__WORKAROUND_SPECULATIVE_LOADS} is defined. 12046 12047@item -mno-specld-anomaly 12048@opindex mno-specld-anomaly 12049Don't generate extra code to prevent speculative loads from occurring. 12050 12051@item -mcsync-anomaly 12052@opindex mcsync-anomaly 12053When enabled, the compiler ensures that the generated code does not 12054contain CSYNC or SSYNC instructions too soon after conditional branches. 12055If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined. 12056 12057@item -mno-csync-anomaly 12058@opindex mno-csync-anomaly 12059Don't generate extra code to prevent CSYNC or SSYNC instructions from 12060occurring too soon after a conditional branch. 12061 12062@item -mlow-64k 12063@opindex mlow-64k 12064When enabled, the compiler is free to take advantage of the knowledge that 12065the entire program fits into the low 64k of memory. 12066 12067@item -mno-low-64k 12068@opindex mno-low-64k 12069Assume that the program is arbitrarily large. This is the default. 12070 12071@item -mstack-check-l1 12072@opindex mstack-check-l1 12073Do stack checking using information placed into L1 scratchpad memory by the 12074uClinux kernel. 12075 12076@item -mid-shared-library 12077@opindex mid-shared-library 12078Generate code that supports shared libraries via the library ID method. 12079This allows for execute in place and shared libraries in an environment 12080without virtual memory management. This option implies @option{-fPIC}. 12081With a @samp{bfin-elf} target, this option implies @option{-msim}. 12082 12083@item -mno-id-shared-library 12084@opindex mno-id-shared-library 12085Generate code that doesn't assume ID-based shared libraries are being used. 12086This is the default. 12087 12088@item -mleaf-id-shared-library 12089@opindex mleaf-id-shared-library 12090Generate code that supports shared libraries via the library ID method, 12091but assumes that this library or executable won't link against any other 12092ID shared libraries. That allows the compiler to use faster code for jumps 12093and calls. 12094 12095@item -mno-leaf-id-shared-library 12096@opindex mno-leaf-id-shared-library 12097Do not assume that the code being compiled won't link against any ID shared 12098libraries. Slower code is generated for jump and call insns. 12099 12100@item -mshared-library-id=n 12101@opindex mshared-library-id 12102Specifies the identification number of the ID-based shared library being 12103compiled. Specifying a value of 0 generates more compact code; specifying 12104other values forces the allocation of that number to the current 12105library but is no more space- or time-efficient than omitting this option. 12106 12107@item -msep-data 12108@opindex msep-data 12109Generate code that allows the data segment to be located in a different 12110area of memory from the text segment. This allows for execute in place in 12111an environment without virtual memory management by eliminating relocations 12112against the text section. 12113 12114@item -mno-sep-data 12115@opindex mno-sep-data 12116Generate code that assumes that the data segment follows the text segment. 12117This is the default. 12118 12119@item -mlong-calls 12120@itemx -mno-long-calls 12121@opindex mlong-calls 12122@opindex mno-long-calls 12123Tells the compiler to perform function calls by first loading the 12124address of the function into a register and then performing a subroutine 12125call on this register. This switch is needed if the target function 12126lies outside of the 24-bit addressing range of the offset-based 12127version of subroutine call instruction. 12128 12129This feature is not enabled by default. Specifying 12130@option{-mno-long-calls} restores the default behavior. Note these 12131switches have no effect on how the compiler generates code to handle 12132function calls via function pointers. 12133 12134@item -mfast-fp 12135@opindex mfast-fp 12136Link with the fast floating-point library. This library relaxes some of 12137the IEEE floating-point standard's rules for checking inputs against 12138Not-a-Number (NAN), in the interest of performance. 12139 12140@item -minline-plt 12141@opindex minline-plt 12142Enable inlining of PLT entries in function calls to functions that are 12143not known to bind locally. It has no effect without @option{-mfdpic}. 12144 12145@item -mmulticore 12146@opindex mmulticore 12147Build a standalone application for multicore Blackfin processors. 12148This option causes proper start files and link scripts supporting 12149multicore to be used, and defines the macro @code{__BFIN_MULTICORE}. 12150It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}. 12151 12152This option can be used with @option{-mcorea} or @option{-mcoreb}, which 12153selects the one-application-per-core programming model. Without 12154@option{-mcorea} or @option{-mcoreb}, the single-application/dual-core 12155programming model is used. In this model, the main function of Core B 12156should be named as @code{coreb_main}. 12157 12158If this option is not used, the single-core application programming 12159model is used. 12160 12161@item -mcorea 12162@opindex mcorea 12163Build a standalone application for Core A of BF561 when using 12164the one-application-per-core programming model. Proper start files 12165and link scripts are used to support Core A, and the macro 12166@code{__BFIN_COREA} is defined. 12167This option can only be used in conjunction with @option{-mmulticore}. 12168 12169@item -mcoreb 12170@opindex mcoreb 12171Build a standalone application for Core B of BF561 when using 12172the one-application-per-core programming model. Proper start files 12173and link scripts are used to support Core B, and the macro 12174@code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main} 12175should be used instead of @code{main}. 12176This option can only be used in conjunction with @option{-mmulticore}. 12177 12178@item -msdram 12179@opindex msdram 12180Build a standalone application for SDRAM. Proper start files and 12181link scripts are used to put the application into SDRAM, and the macro 12182@code{__BFIN_SDRAM} is defined. 12183The loader should initialize SDRAM before loading the application. 12184 12185@item -micplb 12186@opindex micplb 12187Assume that ICPLBs are enabled at run time. This has an effect on certain 12188anomaly workarounds. For Linux targets, the default is to assume ICPLBs 12189are enabled; for standalone applications the default is off. 12190@end table 12191 12192@node C6X Options 12193@subsection C6X Options 12194@cindex C6X Options 12195 12196@table @gcctabopt 12197@item -march=@var{name} 12198@opindex march 12199This specifies the name of the target architecture. GCC uses this 12200name to determine what kind of instructions it can emit when generating 12201assembly code. Permissible names are: @samp{c62x}, 12202@samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}. 12203 12204@item -mbig-endian 12205@opindex mbig-endian 12206Generate code for a big-endian target. 12207 12208@item -mlittle-endian 12209@opindex mlittle-endian 12210Generate code for a little-endian target. This is the default. 12211 12212@item -msim 12213@opindex msim 12214Choose startup files and linker script suitable for the simulator. 12215 12216@item -msdata=default 12217@opindex msdata=default 12218Put small global and static data in the @samp{.neardata} section, 12219which is pointed to by register @code{B14}. Put small uninitialized 12220global and static data in the @samp{.bss} section, which is adjacent 12221to the @samp{.neardata} section. Put small read-only data into the 12222@samp{.rodata} section. The corresponding sections used for large 12223pieces of data are @samp{.fardata}, @samp{.far} and @samp{.const}. 12224 12225@item -msdata=all 12226@opindex msdata=all 12227Put all data, not just small objects, into the sections reserved for 12228small data, and use addressing relative to the @code{B14} register to 12229access them. 12230 12231@item -msdata=none 12232@opindex msdata=none 12233Make no use of the sections reserved for small data, and use absolute 12234addresses to access all data. Put all initialized global and static 12235data in the @samp{.fardata} section, and all uninitialized data in the 12236@samp{.far} section. Put all constant data into the @samp{.const} 12237section. 12238@end table 12239 12240@node CRIS Options 12241@subsection CRIS Options 12242@cindex CRIS Options 12243 12244These options are defined specifically for the CRIS ports. 12245 12246@table @gcctabopt 12247@item -march=@var{architecture-type} 12248@itemx -mcpu=@var{architecture-type} 12249@opindex march 12250@opindex mcpu 12251Generate code for the specified architecture. The choices for 12252@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for 12253respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@. 12254Default is @samp{v0} except for cris-axis-linux-gnu, where the default is 12255@samp{v10}. 12256 12257@item -mtune=@var{architecture-type} 12258@opindex mtune 12259Tune to @var{architecture-type} everything applicable about the generated 12260code, except for the ABI and the set of available instructions. The 12261choices for @var{architecture-type} are the same as for 12262@option{-march=@var{architecture-type}}. 12263 12264@item -mmax-stack-frame=@var{n} 12265@opindex mmax-stack-frame 12266Warn when the stack frame of a function exceeds @var{n} bytes. 12267 12268@item -metrax4 12269@itemx -metrax100 12270@opindex metrax4 12271@opindex metrax100 12272The options @option{-metrax4} and @option{-metrax100} are synonyms for 12273@option{-march=v3} and @option{-march=v8} respectively. 12274 12275@item -mmul-bug-workaround 12276@itemx -mno-mul-bug-workaround 12277@opindex mmul-bug-workaround 12278@opindex mno-mul-bug-workaround 12279Work around a bug in the @code{muls} and @code{mulu} instructions for CPU 12280models where it applies. This option is active by default. 12281 12282@item -mpdebug 12283@opindex mpdebug 12284Enable CRIS-specific verbose debug-related information in the assembly 12285code. This option also has the effect of turning off the @samp{#NO_APP} 12286formatted-code indicator to the assembler at the beginning of the 12287assembly file. 12288 12289@item -mcc-init 12290@opindex mcc-init 12291Do not use condition-code results from previous instruction; always emit 12292compare and test instructions before use of condition codes. 12293 12294@item -mno-side-effects 12295@opindex mno-side-effects 12296Do not emit instructions with side effects in addressing modes other than 12297post-increment. 12298 12299@item -mstack-align 12300@itemx -mno-stack-align 12301@itemx -mdata-align 12302@itemx -mno-data-align 12303@itemx -mconst-align 12304@itemx -mno-const-align 12305@opindex mstack-align 12306@opindex mno-stack-align 12307@opindex mdata-align 12308@opindex mno-data-align 12309@opindex mconst-align 12310@opindex mno-const-align 12311These options (@samp{no-} options) arrange (eliminate arrangements) for the 12312stack frame, individual data and constants to be aligned for the maximum 12313single data access size for the chosen CPU model. The default is to 12314arrange for 32-bit alignment. ABI details such as structure layout are 12315not affected by these options. 12316 12317@item -m32-bit 12318@itemx -m16-bit 12319@itemx -m8-bit 12320@opindex m32-bit 12321@opindex m16-bit 12322@opindex m8-bit 12323Similar to the stack- data- and const-align options above, these options 12324arrange for stack frame, writable data and constants to all be 32-bit, 1232516-bit or 8-bit aligned. The default is 32-bit alignment. 12326 12327@item -mno-prologue-epilogue 12328@itemx -mprologue-epilogue 12329@opindex mno-prologue-epilogue 12330@opindex mprologue-epilogue 12331With @option{-mno-prologue-epilogue}, the normal function prologue and 12332epilogue which set up the stack frame are omitted and no return 12333instructions or return sequences are generated in the code. Use this 12334option only together with visual inspection of the compiled code: no 12335warnings or errors are generated when call-saved registers must be saved, 12336or storage for local variables needs to be allocated. 12337 12338@item -mno-gotplt 12339@itemx -mgotplt 12340@opindex mno-gotplt 12341@opindex mgotplt 12342With @option{-fpic} and @option{-fPIC}, don't generate (do generate) 12343instruction sequences that load addresses for functions from the PLT part 12344of the GOT rather than (traditional on other architectures) calls to the 12345PLT@. The default is @option{-mgotplt}. 12346 12347@item -melf 12348@opindex melf 12349Legacy no-op option only recognized with the cris-axis-elf and 12350cris-axis-linux-gnu targets. 12351 12352@item -mlinux 12353@opindex mlinux 12354Legacy no-op option only recognized with the cris-axis-linux-gnu target. 12355 12356@item -sim 12357@opindex sim 12358This option, recognized for the cris-axis-elf, arranges 12359to link with input-output functions from a simulator library. Code, 12360initialized data and zero-initialized data are allocated consecutively. 12361 12362@item -sim2 12363@opindex sim2 12364Like @option{-sim}, but pass linker options to locate initialized data at 123650x40000000 and zero-initialized data at 0x80000000. 12366@end table 12367 12368@node CR16 Options 12369@subsection CR16 Options 12370@cindex CR16 Options 12371 12372These options are defined specifically for the CR16 ports. 12373 12374@table @gcctabopt 12375 12376@item -mmac 12377@opindex mmac 12378Enable the use of multiply-accumulate instructions. Disabled by default. 12379 12380@item -mcr16cplus 12381@itemx -mcr16c 12382@opindex mcr16cplus 12383@opindex mcr16c 12384Generate code for CR16C or CR16C+ architecture. CR16C+ architecture 12385is default. 12386 12387@item -msim 12388@opindex msim 12389Links the library libsim.a which is in compatible with simulator. Applicable 12390to ELF compiler only. 12391 12392@item -mint32 12393@opindex mint32 12394Choose integer type as 32-bit wide. 12395 12396@item -mbit-ops 12397@opindex mbit-ops 12398Generates @code{sbit}/@code{cbit} instructions for bit manipulations. 12399 12400@item -mdata-model=@var{model} 12401@opindex mdata-model 12402Choose a data model. The choices for @var{model} are @samp{near}, 12403@samp{far} or @samp{medium}. @samp{medium} is default. 12404However, @samp{far} is not valid with @option{-mcr16c}, as the 12405CR16C architecture does not support the far data model. 12406@end table 12407 12408@node Darwin Options 12409@subsection Darwin Options 12410@cindex Darwin options 12411 12412These options are defined for all architectures running the Darwin operating 12413system. 12414 12415FSF GCC on Darwin does not create ``fat'' object files; it creates 12416an object file for the single architecture that GCC was built to 12417target. Apple's GCC on Darwin does create ``fat'' files if multiple 12418@option{-arch} options are used; it does so by running the compiler or 12419linker multiple times and joining the results together with 12420@file{lipo}. 12421 12422The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or 12423@samp{i686}) is determined by the flags that specify the ISA 12424that GCC is targeting, like @option{-mcpu} or @option{-march}. The 12425@option{-force_cpusubtype_ALL} option can be used to override this. 12426 12427The Darwin tools vary in their behavior when presented with an ISA 12428mismatch. The assembler, @file{as}, only permits instructions to 12429be used that are valid for the subtype of the file it is generating, 12430so you cannot put 64-bit instructions in a @samp{ppc750} object file. 12431The linker for shared libraries, @file{/usr/bin/libtool}, fails 12432and prints an error if asked to create a shared library with a less 12433restrictive subtype than its input files (for instance, trying to put 12434a @samp{ppc970} object file in a @samp{ppc7400} library). The linker 12435for executables, @command{ld}, quietly gives the executable the most 12436restrictive subtype of any of its input files. 12437 12438@table @gcctabopt 12439@item -F@var{dir} 12440@opindex F 12441Add the framework directory @var{dir} to the head of the list of 12442directories to be searched for header files. These directories are 12443interleaved with those specified by @option{-I} options and are 12444scanned in a left-to-right order. 12445 12446A framework directory is a directory with frameworks in it. A 12447framework is a directory with a @file{Headers} and/or 12448@file{PrivateHeaders} directory contained directly in it that ends 12449in @file{.framework}. The name of a framework is the name of this 12450directory excluding the @file{.framework}. Headers associated with 12451the framework are found in one of those two directories, with 12452@file{Headers} being searched first. A subframework is a framework 12453directory that is in a framework's @file{Frameworks} directory. 12454Includes of subframework headers can only appear in a header of a 12455framework that contains the subframework, or in a sibling subframework 12456header. Two subframeworks are siblings if they occur in the same 12457framework. A subframework should not have the same name as a 12458framework; a warning is issued if this is violated. Currently a 12459subframework cannot have subframeworks; in the future, the mechanism 12460may be extended to support this. The standard frameworks can be found 12461in @file{/System/Library/Frameworks} and 12462@file{/Library/Frameworks}. An example include looks like 12463@code{#include <Framework/header.h>}, where @file{Framework} denotes 12464the name of the framework and @file{header.h} is found in the 12465@file{PrivateHeaders} or @file{Headers} directory. 12466 12467@item -iframework@var{dir} 12468@opindex iframework 12469Like @option{-F} except the directory is a treated as a system 12470directory. The main difference between this @option{-iframework} and 12471@option{-F} is that with @option{-iframework} the compiler does not 12472warn about constructs contained within header files found via 12473@var{dir}. This option is valid only for the C family of languages. 12474 12475@item -gused 12476@opindex gused 12477Emit debugging information for symbols that are used. For stabs 12478debugging format, this enables @option{-feliminate-unused-debug-symbols}. 12479This is by default ON@. 12480 12481@item -gfull 12482@opindex gfull 12483Emit debugging information for all symbols and types. 12484 12485@item -mmacosx-version-min=@var{version} 12486The earliest version of MacOS X that this executable will run on 12487is @var{version}. Typical values of @var{version} include @code{10.1}, 12488@code{10.2}, and @code{10.3.9}. 12489 12490If the compiler was built to use the system's headers by default, 12491then the default for this option is the system version on which the 12492compiler is running, otherwise the default is to make choices that 12493are compatible with as many systems and code bases as possible. 12494 12495@item -mkernel 12496@opindex mkernel 12497Enable kernel development mode. The @option{-mkernel} option sets 12498@option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit}, 12499@option{-fno-exceptions}, @option{-fno-non-call-exceptions}, 12500@option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where 12501applicable. This mode also sets @option{-mno-altivec}, 12502@option{-msoft-float}, @option{-fno-builtin} and 12503@option{-mlong-branch} for PowerPC targets. 12504 12505@item -mone-byte-bool 12506@opindex mone-byte-bool 12507Override the defaults for @samp{bool} so that @samp{sizeof(bool)==1}. 12508By default @samp{sizeof(bool)} is @samp{4} when compiling for 12509Darwin/PowerPC and @samp{1} when compiling for Darwin/x86, so this 12510option has no effect on x86. 12511 12512@strong{Warning:} The @option{-mone-byte-bool} switch causes GCC 12513to generate code that is not binary compatible with code generated 12514without that switch. Using this switch may require recompiling all 12515other modules in a program, including system libraries. Use this 12516switch to conform to a non-default data model. 12517 12518@item -mfix-and-continue 12519@itemx -ffix-and-continue 12520@itemx -findirect-data 12521@opindex mfix-and-continue 12522@opindex ffix-and-continue 12523@opindex findirect-data 12524Generate code suitable for fast turnaround development, such as to 12525allow GDB to dynamically load @code{.o} files into already-running 12526programs. @option{-findirect-data} and @option{-ffix-and-continue} 12527are provided for backwards compatibility. 12528 12529@item -all_load 12530@opindex all_load 12531Loads all members of static archive libraries. 12532See man ld(1) for more information. 12533 12534@item -arch_errors_fatal 12535@opindex arch_errors_fatal 12536Cause the errors having to do with files that have the wrong architecture 12537to be fatal. 12538 12539@item -bind_at_load 12540@opindex bind_at_load 12541Causes the output file to be marked such that the dynamic linker will 12542bind all undefined references when the file is loaded or launched. 12543 12544@item -bundle 12545@opindex bundle 12546Produce a Mach-o bundle format file. 12547See man ld(1) for more information. 12548 12549@item -bundle_loader @var{executable} 12550@opindex bundle_loader 12551This option specifies the @var{executable} that will load the build 12552output file being linked. See man ld(1) for more information. 12553 12554@item -dynamiclib 12555@opindex dynamiclib 12556When passed this option, GCC produces a dynamic library instead of 12557an executable when linking, using the Darwin @file{libtool} command. 12558 12559@item -force_cpusubtype_ALL 12560@opindex force_cpusubtype_ALL 12561This causes GCC's output file to have the @var{ALL} subtype, instead of 12562one controlled by the @option{-mcpu} or @option{-march} option. 12563 12564@item -allowable_client @var{client_name} 12565@itemx -client_name 12566@itemx -compatibility_version 12567@itemx -current_version 12568@itemx -dead_strip 12569@itemx -dependency-file 12570@itemx -dylib_file 12571@itemx -dylinker_install_name 12572@itemx -dynamic 12573@itemx -exported_symbols_list 12574@itemx -filelist 12575@need 800 12576@itemx -flat_namespace 12577@itemx -force_flat_namespace 12578@itemx -headerpad_max_install_names 12579@itemx -image_base 12580@itemx -init 12581@itemx -install_name 12582@itemx -keep_private_externs 12583@itemx -multi_module 12584@itemx -multiply_defined 12585@itemx -multiply_defined_unused 12586@need 800 12587@itemx -noall_load 12588@itemx -no_dead_strip_inits_and_terms 12589@itemx -nofixprebinding 12590@itemx -nomultidefs 12591@itemx -noprebind 12592@itemx -noseglinkedit 12593@itemx -pagezero_size 12594@itemx -prebind 12595@itemx -prebind_all_twolevel_modules 12596@itemx -private_bundle 12597@need 800 12598@itemx -read_only_relocs 12599@itemx -sectalign 12600@itemx -sectobjectsymbols 12601@itemx -whyload 12602@itemx -seg1addr 12603@itemx -sectcreate 12604@itemx -sectobjectsymbols 12605@itemx -sectorder 12606@itemx -segaddr 12607@itemx -segs_read_only_addr 12608@need 800 12609@itemx -segs_read_write_addr 12610@itemx -seg_addr_table 12611@itemx -seg_addr_table_filename 12612@itemx -seglinkedit 12613@itemx -segprot 12614@itemx -segs_read_only_addr 12615@itemx -segs_read_write_addr 12616@itemx -single_module 12617@itemx -static 12618@itemx -sub_library 12619@need 800 12620@itemx -sub_umbrella 12621@itemx -twolevel_namespace 12622@itemx -umbrella 12623@itemx -undefined 12624@itemx -unexported_symbols_list 12625@itemx -weak_reference_mismatches 12626@itemx -whatsloaded 12627@opindex allowable_client 12628@opindex client_name 12629@opindex compatibility_version 12630@opindex current_version 12631@opindex dead_strip 12632@opindex dependency-file 12633@opindex dylib_file 12634@opindex dylinker_install_name 12635@opindex dynamic 12636@opindex exported_symbols_list 12637@opindex filelist 12638@opindex flat_namespace 12639@opindex force_flat_namespace 12640@opindex headerpad_max_install_names 12641@opindex image_base 12642@opindex init 12643@opindex install_name 12644@opindex keep_private_externs 12645@opindex multi_module 12646@opindex multiply_defined 12647@opindex multiply_defined_unused 12648@opindex noall_load 12649@opindex no_dead_strip_inits_and_terms 12650@opindex nofixprebinding 12651@opindex nomultidefs 12652@opindex noprebind 12653@opindex noseglinkedit 12654@opindex pagezero_size 12655@opindex prebind 12656@opindex prebind_all_twolevel_modules 12657@opindex private_bundle 12658@opindex read_only_relocs 12659@opindex sectalign 12660@opindex sectobjectsymbols 12661@opindex whyload 12662@opindex seg1addr 12663@opindex sectcreate 12664@opindex sectobjectsymbols 12665@opindex sectorder 12666@opindex segaddr 12667@opindex segs_read_only_addr 12668@opindex segs_read_write_addr 12669@opindex seg_addr_table 12670@opindex seg_addr_table_filename 12671@opindex seglinkedit 12672@opindex segprot 12673@opindex segs_read_only_addr 12674@opindex segs_read_write_addr 12675@opindex single_module 12676@opindex static 12677@opindex sub_library 12678@opindex sub_umbrella 12679@opindex twolevel_namespace 12680@opindex umbrella 12681@opindex undefined 12682@opindex unexported_symbols_list 12683@opindex weak_reference_mismatches 12684@opindex whatsloaded 12685These options are passed to the Darwin linker. The Darwin linker man page 12686describes them in detail. 12687@end table 12688 12689@node DEC Alpha Options 12690@subsection DEC Alpha Options 12691 12692These @samp{-m} options are defined for the DEC Alpha implementations: 12693 12694@table @gcctabopt 12695@item -mno-soft-float 12696@itemx -msoft-float 12697@opindex mno-soft-float 12698@opindex msoft-float 12699Use (do not use) the hardware floating-point instructions for 12700floating-point operations. When @option{-msoft-float} is specified, 12701functions in @file{libgcc.a} are used to perform floating-point 12702operations. Unless they are replaced by routines that emulate the 12703floating-point operations, or compiled in such a way as to call such 12704emulations routines, these routines issue floating-point 12705operations. If you are compiling for an Alpha without floating-point 12706operations, you must ensure that the library is built so as not to call 12707them. 12708 12709Note that Alpha implementations without floating-point operations are 12710required to have floating-point registers. 12711 12712@item -mfp-reg 12713@itemx -mno-fp-regs 12714@opindex mfp-reg 12715@opindex mno-fp-regs 12716Generate code that uses (does not use) the floating-point register set. 12717@option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point 12718register set is not used, floating-point operands are passed in integer 12719registers as if they were integers and floating-point results are passed 12720in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence, 12721so any function with a floating-point argument or return value called by code 12722compiled with @option{-mno-fp-regs} must also be compiled with that 12723option. 12724 12725A typical use of this option is building a kernel that does not use, 12726and hence need not save and restore, any floating-point registers. 12727 12728@item -mieee 12729@opindex mieee 12730The Alpha architecture implements floating-point hardware optimized for 12731maximum performance. It is mostly compliant with the IEEE floating-point 12732standard. However, for full compliance, software assistance is 12733required. This option generates code fully IEEE-compliant code 12734@emph{except} that the @var{inexact-flag} is not maintained (see below). 12735If this option is turned on, the preprocessor macro @code{_IEEE_FP} is 12736defined during compilation. The resulting code is less efficient but is 12737able to correctly support denormalized numbers and exceptional IEEE 12738values such as not-a-number and plus/minus infinity. Other Alpha 12739compilers call this option @option{-ieee_with_no_inexact}. 12740 12741@item -mieee-with-inexact 12742@opindex mieee-with-inexact 12743This is like @option{-mieee} except the generated code also maintains 12744the IEEE @var{inexact-flag}. Turning on this option causes the 12745generated code to implement fully-compliant IEEE math. In addition to 12746@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor 12747macro. On some Alpha implementations the resulting code may execute 12748significantly slower than the code generated by default. Since there is 12749very little code that depends on the @var{inexact-flag}, you should 12750normally not specify this option. Other Alpha compilers call this 12751option @option{-ieee_with_inexact}. 12752 12753@item -mfp-trap-mode=@var{trap-mode} 12754@opindex mfp-trap-mode 12755This option controls what floating-point related traps are enabled. 12756Other Alpha compilers call this option @option{-fptm @var{trap-mode}}. 12757The trap mode can be set to one of four values: 12758 12759@table @samp 12760@item n 12761This is the default (normal) setting. The only traps that are enabled 12762are the ones that cannot be disabled in software (e.g., division by zero 12763trap). 12764 12765@item u 12766In addition to the traps enabled by @samp{n}, underflow traps are enabled 12767as well. 12768 12769@item su 12770Like @samp{u}, but the instructions are marked to be safe for software 12771completion (see Alpha architecture manual for details). 12772 12773@item sui 12774Like @samp{su}, but inexact traps are enabled as well. 12775@end table 12776 12777@item -mfp-rounding-mode=@var{rounding-mode} 12778@opindex mfp-rounding-mode 12779Selects the IEEE rounding mode. Other Alpha compilers call this option 12780@option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one 12781of: 12782 12783@table @samp 12784@item n 12785Normal IEEE rounding mode. Floating-point numbers are rounded towards 12786the nearest machine number or towards the even machine number in case 12787of a tie. 12788 12789@item m 12790Round towards minus infinity. 12791 12792@item c 12793Chopped rounding mode. Floating-point numbers are rounded towards zero. 12794 12795@item d 12796Dynamic rounding mode. A field in the floating-point control register 12797(@var{fpcr}, see Alpha architecture reference manual) controls the 12798rounding mode in effect. The C library initializes this register for 12799rounding towards plus infinity. Thus, unless your program modifies the 12800@var{fpcr}, @samp{d} corresponds to round towards plus infinity. 12801@end table 12802 12803@item -mtrap-precision=@var{trap-precision} 12804@opindex mtrap-precision 12805In the Alpha architecture, floating-point traps are imprecise. This 12806means without software assistance it is impossible to recover from a 12807floating trap and program execution normally needs to be terminated. 12808GCC can generate code that can assist operating system trap handlers 12809in determining the exact location that caused a floating-point trap. 12810Depending on the requirements of an application, different levels of 12811precisions can be selected: 12812 12813@table @samp 12814@item p 12815Program precision. This option is the default and means a trap handler 12816can only identify which program caused a floating-point exception. 12817 12818@item f 12819Function precision. The trap handler can determine the function that 12820caused a floating-point exception. 12821 12822@item i 12823Instruction precision. The trap handler can determine the exact 12824instruction that caused a floating-point exception. 12825@end table 12826 12827Other Alpha compilers provide the equivalent options called 12828@option{-scope_safe} and @option{-resumption_safe}. 12829 12830@item -mieee-conformant 12831@opindex mieee-conformant 12832This option marks the generated code as IEEE conformant. You must not 12833use this option unless you also specify @option{-mtrap-precision=i} and either 12834@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect 12835is to emit the line @samp{.eflag 48} in the function prologue of the 12836generated assembly file. 12837 12838@item -mbuild-constants 12839@opindex mbuild-constants 12840Normally GCC examines a 32- or 64-bit integer constant to 12841see if it can construct it from smaller constants in two or three 12842instructions. If it cannot, it outputs the constant as a literal and 12843generates code to load it from the data segment at run time. 12844 12845Use this option to require GCC to construct @emph{all} integer constants 12846using code, even if it takes more instructions (the maximum is six). 12847 12848You typically use this option to build a shared library dynamic 12849loader. Itself a shared library, it must relocate itself in memory 12850before it can find the variables and constants in its own data segment. 12851 12852@item -mbwx 12853@itemx -mno-bwx 12854@itemx -mcix 12855@itemx -mno-cix 12856@itemx -mfix 12857@itemx -mno-fix 12858@itemx -mmax 12859@itemx -mno-max 12860@opindex mbwx 12861@opindex mno-bwx 12862@opindex mcix 12863@opindex mno-cix 12864@opindex mfix 12865@opindex mno-fix 12866@opindex mmax 12867@opindex mno-max 12868Indicate whether GCC should generate code to use the optional BWX, 12869CIX, FIX and MAX instruction sets. The default is to use the instruction 12870sets supported by the CPU type specified via @option{-mcpu=} option or that 12871of the CPU on which GCC was built if none is specified. 12872 12873@item -mfloat-vax 12874@itemx -mfloat-ieee 12875@opindex mfloat-vax 12876@opindex mfloat-ieee 12877Generate code that uses (does not use) VAX F and G floating-point 12878arithmetic instead of IEEE single and double precision. 12879 12880@item -mexplicit-relocs 12881@itemx -mno-explicit-relocs 12882@opindex mexplicit-relocs 12883@opindex mno-explicit-relocs 12884Older Alpha assemblers provided no way to generate symbol relocations 12885except via assembler macros. Use of these macros does not allow 12886optimal instruction scheduling. GNU binutils as of version 2.12 12887supports a new syntax that allows the compiler to explicitly mark 12888which relocations should apply to which instructions. This option 12889is mostly useful for debugging, as GCC detects the capabilities of 12890the assembler when it is built and sets the default accordingly. 12891 12892@item -msmall-data 12893@itemx -mlarge-data 12894@opindex msmall-data 12895@opindex mlarge-data 12896When @option{-mexplicit-relocs} is in effect, static data is 12897accessed via @dfn{gp-relative} relocations. When @option{-msmall-data} 12898is used, objects 8 bytes long or smaller are placed in a @dfn{small data area} 12899(the @code{.sdata} and @code{.sbss} sections) and are accessed via 1290016-bit relocations off of the @code{$gp} register. This limits the 12901size of the small data area to 64KB, but allows the variables to be 12902directly accessed via a single instruction. 12903 12904The default is @option{-mlarge-data}. With this option the data area 12905is limited to just below 2GB@. Programs that require more than 2GB of 12906data must use @code{malloc} or @code{mmap} to allocate the data in the 12907heap instead of in the program's data segment. 12908 12909When generating code for shared libraries, @option{-fpic} implies 12910@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}. 12911 12912@item -msmall-text 12913@itemx -mlarge-text 12914@opindex msmall-text 12915@opindex mlarge-text 12916When @option{-msmall-text} is used, the compiler assumes that the 12917code of the entire program (or shared library) fits in 4MB, and is 12918thus reachable with a branch instruction. When @option{-msmall-data} 12919is used, the compiler can assume that all local symbols share the 12920same @code{$gp} value, and thus reduce the number of instructions 12921required for a function call from 4 to 1. 12922 12923The default is @option{-mlarge-text}. 12924 12925@item -mcpu=@var{cpu_type} 12926@opindex mcpu 12927Set the instruction set and instruction scheduling parameters for 12928machine type @var{cpu_type}. You can specify either the @samp{EV} 12929style name or the corresponding chip number. GCC supports scheduling 12930parameters for the EV4, EV5 and EV6 family of processors and 12931chooses the default values for the instruction set from the processor 12932you specify. If you do not specify a processor type, GCC defaults 12933to the processor on which the compiler was built. 12934 12935Supported values for @var{cpu_type} are 12936 12937@table @samp 12938@item ev4 12939@itemx ev45 12940@itemx 21064 12941Schedules as an EV4 and has no instruction set extensions. 12942 12943@item ev5 12944@itemx 21164 12945Schedules as an EV5 and has no instruction set extensions. 12946 12947@item ev56 12948@itemx 21164a 12949Schedules as an EV5 and supports the BWX extension. 12950 12951@item pca56 12952@itemx 21164pc 12953@itemx 21164PC 12954Schedules as an EV5 and supports the BWX and MAX extensions. 12955 12956@item ev6 12957@itemx 21264 12958Schedules as an EV6 and supports the BWX, FIX, and MAX extensions. 12959 12960@item ev67 12961@itemx 21264a 12962Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions. 12963@end table 12964 12965Native toolchains also support the value @samp{native}, 12966which selects the best architecture option for the host processor. 12967@option{-mcpu=native} has no effect if GCC does not recognize 12968the processor. 12969 12970@item -mtune=@var{cpu_type} 12971@opindex mtune 12972Set only the instruction scheduling parameters for machine type 12973@var{cpu_type}. The instruction set is not changed. 12974 12975Native toolchains also support the value @samp{native}, 12976which selects the best architecture option for the host processor. 12977@option{-mtune=native} has no effect if GCC does not recognize 12978the processor. 12979 12980@item -mmemory-latency=@var{time} 12981@opindex mmemory-latency 12982Sets the latency the scheduler should assume for typical memory 12983references as seen by the application. This number is highly 12984dependent on the memory access patterns used by the application 12985and the size of the external cache on the machine. 12986 12987Valid options for @var{time} are 12988 12989@table @samp 12990@item @var{number} 12991A decimal number representing clock cycles. 12992 12993@item L1 12994@itemx L2 12995@itemx L3 12996@itemx main 12997The compiler contains estimates of the number of clock cycles for 12998``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches 12999(also called Dcache, Scache, and Bcache), as well as to main memory. 13000Note that L3 is only valid for EV5. 13001 13002@end table 13003@end table 13004 13005@node FR30 Options 13006@subsection FR30 Options 13007@cindex FR30 Options 13008 13009These options are defined specifically for the FR30 port. 13010 13011@table @gcctabopt 13012 13013@item -msmall-model 13014@opindex msmall-model 13015Use the small address space model. This can produce smaller code, but 13016it does assume that all symbolic values and addresses fit into a 1301720-bit range. 13018 13019@item -mno-lsim 13020@opindex mno-lsim 13021Assume that runtime support has been provided and so there is no need 13022to include the simulator library (@file{libsim.a}) on the linker 13023command line. 13024 13025@end table 13026 13027@node FRV Options 13028@subsection FRV Options 13029@cindex FRV Options 13030 13031@table @gcctabopt 13032@item -mgpr-32 13033@opindex mgpr-32 13034 13035Only use the first 32 general-purpose registers. 13036 13037@item -mgpr-64 13038@opindex mgpr-64 13039 13040Use all 64 general-purpose registers. 13041 13042@item -mfpr-32 13043@opindex mfpr-32 13044 13045Use only the first 32 floating-point registers. 13046 13047@item -mfpr-64 13048@opindex mfpr-64 13049 13050Use all 64 floating-point registers. 13051 13052@item -mhard-float 13053@opindex mhard-float 13054 13055Use hardware instructions for floating-point operations. 13056 13057@item -msoft-float 13058@opindex msoft-float 13059 13060Use library routines for floating-point operations. 13061 13062@item -malloc-cc 13063@opindex malloc-cc 13064 13065Dynamically allocate condition code registers. 13066 13067@item -mfixed-cc 13068@opindex mfixed-cc 13069 13070Do not try to dynamically allocate condition code registers, only 13071use @code{icc0} and @code{fcc0}. 13072 13073@item -mdword 13074@opindex mdword 13075 13076Change ABI to use double word insns. 13077 13078@item -mno-dword 13079@opindex mno-dword 13080 13081Do not use double word instructions. 13082 13083@item -mdouble 13084@opindex mdouble 13085 13086Use floating-point double instructions. 13087 13088@item -mno-double 13089@opindex mno-double 13090 13091Do not use floating-point double instructions. 13092 13093@item -mmedia 13094@opindex mmedia 13095 13096Use media instructions. 13097 13098@item -mno-media 13099@opindex mno-media 13100 13101Do not use media instructions. 13102 13103@item -mmuladd 13104@opindex mmuladd 13105 13106Use multiply and add/subtract instructions. 13107 13108@item -mno-muladd 13109@opindex mno-muladd 13110 13111Do not use multiply and add/subtract instructions. 13112 13113@item -mfdpic 13114@opindex mfdpic 13115 13116Select the FDPIC ABI, which uses function descriptors to represent 13117pointers to functions. Without any PIC/PIE-related options, it 13118implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it 13119assumes GOT entries and small data are within a 12-bit range from the 13120GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets 13121are computed with 32 bits. 13122With a @samp{bfin-elf} target, this option implies @option{-msim}. 13123 13124@item -minline-plt 13125@opindex minline-plt 13126 13127Enable inlining of PLT entries in function calls to functions that are 13128not known to bind locally. It has no effect without @option{-mfdpic}. 13129It's enabled by default if optimizing for speed and compiling for 13130shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an 13131optimization option such as @option{-O3} or above is present in the 13132command line. 13133 13134@item -mTLS 13135@opindex mTLS 13136 13137Assume a large TLS segment when generating thread-local code. 13138 13139@item -mtls 13140@opindex mtls 13141 13142Do not assume a large TLS segment when generating thread-local code. 13143 13144@item -mgprel-ro 13145@opindex mgprel-ro 13146 13147Enable the use of @code{GPREL} relocations in the FDPIC ABI for data 13148that is known to be in read-only sections. It's enabled by default, 13149except for @option{-fpic} or @option{-fpie}: even though it may help 13150make the global offset table smaller, it trades 1 instruction for 4. 13151With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4, 13152one of which may be shared by multiple symbols, and it avoids the need 13153for a GOT entry for the referenced symbol, so it's more likely to be a 13154win. If it is not, @option{-mno-gprel-ro} can be used to disable it. 13155 13156@item -multilib-library-pic 13157@opindex multilib-library-pic 13158 13159Link with the (library, not FD) pic libraries. It's implied by 13160@option{-mlibrary-pic}, as well as by @option{-fPIC} and 13161@option{-fpic} without @option{-mfdpic}. You should never have to use 13162it explicitly. 13163 13164@item -mlinked-fp 13165@opindex mlinked-fp 13166 13167Follow the EABI requirement of always creating a frame pointer whenever 13168a stack frame is allocated. This option is enabled by default and can 13169be disabled with @option{-mno-linked-fp}. 13170 13171@item -mlong-calls 13172@opindex mlong-calls 13173 13174Use indirect addressing to call functions outside the current 13175compilation unit. This allows the functions to be placed anywhere 13176within the 32-bit address space. 13177 13178@item -malign-labels 13179@opindex malign-labels 13180 13181Try to align labels to an 8-byte boundary by inserting NOPs into the 13182previous packet. This option only has an effect when VLIW packing 13183is enabled. It doesn't create new packets; it merely adds NOPs to 13184existing ones. 13185 13186@item -mlibrary-pic 13187@opindex mlibrary-pic 13188 13189Generate position-independent EABI code. 13190 13191@item -macc-4 13192@opindex macc-4 13193 13194Use only the first four media accumulator registers. 13195 13196@item -macc-8 13197@opindex macc-8 13198 13199Use all eight media accumulator registers. 13200 13201@item -mpack 13202@opindex mpack 13203 13204Pack VLIW instructions. 13205 13206@item -mno-pack 13207@opindex mno-pack 13208 13209Do not pack VLIW instructions. 13210 13211@item -mno-eflags 13212@opindex mno-eflags 13213 13214Do not mark ABI switches in e_flags. 13215 13216@item -mcond-move 13217@opindex mcond-move 13218 13219Enable the use of conditional-move instructions (default). 13220 13221This switch is mainly for debugging the compiler and will likely be removed 13222in a future version. 13223 13224@item -mno-cond-move 13225@opindex mno-cond-move 13226 13227Disable the use of conditional-move instructions. 13228 13229This switch is mainly for debugging the compiler and will likely be removed 13230in a future version. 13231 13232@item -mscc 13233@opindex mscc 13234 13235Enable the use of conditional set instructions (default). 13236 13237This switch is mainly for debugging the compiler and will likely be removed 13238in a future version. 13239 13240@item -mno-scc 13241@opindex mno-scc 13242 13243Disable the use of conditional set instructions. 13244 13245This switch is mainly for debugging the compiler and will likely be removed 13246in a future version. 13247 13248@item -mcond-exec 13249@opindex mcond-exec 13250 13251Enable the use of conditional execution (default). 13252 13253This switch is mainly for debugging the compiler and will likely be removed 13254in a future version. 13255 13256@item -mno-cond-exec 13257@opindex mno-cond-exec 13258 13259Disable the use of conditional execution. 13260 13261This switch is mainly for debugging the compiler and will likely be removed 13262in a future version. 13263 13264@item -mvliw-branch 13265@opindex mvliw-branch 13266 13267Run a pass to pack branches into VLIW instructions (default). 13268 13269This switch is mainly for debugging the compiler and will likely be removed 13270in a future version. 13271 13272@item -mno-vliw-branch 13273@opindex mno-vliw-branch 13274 13275Do not run a pass to pack branches into VLIW instructions. 13276 13277This switch is mainly for debugging the compiler and will likely be removed 13278in a future version. 13279 13280@item -mmulti-cond-exec 13281@opindex mmulti-cond-exec 13282 13283Enable optimization of @code{&&} and @code{||} in conditional execution 13284(default). 13285 13286This switch is mainly for debugging the compiler and will likely be removed 13287in a future version. 13288 13289@item -mno-multi-cond-exec 13290@opindex mno-multi-cond-exec 13291 13292Disable optimization of @code{&&} and @code{||} in conditional execution. 13293 13294This switch is mainly for debugging the compiler and will likely be removed 13295in a future version. 13296 13297@item -mnested-cond-exec 13298@opindex mnested-cond-exec 13299 13300Enable nested conditional execution optimizations (default). 13301 13302This switch is mainly for debugging the compiler and will likely be removed 13303in a future version. 13304 13305@item -mno-nested-cond-exec 13306@opindex mno-nested-cond-exec 13307 13308Disable nested conditional execution optimizations. 13309 13310This switch is mainly for debugging the compiler and will likely be removed 13311in a future version. 13312 13313@item -moptimize-membar 13314@opindex moptimize-membar 13315 13316This switch removes redundant @code{membar} instructions from the 13317compiler-generated code. It is enabled by default. 13318 13319@item -mno-optimize-membar 13320@opindex mno-optimize-membar 13321 13322This switch disables the automatic removal of redundant @code{membar} 13323instructions from the generated code. 13324 13325@item -mtomcat-stats 13326@opindex mtomcat-stats 13327 13328Cause gas to print out tomcat statistics. 13329 13330@item -mcpu=@var{cpu} 13331@opindex mcpu 13332 13333Select the processor type for which to generate code. Possible values are 13334@samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450}, 13335@samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}. 13336 13337@end table 13338 13339@node GNU/Linux Options 13340@subsection GNU/Linux Options 13341 13342These @samp{-m} options are defined for GNU/Linux targets: 13343 13344@table @gcctabopt 13345@item -mglibc 13346@opindex mglibc 13347Use the GNU C library. This is the default except 13348on @samp{*-*-linux-*uclibc*} and @samp{*-*-linux-*android*} targets. 13349 13350@item -muclibc 13351@opindex muclibc 13352Use uClibc C library. This is the default on 13353@samp{*-*-linux-*uclibc*} targets. 13354 13355@item -mbionic 13356@opindex mbionic 13357Use Bionic C library. This is the default on 13358@samp{*-*-linux-*android*} targets. 13359 13360@item -mandroid 13361@opindex mandroid 13362Compile code compatible with Android platform. This is the default on 13363@samp{*-*-linux-*android*} targets. 13364 13365When compiling, this option enables @option{-mbionic}, @option{-fPIC}, 13366@option{-fno-exceptions} and @option{-fno-rtti} by default. When linking, 13367this option makes the GCC driver pass Android-specific options to the linker. 13368Finally, this option causes the preprocessor macro @code{__ANDROID__} 13369to be defined. 13370 13371@item -tno-android-cc 13372@opindex tno-android-cc 13373Disable compilation effects of @option{-mandroid}, i.e., do not enable 13374@option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and 13375@option{-fno-rtti} by default. 13376 13377@item -tno-android-ld 13378@opindex tno-android-ld 13379Disable linking effects of @option{-mandroid}, i.e., pass standard Linux 13380linking options to the linker. 13381 13382@end table 13383 13384@node H8/300 Options 13385@subsection H8/300 Options 13386 13387These @samp{-m} options are defined for the H8/300 implementations: 13388 13389@table @gcctabopt 13390@item -mrelax 13391@opindex mrelax 13392Shorten some address references at link time, when possible; uses the 13393linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300, 13394ld, Using ld}, for a fuller description. 13395 13396@item -mh 13397@opindex mh 13398Generate code for the H8/300H@. 13399 13400@item -ms 13401@opindex ms 13402Generate code for the H8S@. 13403 13404@item -mn 13405@opindex mn 13406Generate code for the H8S and H8/300H in the normal mode. This switch 13407must be used either with @option{-mh} or @option{-ms}. 13408 13409@item -ms2600 13410@opindex ms2600 13411Generate code for the H8S/2600. This switch must be used with @option{-ms}. 13412 13413@item -mexr 13414@opindex mexr 13415Extended registers are stored on stack before execution of function 13416with monitor attribute. Default option is @option{-mexr}. 13417This option is valid only for H8S targets. 13418 13419@item -mno-exr 13420@opindex mno-exr 13421Extended registers are not stored on stack before execution of function 13422with monitor attribute. Default option is @option{-mno-exr}. 13423This option is valid only for H8S targets. 13424 13425@item -mint32 13426@opindex mint32 13427Make @code{int} data 32 bits by default. 13428 13429@item -malign-300 13430@opindex malign-300 13431On the H8/300H and H8S, use the same alignment rules as for the H8/300. 13432The default for the H8/300H and H8S is to align longs and floats on 134334-byte boundaries. 13434@option{-malign-300} causes them to be aligned on 2-byte boundaries. 13435This option has no effect on the H8/300. 13436@end table 13437 13438@node HPPA Options 13439@subsection HPPA Options 13440@cindex HPPA Options 13441 13442These @samp{-m} options are defined for the HPPA family of computers: 13443 13444@table @gcctabopt 13445@item -march=@var{architecture-type} 13446@opindex march 13447Generate code for the specified architecture. The choices for 13448@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA 134491.1, and @samp{2.0} for PA 2.0 processors. Refer to 13450@file{/usr/lib/sched.models} on an HP-UX system to determine the proper 13451architecture option for your machine. Code compiled for lower numbered 13452architectures runs on higher numbered architectures, but not the 13453other way around. 13454 13455@item -mpa-risc-1-0 13456@itemx -mpa-risc-1-1 13457@itemx -mpa-risc-2-0 13458@opindex mpa-risc-1-0 13459@opindex mpa-risc-1-1 13460@opindex mpa-risc-2-0 13461Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively. 13462 13463@item -mbig-switch 13464@opindex mbig-switch 13465Generate code suitable for big switch tables. Use this option only if 13466the assembler/linker complain about out-of-range branches within a switch 13467table. 13468 13469@item -mjump-in-delay 13470@opindex mjump-in-delay 13471Fill delay slots of function calls with unconditional jump instructions 13472by modifying the return pointer for the function call to be the target 13473of the conditional jump. 13474 13475@item -mdisable-fpregs 13476@opindex mdisable-fpregs 13477Prevent floating-point registers from being used in any manner. This is 13478necessary for compiling kernels that perform lazy context switching of 13479floating-point registers. If you use this option and attempt to perform 13480floating-point operations, the compiler aborts. 13481 13482@item -mdisable-indexing 13483@opindex mdisable-indexing 13484Prevent the compiler from using indexing address modes. This avoids some 13485rather obscure problems when compiling MIG generated code under MACH@. 13486 13487@item -mno-space-regs 13488@opindex mno-space-regs 13489Generate code that assumes the target has no space registers. This allows 13490GCC to generate faster indirect calls and use unscaled index address modes. 13491 13492Such code is suitable for level 0 PA systems and kernels. 13493 13494@item -mfast-indirect-calls 13495@opindex mfast-indirect-calls 13496Generate code that assumes calls never cross space boundaries. This 13497allows GCC to emit code that performs faster indirect calls. 13498 13499This option does not work in the presence of shared libraries or nested 13500functions. 13501 13502@item -mfixed-range=@var{register-range} 13503@opindex mfixed-range 13504Generate code treating the given register range as fixed registers. 13505A fixed register is one that the register allocator cannot use. This is 13506useful when compiling kernel code. A register range is specified as 13507two registers separated by a dash. Multiple register ranges can be 13508specified separated by a comma. 13509 13510@item -mlong-load-store 13511@opindex mlong-load-store 13512Generate 3-instruction load and store sequences as sometimes required by 13513the HP-UX 10 linker. This is equivalent to the @samp{+k} option to 13514the HP compilers. 13515 13516@item -mportable-runtime 13517@opindex mportable-runtime 13518Use the portable calling conventions proposed by HP for ELF systems. 13519 13520@item -mgas 13521@opindex mgas 13522Enable the use of assembler directives only GAS understands. 13523 13524@item -mschedule=@var{cpu-type} 13525@opindex mschedule 13526Schedule code according to the constraints for the machine type 13527@var{cpu-type}. The choices for @var{cpu-type} are @samp{700} 13528@samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer 13529to @file{/usr/lib/sched.models} on an HP-UX system to determine the 13530proper scheduling option for your machine. The default scheduling is 13531@samp{8000}. 13532 13533@item -mlinker-opt 13534@opindex mlinker-opt 13535Enable the optimization pass in the HP-UX linker. Note this makes symbolic 13536debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9 13537linkers in which they give bogus error messages when linking some programs. 13538 13539@item -msoft-float 13540@opindex msoft-float 13541Generate output containing library calls for floating point. 13542@strong{Warning:} the requisite libraries are not available for all HPPA 13543targets. Normally the facilities of the machine's usual C compiler are 13544used, but this cannot be done directly in cross-compilation. You must make 13545your own arrangements to provide suitable library functions for 13546cross-compilation. 13547 13548@option{-msoft-float} changes the calling convention in the output file; 13549therefore, it is only useful if you compile @emph{all} of a program with 13550this option. In particular, you need to compile @file{libgcc.a}, the 13551library that comes with GCC, with @option{-msoft-float} in order for 13552this to work. 13553 13554@item -msio 13555@opindex msio 13556Generate the predefine, @code{_SIO}, for server IO@. The default is 13557@option{-mwsio}. This generates the predefines, @code{__hp9000s700}, 13558@code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These 13559options are available under HP-UX and HI-UX@. 13560 13561@item -mgnu-ld 13562@opindex mgnu-ld 13563Use options specific to GNU @command{ld}. 13564This passes @option{-shared} to @command{ld} when 13565building a shared library. It is the default when GCC is configured, 13566explicitly or implicitly, with the GNU linker. This option does not 13567affect which @command{ld} is called; it only changes what parameters 13568are passed to that @command{ld}. 13569The @command{ld} that is called is determined by the 13570@option{--with-ld} configure option, GCC's program search path, and 13571finally by the user's @env{PATH}. The linker used by GCC can be printed 13572using @samp{which `gcc -print-prog-name=ld`}. This option is only available 13573on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}. 13574 13575@item -mhp-ld 13576@opindex mhp-ld 13577Use options specific to HP @command{ld}. 13578This passes @option{-b} to @command{ld} when building 13579a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all 13580links. It is the default when GCC is configured, explicitly or 13581implicitly, with the HP linker. This option does not affect 13582which @command{ld} is called; it only changes what parameters are passed to that 13583@command{ld}. 13584The @command{ld} that is called is determined by the @option{--with-ld} 13585configure option, GCC's program search path, and finally by the user's 13586@env{PATH}. The linker used by GCC can be printed using @samp{which 13587`gcc -print-prog-name=ld`}. This option is only available on the 64-bit 13588HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}. 13589 13590@item -mlong-calls 13591@opindex mno-long-calls 13592Generate code that uses long call sequences. This ensures that a call 13593is always able to reach linker generated stubs. The default is to generate 13594long calls only when the distance from the call site to the beginning 13595of the function or translation unit, as the case may be, exceeds a 13596predefined limit set by the branch type being used. The limits for 13597normal calls are 7,600,000 and 240,000 bytes, respectively for the 13598PA 2.0 and PA 1.X architectures. Sibcalls are always limited at 13599240,000 bytes. 13600 13601Distances are measured from the beginning of functions when using the 13602@option{-ffunction-sections} option, or when using the @option{-mgas} 13603and @option{-mno-portable-runtime} options together under HP-UX with 13604the SOM linker. 13605 13606It is normally not desirable to use this option as it degrades 13607performance. However, it may be useful in large applications, 13608particularly when partial linking is used to build the application. 13609 13610The types of long calls used depends on the capabilities of the 13611assembler and linker, and the type of code being generated. The 13612impact on systems that support long absolute calls, and long pic 13613symbol-difference or pc-relative calls should be relatively small. 13614However, an indirect call is used on 32-bit ELF systems in pic code 13615and it is quite long. 13616 13617@item -munix=@var{unix-std} 13618@opindex march 13619Generate compiler predefines and select a startfile for the specified 13620UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95} 13621and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95} 13622is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX 1362311.11 and later. The default values are @samp{93} for HP-UX 10.00, 13624@samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11 13625and later. 13626 13627@option{-munix=93} provides the same predefines as GCC 3.3 and 3.4. 13628@option{-munix=95} provides additional predefines for @code{XOPEN_UNIX} 13629and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}. 13630@option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX}, 13631@code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and 13632@code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}. 13633 13634It is @emph{important} to note that this option changes the interfaces 13635for various library routines. It also affects the operational behavior 13636of the C library. Thus, @emph{extreme} care is needed in using this 13637option. 13638 13639Library code that is intended to operate with more than one UNIX 13640standard must test, set and restore the variable @var{__xpg4_extended_mask} 13641as appropriate. Most GNU software doesn't provide this capability. 13642 13643@item -nolibdld 13644@opindex nolibdld 13645Suppress the generation of link options to search libdld.sl when the 13646@option{-static} option is specified on HP-UX 10 and later. 13647 13648@item -static 13649@opindex static 13650The HP-UX implementation of setlocale in libc has a dependency on 13651libdld.sl. There isn't an archive version of libdld.sl. Thus, 13652when the @option{-static} option is specified, special link options 13653are needed to resolve this dependency. 13654 13655On HP-UX 10 and later, the GCC driver adds the necessary options to 13656link with libdld.sl when the @option{-static} option is specified. 13657This causes the resulting binary to be dynamic. On the 64-bit port, 13658the linkers generate dynamic binaries by default in any case. The 13659@option{-nolibdld} option can be used to prevent the GCC driver from 13660adding these link options. 13661 13662@item -threads 13663@opindex threads 13664Add support for multithreading with the @dfn{dce thread} library 13665under HP-UX@. This option sets flags for both the preprocessor and 13666linker. 13667@end table 13668 13669@node i386 and x86-64 Options 13670@subsection Intel 386 and AMD x86-64 Options 13671@cindex i386 Options 13672@cindex x86-64 Options 13673@cindex Intel 386 Options 13674@cindex AMD x86-64 Options 13675 13676These @samp{-m} options are defined for the i386 and x86-64 family of 13677computers: 13678 13679@table @gcctabopt 13680 13681@item -march=@var{cpu-type} 13682@opindex march 13683Generate instructions for the machine type @var{cpu-type}. In contrast to 13684@option{-mtune=@var{cpu-type}}, which merely tunes the generated code 13685for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC 13686to generate code that may not run at all on processors other than the one 13687indicated. Specifying @option{-march=@var{cpu-type}} implies 13688@option{-mtune=@var{cpu-type}}. 13689 13690The choices for @var{cpu-type} are: 13691 13692@table @samp 13693@item native 13694This selects the CPU to generate code for at compilation time by determining 13695the processor type of the compiling machine. Using @option{-march=native} 13696enables all instruction subsets supported by the local machine (hence 13697the result might not run on different machines). Using @option{-mtune=native} 13698produces code optimized for the local machine under the constraints 13699of the selected instruction set. 13700 13701@item i386 13702Original Intel i386 CPU@. 13703 13704@item i486 13705Intel i486 CPU@. (No scheduling is implemented for this chip.) 13706 13707@item i586 13708@itemx pentium 13709Intel Pentium CPU with no MMX support. 13710 13711@item pentium-mmx 13712Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support. 13713 13714@item pentiumpro 13715Intel Pentium Pro CPU@. 13716 13717@item i686 13718When used with @option{-march}, the Pentium Pro 13719instruction set is used, so the code runs on all i686 family chips. 13720When used with @option{-mtune}, it has the same meaning as @samp{generic}. 13721 13722@item pentium2 13723Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set 13724support. 13725 13726@item pentium3 13727@itemx pentium3m 13728Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction 13729set support. 13730 13731@item pentium-m 13732Intel Pentium M; low-power version of Intel Pentium III CPU 13733with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks. 13734 13735@item pentium4 13736@itemx pentium4m 13737Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support. 13738 13739@item prescott 13740Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction 13741set support. 13742 13743@item nocona 13744Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE, 13745SSE2 and SSE3 instruction set support. 13746 13747@item core2 13748Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3 13749instruction set support. 13750 13751@item corei7 13752Intel Core i7 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1 13753and SSE4.2 instruction set support. 13754 13755@item corei7-avx 13756Intel Core i7 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, 13757SSE4.1, SSE4.2, AVX, AES and PCLMUL instruction set support. 13758 13759@item core-avx-i 13760Intel Core CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, 13761SSE4.1, SSE4.2, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C instruction 13762set support. 13763 13764@item core-avx2 13765Intel Core CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 13766SSE4.1, SSE4.2, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2 13767and F16C instruction set support. 13768 13769@item atom 13770Intel Atom CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3 13771instruction set support. 13772 13773@item k6 13774AMD K6 CPU with MMX instruction set support. 13775 13776@item k6-2 13777@itemx k6-3 13778Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support. 13779 13780@item athlon 13781@itemx athlon-tbird 13782AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions 13783support. 13784 13785@item athlon-4 13786@itemx athlon-xp 13787@itemx athlon-mp 13788Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE 13789instruction set support. 13790 13791@item k8 13792@itemx opteron 13793@itemx athlon64 13794@itemx athlon-fx 13795Processors based on the AMD K8 core with x86-64 instruction set support, 13796including the AMD Opteron, Athlon 64, and Athlon 64 FX processors. 13797(This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit 13798instruction set extensions.) 13799 13800@item k8-sse3 13801@itemx opteron-sse3 13802@itemx athlon64-sse3 13803Improved versions of AMD K8 cores with SSE3 instruction set support. 13804 13805@item amdfam10 13806@itemx barcelona 13807CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This 13808supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit 13809instruction set extensions.) 13810 13811@item bdver1 13812CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This 13813supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, 13814SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.) 13815@item bdver2 13816AMD Family 15h core based CPUs with x86-64 instruction set support. (This 13817supersets BMI, TBM, F16C, FMA, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, 13818SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set 13819extensions.) 13820@item bdver3 13821AMD Family 15h core based CPUs with x86-64 instruction set support. (This 13822supersets BMI, TBM, F16C, FMA, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, 13823SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set 13824extensions. 13825 13826@item btver1 13827CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This 13828supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit 13829instruction set extensions.) 13830 13831@item btver2 13832CPUs based on AMD Family 16h cores with x86-64 instruction set support. This 13833includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM, 13834SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions. 13835 13836@item winchip-c6 13837IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction 13838set support. 13839 13840@item winchip2 13841IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@: 13842instruction set support. 13843 13844@item c3 13845VIA C3 CPU with MMX and 3DNow!@: instruction set support. (No scheduling is 13846implemented for this chip.) 13847 13848@item c3-2 13849VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support. 13850(No scheduling is 13851implemented for this chip.) 13852 13853@item geode 13854AMD Geode embedded processor with MMX and 3DNow!@: instruction set support. 13855@end table 13856 13857@item -mtune=@var{cpu-type} 13858@opindex mtune 13859Tune to @var{cpu-type} everything applicable about the generated code, except 13860for the ABI and the set of available instructions. 13861While picking a specific @var{cpu-type} schedules things appropriately 13862for that particular chip, the compiler does not generate any code that 13863cannot run on the default machine type unless you use a 13864@option{-march=@var{cpu-type}} option. 13865For example, if GCC is configured for i686-pc-linux-gnu 13866then @option{-mtune=pentium4} generates code that is tuned for Pentium 4 13867but still runs on i686 machines. 13868 13869The choices for @var{cpu-type} are the same as for @option{-march}. 13870In addition, @option{-mtune} supports an extra choice for @var{cpu-type}: 13871 13872@table @samp 13873@item generic 13874Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors. 13875If you know the CPU on which your code will run, then you should use 13876the corresponding @option{-mtune} or @option{-march} option instead of 13877@option{-mtune=generic}. But, if you do not know exactly what CPU users 13878of your application will have, then you should use this option. 13879 13880As new processors are deployed in the marketplace, the behavior of this 13881option will change. Therefore, if you upgrade to a newer version of 13882GCC, code generation controlled by this option will change to reflect 13883the processors 13884that are most common at the time that version of GCC is released. 13885 13886There is no @option{-march=generic} option because @option{-march} 13887indicates the instruction set the compiler can use, and there is no 13888generic instruction set applicable to all processors. In contrast, 13889@option{-mtune} indicates the processor (or, in this case, collection of 13890processors) for which the code is optimized. 13891@end table 13892 13893@item -mcpu=@var{cpu-type} 13894@opindex mcpu 13895A deprecated synonym for @option{-mtune}. 13896 13897@item -mfpmath=@var{unit} 13898@opindex mfpmath 13899Generate floating-point arithmetic for selected unit @var{unit}. The choices 13900for @var{unit} are: 13901 13902@table @samp 13903@item 387 13904Use the standard 387 floating-point coprocessor present on the majority of chips and 13905emulated otherwise. Code compiled with this option runs almost everywhere. 13906The temporary results are computed in 80-bit precision instead of the precision 13907specified by the type, resulting in slightly different results compared to most 13908of other chips. See @option{-ffloat-store} for more detailed description. 13909 13910This is the default choice for i386 compiler. 13911 13912@item sse 13913Use scalar floating-point instructions present in the SSE instruction set. 13914This instruction set is supported by Pentium III and newer chips, 13915and in the AMD line 13916by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE 13917instruction set supports only single-precision arithmetic, thus the double and 13918extended-precision arithmetic are still done using 387. A later version, present 13919only in Pentium 4 and AMD x86-64 chips, supports double-precision 13920arithmetic too. 13921 13922For the i386 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse} 13923or @option{-msse2} switches to enable SSE extensions and make this option 13924effective. For the x86-64 compiler, these extensions are enabled by default. 13925 13926The resulting code should be considerably faster in the majority of cases and avoid 13927the numerical instability problems of 387 code, but may break some existing 13928code that expects temporaries to be 80 bits. 13929 13930This is the default choice for the x86-64 compiler. 13931 13932@item sse,387 13933@itemx sse+387 13934@itemx both 13935Attempt to utilize both instruction sets at once. This effectively doubles the 13936amount of available registers, and on chips with separate execution units for 13937387 and SSE the execution resources too. Use this option with care, as it is 13938still experimental, because the GCC register allocator does not model separate 13939functional units well, resulting in unstable performance. 13940@end table 13941 13942@item -masm=@var{dialect} 13943@opindex masm=@var{dialect} 13944Output assembly instructions using selected @var{dialect}. Supported 13945choices are @samp{intel} or @samp{att} (the default). Darwin does 13946not support @samp{intel}. 13947 13948@item -mieee-fp 13949@itemx -mno-ieee-fp 13950@opindex mieee-fp 13951@opindex mno-ieee-fp 13952Control whether or not the compiler uses IEEE floating-point 13953comparisons. These correctly handle the case where the result of a 13954comparison is unordered. 13955 13956@item -msoft-float 13957@opindex msoft-float 13958Generate output containing library calls for floating point. 13959 13960@strong{Warning:} the requisite libraries are not part of GCC@. 13961Normally the facilities of the machine's usual C compiler are used, but 13962this can't be done directly in cross-compilation. You must make your 13963own arrangements to provide suitable library functions for 13964cross-compilation. 13965 13966On machines where a function returns floating-point results in the 80387 13967register stack, some floating-point opcodes may be emitted even if 13968@option{-msoft-float} is used. 13969 13970@item -mno-fp-ret-in-387 13971@opindex mno-fp-ret-in-387 13972Do not use the FPU registers for return values of functions. 13973 13974The usual calling convention has functions return values of types 13975@code{float} and @code{double} in an FPU register, even if there 13976is no FPU@. The idea is that the operating system should emulate 13977an FPU@. 13978 13979The option @option{-mno-fp-ret-in-387} causes such values to be returned 13980in ordinary CPU registers instead. 13981 13982@item -mno-fancy-math-387 13983@opindex mno-fancy-math-387 13984Some 387 emulators do not support the @code{sin}, @code{cos} and 13985@code{sqrt} instructions for the 387. Specify this option to avoid 13986generating those instructions. This option is the default on FreeBSD, 13987OpenBSD and NetBSD@. This option is overridden when @option{-march} 13988indicates that the target CPU always has an FPU and so the 13989instruction does not need emulation. These 13990instructions are not generated unless you also use the 13991@option{-funsafe-math-optimizations} switch. 13992 13993@item -malign-double 13994@itemx -mno-align-double 13995@opindex malign-double 13996@opindex mno-align-double 13997Control whether GCC aligns @code{double}, @code{long double}, and 13998@code{long long} variables on a two-word boundary or a one-word 13999boundary. Aligning @code{double} variables on a two-word boundary 14000produces code that runs somewhat faster on a Pentium at the 14001expense of more memory. 14002 14003On x86-64, @option{-malign-double} is enabled by default. 14004 14005@strong{Warning:} if you use the @option{-malign-double} switch, 14006structures containing the above types are aligned differently than 14007the published application binary interface specifications for the 386 14008and are not binary compatible with structures in code compiled 14009without that switch. 14010 14011@item -m96bit-long-double 14012@itemx -m128bit-long-double 14013@opindex m96bit-long-double 14014@opindex m128bit-long-double 14015These switches control the size of @code{long double} type. The i386 14016application binary interface specifies the size to be 96 bits, 14017so @option{-m96bit-long-double} is the default in 32-bit mode. 14018 14019Modern architectures (Pentium and newer) prefer @code{long double} 14020to be aligned to an 8- or 16-byte boundary. In arrays or structures 14021conforming to the ABI, this is not possible. So specifying 14022@option{-m128bit-long-double} aligns @code{long double} 14023to a 16-byte boundary by padding the @code{long double} with an additional 1402432-bit zero. 14025 14026In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as 14027its ABI specifies that @code{long double} is aligned on 16-byte boundary. 14028 14029Notice that neither of these options enable any extra precision over the x87 14030standard of 80 bits for a @code{long double}. 14031 14032@strong{Warning:} if you override the default value for your target ABI, this 14033changes the size of 14034structures and arrays containing @code{long double} variables, 14035as well as modifying the function calling convention for functions taking 14036@code{long double}. Hence they are not binary-compatible 14037with code compiled without that switch. 14038 14039@item -mlong-double-64 14040@itemx -mlong-double-80 14041@opindex mlong-double-64 14042@opindex mlong-double-80 14043These switches control the size of @code{long double} type. A size 14044of 64 bits makes the @code{long double} type equivalent to the @code{double} 14045type. This is the default for Bionic C library. 14046 14047@strong{Warning:} if you override the default value for your target ABI, this 14048changes the size of 14049structures and arrays containing @code{long double} variables, 14050as well as modifying the function calling convention for functions taking 14051@code{long double}. Hence they are not binary-compatible 14052with code compiled without that switch. 14053 14054@item -mlarge-data-threshold=@var{threshold} 14055@opindex mlarge-data-threshold 14056When @option{-mcmodel=medium} is specified, data objects larger than 14057@var{threshold} are placed in the large data section. This value must be the 14058same across all objects linked into the binary, and defaults to 65535. 14059 14060@item -mrtd 14061@opindex mrtd 14062Use a different function-calling convention, in which functions that 14063take a fixed number of arguments return with the @code{ret @var{num}} 14064instruction, which pops their arguments while returning. This saves one 14065instruction in the caller since there is no need to pop the arguments 14066there. 14067 14068You can specify that an individual function is called with this calling 14069sequence with the function attribute @samp{stdcall}. You can also 14070override the @option{-mrtd} option by using the function attribute 14071@samp{cdecl}. @xref{Function Attributes}. 14072 14073@strong{Warning:} this calling convention is incompatible with the one 14074normally used on Unix, so you cannot use it if you need to call 14075libraries compiled with the Unix compiler. 14076 14077Also, you must provide function prototypes for all functions that 14078take variable numbers of arguments (including @code{printf}); 14079otherwise incorrect code is generated for calls to those 14080functions. 14081 14082In addition, seriously incorrect code results if you call a 14083function with too many arguments. (Normally, extra arguments are 14084harmlessly ignored.) 14085 14086@item -mregparm=@var{num} 14087@opindex mregparm 14088Control how many registers are used to pass integer arguments. By 14089default, no registers are used to pass arguments, and at most 3 14090registers can be used. You can control this behavior for a specific 14091function by using the function attribute @samp{regparm}. 14092@xref{Function Attributes}. 14093 14094@strong{Warning:} if you use this switch, and 14095@var{num} is nonzero, then you must build all modules with the same 14096value, including any libraries. This includes the system libraries and 14097startup modules. 14098 14099@item -msseregparm 14100@opindex msseregparm 14101Use SSE register passing conventions for float and double arguments 14102and return values. You can control this behavior for a specific 14103function by using the function attribute @samp{sseregparm}. 14104@xref{Function Attributes}. 14105 14106@strong{Warning:} if you use this switch then you must build all 14107modules with the same value, including any libraries. This includes 14108the system libraries and startup modules. 14109 14110@item -mvect8-ret-in-mem 14111@opindex mvect8-ret-in-mem 14112Return 8-byte vectors in memory instead of MMX registers. This is the 14113default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun 14114Studio compilers until version 12. Later compiler versions (starting 14115with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which 14116is the default on Solaris@tie{}10 and later. @emph{Only} use this option if 14117you need to remain compatible with existing code produced by those 14118previous compiler versions or older versions of GCC@. 14119 14120@item -mpc32 14121@itemx -mpc64 14122@itemx -mpc80 14123@opindex mpc32 14124@opindex mpc64 14125@opindex mpc80 14126 14127Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32} 14128is specified, the significands of results of floating-point operations are 14129rounded to 24 bits (single precision); @option{-mpc64} rounds the 14130significands of results of floating-point operations to 53 bits (double 14131precision) and @option{-mpc80} rounds the significands of results of 14132floating-point operations to 64 bits (extended double precision), which is 14133the default. When this option is used, floating-point operations in higher 14134precisions are not available to the programmer without setting the FPU 14135control word explicitly. 14136 14137Setting the rounding of floating-point operations to less than the default 1413880 bits can speed some programs by 2% or more. Note that some mathematical 14139libraries assume that extended-precision (80-bit) floating-point operations 14140are enabled by default; routines in such libraries could suffer significant 14141loss of accuracy, typically through so-called ``catastrophic cancellation'', 14142when this option is used to set the precision to less than extended precision. 14143 14144@item -mstackrealign 14145@opindex mstackrealign 14146Realign the stack at entry. On the Intel x86, the @option{-mstackrealign} 14147option generates an alternate prologue and epilogue that realigns the 14148run-time stack if necessary. This supports mixing legacy codes that keep 141494-byte stack alignment with modern codes that keep 16-byte stack alignment for 14150SSE compatibility. See also the attribute @code{force_align_arg_pointer}, 14151applicable to individual functions. 14152 14153@item -mpreferred-stack-boundary=@var{num} 14154@opindex mpreferred-stack-boundary 14155Attempt to keep the stack boundary aligned to a 2 raised to @var{num} 14156byte boundary. If @option{-mpreferred-stack-boundary} is not specified, 14157the default is 4 (16 bytes or 128 bits). 14158 14159@strong{Warning:} When generating code for the x86-64 architecture with 14160SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be 14161used to keep the stack boundary aligned to 8 byte boundary. Since 14162x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and 14163intended to be used in controlled environment where stack space is 14164important limitation. This option will lead to wrong code when functions 14165compiled with 16 byte stack alignment (such as functions from a standard 14166library) are called with misaligned stack. In this case, SSE 14167instructions may lead to misaligned memory access traps. In addition, 14168variable arguments will be handled incorrectly for 16 byte aligned 14169objects (including x87 long double and __int128), leading to wrong 14170results. You must build all modules with 14171@option{-mpreferred-stack-boundary=3}, including any libraries. This 14172includes the system libraries and startup modules. 14173 14174@item -mincoming-stack-boundary=@var{num} 14175@opindex mincoming-stack-boundary 14176Assume the incoming stack is aligned to a 2 raised to @var{num} byte 14177boundary. If @option{-mincoming-stack-boundary} is not specified, 14178the one specified by @option{-mpreferred-stack-boundary} is used. 14179 14180On Pentium and Pentium Pro, @code{double} and @code{long double} values 14181should be aligned to an 8-byte boundary (see @option{-malign-double}) or 14182suffer significant run time performance penalties. On Pentium III, the 14183Streaming SIMD Extension (SSE) data type @code{__m128} may not work 14184properly if it is not 16-byte aligned. 14185 14186To ensure proper alignment of this values on the stack, the stack boundary 14187must be as aligned as that required by any value stored on the stack. 14188Further, every function must be generated such that it keeps the stack 14189aligned. Thus calling a function compiled with a higher preferred 14190stack boundary from a function compiled with a lower preferred stack 14191boundary most likely misaligns the stack. It is recommended that 14192libraries that use callbacks always use the default setting. 14193 14194This extra alignment does consume extra stack space, and generally 14195increases code size. Code that is sensitive to stack space usage, such 14196as embedded systems and operating system kernels, may want to reduce the 14197preferred alignment to @option{-mpreferred-stack-boundary=2}. 14198 14199@item -mmmx 14200@itemx -mno-mmx 14201@itemx -msse 14202@itemx -mno-sse 14203@itemx -msse2 14204@itemx -mno-sse2 14205@itemx -msse3 14206@itemx -mno-sse3 14207@itemx -mssse3 14208@itemx -mno-ssse3 14209@itemx -msse4.1 14210@need 800 14211@itemx -mno-sse4.1 14212@itemx -msse4.2 14213@itemx -mno-sse4.2 14214@itemx -msse4 14215@itemx -mno-sse4 14216@itemx -mavx 14217@itemx -mno-avx 14218@itemx -mavx2 14219@itemx -mno-avx2 14220@itemx -maes 14221@itemx -mno-aes 14222@itemx -mpclmul 14223@need 800 14224@itemx -mno-pclmul 14225@itemx -mfsgsbase 14226@itemx -mno-fsgsbase 14227@itemx -mrdrnd 14228@itemx -mno-rdrnd 14229@itemx -mf16c 14230@itemx -mno-f16c 14231@itemx -mfma 14232@itemx -mno-fma 14233@itemx -msse4a 14234@itemx -mno-sse4a 14235@itemx -mfma4 14236@need 800 14237@itemx -mno-fma4 14238@itemx -mxop 14239@itemx -mno-xop 14240@itemx -mlwp 14241@itemx -mno-lwp 14242@itemx -m3dnow 14243@itemx -mno-3dnow 14244@itemx -mpopcnt 14245@itemx -mno-popcnt 14246@itemx -mabm 14247@itemx -mno-abm 14248@itemx -mbmi 14249@itemx -mbmi2 14250@itemx -mno-bmi 14251@itemx -mno-bmi2 14252@itemx -mlzcnt 14253@itemx -mno-lzcnt 14254@itemx -mrtm 14255@itemx -mtbm 14256@itemx -mno-tbm 14257@opindex mmmx 14258@opindex mno-mmx 14259@opindex msse 14260@opindex mno-sse 14261@opindex m3dnow 14262@opindex mno-3dnow 14263These switches enable or disable the use of instructions in the MMX, SSE, 14264SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, F16C, 14265FMA, SSE4A, FMA4, XOP, LWP, ABM, BMI, BMI2, LZCNT, RTM or 3DNow!@: 14266extended instruction sets. 14267These extensions are also available as built-in functions: see 14268@ref{X86 Built-in Functions}, for details of the functions enabled and 14269disabled by these switches. 14270 14271To generate SSE/SSE2 instructions automatically from floating-point 14272code (as opposed to 387 instructions), see @option{-mfpmath=sse}. 14273 14274GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it 14275generates new AVX instructions or AVX equivalence for all SSEx instructions 14276when needed. 14277 14278These options enable GCC to use these extended instructions in 14279generated code, even without @option{-mfpmath=sse}. Applications that 14280perform run-time CPU detection must compile separate files for each 14281supported architecture, using the appropriate flags. In particular, 14282the file containing the CPU detection code should be compiled without 14283these options. 14284 14285@item -mcld 14286@opindex mcld 14287This option instructs GCC to emit a @code{cld} instruction in the prologue 14288of functions that use string instructions. String instructions depend on 14289the DF flag to select between autoincrement or autodecrement mode. While the 14290ABI specifies the DF flag to be cleared on function entry, some operating 14291systems violate this specification by not clearing the DF flag in their 14292exception dispatchers. The exception handler can be invoked with the DF flag 14293set, which leads to wrong direction mode when string instructions are used. 14294This option can be enabled by default on 32-bit x86 targets by configuring 14295GCC with the @option{--enable-cld} configure option. Generation of @code{cld} 14296instructions can be suppressed with the @option{-mno-cld} compiler option 14297in this case. 14298 14299@item -mvzeroupper 14300@opindex mvzeroupper 14301This option instructs GCC to emit a @code{vzeroupper} instruction 14302before a transfer of control flow out of the function to minimize 14303the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper} 14304intrinsics. 14305 14306@item -mprefer-avx128 14307@opindex mprefer-avx128 14308This option instructs GCC to use 128-bit AVX instructions instead of 14309256-bit AVX instructions in the auto-vectorizer. 14310 14311@item -mcx16 14312@opindex mcx16 14313This option enables GCC to generate @code{CMPXCHG16B} instructions. 14314@code{CMPXCHG16B} allows for atomic operations on 128-bit double quadword 14315(or oword) data types. 14316This is useful for high-resolution counters that can be updated 14317by multiple processors (or cores). This instruction is generated as part of 14318atomic built-in functions: see @ref{__sync Builtins} or 14319@ref{__atomic Builtins} for details. 14320 14321@item -msahf 14322@opindex msahf 14323This option enables generation of @code{SAHF} instructions in 64-bit code. 14324Early Intel Pentium 4 CPUs with Intel 64 support, 14325prior to the introduction of Pentium 4 G1 step in December 2005, 14326lacked the @code{LAHF} and @code{SAHF} instructions 14327which were supported by AMD64. 14328These are load and store instructions, respectively, for certain status flags. 14329In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod}, 14330@code{drem}, and @code{remainder} built-in functions; 14331see @ref{Other Builtins} for details. 14332 14333@item -mmovbe 14334@opindex mmovbe 14335This option enables use of the @code{movbe} instruction to implement 14336@code{__builtin_bswap32} and @code{__builtin_bswap64}. 14337 14338@item -mcrc32 14339@opindex mcrc32 14340This option enables built-in functions @code{__builtin_ia32_crc32qi}, 14341@code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and 14342@code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction. 14343 14344@item -mrecip 14345@opindex mrecip 14346This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions 14347(and their vectorized variants @code{RCPPS} and @code{RSQRTPS}) 14348with an additional Newton-Raphson step 14349to increase precision instead of @code{DIVSS} and @code{SQRTSS} 14350(and their vectorized 14351variants) for single-precision floating-point arguments. These instructions 14352are generated only when @option{-funsafe-math-optimizations} is enabled 14353together with @option{-finite-math-only} and @option{-fno-trapping-math}. 14354Note that while the throughput of the sequence is higher than the throughput 14355of the non-reciprocal instruction, the precision of the sequence can be 14356decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994). 14357 14358Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS} 14359(or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option 14360combination), and doesn't need @option{-mrecip}. 14361 14362Also note that GCC emits the above sequence with additional Newton-Raphson step 14363for vectorized single-float division and vectorized @code{sqrtf(@var{x})} 14364already with @option{-ffast-math} (or the above option combination), and 14365doesn't need @option{-mrecip}. 14366 14367@item -mrecip=@var{opt} 14368@opindex mrecip=opt 14369This option controls which reciprocal estimate instructions 14370may be used. @var{opt} is a comma-separated list of options, which may 14371be preceded by a @samp{!} to invert the option: 14372 14373@table @samp 14374@item all 14375Enable all estimate instructions. 14376 14377@item default 14378Enable the default instructions, equivalent to @option{-mrecip}. 14379 14380@item none 14381Disable all estimate instructions, equivalent to @option{-mno-recip}. 14382 14383@item div 14384Enable the approximation for scalar division. 14385 14386@item vec-div 14387Enable the approximation for vectorized division. 14388 14389@item sqrt 14390Enable the approximation for scalar square root. 14391 14392@item vec-sqrt 14393Enable the approximation for vectorized square root. 14394@end table 14395 14396So, for example, @option{-mrecip=all,!sqrt} enables 14397all of the reciprocal approximations, except for square root. 14398 14399@item -mveclibabi=@var{type} 14400@opindex mveclibabi 14401Specifies the ABI type to use for vectorizing intrinsics using an 14402external library. Supported values for @var{type} are @samp{svml} 14403for the Intel short 14404vector math library and @samp{acml} for the AMD math core library. 14405To use this option, both @option{-ftree-vectorize} and 14406@option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML 14407ABI-compatible library must be specified at link time. 14408 14409GCC currently emits calls to @code{vmldExp2}, 14410@code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2}, 14411@code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2}, 14412@code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2}, 14413@code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2}, 14414@code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104}, 14415@code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4}, 14416@code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4}, 14417@code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4}, 14418@code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding 14419function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin}, 14420@code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2}, 14421@code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf}, 14422@code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f}, 14423@code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type 14424when @option{-mveclibabi=acml} is used. 14425 14426@item -mabi=@var{name} 14427@opindex mabi 14428Generate code for the specified calling convention. Permissible values 14429are @samp{sysv} for the ABI used on GNU/Linux and other systems, and 14430@samp{ms} for the Microsoft ABI. The default is to use the Microsoft 14431ABI when targeting Microsoft Windows and the SysV ABI on all other systems. 14432You can control this behavior for a specific function by 14433using the function attribute @samp{ms_abi}/@samp{sysv_abi}. 14434@xref{Function Attributes}. 14435 14436@item -mtls-dialect=@var{type} 14437@opindex mtls-dialect 14438Generate code to access thread-local storage using the @samp{gnu} or 14439@samp{gnu2} conventions. @samp{gnu} is the conservative default; 14440@samp{gnu2} is more efficient, but it may add compile- and run-time 14441requirements that cannot be satisfied on all systems. 14442 14443@item -mpush-args 14444@itemx -mno-push-args 14445@opindex mpush-args 14446@opindex mno-push-args 14447Use PUSH operations to store outgoing parameters. This method is shorter 14448and usually equally fast as method using SUB/MOV operations and is enabled 14449by default. In some cases disabling it may improve performance because of 14450improved scheduling and reduced dependencies. 14451 14452@item -maccumulate-outgoing-args 14453@opindex maccumulate-outgoing-args 14454If enabled, the maximum amount of space required for outgoing arguments is 14455computed in the function prologue. This is faster on most modern CPUs 14456because of reduced dependencies, improved scheduling and reduced stack usage 14457when the preferred stack boundary is not equal to 2. The drawback is a notable 14458increase in code size. This switch implies @option{-mno-push-args}. 14459 14460@item -mthreads 14461@opindex mthreads 14462Support thread-safe exception handling on MinGW. Programs that rely 14463on thread-safe exception handling must compile and link all code with the 14464@option{-mthreads} option. When compiling, @option{-mthreads} defines 14465@code{-D_MT}; when linking, it links in a special thread helper library 14466@option{-lmingwthrd} which cleans up per-thread exception-handling data. 14467 14468@item -mno-align-stringops 14469@opindex mno-align-stringops 14470Do not align the destination of inlined string operations. This switch reduces 14471code size and improves performance in case the destination is already aligned, 14472but GCC doesn't know about it. 14473 14474@item -minline-all-stringops 14475@opindex minline-all-stringops 14476By default GCC inlines string operations only when the destination is 14477known to be aligned to least a 4-byte boundary. 14478This enables more inlining and increases code 14479size, but may improve performance of code that depends on fast 14480@code{memcpy}, @code{strlen}, 14481and @code{memset} for short lengths. 14482 14483@item -minline-stringops-dynamically 14484@opindex minline-stringops-dynamically 14485For string operations of unknown size, use run-time checks with 14486inline code for small blocks and a library call for large blocks. 14487 14488@item -mstringop-strategy=@var{alg} 14489@opindex mstringop-strategy=@var{alg} 14490Override the internal decision heuristic for the particular algorithm to use 14491for inlining string operations. The allowed values for @var{alg} are: 14492 14493@table @samp 14494@item rep_byte 14495@itemx rep_4byte 14496@itemx rep_8byte 14497Expand using i386 @code{rep} prefix of the specified size. 14498 14499@item byte_loop 14500@itemx loop 14501@itemx unrolled_loop 14502Expand into an inline loop. 14503 14504@item libcall 14505Always use a library call. 14506@end table 14507 14508@item -momit-leaf-frame-pointer 14509@opindex momit-leaf-frame-pointer 14510Don't keep the frame pointer in a register for leaf functions. This 14511avoids the instructions to save, set up, and restore frame pointers and 14512makes an extra register available in leaf functions. The option 14513@option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions, 14514which might make debugging harder. 14515 14516@item -mtls-direct-seg-refs 14517@itemx -mno-tls-direct-seg-refs 14518@opindex mtls-direct-seg-refs 14519Controls whether TLS variables may be accessed with offsets from the 14520TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit), 14521or whether the thread base pointer must be added. Whether or not this 14522is valid depends on the operating system, and whether it maps the 14523segment to cover the entire TLS area. 14524 14525For systems that use the GNU C Library, the default is on. 14526 14527@item -msse2avx 14528@itemx -mno-sse2avx 14529@opindex msse2avx 14530Specify that the assembler should encode SSE instructions with VEX 14531prefix. The option @option{-mavx} turns this on by default. 14532 14533@item -mfentry 14534@itemx -mno-fentry 14535@opindex mfentry 14536If profiling is active (@option{-pg}), put the profiling 14537counter call before the prologue. 14538Note: On x86 architectures the attribute @code{ms_hook_prologue} 14539isn't possible at the moment for @option{-mfentry} and @option{-pg}. 14540 14541@item -m8bit-idiv 14542@itemx -mno-8bit-idiv 14543@opindex 8bit-idiv 14544On some processors, like Intel Atom, 8-bit unsigned integer divide is 14545much faster than 32-bit/64-bit integer divide. This option generates a 14546run-time check. If both dividend and divisor are within range of 0 14547to 255, 8-bit unsigned integer divide is used instead of 1454832-bit/64-bit integer divide. 14549 14550@item -mavx256-split-unaligned-load 14551@itemx -mavx256-split-unaligned-store 14552@opindex avx256-split-unaligned-load 14553@opindex avx256-split-unaligned-store 14554Split 32-byte AVX unaligned load and store. 14555 14556@end table 14557 14558These @samp{-m} switches are supported in addition to the above 14559on x86-64 processors in 64-bit environments. 14560 14561@table @gcctabopt 14562@item -m32 14563@itemx -m64 14564@itemx -mx32 14565@opindex m32 14566@opindex m64 14567@opindex mx32 14568Generate code for a 32-bit or 64-bit environment. 14569The @option{-m32} option sets @code{int}, @code{long}, and pointer types 14570to 32 bits, and 14571generates code that runs on any i386 system. 14572 14573The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer 14574types to 64 bits, and generates code for the x86-64 architecture. 14575For Darwin only the @option{-m64} option also turns off the @option{-fno-pic} 14576and @option{-mdynamic-no-pic} options. 14577 14578The @option{-mx32} option sets @code{int}, @code{long}, and pointer types 14579to 32 bits, and 14580generates code for the x86-64 architecture. 14581 14582@item -mno-red-zone 14583@opindex mno-red-zone 14584Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated 14585by the x86-64 ABI; it is a 128-byte area beyond the location of the 14586stack pointer that is not modified by signal or interrupt handlers 14587and therefore can be used for temporary data without adjusting the stack 14588pointer. The flag @option{-mno-red-zone} disables this red zone. 14589 14590@item -mcmodel=small 14591@opindex mcmodel=small 14592Generate code for the small code model: the program and its symbols must 14593be linked in the lower 2 GB of the address space. Pointers are 64 bits. 14594Programs can be statically or dynamically linked. This is the default 14595code model. 14596 14597@item -mcmodel=kernel 14598@opindex mcmodel=kernel 14599Generate code for the kernel code model. The kernel runs in the 14600negative 2 GB of the address space. 14601This model has to be used for Linux kernel code. 14602 14603@item -mcmodel=medium 14604@opindex mcmodel=medium 14605Generate code for the medium model: the program is linked in the lower 2 14606GB of the address space. Small symbols are also placed there. Symbols 14607with sizes larger than @option{-mlarge-data-threshold} are put into 14608large data or BSS sections and can be located above 2GB. Programs can 14609be statically or dynamically linked. 14610 14611@item -mcmodel=large 14612@opindex mcmodel=large 14613Generate code for the large model. This model makes no assumptions 14614about addresses and sizes of sections. 14615 14616@item -maddress-mode=long 14617@opindex maddress-mode=long 14618Generate code for long address mode. This is only supported for 64-bit 14619and x32 environments. It is the default address mode for 64-bit 14620environments. 14621 14622@item -maddress-mode=short 14623@opindex maddress-mode=short 14624Generate code for short address mode. This is only supported for 32-bit 14625and x32 environments. It is the default address mode for 32-bit and 14626x32 environments. 14627@end table 14628 14629@node i386 and x86-64 Windows Options 14630@subsection i386 and x86-64 Windows Options 14631@cindex i386 and x86-64 Windows Options 14632 14633These additional options are available for Microsoft Windows targets: 14634 14635@table @gcctabopt 14636@item -mconsole 14637@opindex mconsole 14638This option 14639specifies that a console application is to be generated, by 14640instructing the linker to set the PE header subsystem type 14641required for console applications. 14642This option is available for Cygwin and MinGW targets and is 14643enabled by default on those targets. 14644 14645@item -mdll 14646@opindex mdll 14647This option is available for Cygwin and MinGW targets. It 14648specifies that a DLL---a dynamic link library---is to be 14649generated, enabling the selection of the required runtime 14650startup object and entry point. 14651 14652@item -mnop-fun-dllimport 14653@opindex mnop-fun-dllimport 14654This option is available for Cygwin and MinGW targets. It 14655specifies that the @code{dllimport} attribute should be ignored. 14656 14657@item -mthread 14658@opindex mthread 14659This option is available for MinGW targets. It specifies 14660that MinGW-specific thread support is to be used. 14661 14662@item -municode 14663@opindex municode 14664This option is available for MinGW-w64 targets. It causes 14665the @code{UNICODE} preprocessor macro to be predefined, and 14666chooses Unicode-capable runtime startup code. 14667 14668@item -mwin32 14669@opindex mwin32 14670This option is available for Cygwin and MinGW targets. It 14671specifies that the typical Microsoft Windows predefined macros are to 14672be set in the pre-processor, but does not influence the choice 14673of runtime library/startup code. 14674 14675@item -mwindows 14676@opindex mwindows 14677This option is available for Cygwin and MinGW targets. It 14678specifies that a GUI application is to be generated by 14679instructing the linker to set the PE header subsystem type 14680appropriately. 14681 14682@item -fno-set-stack-executable 14683@opindex fno-set-stack-executable 14684This option is available for MinGW targets. It specifies that 14685the executable flag for the stack used by nested functions isn't 14686set. This is necessary for binaries running in kernel mode of 14687Microsoft Windows, as there the User32 API, which is used to set executable 14688privileges, isn't available. 14689 14690@item -fwritable-relocated-rdata 14691@opindex fno-writable-relocated-rdata 14692This option is available for MinGW and Cygwin targets. It specifies 14693that relocated-data in read-only section is put into .data 14694section. This is a necessary for older runtimes not supporting 14695modification of .rdata sections for pseudo-relocation. 14696 14697@item -mpe-aligned-commons 14698@opindex mpe-aligned-commons 14699This option is available for Cygwin and MinGW targets. It 14700specifies that the GNU extension to the PE file format that 14701permits the correct alignment of COMMON variables should be 14702used when generating code. It is enabled by default if 14703GCC detects that the target assembler found during configuration 14704supports the feature. 14705@end table 14706 14707See also under @ref{i386 and x86-64 Options} for standard options. 14708 14709@node IA-64 Options 14710@subsection IA-64 Options 14711@cindex IA-64 Options 14712 14713These are the @samp{-m} options defined for the Intel IA-64 architecture. 14714 14715@table @gcctabopt 14716@item -mbig-endian 14717@opindex mbig-endian 14718Generate code for a big-endian target. This is the default for HP-UX@. 14719 14720@item -mlittle-endian 14721@opindex mlittle-endian 14722Generate code for a little-endian target. This is the default for AIX5 14723and GNU/Linux. 14724 14725@item -mgnu-as 14726@itemx -mno-gnu-as 14727@opindex mgnu-as 14728@opindex mno-gnu-as 14729Generate (or don't) code for the GNU assembler. This is the default. 14730@c Also, this is the default if the configure option @option{--with-gnu-as} 14731@c is used. 14732 14733@item -mgnu-ld 14734@itemx -mno-gnu-ld 14735@opindex mgnu-ld 14736@opindex mno-gnu-ld 14737Generate (or don't) code for the GNU linker. This is the default. 14738@c Also, this is the default if the configure option @option{--with-gnu-ld} 14739@c is used. 14740 14741@item -mno-pic 14742@opindex mno-pic 14743Generate code that does not use a global pointer register. The result 14744is not position independent code, and violates the IA-64 ABI@. 14745 14746@item -mvolatile-asm-stop 14747@itemx -mno-volatile-asm-stop 14748@opindex mvolatile-asm-stop 14749@opindex mno-volatile-asm-stop 14750Generate (or don't) a stop bit immediately before and after volatile asm 14751statements. 14752 14753@item -mregister-names 14754@itemx -mno-register-names 14755@opindex mregister-names 14756@opindex mno-register-names 14757Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for 14758the stacked registers. This may make assembler output more readable. 14759 14760@item -mno-sdata 14761@itemx -msdata 14762@opindex mno-sdata 14763@opindex msdata 14764Disable (or enable) optimizations that use the small data section. This may 14765be useful for working around optimizer bugs. 14766 14767@item -mconstant-gp 14768@opindex mconstant-gp 14769Generate code that uses a single constant global pointer value. This is 14770useful when compiling kernel code. 14771 14772@item -mauto-pic 14773@opindex mauto-pic 14774Generate code that is self-relocatable. This implies @option{-mconstant-gp}. 14775This is useful when compiling firmware code. 14776 14777@item -minline-float-divide-min-latency 14778@opindex minline-float-divide-min-latency 14779Generate code for inline divides of floating-point values 14780using the minimum latency algorithm. 14781 14782@item -minline-float-divide-max-throughput 14783@opindex minline-float-divide-max-throughput 14784Generate code for inline divides of floating-point values 14785using the maximum throughput algorithm. 14786 14787@item -mno-inline-float-divide 14788@opindex mno-inline-float-divide 14789Do not generate inline code for divides of floating-point values. 14790 14791@item -minline-int-divide-min-latency 14792@opindex minline-int-divide-min-latency 14793Generate code for inline divides of integer values 14794using the minimum latency algorithm. 14795 14796@item -minline-int-divide-max-throughput 14797@opindex minline-int-divide-max-throughput 14798Generate code for inline divides of integer values 14799using the maximum throughput algorithm. 14800 14801@item -mno-inline-int-divide 14802@opindex mno-inline-int-divide 14803Do not generate inline code for divides of integer values. 14804 14805@item -minline-sqrt-min-latency 14806@opindex minline-sqrt-min-latency 14807Generate code for inline square roots 14808using the minimum latency algorithm. 14809 14810@item -minline-sqrt-max-throughput 14811@opindex minline-sqrt-max-throughput 14812Generate code for inline square roots 14813using the maximum throughput algorithm. 14814 14815@item -mno-inline-sqrt 14816@opindex mno-inline-sqrt 14817Do not generate inline code for @code{sqrt}. 14818 14819@item -mfused-madd 14820@itemx -mno-fused-madd 14821@opindex mfused-madd 14822@opindex mno-fused-madd 14823Do (don't) generate code that uses the fused multiply/add or multiply/subtract 14824instructions. The default is to use these instructions. 14825 14826@item -mno-dwarf2-asm 14827@itemx -mdwarf2-asm 14828@opindex mno-dwarf2-asm 14829@opindex mdwarf2-asm 14830Don't (or do) generate assembler code for the DWARF 2 line number debugging 14831info. This may be useful when not using the GNU assembler. 14832 14833@item -mearly-stop-bits 14834@itemx -mno-early-stop-bits 14835@opindex mearly-stop-bits 14836@opindex mno-early-stop-bits 14837Allow stop bits to be placed earlier than immediately preceding the 14838instruction that triggered the stop bit. This can improve instruction 14839scheduling, but does not always do so. 14840 14841@item -mfixed-range=@var{register-range} 14842@opindex mfixed-range 14843Generate code treating the given register range as fixed registers. 14844A fixed register is one that the register allocator cannot use. This is 14845useful when compiling kernel code. A register range is specified as 14846two registers separated by a dash. Multiple register ranges can be 14847specified separated by a comma. 14848 14849@item -mtls-size=@var{tls-size} 14850@opindex mtls-size 14851Specify bit size of immediate TLS offsets. Valid values are 14, 22, and 1485264. 14853 14854@item -mtune=@var{cpu-type} 14855@opindex mtune 14856Tune the instruction scheduling for a particular CPU, Valid values are 14857@samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2}, 14858and @samp{mckinley}. 14859 14860@item -milp32 14861@itemx -mlp64 14862@opindex milp32 14863@opindex mlp64 14864Generate code for a 32-bit or 64-bit environment. 14865The 32-bit environment sets int, long and pointer to 32 bits. 14866The 64-bit environment sets int to 32 bits and long and pointer 14867to 64 bits. These are HP-UX specific flags. 14868 14869@item -mno-sched-br-data-spec 14870@itemx -msched-br-data-spec 14871@opindex mno-sched-br-data-spec 14872@opindex msched-br-data-spec 14873(Dis/En)able data speculative scheduling before reload. 14874This results in generation of @code{ld.a} instructions and 14875the corresponding check instructions (@code{ld.c} / @code{chk.a}). 14876The default is 'disable'. 14877 14878@item -msched-ar-data-spec 14879@itemx -mno-sched-ar-data-spec 14880@opindex msched-ar-data-spec 14881@opindex mno-sched-ar-data-spec 14882(En/Dis)able data speculative scheduling after reload. 14883This results in generation of @code{ld.a} instructions and 14884the corresponding check instructions (@code{ld.c} / @code{chk.a}). 14885The default is 'enable'. 14886 14887@item -mno-sched-control-spec 14888@itemx -msched-control-spec 14889@opindex mno-sched-control-spec 14890@opindex msched-control-spec 14891(Dis/En)able control speculative scheduling. This feature is 14892available only during region scheduling (i.e.@: before reload). 14893This results in generation of the @code{ld.s} instructions and 14894the corresponding check instructions @code{chk.s}. 14895The default is 'disable'. 14896 14897@item -msched-br-in-data-spec 14898@itemx -mno-sched-br-in-data-spec 14899@opindex msched-br-in-data-spec 14900@opindex mno-sched-br-in-data-spec 14901(En/Dis)able speculative scheduling of the instructions that 14902are dependent on the data speculative loads before reload. 14903This is effective only with @option{-msched-br-data-spec} enabled. 14904The default is 'enable'. 14905 14906@item -msched-ar-in-data-spec 14907@itemx -mno-sched-ar-in-data-spec 14908@opindex msched-ar-in-data-spec 14909@opindex mno-sched-ar-in-data-spec 14910(En/Dis)able speculative scheduling of the instructions that 14911are dependent on the data speculative loads after reload. 14912This is effective only with @option{-msched-ar-data-spec} enabled. 14913The default is 'enable'. 14914 14915@item -msched-in-control-spec 14916@itemx -mno-sched-in-control-spec 14917@opindex msched-in-control-spec 14918@opindex mno-sched-in-control-spec 14919(En/Dis)able speculative scheduling of the instructions that 14920are dependent on the control speculative loads. 14921This is effective only with @option{-msched-control-spec} enabled. 14922The default is 'enable'. 14923 14924@item -mno-sched-prefer-non-data-spec-insns 14925@itemx -msched-prefer-non-data-spec-insns 14926@opindex mno-sched-prefer-non-data-spec-insns 14927@opindex msched-prefer-non-data-spec-insns 14928If enabled, data-speculative instructions are chosen for schedule 14929only if there are no other choices at the moment. This makes 14930the use of the data speculation much more conservative. 14931The default is 'disable'. 14932 14933@item -mno-sched-prefer-non-control-spec-insns 14934@itemx -msched-prefer-non-control-spec-insns 14935@opindex mno-sched-prefer-non-control-spec-insns 14936@opindex msched-prefer-non-control-spec-insns 14937If enabled, control-speculative instructions are chosen for schedule 14938only if there are no other choices at the moment. This makes 14939the use of the control speculation much more conservative. 14940The default is 'disable'. 14941 14942@item -mno-sched-count-spec-in-critical-path 14943@itemx -msched-count-spec-in-critical-path 14944@opindex mno-sched-count-spec-in-critical-path 14945@opindex msched-count-spec-in-critical-path 14946If enabled, speculative dependencies are considered during 14947computation of the instructions priorities. This makes the use of the 14948speculation a bit more conservative. 14949The default is 'disable'. 14950 14951@item -msched-spec-ldc 14952@opindex msched-spec-ldc 14953Use a simple data speculation check. This option is on by default. 14954 14955@item -msched-control-spec-ldc 14956@opindex msched-spec-ldc 14957Use a simple check for control speculation. This option is on by default. 14958 14959@item -msched-stop-bits-after-every-cycle 14960@opindex msched-stop-bits-after-every-cycle 14961Place a stop bit after every cycle when scheduling. This option is on 14962by default. 14963 14964@item -msched-fp-mem-deps-zero-cost 14965@opindex msched-fp-mem-deps-zero-cost 14966Assume that floating-point stores and loads are not likely to cause a conflict 14967when placed into the same instruction group. This option is disabled by 14968default. 14969 14970@item -msel-sched-dont-check-control-spec 14971@opindex msel-sched-dont-check-control-spec 14972Generate checks for control speculation in selective scheduling. 14973This flag is disabled by default. 14974 14975@item -msched-max-memory-insns=@var{max-insns} 14976@opindex msched-max-memory-insns 14977Limit on the number of memory insns per instruction group, giving lower 14978priority to subsequent memory insns attempting to schedule in the same 14979instruction group. Frequently useful to prevent cache bank conflicts. 14980The default value is 1. 14981 14982@item -msched-max-memory-insns-hard-limit 14983@opindex msched-max-memory-insns-hard-limit 14984Makes the limit specified by @option{msched-max-memory-insns} a hard limit, 14985disallowing more than that number in an instruction group. 14986Otherwise, the limit is ``soft'', meaning that non-memory operations 14987are preferred when the limit is reached, but memory operations may still 14988be scheduled. 14989 14990@end table 14991 14992@node LM32 Options 14993@subsection LM32 Options 14994@cindex LM32 options 14995 14996These @option{-m} options are defined for the LatticeMico32 architecture: 14997 14998@table @gcctabopt 14999@item -mbarrel-shift-enabled 15000@opindex mbarrel-shift-enabled 15001Enable barrel-shift instructions. 15002 15003@item -mdivide-enabled 15004@opindex mdivide-enabled 15005Enable divide and modulus instructions. 15006 15007@item -mmultiply-enabled 15008@opindex multiply-enabled 15009Enable multiply instructions. 15010 15011@item -msign-extend-enabled 15012@opindex msign-extend-enabled 15013Enable sign extend instructions. 15014 15015@item -muser-enabled 15016@opindex muser-enabled 15017Enable user-defined instructions. 15018 15019@end table 15020 15021@node M32C Options 15022@subsection M32C Options 15023@cindex M32C options 15024 15025@table @gcctabopt 15026@item -mcpu=@var{name} 15027@opindex mcpu= 15028Select the CPU for which code is generated. @var{name} may be one of 15029@samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to 15030/60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for 15031the M32C/80 series. 15032 15033@item -msim 15034@opindex msim 15035Specifies that the program will be run on the simulator. This causes 15036an alternate runtime library to be linked in which supports, for 15037example, file I/O@. You must not use this option when generating 15038programs that will run on real hardware; you must provide your own 15039runtime library for whatever I/O functions are needed. 15040 15041@item -memregs=@var{number} 15042@opindex memregs= 15043Specifies the number of memory-based pseudo-registers GCC uses 15044during code generation. These pseudo-registers are used like real 15045registers, so there is a tradeoff between GCC's ability to fit the 15046code into available registers, and the performance penalty of using 15047memory instead of registers. Note that all modules in a program must 15048be compiled with the same value for this option. Because of that, you 15049must not use this option with GCC's default runtime libraries. 15050 15051@end table 15052 15053@node M32R/D Options 15054@subsection M32R/D Options 15055@cindex M32R/D options 15056 15057These @option{-m} options are defined for Renesas M32R/D architectures: 15058 15059@table @gcctabopt 15060@item -m32r2 15061@opindex m32r2 15062Generate code for the M32R/2@. 15063 15064@item -m32rx 15065@opindex m32rx 15066Generate code for the M32R/X@. 15067 15068@item -m32r 15069@opindex m32r 15070Generate code for the M32R@. This is the default. 15071 15072@item -mmodel=small 15073@opindex mmodel=small 15074Assume all objects live in the lower 16MB of memory (so that their addresses 15075can be loaded with the @code{ld24} instruction), and assume all subroutines 15076are reachable with the @code{bl} instruction. 15077This is the default. 15078 15079The addressability of a particular object can be set with the 15080@code{model} attribute. 15081 15082@item -mmodel=medium 15083@opindex mmodel=medium 15084Assume objects may be anywhere in the 32-bit address space (the compiler 15085generates @code{seth/add3} instructions to load their addresses), and 15086assume all subroutines are reachable with the @code{bl} instruction. 15087 15088@item -mmodel=large 15089@opindex mmodel=large 15090Assume objects may be anywhere in the 32-bit address space (the compiler 15091generates @code{seth/add3} instructions to load their addresses), and 15092assume subroutines may not be reachable with the @code{bl} instruction 15093(the compiler generates the much slower @code{seth/add3/jl} 15094instruction sequence). 15095 15096@item -msdata=none 15097@opindex msdata=none 15098Disable use of the small data area. Variables are put into 15099one of @samp{.data}, @samp{.bss}, or @samp{.rodata} (unless the 15100@code{section} attribute has been specified). 15101This is the default. 15102 15103The small data area consists of sections @samp{.sdata} and @samp{.sbss}. 15104Objects may be explicitly put in the small data area with the 15105@code{section} attribute using one of these sections. 15106 15107@item -msdata=sdata 15108@opindex msdata=sdata 15109Put small global and static data in the small data area, but do not 15110generate special code to reference them. 15111 15112@item -msdata=use 15113@opindex msdata=use 15114Put small global and static data in the small data area, and generate 15115special instructions to reference them. 15116 15117@item -G @var{num} 15118@opindex G 15119@cindex smaller data references 15120Put global and static objects less than or equal to @var{num} bytes 15121into the small data or BSS sections instead of the normal data or BSS 15122sections. The default value of @var{num} is 8. 15123The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use} 15124for this option to have any effect. 15125 15126All modules should be compiled with the same @option{-G @var{num}} value. 15127Compiling with different values of @var{num} may or may not work; if it 15128doesn't the linker gives an error message---incorrect code is not 15129generated. 15130 15131@item -mdebug 15132@opindex mdebug 15133Makes the M32R-specific code in the compiler display some statistics 15134that might help in debugging programs. 15135 15136@item -malign-loops 15137@opindex malign-loops 15138Align all loops to a 32-byte boundary. 15139 15140@item -mno-align-loops 15141@opindex mno-align-loops 15142Do not enforce a 32-byte alignment for loops. This is the default. 15143 15144@item -missue-rate=@var{number} 15145@opindex missue-rate=@var{number} 15146Issue @var{number} instructions per cycle. @var{number} can only be 1 15147or 2. 15148 15149@item -mbranch-cost=@var{number} 15150@opindex mbranch-cost=@var{number} 15151@var{number} can only be 1 or 2. If it is 1 then branches are 15152preferred over conditional code, if it is 2, then the opposite applies. 15153 15154@item -mflush-trap=@var{number} 15155@opindex mflush-trap=@var{number} 15156Specifies the trap number to use to flush the cache. The default is 1515712. Valid numbers are between 0 and 15 inclusive. 15158 15159@item -mno-flush-trap 15160@opindex mno-flush-trap 15161Specifies that the cache cannot be flushed by using a trap. 15162 15163@item -mflush-func=@var{name} 15164@opindex mflush-func=@var{name} 15165Specifies the name of the operating system function to call to flush 15166the cache. The default is @emph{_flush_cache}, but a function call 15167is only used if a trap is not available. 15168 15169@item -mno-flush-func 15170@opindex mno-flush-func 15171Indicates that there is no OS function for flushing the cache. 15172 15173@end table 15174 15175@node M680x0 Options 15176@subsection M680x0 Options 15177@cindex M680x0 options 15178 15179These are the @samp{-m} options defined for M680x0 and ColdFire processors. 15180The default settings depend on which architecture was selected when 15181the compiler was configured; the defaults for the most common choices 15182are given below. 15183 15184@table @gcctabopt 15185@item -march=@var{arch} 15186@opindex march 15187Generate code for a specific M680x0 or ColdFire instruction set 15188architecture. Permissible values of @var{arch} for M680x0 15189architectures are: @samp{68000}, @samp{68010}, @samp{68020}, 15190@samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire 15191architectures are selected according to Freescale's ISA classification 15192and the permissible values are: @samp{isaa}, @samp{isaaplus}, 15193@samp{isab} and @samp{isac}. 15194 15195GCC defines a macro @samp{__mcf@var{arch}__} whenever it is generating 15196code for a ColdFire target. The @var{arch} in this macro is one of the 15197@option{-march} arguments given above. 15198 15199When used together, @option{-march} and @option{-mtune} select code 15200that runs on a family of similar processors but that is optimized 15201for a particular microarchitecture. 15202 15203@item -mcpu=@var{cpu} 15204@opindex mcpu 15205Generate code for a specific M680x0 or ColdFire processor. 15206The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020}, 15207@samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332} 15208and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table 15209below, which also classifies the CPUs into families: 15210 15211@multitable @columnfractions 0.20 0.80 15212@item @strong{Family} @tab @strong{@samp{-mcpu} arguments} 15213@item @samp{51} @tab @samp{51} @samp{51ac} @samp{51ag} @samp{51cn} @samp{51em} @samp{51je} @samp{51jf} @samp{51jg} @samp{51jm} @samp{51mm} @samp{51qe} @samp{51qm} 15214@item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206} 15215@item @samp{5206e} @tab @samp{5206e} 15216@item @samp{5208} @tab @samp{5207} @samp{5208} 15217@item @samp{5211a} @tab @samp{5210a} @samp{5211a} 15218@item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213} 15219@item @samp{5216} @tab @samp{5214} @samp{5216} 15220@item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235} 15221@item @samp{5225} @tab @samp{5224} @samp{5225} 15222@item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259} 15223@item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x} 15224@item @samp{5249} @tab @samp{5249} 15225@item @samp{5250} @tab @samp{5250} 15226@item @samp{5271} @tab @samp{5270} @samp{5271} 15227@item @samp{5272} @tab @samp{5272} 15228@item @samp{5275} @tab @samp{5274} @samp{5275} 15229@item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x} 15230@item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017} 15231@item @samp{5307} @tab @samp{5307} 15232@item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x} 15233@item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x} 15234@item @samp{5407} @tab @samp{5407} 15235@item @samp{5475} @tab @samp{5470} @samp{5471} @samp{5472} @samp{5473} @samp{5474} @samp{5475} @samp{547x} @samp{5480} @samp{5481} @samp{5482} @samp{5483} @samp{5484} @samp{5485} 15236@end multitable 15237 15238@option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if 15239@var{arch} is compatible with @var{cpu}. Other combinations of 15240@option{-mcpu} and @option{-march} are rejected. 15241 15242GCC defines the macro @samp{__mcf_cpu_@var{cpu}} when ColdFire target 15243@var{cpu} is selected. It also defines @samp{__mcf_family_@var{family}}, 15244where the value of @var{family} is given by the table above. 15245 15246@item -mtune=@var{tune} 15247@opindex mtune 15248Tune the code for a particular microarchitecture within the 15249constraints set by @option{-march} and @option{-mcpu}. 15250The M680x0 microarchitectures are: @samp{68000}, @samp{68010}, 15251@samp{68020}, @samp{68030}, @samp{68040}, @samp{68060} 15252and @samp{cpu32}. The ColdFire microarchitectures 15253are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}. 15254 15255You can also use @option{-mtune=68020-40} for code that needs 15256to run relatively well on 68020, 68030 and 68040 targets. 15257@option{-mtune=68020-60} is similar but includes 68060 targets 15258as well. These two options select the same tuning decisions as 15259@option{-m68020-40} and @option{-m68020-60} respectively. 15260 15261GCC defines the macros @samp{__mc@var{arch}} and @samp{__mc@var{arch}__} 15262when tuning for 680x0 architecture @var{arch}. It also defines 15263@samp{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std} 15264option is used. If GCC is tuning for a range of architectures, 15265as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60}, 15266it defines the macros for every architecture in the range. 15267 15268GCC also defines the macro @samp{__m@var{uarch}__} when tuning for 15269ColdFire microarchitecture @var{uarch}, where @var{uarch} is one 15270of the arguments given above. 15271 15272@item -m68000 15273@itemx -mc68000 15274@opindex m68000 15275@opindex mc68000 15276Generate output for a 68000. This is the default 15277when the compiler is configured for 68000-based systems. 15278It is equivalent to @option{-march=68000}. 15279 15280Use this option for microcontrollers with a 68000 or EC000 core, 15281including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356. 15282 15283@item -m68010 15284@opindex m68010 15285Generate output for a 68010. This is the default 15286when the compiler is configured for 68010-based systems. 15287It is equivalent to @option{-march=68010}. 15288 15289@item -m68020 15290@itemx -mc68020 15291@opindex m68020 15292@opindex mc68020 15293Generate output for a 68020. This is the default 15294when the compiler is configured for 68020-based systems. 15295It is equivalent to @option{-march=68020}. 15296 15297@item -m68030 15298@opindex m68030 15299Generate output for a 68030. This is the default when the compiler is 15300configured for 68030-based systems. It is equivalent to 15301@option{-march=68030}. 15302 15303@item -m68040 15304@opindex m68040 15305Generate output for a 68040. This is the default when the compiler is 15306configured for 68040-based systems. It is equivalent to 15307@option{-march=68040}. 15308 15309This option inhibits the use of 68881/68882 instructions that have to be 15310emulated by software on the 68040. Use this option if your 68040 does not 15311have code to emulate those instructions. 15312 15313@item -m68060 15314@opindex m68060 15315Generate output for a 68060. This is the default when the compiler is 15316configured for 68060-based systems. It is equivalent to 15317@option{-march=68060}. 15318 15319This option inhibits the use of 68020 and 68881/68882 instructions that 15320have to be emulated by software on the 68060. Use this option if your 68060 15321does not have code to emulate those instructions. 15322 15323@item -mcpu32 15324@opindex mcpu32 15325Generate output for a CPU32. This is the default 15326when the compiler is configured for CPU32-based systems. 15327It is equivalent to @option{-march=cpu32}. 15328 15329Use this option for microcontrollers with a 15330CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334, 1533168336, 68340, 68341, 68349 and 68360. 15332 15333@item -m5200 15334@opindex m5200 15335Generate output for a 520X ColdFire CPU@. This is the default 15336when the compiler is configured for 520X-based systems. 15337It is equivalent to @option{-mcpu=5206}, and is now deprecated 15338in favor of that option. 15339 15340Use this option for microcontroller with a 5200 core, including 15341the MCF5202, MCF5203, MCF5204 and MCF5206. 15342 15343@item -m5206e 15344@opindex m5206e 15345Generate output for a 5206e ColdFire CPU@. The option is now 15346deprecated in favor of the equivalent @option{-mcpu=5206e}. 15347 15348@item -m528x 15349@opindex m528x 15350Generate output for a member of the ColdFire 528X family. 15351The option is now deprecated in favor of the equivalent 15352@option{-mcpu=528x}. 15353 15354@item -m5307 15355@opindex m5307 15356Generate output for a ColdFire 5307 CPU@. The option is now deprecated 15357in favor of the equivalent @option{-mcpu=5307}. 15358 15359@item -m5407 15360@opindex m5407 15361Generate output for a ColdFire 5407 CPU@. The option is now deprecated 15362in favor of the equivalent @option{-mcpu=5407}. 15363 15364@item -mcfv4e 15365@opindex mcfv4e 15366Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x). 15367This includes use of hardware floating-point instructions. 15368The option is equivalent to @option{-mcpu=547x}, and is now 15369deprecated in favor of that option. 15370 15371@item -m68020-40 15372@opindex m68020-40 15373Generate output for a 68040, without using any of the new instructions. 15374This results in code that can run relatively efficiently on either a 1537568020/68881 or a 68030 or a 68040. The generated code does use the 1537668881 instructions that are emulated on the 68040. 15377 15378The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}. 15379 15380@item -m68020-60 15381@opindex m68020-60 15382Generate output for a 68060, without using any of the new instructions. 15383This results in code that can run relatively efficiently on either a 1538468020/68881 or a 68030 or a 68040. The generated code does use the 1538568881 instructions that are emulated on the 68060. 15386 15387The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}. 15388 15389@item -mhard-float 15390@itemx -m68881 15391@opindex mhard-float 15392@opindex m68881 15393Generate floating-point instructions. This is the default for 68020 15394and above, and for ColdFire devices that have an FPU@. It defines the 15395macro @samp{__HAVE_68881__} on M680x0 targets and @samp{__mcffpu__} 15396on ColdFire targets. 15397 15398@item -msoft-float 15399@opindex msoft-float 15400Do not generate floating-point instructions; use library calls instead. 15401This is the default for 68000, 68010, and 68832 targets. It is also 15402the default for ColdFire devices that have no FPU. 15403 15404@item -mdiv 15405@itemx -mno-div 15406@opindex mdiv 15407@opindex mno-div 15408Generate (do not generate) ColdFire hardware divide and remainder 15409instructions. If @option{-march} is used without @option{-mcpu}, 15410the default is ``on'' for ColdFire architectures and ``off'' for M680x0 15411architectures. Otherwise, the default is taken from the target CPU 15412(either the default CPU, or the one specified by @option{-mcpu}). For 15413example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for 15414@option{-mcpu=5206e}. 15415 15416GCC defines the macro @samp{__mcfhwdiv__} when this option is enabled. 15417 15418@item -mshort 15419@opindex mshort 15420Consider type @code{int} to be 16 bits wide, like @code{short int}. 15421Additionally, parameters passed on the stack are also aligned to a 1542216-bit boundary even on targets whose API mandates promotion to 32-bit. 15423 15424@item -mno-short 15425@opindex mno-short 15426Do not consider type @code{int} to be 16 bits wide. This is the default. 15427 15428@item -mnobitfield 15429@itemx -mno-bitfield 15430@opindex mnobitfield 15431@opindex mno-bitfield 15432Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32} 15433and @option{-m5200} options imply @w{@option{-mnobitfield}}. 15434 15435@item -mbitfield 15436@opindex mbitfield 15437Do use the bit-field instructions. The @option{-m68020} option implies 15438@option{-mbitfield}. This is the default if you use a configuration 15439designed for a 68020. 15440 15441@item -mrtd 15442@opindex mrtd 15443Use a different function-calling convention, in which functions 15444that take a fixed number of arguments return with the @code{rtd} 15445instruction, which pops their arguments while returning. This 15446saves one instruction in the caller since there is no need to pop 15447the arguments there. 15448 15449This calling convention is incompatible with the one normally 15450used on Unix, so you cannot use it if you need to call libraries 15451compiled with the Unix compiler. 15452 15453Also, you must provide function prototypes for all functions that 15454take variable numbers of arguments (including @code{printf}); 15455otherwise incorrect code is generated for calls to those 15456functions. 15457 15458In addition, seriously incorrect code results if you call a 15459function with too many arguments. (Normally, extra arguments are 15460harmlessly ignored.) 15461 15462The @code{rtd} instruction is supported by the 68010, 68020, 68030, 1546368040, 68060 and CPU32 processors, but not by the 68000 or 5200. 15464 15465@item -mno-rtd 15466@opindex mno-rtd 15467Do not use the calling conventions selected by @option{-mrtd}. 15468This is the default. 15469 15470@item -malign-int 15471@itemx -mno-align-int 15472@opindex malign-int 15473@opindex mno-align-int 15474Control whether GCC aligns @code{int}, @code{long}, @code{long long}, 15475@code{float}, @code{double}, and @code{long double} variables on a 32-bit 15476boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}). 15477Aligning variables on 32-bit boundaries produces code that runs somewhat 15478faster on processors with 32-bit busses at the expense of more memory. 15479 15480@strong{Warning:} if you use the @option{-malign-int} switch, GCC 15481aligns structures containing the above types differently than 15482most published application binary interface specifications for the m68k. 15483 15484@item -mpcrel 15485@opindex mpcrel 15486Use the pc-relative addressing mode of the 68000 directly, instead of 15487using a global offset table. At present, this option implies @option{-fpic}, 15488allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is 15489not presently supported with @option{-mpcrel}, though this could be supported for 1549068020 and higher processors. 15491 15492@item -mno-strict-align 15493@itemx -mstrict-align 15494@opindex mno-strict-align 15495@opindex mstrict-align 15496Do not (do) assume that unaligned memory references are handled by 15497the system. 15498 15499@item -msep-data 15500Generate code that allows the data segment to be located in a different 15501area of memory from the text segment. This allows for execute-in-place in 15502an environment without virtual memory management. This option implies 15503@option{-fPIC}. 15504 15505@item -mno-sep-data 15506Generate code that assumes that the data segment follows the text segment. 15507This is the default. 15508 15509@item -mid-shared-library 15510Generate code that supports shared libraries via the library ID method. 15511This allows for execute-in-place and shared libraries in an environment 15512without virtual memory management. This option implies @option{-fPIC}. 15513 15514@item -mno-id-shared-library 15515Generate code that doesn't assume ID-based shared libraries are being used. 15516This is the default. 15517 15518@item -mshared-library-id=n 15519Specifies the identification number of the ID-based shared library being 15520compiled. Specifying a value of 0 generates more compact code; specifying 15521other values forces the allocation of that number to the current 15522library, but is no more space- or time-efficient than omitting this option. 15523 15524@item -mxgot 15525@itemx -mno-xgot 15526@opindex mxgot 15527@opindex mno-xgot 15528When generating position-independent code for ColdFire, generate code 15529that works if the GOT has more than 8192 entries. This code is 15530larger and slower than code generated without this option. On M680x0 15531processors, this option is not needed; @option{-fPIC} suffices. 15532 15533GCC normally uses a single instruction to load values from the GOT@. 15534While this is relatively efficient, it only works if the GOT 15535is smaller than about 64k. Anything larger causes the linker 15536to report an error such as: 15537 15538@cindex relocation truncated to fit (ColdFire) 15539@smallexample 15540relocation truncated to fit: R_68K_GOT16O foobar 15541@end smallexample 15542 15543If this happens, you should recompile your code with @option{-mxgot}. 15544It should then work with very large GOTs. However, code generated with 15545@option{-mxgot} is less efficient, since it takes 4 instructions to fetch 15546the value of a global symbol. 15547 15548Note that some linkers, including newer versions of the GNU linker, 15549can create multiple GOTs and sort GOT entries. If you have such a linker, 15550you should only need to use @option{-mxgot} when compiling a single 15551object file that accesses more than 8192 GOT entries. Very few do. 15552 15553These options have no effect unless GCC is generating 15554position-independent code. 15555 15556@end table 15557 15558@node MCore Options 15559@subsection MCore Options 15560@cindex MCore options 15561 15562These are the @samp{-m} options defined for the Motorola M*Core 15563processors. 15564 15565@table @gcctabopt 15566 15567@item -mhardlit 15568@itemx -mno-hardlit 15569@opindex mhardlit 15570@opindex mno-hardlit 15571Inline constants into the code stream if it can be done in two 15572instructions or less. 15573 15574@item -mdiv 15575@itemx -mno-div 15576@opindex mdiv 15577@opindex mno-div 15578Use the divide instruction. (Enabled by default). 15579 15580@item -mrelax-immediate 15581@itemx -mno-relax-immediate 15582@opindex mrelax-immediate 15583@opindex mno-relax-immediate 15584Allow arbitrary-sized immediates in bit operations. 15585 15586@item -mwide-bitfields 15587@itemx -mno-wide-bitfields 15588@opindex mwide-bitfields 15589@opindex mno-wide-bitfields 15590Always treat bit-fields as @code{int}-sized. 15591 15592@item -m4byte-functions 15593@itemx -mno-4byte-functions 15594@opindex m4byte-functions 15595@opindex mno-4byte-functions 15596Force all functions to be aligned to a 4-byte boundary. 15597 15598@item -mcallgraph-data 15599@itemx -mno-callgraph-data 15600@opindex mcallgraph-data 15601@opindex mno-callgraph-data 15602Emit callgraph information. 15603 15604@item -mslow-bytes 15605@itemx -mno-slow-bytes 15606@opindex mslow-bytes 15607@opindex mno-slow-bytes 15608Prefer word access when reading byte quantities. 15609 15610@item -mlittle-endian 15611@itemx -mbig-endian 15612@opindex mlittle-endian 15613@opindex mbig-endian 15614Generate code for a little-endian target. 15615 15616@item -m210 15617@itemx -m340 15618@opindex m210 15619@opindex m340 15620Generate code for the 210 processor. 15621 15622@item -mno-lsim 15623@opindex mno-lsim 15624Assume that runtime support has been provided and so omit the 15625simulator library (@file{libsim.a)} from the linker command line. 15626 15627@item -mstack-increment=@var{size} 15628@opindex mstack-increment 15629Set the maximum amount for a single stack increment operation. Large 15630values can increase the speed of programs that contain functions 15631that need a large amount of stack space, but they can also trigger a 15632segmentation fault if the stack is extended too much. The default 15633value is 0x1000. 15634 15635@end table 15636 15637@node MeP Options 15638@subsection MeP Options 15639@cindex MeP options 15640 15641@table @gcctabopt 15642 15643@item -mabsdiff 15644@opindex mabsdiff 15645Enables the @code{abs} instruction, which is the absolute difference 15646between two registers. 15647 15648@item -mall-opts 15649@opindex mall-opts 15650Enables all the optional instructions---average, multiply, divide, bit 15651operations, leading zero, absolute difference, min/max, clip, and 15652saturation. 15653 15654 15655@item -maverage 15656@opindex maverage 15657Enables the @code{ave} instruction, which computes the average of two 15658registers. 15659 15660@item -mbased=@var{n} 15661@opindex mbased= 15662Variables of size @var{n} bytes or smaller are placed in the 15663@code{.based} section by default. Based variables use the @code{$tp} 15664register as a base register, and there is a 128-byte limit to the 15665@code{.based} section. 15666 15667@item -mbitops 15668@opindex mbitops 15669Enables the bit operation instructions---bit test (@code{btstm}), set 15670(@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and 15671test-and-set (@code{tas}). 15672 15673@item -mc=@var{name} 15674@opindex mc= 15675Selects which section constant data is placed in. @var{name} may 15676be @code{tiny}, @code{near}, or @code{far}. 15677 15678@item -mclip 15679@opindex mclip 15680Enables the @code{clip} instruction. Note that @code{-mclip} is not 15681useful unless you also provide @code{-mminmax}. 15682 15683@item -mconfig=@var{name} 15684@opindex mconfig= 15685Selects one of the built-in core configurations. Each MeP chip has 15686one or more modules in it; each module has a core CPU and a variety of 15687coprocessors, optional instructions, and peripherals. The 15688@code{MeP-Integrator} tool, not part of GCC, provides these 15689configurations through this option; using this option is the same as 15690using all the corresponding command-line options. The default 15691configuration is @code{default}. 15692 15693@item -mcop 15694@opindex mcop 15695Enables the coprocessor instructions. By default, this is a 32-bit 15696coprocessor. Note that the coprocessor is normally enabled via the 15697@code{-mconfig=} option. 15698 15699@item -mcop32 15700@opindex mcop32 15701Enables the 32-bit coprocessor's instructions. 15702 15703@item -mcop64 15704@opindex mcop64 15705Enables the 64-bit coprocessor's instructions. 15706 15707@item -mivc2 15708@opindex mivc2 15709Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor. 15710 15711@item -mdc 15712@opindex mdc 15713Causes constant variables to be placed in the @code{.near} section. 15714 15715@item -mdiv 15716@opindex mdiv 15717Enables the @code{div} and @code{divu} instructions. 15718 15719@item -meb 15720@opindex meb 15721Generate big-endian code. 15722 15723@item -mel 15724@opindex mel 15725Generate little-endian code. 15726 15727@item -mio-volatile 15728@opindex mio-volatile 15729Tells the compiler that any variable marked with the @code{io} 15730attribute is to be considered volatile. 15731 15732@item -ml 15733@opindex ml 15734Causes variables to be assigned to the @code{.far} section by default. 15735 15736@item -mleadz 15737@opindex mleadz 15738Enables the @code{leadz} (leading zero) instruction. 15739 15740@item -mm 15741@opindex mm 15742Causes variables to be assigned to the @code{.near} section by default. 15743 15744@item -mminmax 15745@opindex mminmax 15746Enables the @code{min} and @code{max} instructions. 15747 15748@item -mmult 15749@opindex mmult 15750Enables the multiplication and multiply-accumulate instructions. 15751 15752@item -mno-opts 15753@opindex mno-opts 15754Disables all the optional instructions enabled by @code{-mall-opts}. 15755 15756@item -mrepeat 15757@opindex mrepeat 15758Enables the @code{repeat} and @code{erepeat} instructions, used for 15759low-overhead looping. 15760 15761@item -ms 15762@opindex ms 15763Causes all variables to default to the @code{.tiny} section. Note 15764that there is a 65536-byte limit to this section. Accesses to these 15765variables use the @code{%gp} base register. 15766 15767@item -msatur 15768@opindex msatur 15769Enables the saturation instructions. Note that the compiler does not 15770currently generate these itself, but this option is included for 15771compatibility with other tools, like @code{as}. 15772 15773@item -msdram 15774@opindex msdram 15775Link the SDRAM-based runtime instead of the default ROM-based runtime. 15776 15777@item -msim 15778@opindex msim 15779Link the simulator runtime libraries. 15780 15781@item -msimnovec 15782@opindex msimnovec 15783Link the simulator runtime libraries, excluding built-in support 15784for reset and exception vectors and tables. 15785 15786@item -mtf 15787@opindex mtf 15788Causes all functions to default to the @code{.far} section. Without 15789this option, functions default to the @code{.near} section. 15790 15791@item -mtiny=@var{n} 15792@opindex mtiny= 15793Variables that are @var{n} bytes or smaller are allocated to the 15794@code{.tiny} section. These variables use the @code{$gp} base 15795register. The default for this option is 4, but note that there's a 1579665536-byte limit to the @code{.tiny} section. 15797 15798@end table 15799 15800@node MicroBlaze Options 15801@subsection MicroBlaze Options 15802@cindex MicroBlaze Options 15803 15804@table @gcctabopt 15805 15806@item -msoft-float 15807@opindex msoft-float 15808Use software emulation for floating point (default). 15809 15810@item -mhard-float 15811@opindex mhard-float 15812Use hardware floating-point instructions. 15813 15814@item -mmemcpy 15815@opindex mmemcpy 15816Do not optimize block moves, use @code{memcpy}. 15817 15818@item -mno-clearbss 15819@opindex mno-clearbss 15820This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead. 15821 15822@item -mcpu=@var{cpu-type} 15823@opindex mcpu= 15824Use features of, and schedule code for, the given CPU. 15825Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}}, 15826where @var{X} is a major version, @var{YY} is the minor version, and 15827@var{Z} is compatibility code. Example values are @samp{v3.00.a}, 15828@samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}. 15829 15830@item -mxl-soft-mul 15831@opindex mxl-soft-mul 15832Use software multiply emulation (default). 15833 15834@item -mxl-soft-div 15835@opindex mxl-soft-div 15836Use software emulation for divides (default). 15837 15838@item -mxl-barrel-shift 15839@opindex mxl-barrel-shift 15840Use the hardware barrel shifter. 15841 15842@item -mxl-pattern-compare 15843@opindex mxl-pattern-compare 15844Use pattern compare instructions. 15845 15846@item -msmall-divides 15847@opindex msmall-divides 15848Use table lookup optimization for small signed integer divisions. 15849 15850@item -mxl-stack-check 15851@opindex mxl-stack-check 15852This option is deprecated. Use @option{-fstack-check} instead. 15853 15854@item -mxl-gp-opt 15855@opindex mxl-gp-opt 15856Use GP-relative @code{.sdata}/@code{.sbss} sections. 15857 15858@item -mxl-multiply-high 15859@opindex mxl-multiply-high 15860Use multiply high instructions for high part of 32x32 multiply. 15861 15862@item -mxl-float-convert 15863@opindex mxl-float-convert 15864Use hardware floating-point conversion instructions. 15865 15866@item -mxl-float-sqrt 15867@opindex mxl-float-sqrt 15868Use hardware floating-point square root instruction. 15869 15870@item -mbig-endian 15871@opindex mbig-endian 15872Generate code for a big-endian target. 15873 15874@item -mlittle-endian 15875@opindex mlittle-endian 15876Generate code for a little-endian target. 15877 15878@item -mxl-reorder 15879@opindex mxl-reorder 15880Use reorder instructions (swap and byte reversed load/store). 15881 15882@item -mxl-mode-@var{app-model} 15883Select application model @var{app-model}. Valid models are 15884@table @samp 15885@item executable 15886normal executable (default), uses startup code @file{crt0.o}. 15887 15888@item xmdstub 15889for use with Xilinx Microprocessor Debugger (XMD) based 15890software intrusive debug agent called xmdstub. This uses startup file 15891@file{crt1.o} and sets the start address of the program to 0x800. 15892 15893@item bootstrap 15894for applications that are loaded using a bootloader. 15895This model uses startup file @file{crt2.o} which does not contain a processor 15896reset vector handler. This is suitable for transferring control on a 15897processor reset to the bootloader rather than the application. 15898 15899@item novectors 15900for applications that do not require any of the 15901MicroBlaze vectors. This option may be useful for applications running 15902within a monitoring application. This model uses @file{crt3.o} as a startup file. 15903@end table 15904 15905Option @option{-xl-mode-@var{app-model}} is a deprecated alias for 15906@option{-mxl-mode-@var{app-model}}. 15907 15908@end table 15909 15910@node MIPS Options 15911@subsection MIPS Options 15912@cindex MIPS options 15913 15914@table @gcctabopt 15915 15916@item -EB 15917@opindex EB 15918Generate big-endian code. 15919 15920@item -EL 15921@opindex EL 15922Generate little-endian code. This is the default for @samp{mips*el-*-*} 15923configurations. 15924 15925@item -march=@var{arch} 15926@opindex march 15927Generate code that runs on @var{arch}, which can be the name of a 15928generic MIPS ISA, or the name of a particular processor. 15929The ISA names are: 15930@samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4}, 15931@samp{mips32}, @samp{mips32r2}, @samp{mips64} and @samp{mips64r2}. 15932The processor names are: 15933@samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc}, 15934@samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd}, 15935@samp{5kc}, @samp{5kf}, 15936@samp{20kc}, 15937@samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1}, 15938@samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1}, 15939@samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn}, 15940@samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2}, 15941@samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1}, 15942@samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, 15943@samp{m4k}, 15944@samp{octeon}, @samp{octeon+}, @samp{octeon2}, 15945@samp{orion}, 15946@samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400}, 15947@samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000}, 15948@samp{rm7000}, @samp{rm9000}, 15949@samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000}, 15950@samp{sb1}, 15951@samp{sr71000}, 15952@samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300}, 15953@samp{vr5000}, @samp{vr5400}, @samp{vr5500}, 15954@samp{xlr} and @samp{xlp}. 15955The special value @samp{from-abi} selects the 15956most compatible architecture for the selected ABI (that is, 15957@samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@. 15958 15959The native Linux/GNU toolchain also supports the value @samp{native}, 15960which selects the best architecture option for the host processor. 15961@option{-march=native} has no effect if GCC does not recognize 15962the processor. 15963 15964In processor names, a final @samp{000} can be abbreviated as @samp{k} 15965(for example, @option{-march=r2k}). Prefixes are optional, and 15966@samp{vr} may be written @samp{r}. 15967 15968Names of the form @samp{@var{n}f2_1} refer to processors with 15969FPUs clocked at half the rate of the core, names of the form 15970@samp{@var{n}f1_1} refer to processors with FPUs clocked at the same 15971rate as the core, and names of the form @samp{@var{n}f3_2} refer to 15972processors with FPUs clocked a ratio of 3:2 with respect to the core. 15973For compatibility reasons, @samp{@var{n}f} is accepted as a synonym 15974for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are 15975accepted as synonyms for @samp{@var{n}f1_1}. 15976 15977GCC defines two macros based on the value of this option. The first 15978is @samp{_MIPS_ARCH}, which gives the name of target architecture, as 15979a string. The second has the form @samp{_MIPS_ARCH_@var{foo}}, 15980where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@. 15981For example, @option{-march=r2000} sets @samp{_MIPS_ARCH} 15982to @samp{"r2000"} and defines the macro @samp{_MIPS_ARCH_R2000}. 15983 15984Note that the @samp{_MIPS_ARCH} macro uses the processor names given 15985above. In other words, it has the full prefix and does not 15986abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi}, 15987the macro names the resolved architecture (either @samp{"mips1"} or 15988@samp{"mips3"}). It names the default architecture when no 15989@option{-march} option is given. 15990 15991@item -mtune=@var{arch} 15992@opindex mtune 15993Optimize for @var{arch}. Among other things, this option controls 15994the way instructions are scheduled, and the perceived cost of arithmetic 15995operations. The list of @var{arch} values is the same as for 15996@option{-march}. 15997 15998When this option is not used, GCC optimizes for the processor 15999specified by @option{-march}. By using @option{-march} and 16000@option{-mtune} together, it is possible to generate code that 16001runs on a family of processors, but optimize the code for one 16002particular member of that family. 16003 16004@option{-mtune} defines the macros @samp{_MIPS_TUNE} and 16005@samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the 16006@option{-march} ones described above. 16007 16008@item -mips1 16009@opindex mips1 16010Equivalent to @option{-march=mips1}. 16011 16012@item -mips2 16013@opindex mips2 16014Equivalent to @option{-march=mips2}. 16015 16016@item -mips3 16017@opindex mips3 16018Equivalent to @option{-march=mips3}. 16019 16020@item -mips4 16021@opindex mips4 16022Equivalent to @option{-march=mips4}. 16023 16024@item -mips32 16025@opindex mips32 16026Equivalent to @option{-march=mips32}. 16027 16028@item -mips32r2 16029@opindex mips32r2 16030Equivalent to @option{-march=mips32r2}. 16031 16032@item -mips64 16033@opindex mips64 16034Equivalent to @option{-march=mips64}. 16035 16036@item -mips64r2 16037@opindex mips64r2 16038Equivalent to @option{-march=mips64r2}. 16039 16040@item -mips16 16041@itemx -mno-mips16 16042@opindex mips16 16043@opindex mno-mips16 16044Generate (do not generate) MIPS16 code. If GCC is targeting a 16045MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@. 16046 16047MIPS16 code generation can also be controlled on a per-function basis 16048by means of @code{mips16} and @code{nomips16} attributes. 16049@xref{Function Attributes}, for more information. 16050 16051@item -mflip-mips16 16052@opindex mflip-mips16 16053Generate MIPS16 code on alternating functions. This option is provided 16054for regression testing of mixed MIPS16/non-MIPS16 code generation, and is 16055not intended for ordinary use in compiling user code. 16056 16057@item -minterlink-mips16 16058@itemx -mno-interlink-mips16 16059@opindex minterlink-mips16 16060@opindex mno-interlink-mips16 16061Require (do not require) that non-MIPS16 code be link-compatible with 16062MIPS16 code. 16063 16064For example, non-MIPS16 code cannot jump directly to MIPS16 code; 16065it must either use a call or an indirect jump. @option{-minterlink-mips16} 16066therefore disables direct jumps unless GCC knows that the target of the 16067jump is not MIPS16. 16068 16069@item -mabi=32 16070@itemx -mabi=o64 16071@itemx -mabi=n32 16072@itemx -mabi=64 16073@itemx -mabi=eabi 16074@opindex mabi=32 16075@opindex mabi=o64 16076@opindex mabi=n32 16077@opindex mabi=64 16078@opindex mabi=eabi 16079Generate code for the given ABI@. 16080 16081Note that the EABI has a 32-bit and a 64-bit variant. GCC normally 16082generates 64-bit code when you select a 64-bit architecture, but you 16083can use @option{-mgp32} to get 32-bit code instead. 16084 16085For information about the O64 ABI, see 16086@uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}. 16087 16088GCC supports a variant of the o32 ABI in which floating-point registers 16089are 64 rather than 32 bits wide. You can select this combination with 16090@option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1} 16091and @code{mfhc1} instructions and is therefore only supported for 16092MIPS32R2 processors. 16093 16094The register assignments for arguments and return values remain the 16095same, but each scalar value is passed in a single 64-bit register 16096rather than a pair of 32-bit registers. For example, scalar 16097floating-point values are returned in @samp{$f0} only, not a 16098@samp{$f0}/@samp{$f1} pair. The set of call-saved registers also 16099remains the same, but all 64 bits are saved. 16100 16101@item -mabicalls 16102@itemx -mno-abicalls 16103@opindex mabicalls 16104@opindex mno-abicalls 16105Generate (do not generate) code that is suitable for SVR4-style 16106dynamic objects. @option{-mabicalls} is the default for SVR4-based 16107systems. 16108 16109@item -mshared 16110@itemx -mno-shared 16111Generate (do not generate) code that is fully position-independent, 16112and that can therefore be linked into shared libraries. This option 16113only affects @option{-mabicalls}. 16114 16115All @option{-mabicalls} code has traditionally been position-independent, 16116regardless of options like @option{-fPIC} and @option{-fpic}. However, 16117as an extension, the GNU toolchain allows executables to use absolute 16118accesses for locally-binding symbols. It can also use shorter GP 16119initialization sequences and generate direct calls to locally-defined 16120functions. This mode is selected by @option{-mno-shared}. 16121 16122@option{-mno-shared} depends on binutils 2.16 or higher and generates 16123objects that can only be linked by the GNU linker. However, the option 16124does not affect the ABI of the final executable; it only affects the ABI 16125of relocatable objects. Using @option{-mno-shared} generally makes 16126executables both smaller and quicker. 16127 16128@option{-mshared} is the default. 16129 16130@item -mplt 16131@itemx -mno-plt 16132@opindex mplt 16133@opindex mno-plt 16134Assume (do not assume) that the static and dynamic linkers 16135support PLTs and copy relocations. This option only affects 16136@option{-mno-shared -mabicalls}. For the n64 ABI, this option 16137has no effect without @option{-msym32}. 16138 16139You can make @option{-mplt} the default by configuring 16140GCC with @option{--with-mips-plt}. The default is 16141@option{-mno-plt} otherwise. 16142 16143@item -mxgot 16144@itemx -mno-xgot 16145@opindex mxgot 16146@opindex mno-xgot 16147Lift (do not lift) the usual restrictions on the size of the global 16148offset table. 16149 16150GCC normally uses a single instruction to load values from the GOT@. 16151While this is relatively efficient, it only works if the GOT 16152is smaller than about 64k. Anything larger causes the linker 16153to report an error such as: 16154 16155@cindex relocation truncated to fit (MIPS) 16156@smallexample 16157relocation truncated to fit: R_MIPS_GOT16 foobar 16158@end smallexample 16159 16160If this happens, you should recompile your code with @option{-mxgot}. 16161This works with very large GOTs, although the code is also 16162less efficient, since it takes three instructions to fetch the 16163value of a global symbol. 16164 16165Note that some linkers can create multiple GOTs. If you have such a 16166linker, you should only need to use @option{-mxgot} when a single object 16167file accesses more than 64k's worth of GOT entries. Very few do. 16168 16169These options have no effect unless GCC is generating position 16170independent code. 16171 16172@item -mgp32 16173@opindex mgp32 16174Assume that general-purpose registers are 32 bits wide. 16175 16176@item -mgp64 16177@opindex mgp64 16178Assume that general-purpose registers are 64 bits wide. 16179 16180@item -mfp32 16181@opindex mfp32 16182Assume that floating-point registers are 32 bits wide. 16183 16184@item -mfp64 16185@opindex mfp64 16186Assume that floating-point registers are 64 bits wide. 16187 16188@item -mhard-float 16189@opindex mhard-float 16190Use floating-point coprocessor instructions. 16191 16192@item -msoft-float 16193@opindex msoft-float 16194Do not use floating-point coprocessor instructions. Implement 16195floating-point calculations using library calls instead. 16196 16197@item -mno-float 16198@opindex mno-float 16199Equivalent to @option{-msoft-float}, but additionally asserts that the 16200program being compiled does not perform any floating-point operations. 16201This option is presently supported only by some bare-metal MIPS 16202configurations, where it may select a special set of libraries 16203that lack all floating-point support (including, for example, the 16204floating-point @code{printf} formats). 16205If code compiled with @code{-mno-float} accidentally contains 16206floating-point operations, it is likely to suffer a link-time 16207or run-time failure. 16208 16209@item -msingle-float 16210@opindex msingle-float 16211Assume that the floating-point coprocessor only supports single-precision 16212operations. 16213 16214@item -mdouble-float 16215@opindex mdouble-float 16216Assume that the floating-point coprocessor supports double-precision 16217operations. This is the default. 16218 16219@item -mllsc 16220@itemx -mno-llsc 16221@opindex mllsc 16222@opindex mno-llsc 16223Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to 16224implement atomic memory built-in functions. When neither option is 16225specified, GCC uses the instructions if the target architecture 16226supports them. 16227 16228@option{-mllsc} is useful if the runtime environment can emulate the 16229instructions and @option{-mno-llsc} can be useful when compiling for 16230nonstandard ISAs. You can make either option the default by 16231configuring GCC with @option{--with-llsc} and @option{--without-llsc} 16232respectively. @option{--with-llsc} is the default for some 16233configurations; see the installation documentation for details. 16234 16235@item -mdsp 16236@itemx -mno-dsp 16237@opindex mdsp 16238@opindex mno-dsp 16239Use (do not use) revision 1 of the MIPS DSP ASE@. 16240@xref{MIPS DSP Built-in Functions}. This option defines the 16241preprocessor macro @samp{__mips_dsp}. It also defines 16242@samp{__mips_dsp_rev} to 1. 16243 16244@item -mdspr2 16245@itemx -mno-dspr2 16246@opindex mdspr2 16247@opindex mno-dspr2 16248Use (do not use) revision 2 of the MIPS DSP ASE@. 16249@xref{MIPS DSP Built-in Functions}. This option defines the 16250preprocessor macros @samp{__mips_dsp} and @samp{__mips_dspr2}. 16251It also defines @samp{__mips_dsp_rev} to 2. 16252 16253@item -msmartmips 16254@itemx -mno-smartmips 16255@opindex msmartmips 16256@opindex mno-smartmips 16257Use (do not use) the MIPS SmartMIPS ASE. 16258 16259@item -mpaired-single 16260@itemx -mno-paired-single 16261@opindex mpaired-single 16262@opindex mno-paired-single 16263Use (do not use) paired-single floating-point instructions. 16264@xref{MIPS Paired-Single Support}. This option requires 16265hardware floating-point support to be enabled. 16266 16267@item -mdmx 16268@itemx -mno-mdmx 16269@opindex mdmx 16270@opindex mno-mdmx 16271Use (do not use) MIPS Digital Media Extension instructions. 16272This option can only be used when generating 64-bit code and requires 16273hardware floating-point support to be enabled. 16274 16275@item -mips3d 16276@itemx -mno-mips3d 16277@opindex mips3d 16278@opindex mno-mips3d 16279Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}. 16280The option @option{-mips3d} implies @option{-mpaired-single}. 16281 16282@item -mmt 16283@itemx -mno-mt 16284@opindex mmt 16285@opindex mno-mt 16286Use (do not use) MT Multithreading instructions. 16287 16288@item -mmcu 16289@itemx -mno-mcu 16290@opindex mmcu 16291@opindex mno-mcu 16292Use (do not use) the MIPS MCU ASE instructions. 16293 16294@item -mlong64 16295@opindex mlong64 16296Force @code{long} types to be 64 bits wide. See @option{-mlong32} for 16297an explanation of the default and the way that the pointer size is 16298determined. 16299 16300@item -mlong32 16301@opindex mlong32 16302Force @code{long}, @code{int}, and pointer types to be 32 bits wide. 16303 16304The default size of @code{int}s, @code{long}s and pointers depends on 16305the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI 16306uses 64-bit @code{long}s, as does the 64-bit EABI; the others use 1630732-bit @code{long}s. Pointers are the same size as @code{long}s, 16308or the same size as integer registers, whichever is smaller. 16309 16310@item -msym32 16311@itemx -mno-sym32 16312@opindex msym32 16313@opindex mno-sym32 16314Assume (do not assume) that all symbols have 32-bit values, regardless 16315of the selected ABI@. This option is useful in combination with 16316@option{-mabi=64} and @option{-mno-abicalls} because it allows GCC 16317to generate shorter and faster references to symbolic addresses. 16318 16319@item -G @var{num} 16320@opindex G 16321Put definitions of externally-visible data in a small data section 16322if that data is no bigger than @var{num} bytes. GCC can then generate 16323more efficient accesses to the data; see @option{-mgpopt} for details. 16324 16325The default @option{-G} option depends on the configuration. 16326 16327@item -mlocal-sdata 16328@itemx -mno-local-sdata 16329@opindex mlocal-sdata 16330@opindex mno-local-sdata 16331Extend (do not extend) the @option{-G} behavior to local data too, 16332such as to static variables in C@. @option{-mlocal-sdata} is the 16333default for all configurations. 16334 16335If the linker complains that an application is using too much small data, 16336you might want to try rebuilding the less performance-critical parts with 16337@option{-mno-local-sdata}. You might also want to build large 16338libraries with @option{-mno-local-sdata}, so that the libraries leave 16339more room for the main program. 16340 16341@item -mextern-sdata 16342@itemx -mno-extern-sdata 16343@opindex mextern-sdata 16344@opindex mno-extern-sdata 16345Assume (do not assume) that externally-defined data is in 16346a small data section if the size of that data is within the @option{-G} limit. 16347@option{-mextern-sdata} is the default for all configurations. 16348 16349If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G 16350@var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var} 16351that is no bigger than @var{num} bytes, you must make sure that @var{Var} 16352is placed in a small data section. If @var{Var} is defined by another 16353module, you must either compile that module with a high-enough 16354@option{-G} setting or attach a @code{section} attribute to @var{Var}'s 16355definition. If @var{Var} is common, you must link the application 16356with a high-enough @option{-G} setting. 16357 16358The easiest way of satisfying these restrictions is to compile 16359and link every module with the same @option{-G} option. However, 16360you may wish to build a library that supports several different 16361small data limits. You can do this by compiling the library with 16362the highest supported @option{-G} setting and additionally using 16363@option{-mno-extern-sdata} to stop the library from making assumptions 16364about externally-defined data. 16365 16366@item -mgpopt 16367@itemx -mno-gpopt 16368@opindex mgpopt 16369@opindex mno-gpopt 16370Use (do not use) GP-relative accesses for symbols that are known to be 16371in a small data section; see @option{-G}, @option{-mlocal-sdata} and 16372@option{-mextern-sdata}. @option{-mgpopt} is the default for all 16373configurations. 16374 16375@option{-mno-gpopt} is useful for cases where the @code{$gp} register 16376might not hold the value of @code{_gp}. For example, if the code is 16377part of a library that might be used in a boot monitor, programs that 16378call boot monitor routines pass an unknown value in @code{$gp}. 16379(In such situations, the boot monitor itself is usually compiled 16380with @option{-G0}.) 16381 16382@option{-mno-gpopt} implies @option{-mno-local-sdata} and 16383@option{-mno-extern-sdata}. 16384 16385@item -membedded-data 16386@itemx -mno-embedded-data 16387@opindex membedded-data 16388@opindex mno-embedded-data 16389Allocate variables to the read-only data section first if possible, then 16390next in the small data section if possible, otherwise in data. This gives 16391slightly slower code than the default, but reduces the amount of RAM required 16392when executing, and thus may be preferred for some embedded systems. 16393 16394@item -muninit-const-in-rodata 16395@itemx -mno-uninit-const-in-rodata 16396@opindex muninit-const-in-rodata 16397@opindex mno-uninit-const-in-rodata 16398Put uninitialized @code{const} variables in the read-only data section. 16399This option is only meaningful in conjunction with @option{-membedded-data}. 16400 16401@item -mcode-readable=@var{setting} 16402@opindex mcode-readable 16403Specify whether GCC may generate code that reads from executable sections. 16404There are three possible settings: 16405 16406@table @gcctabopt 16407@item -mcode-readable=yes 16408Instructions may freely access executable sections. This is the 16409default setting. 16410 16411@item -mcode-readable=pcrel 16412MIPS16 PC-relative load instructions can access executable sections, 16413but other instructions must not do so. This option is useful on 4KSc 16414and 4KSd processors when the code TLBs have the Read Inhibit bit set. 16415It is also useful on processors that can be configured to have a dual 16416instruction/data SRAM interface and that, like the M4K, automatically 16417redirect PC-relative loads to the instruction RAM. 16418 16419@item -mcode-readable=no 16420Instructions must not access executable sections. This option can be 16421useful on targets that are configured to have a dual instruction/data 16422SRAM interface but that (unlike the M4K) do not automatically redirect 16423PC-relative loads to the instruction RAM. 16424@end table 16425 16426@item -msplit-addresses 16427@itemx -mno-split-addresses 16428@opindex msplit-addresses 16429@opindex mno-split-addresses 16430Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler 16431relocation operators. This option has been superseded by 16432@option{-mexplicit-relocs} but is retained for backwards compatibility. 16433 16434@item -mexplicit-relocs 16435@itemx -mno-explicit-relocs 16436@opindex mexplicit-relocs 16437@opindex mno-explicit-relocs 16438Use (do not use) assembler relocation operators when dealing with symbolic 16439addresses. The alternative, selected by @option{-mno-explicit-relocs}, 16440is to use assembler macros instead. 16441 16442@option{-mexplicit-relocs} is the default if GCC was configured 16443to use an assembler that supports relocation operators. 16444 16445@item -mcheck-zero-division 16446@itemx -mno-check-zero-division 16447@opindex mcheck-zero-division 16448@opindex mno-check-zero-division 16449Trap (do not trap) on integer division by zero. 16450 16451The default is @option{-mcheck-zero-division}. 16452 16453@item -mdivide-traps 16454@itemx -mdivide-breaks 16455@opindex mdivide-traps 16456@opindex mdivide-breaks 16457MIPS systems check for division by zero by generating either a 16458conditional trap or a break instruction. Using traps results in 16459smaller code, but is only supported on MIPS II and later. Also, some 16460versions of the Linux kernel have a bug that prevents trap from 16461generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to 16462allow conditional traps on architectures that support them and 16463@option{-mdivide-breaks} to force the use of breaks. 16464 16465The default is usually @option{-mdivide-traps}, but this can be 16466overridden at configure time using @option{--with-divide=breaks}. 16467Divide-by-zero checks can be completely disabled using 16468@option{-mno-check-zero-division}. 16469 16470@item -mmemcpy 16471@itemx -mno-memcpy 16472@opindex mmemcpy 16473@opindex mno-memcpy 16474Force (do not force) the use of @code{memcpy()} for non-trivial block 16475moves. The default is @option{-mno-memcpy}, which allows GCC to inline 16476most constant-sized copies. 16477 16478@item -mlong-calls 16479@itemx -mno-long-calls 16480@opindex mlong-calls 16481@opindex mno-long-calls 16482Disable (do not disable) use of the @code{jal} instruction. Calling 16483functions using @code{jal} is more efficient but requires the caller 16484and callee to be in the same 256 megabyte segment. 16485 16486This option has no effect on abicalls code. The default is 16487@option{-mno-long-calls}. 16488 16489@item -mmad 16490@itemx -mno-mad 16491@opindex mmad 16492@opindex mno-mad 16493Enable (disable) use of the @code{mad}, @code{madu} and @code{mul} 16494instructions, as provided by the R4650 ISA@. 16495 16496@item -mfused-madd 16497@itemx -mno-fused-madd 16498@opindex mfused-madd 16499@opindex mno-fused-madd 16500Enable (disable) use of the floating-point multiply-accumulate 16501instructions, when they are available. The default is 16502@option{-mfused-madd}. 16503 16504On the R8000 CPU when multiply-accumulate instructions are used, 16505the intermediate product is calculated to infinite precision 16506and is not subject to the FCSR Flush to Zero bit. This may be 16507undesirable in some circumstances. On other processors the result 16508is numerically identical to the equivalent computation using 16509separate multiply, add, subtract and negate instructions. 16510 16511@item -nocpp 16512@opindex nocpp 16513Tell the MIPS assembler to not run its preprocessor over user 16514assembler files (with a @samp{.s} suffix) when assembling them. 16515 16516@item -mfix-24k 16517@item -mno-fix-24k 16518@opindex mfix-24k 16519@opindex mno-fix-24k 16520Work around the 24K E48 (lost data on stores during refill) errata. 16521The workarounds are implemented by the assembler rather than by GCC@. 16522 16523@item -mfix-r4000 16524@itemx -mno-fix-r4000 16525@opindex mfix-r4000 16526@opindex mno-fix-r4000 16527Work around certain R4000 CPU errata: 16528@itemize @minus 16529@item 16530A double-word or a variable shift may give an incorrect result if executed 16531immediately after starting an integer division. 16532@item 16533A double-word or a variable shift may give an incorrect result if executed 16534while an integer multiplication is in progress. 16535@item 16536An integer division may give an incorrect result if started in a delay slot 16537of a taken branch or a jump. 16538@end itemize 16539 16540@item -mfix-r4400 16541@itemx -mno-fix-r4400 16542@opindex mfix-r4400 16543@opindex mno-fix-r4400 16544Work around certain R4400 CPU errata: 16545@itemize @minus 16546@item 16547A double-word or a variable shift may give an incorrect result if executed 16548immediately after starting an integer division. 16549@end itemize 16550 16551@item -mfix-r10000 16552@itemx -mno-fix-r10000 16553@opindex mfix-r10000 16554@opindex mno-fix-r10000 16555Work around certain R10000 errata: 16556@itemize @minus 16557@item 16558@code{ll}/@code{sc} sequences may not behave atomically on revisions 16559prior to 3.0. They may deadlock on revisions 2.6 and earlier. 16560@end itemize 16561 16562This option can only be used if the target architecture supports 16563branch-likely instructions. @option{-mfix-r10000} is the default when 16564@option{-march=r10000} is used; @option{-mno-fix-r10000} is the default 16565otherwise. 16566 16567@item -mfix-vr4120 16568@itemx -mno-fix-vr4120 16569@opindex mfix-vr4120 16570Work around certain VR4120 errata: 16571@itemize @minus 16572@item 16573@code{dmultu} does not always produce the correct result. 16574@item 16575@code{div} and @code{ddiv} do not always produce the correct result if one 16576of the operands is negative. 16577@end itemize 16578The workarounds for the division errata rely on special functions in 16579@file{libgcc.a}. At present, these functions are only provided by 16580the @code{mips64vr*-elf} configurations. 16581 16582Other VR4120 errata require a NOP to be inserted between certain pairs of 16583instructions. These errata are handled by the assembler, not by GCC itself. 16584 16585@item -mfix-vr4130 16586@opindex mfix-vr4130 16587Work around the VR4130 @code{mflo}/@code{mfhi} errata. The 16588workarounds are implemented by the assembler rather than by GCC, 16589although GCC avoids using @code{mflo} and @code{mfhi} if the 16590VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi} 16591instructions are available instead. 16592 16593@item -mfix-sb1 16594@itemx -mno-fix-sb1 16595@opindex mfix-sb1 16596Work around certain SB-1 CPU core errata. 16597(This flag currently works around the SB-1 revision 2 16598``F1'' and ``F2'' floating-point errata.) 16599 16600@item -mr10k-cache-barrier=@var{setting} 16601@opindex mr10k-cache-barrier 16602Specify whether GCC should insert cache barriers to avoid the 16603side-effects of speculation on R10K processors. 16604 16605In common with many processors, the R10K tries to predict the outcome 16606of a conditional branch and speculatively executes instructions from 16607the ``taken'' branch. It later aborts these instructions if the 16608predicted outcome is wrong. However, on the R10K, even aborted 16609instructions can have side effects. 16610 16611This problem only affects kernel stores and, depending on the system, 16612kernel loads. As an example, a speculatively-executed store may load 16613the target memory into cache and mark the cache line as dirty, even if 16614the store itself is later aborted. If a DMA operation writes to the 16615same area of memory before the ``dirty'' line is flushed, the cached 16616data overwrites the DMA-ed data. See the R10K processor manual 16617for a full description, including other potential problems. 16618 16619One workaround is to insert cache barrier instructions before every memory 16620access that might be speculatively executed and that might have side 16621effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}} 16622controls GCC's implementation of this workaround. It assumes that 16623aborted accesses to any byte in the following regions does not have 16624side effects: 16625 16626@enumerate 16627@item 16628the memory occupied by the current function's stack frame; 16629 16630@item 16631the memory occupied by an incoming stack argument; 16632 16633@item 16634the memory occupied by an object with a link-time-constant address. 16635@end enumerate 16636 16637It is the kernel's responsibility to ensure that speculative 16638accesses to these regions are indeed safe. 16639 16640If the input program contains a function declaration such as: 16641 16642@smallexample 16643void foo (void); 16644@end smallexample 16645 16646then the implementation of @code{foo} must allow @code{j foo} and 16647@code{jal foo} to be executed speculatively. GCC honors this 16648restriction for functions it compiles itself. It expects non-GCC 16649functions (such as hand-written assembly code) to do the same. 16650 16651The option has three forms: 16652 16653@table @gcctabopt 16654@item -mr10k-cache-barrier=load-store 16655Insert a cache barrier before a load or store that might be 16656speculatively executed and that might have side effects even 16657if aborted. 16658 16659@item -mr10k-cache-barrier=store 16660Insert a cache barrier before a store that might be speculatively 16661executed and that might have side effects even if aborted. 16662 16663@item -mr10k-cache-barrier=none 16664Disable the insertion of cache barriers. This is the default setting. 16665@end table 16666 16667@item -mflush-func=@var{func} 16668@itemx -mno-flush-func 16669@opindex mflush-func 16670Specifies the function to call to flush the I and D caches, or to not 16671call any such function. If called, the function must take the same 16672arguments as the common @code{_flush_func()}, that is, the address of the 16673memory range for which the cache is being flushed, the size of the 16674memory range, and the number 3 (to flush both caches). The default 16675depends on the target GCC was configured for, but commonly is either 16676@samp{_flush_func} or @samp{__cpu_flush}. 16677 16678@item mbranch-cost=@var{num} 16679@opindex mbranch-cost 16680Set the cost of branches to roughly @var{num} ``simple'' instructions. 16681This cost is only a heuristic and is not guaranteed to produce 16682consistent results across releases. A zero cost redundantly selects 16683the default, which is based on the @option{-mtune} setting. 16684 16685@item -mbranch-likely 16686@itemx -mno-branch-likely 16687@opindex mbranch-likely 16688@opindex mno-branch-likely 16689Enable or disable use of Branch Likely instructions, regardless of the 16690default for the selected architecture. By default, Branch Likely 16691instructions may be generated if they are supported by the selected 16692architecture. An exception is for the MIPS32 and MIPS64 architectures 16693and processors that implement those architectures; for those, Branch 16694Likely instructions are not be generated by default because the MIPS32 16695and MIPS64 architectures specifically deprecate their use. 16696 16697@item -mfp-exceptions 16698@itemx -mno-fp-exceptions 16699@opindex mfp-exceptions 16700Specifies whether FP exceptions are enabled. This affects how 16701FP instructions are scheduled for some processors. 16702The default is that FP exceptions are 16703enabled. 16704 16705For instance, on the SB-1, if FP exceptions are disabled, and we are emitting 1670664-bit code, then we can use both FP pipes. Otherwise, we can only use one 16707FP pipe. 16708 16709@item -mvr4130-align 16710@itemx -mno-vr4130-align 16711@opindex mvr4130-align 16712The VR4130 pipeline is two-way superscalar, but can only issue two 16713instructions together if the first one is 8-byte aligned. When this 16714option is enabled, GCC aligns pairs of instructions that it 16715thinks should execute in parallel. 16716 16717This option only has an effect when optimizing for the VR4130. 16718It normally makes code faster, but at the expense of making it bigger. 16719It is enabled by default at optimization level @option{-O3}. 16720 16721@item -msynci 16722@itemx -mno-synci 16723@opindex msynci 16724Enable (disable) generation of @code{synci} instructions on 16725architectures that support it. The @code{synci} instructions (if 16726enabled) are generated when @code{__builtin___clear_cache()} is 16727compiled. 16728 16729This option defaults to @code{-mno-synci}, but the default can be 16730overridden by configuring with @code{--with-synci}. 16731 16732When compiling code for single processor systems, it is generally safe 16733to use @code{synci}. However, on many multi-core (SMP) systems, it 16734does not invalidate the instruction caches on all cores and may lead 16735to undefined behavior. 16736 16737@item -mrelax-pic-calls 16738@itemx -mno-relax-pic-calls 16739@opindex mrelax-pic-calls 16740Try to turn PIC calls that are normally dispatched via register 16741@code{$25} into direct calls. This is only possible if the linker can 16742resolve the destination at link-time and if the destination is within 16743range for a direct call. 16744 16745@option{-mrelax-pic-calls} is the default if GCC was configured to use 16746an assembler and a linker that support the @code{.reloc} assembly 16747directive and @code{-mexplicit-relocs} is in effect. With 16748@code{-mno-explicit-relocs}, this optimization can be performed by the 16749assembler and the linker alone without help from the compiler. 16750 16751@item -mmcount-ra-address 16752@itemx -mno-mcount-ra-address 16753@opindex mmcount-ra-address 16754@opindex mno-mcount-ra-address 16755Emit (do not emit) code that allows @code{_mcount} to modify the 16756calling function's return address. When enabled, this option extends 16757the usual @code{_mcount} interface with a new @var{ra-address} 16758parameter, which has type @code{intptr_t *} and is passed in register 16759@code{$12}. @code{_mcount} can then modify the return address by 16760doing both of the following: 16761@itemize 16762@item 16763Returning the new address in register @code{$31}. 16764@item 16765Storing the new address in @code{*@var{ra-address}}, 16766if @var{ra-address} is nonnull. 16767@end itemize 16768 16769The default is @option{-mno-mcount-ra-address}. 16770 16771@end table 16772 16773@node MMIX Options 16774@subsection MMIX Options 16775@cindex MMIX Options 16776 16777These options are defined for the MMIX: 16778 16779@table @gcctabopt 16780@item -mlibfuncs 16781@itemx -mno-libfuncs 16782@opindex mlibfuncs 16783@opindex mno-libfuncs 16784Specify that intrinsic library functions are being compiled, passing all 16785values in registers, no matter the size. 16786 16787@item -mepsilon 16788@itemx -mno-epsilon 16789@opindex mepsilon 16790@opindex mno-epsilon 16791Generate floating-point comparison instructions that compare with respect 16792to the @code{rE} epsilon register. 16793 16794@item -mabi=mmixware 16795@itemx -mabi=gnu 16796@opindex mabi=mmixware 16797@opindex mabi=gnu 16798Generate code that passes function parameters and return values that (in 16799the called function) are seen as registers @code{$0} and up, as opposed to 16800the GNU ABI which uses global registers @code{$231} and up. 16801 16802@item -mzero-extend 16803@itemx -mno-zero-extend 16804@opindex mzero-extend 16805@opindex mno-zero-extend 16806When reading data from memory in sizes shorter than 64 bits, use (do not 16807use) zero-extending load instructions by default, rather than 16808sign-extending ones. 16809 16810@item -mknuthdiv 16811@itemx -mno-knuthdiv 16812@opindex mknuthdiv 16813@opindex mno-knuthdiv 16814Make the result of a division yielding a remainder have the same sign as 16815the divisor. With the default, @option{-mno-knuthdiv}, the sign of the 16816remainder follows the sign of the dividend. Both methods are 16817arithmetically valid, the latter being almost exclusively used. 16818 16819@item -mtoplevel-symbols 16820@itemx -mno-toplevel-symbols 16821@opindex mtoplevel-symbols 16822@opindex mno-toplevel-symbols 16823Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly 16824code can be used with the @code{PREFIX} assembly directive. 16825 16826@item -melf 16827@opindex melf 16828Generate an executable in the ELF format, rather than the default 16829@samp{mmo} format used by the @command{mmix} simulator. 16830 16831@item -mbranch-predict 16832@itemx -mno-branch-predict 16833@opindex mbranch-predict 16834@opindex mno-branch-predict 16835Use (do not use) the probable-branch instructions, when static branch 16836prediction indicates a probable branch. 16837 16838@item -mbase-addresses 16839@itemx -mno-base-addresses 16840@opindex mbase-addresses 16841@opindex mno-base-addresses 16842Generate (do not generate) code that uses @emph{base addresses}. Using a 16843base address automatically generates a request (handled by the assembler 16844and the linker) for a constant to be set up in a global register. The 16845register is used for one or more base address requests within the range 0 16846to 255 from the value held in the register. The generally leads to short 16847and fast code, but the number of different data items that can be 16848addressed is limited. This means that a program that uses lots of static 16849data may require @option{-mno-base-addresses}. 16850 16851@item -msingle-exit 16852@itemx -mno-single-exit 16853@opindex msingle-exit 16854@opindex mno-single-exit 16855Force (do not force) generated code to have a single exit point in each 16856function. 16857@end table 16858 16859@node MN10300 Options 16860@subsection MN10300 Options 16861@cindex MN10300 options 16862 16863These @option{-m} options are defined for Matsushita MN10300 architectures: 16864 16865@table @gcctabopt 16866@item -mmult-bug 16867@opindex mmult-bug 16868Generate code to avoid bugs in the multiply instructions for the MN10300 16869processors. This is the default. 16870 16871@item -mno-mult-bug 16872@opindex mno-mult-bug 16873Do not generate code to avoid bugs in the multiply instructions for the 16874MN10300 processors. 16875 16876@item -mam33 16877@opindex mam33 16878Generate code using features specific to the AM33 processor. 16879 16880@item -mno-am33 16881@opindex mno-am33 16882Do not generate code using features specific to the AM33 processor. This 16883is the default. 16884 16885@item -mam33-2 16886@opindex mam33-2 16887Generate code using features specific to the AM33/2.0 processor. 16888 16889@item -mam34 16890@opindex mam34 16891Generate code using features specific to the AM34 processor. 16892 16893@item -mtune=@var{cpu-type} 16894@opindex mtune 16895Use the timing characteristics of the indicated CPU type when 16896scheduling instructions. This does not change the targeted processor 16897type. The CPU type must be one of @samp{mn10300}, @samp{am33}, 16898@samp{am33-2} or @samp{am34}. 16899 16900@item -mreturn-pointer-on-d0 16901@opindex mreturn-pointer-on-d0 16902When generating a function that returns a pointer, return the pointer 16903in both @code{a0} and @code{d0}. Otherwise, the pointer is returned 16904only in @code{a0}, and attempts to call such functions without a prototype 16905result in errors. Note that this option is on by default; use 16906@option{-mno-return-pointer-on-d0} to disable it. 16907 16908@item -mno-crt0 16909@opindex mno-crt0 16910Do not link in the C run-time initialization object file. 16911 16912@item -mrelax 16913@opindex mrelax 16914Indicate to the linker that it should perform a relaxation optimization pass 16915to shorten branches, calls and absolute memory addresses. This option only 16916has an effect when used on the command line for the final link step. 16917 16918This option makes symbolic debugging impossible. 16919 16920@item -mliw 16921@opindex mliw 16922Allow the compiler to generate @emph{Long Instruction Word} 16923instructions if the target is the @samp{AM33} or later. This is the 16924default. This option defines the preprocessor macro @samp{__LIW__}. 16925 16926@item -mnoliw 16927@opindex mnoliw 16928Do not allow the compiler to generate @emph{Long Instruction Word} 16929instructions. This option defines the preprocessor macro 16930@samp{__NO_LIW__}. 16931 16932@item -msetlb 16933@opindex msetlb 16934Allow the compiler to generate the @emph{SETLB} and @emph{Lcc} 16935instructions if the target is the @samp{AM33} or later. This is the 16936default. This option defines the preprocessor macro @samp{__SETLB__}. 16937 16938@item -mnosetlb 16939@opindex mnosetlb 16940Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc} 16941instructions. This option defines the preprocessor macro 16942@samp{__NO_SETLB__}. 16943 16944@end table 16945 16946@node Moxie Options 16947@subsection Moxie Options 16948@cindex Moxie Options 16949 16950@table @gcctabopt 16951 16952@item -meb 16953@opindex meb 16954Generate big-endian code. This is the default for @samp{moxie-*-*} 16955configurations. 16956 16957@item -mel 16958@opindex mel 16959Generate little-endian code. 16960 16961@item -mno-crt0 16962@opindex mno-crt0 16963Do not link in the C run-time initialization object file. 16964 16965@end table 16966 16967@node PDP-11 Options 16968@subsection PDP-11 Options 16969@cindex PDP-11 Options 16970 16971These options are defined for the PDP-11: 16972 16973@table @gcctabopt 16974@item -mfpu 16975@opindex mfpu 16976Use hardware FPP floating point. This is the default. (FIS floating 16977point on the PDP-11/40 is not supported.) 16978 16979@item -msoft-float 16980@opindex msoft-float 16981Do not use hardware floating point. 16982 16983@item -mac0 16984@opindex mac0 16985Return floating-point results in ac0 (fr0 in Unix assembler syntax). 16986 16987@item -mno-ac0 16988@opindex mno-ac0 16989Return floating-point results in memory. This is the default. 16990 16991@item -m40 16992@opindex m40 16993Generate code for a PDP-11/40. 16994 16995@item -m45 16996@opindex m45 16997Generate code for a PDP-11/45. This is the default. 16998 16999@item -m10 17000@opindex m10 17001Generate code for a PDP-11/10. 17002 17003@item -mbcopy-builtin 17004@opindex mbcopy-builtin 17005Use inline @code{movmemhi} patterns for copying memory. This is the 17006default. 17007 17008@item -mbcopy 17009@opindex mbcopy 17010Do not use inline @code{movmemhi} patterns for copying memory. 17011 17012@item -mint16 17013@itemx -mno-int32 17014@opindex mint16 17015@opindex mno-int32 17016Use 16-bit @code{int}. This is the default. 17017 17018@item -mint32 17019@itemx -mno-int16 17020@opindex mint32 17021@opindex mno-int16 17022Use 32-bit @code{int}. 17023 17024@item -mfloat64 17025@itemx -mno-float32 17026@opindex mfloat64 17027@opindex mno-float32 17028Use 64-bit @code{float}. This is the default. 17029 17030@item -mfloat32 17031@itemx -mno-float64 17032@opindex mfloat32 17033@opindex mno-float64 17034Use 32-bit @code{float}. 17035 17036@item -mabshi 17037@opindex mabshi 17038Use @code{abshi2} pattern. This is the default. 17039 17040@item -mno-abshi 17041@opindex mno-abshi 17042Do not use @code{abshi2} pattern. 17043 17044@item -mbranch-expensive 17045@opindex mbranch-expensive 17046Pretend that branches are expensive. This is for experimenting with 17047code generation only. 17048 17049@item -mbranch-cheap 17050@opindex mbranch-cheap 17051Do not pretend that branches are expensive. This is the default. 17052 17053@item -munix-asm 17054@opindex munix-asm 17055Use Unix assembler syntax. This is the default when configured for 17056@samp{pdp11-*-bsd}. 17057 17058@item -mdec-asm 17059@opindex mdec-asm 17060Use DEC assembler syntax. This is the default when configured for any 17061PDP-11 target other than @samp{pdp11-*-bsd}. 17062@end table 17063 17064@node picoChip Options 17065@subsection picoChip Options 17066@cindex picoChip options 17067 17068These @samp{-m} options are defined for picoChip implementations: 17069 17070@table @gcctabopt 17071 17072@item -mae=@var{ae_type} 17073@opindex mcpu 17074Set the instruction set, register set, and instruction scheduling 17075parameters for array element type @var{ae_type}. Supported values 17076for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}. 17077 17078@option{-mae=ANY} selects a completely generic AE type. Code 17079generated with this option runs on any of the other AE types. The 17080code is not as efficient as it would be if compiled for a specific 17081AE type, and some types of operation (e.g., multiplication) do not 17082work properly on all types of AE. 17083 17084@option{-mae=MUL} selects a MUL AE type. This is the most useful AE type 17085for compiled code, and is the default. 17086 17087@option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this 17088option may suffer from poor performance of byte (char) manipulation, 17089since the DSP AE does not provide hardware support for byte load/stores. 17090 17091@item -msymbol-as-address 17092Enable the compiler to directly use a symbol name as an address in a 17093load/store instruction, without first loading it into a 17094register. Typically, the use of this option generates larger 17095programs, which run faster than when the option isn't used. However, the 17096results vary from program to program, so it is left as a user option, 17097rather than being permanently enabled. 17098 17099@item -mno-inefficient-warnings 17100Disables warnings about the generation of inefficient code. These 17101warnings can be generated, for example, when compiling code that 17102performs byte-level memory operations on the MAC AE type. The MAC AE has 17103no hardware support for byte-level memory operations, so all byte 17104load/stores must be synthesized from word load/store operations. This is 17105inefficient and a warning is generated to indicate 17106that you should rewrite the code to avoid byte operations, or to target 17107an AE type that has the necessary hardware support. This option disables 17108these warnings. 17109 17110@end table 17111 17112@node PowerPC Options 17113@subsection PowerPC Options 17114@cindex PowerPC options 17115 17116These are listed under @xref{RS/6000 and PowerPC Options}. 17117 17118@node RL78 Options 17119@subsection RL78 Options 17120@cindex RL78 Options 17121 17122@table @gcctabopt 17123 17124@item -msim 17125@opindex msim 17126Links in additional target libraries to support operation within a 17127simulator. 17128 17129@item -mmul=none 17130@itemx -mmul=g13 17131@itemx -mmul=rl78 17132@opindex mmul 17133Specifies the type of hardware multiplication support to be used. The 17134default is @code{none}, which uses software multiplication functions. 17135The @code{g13} option is for the hardware multiply/divide peripheral 17136only on the RL78/G13 targets. The @code{rl78} option is for the 17137standard hardware multiplication defined in the RL78 software manual. 17138 17139@end table 17140 17141@node RS/6000 and PowerPC Options 17142@subsection IBM RS/6000 and PowerPC Options 17143@cindex RS/6000 and PowerPC Options 17144@cindex IBM RS/6000 and PowerPC Options 17145 17146These @samp{-m} options are defined for the IBM RS/6000 and PowerPC: 17147@table @gcctabopt 17148@item -mpowerpc-gpopt 17149@itemx -mno-powerpc-gpopt 17150@itemx -mpowerpc-gfxopt 17151@itemx -mno-powerpc-gfxopt 17152@need 800 17153@itemx -mpowerpc64 17154@itemx -mno-powerpc64 17155@itemx -mmfcrf 17156@itemx -mno-mfcrf 17157@itemx -mpopcntb 17158@itemx -mno-popcntb 17159@itemx -mpopcntd 17160@itemx -mno-popcntd 17161@itemx -mfprnd 17162@itemx -mno-fprnd 17163@need 800 17164@itemx -mcmpb 17165@itemx -mno-cmpb 17166@itemx -mmfpgpr 17167@itemx -mno-mfpgpr 17168@itemx -mhard-dfp 17169@itemx -mno-hard-dfp 17170@opindex mpowerpc-gpopt 17171@opindex mno-powerpc-gpopt 17172@opindex mpowerpc-gfxopt 17173@opindex mno-powerpc-gfxopt 17174@opindex mpowerpc64 17175@opindex mno-powerpc64 17176@opindex mmfcrf 17177@opindex mno-mfcrf 17178@opindex mpopcntb 17179@opindex mno-popcntb 17180@opindex mpopcntd 17181@opindex mno-popcntd 17182@opindex mfprnd 17183@opindex mno-fprnd 17184@opindex mcmpb 17185@opindex mno-cmpb 17186@opindex mmfpgpr 17187@opindex mno-mfpgpr 17188@opindex mhard-dfp 17189@opindex mno-hard-dfp 17190You use these options to specify which instructions are available on the 17191processor you are using. The default value of these options is 17192determined when configuring GCC@. Specifying the 17193@option{-mcpu=@var{cpu_type}} overrides the specification of these 17194options. We recommend you use the @option{-mcpu=@var{cpu_type}} option 17195rather than the options listed above. 17196 17197Specifying @option{-mpowerpc-gpopt} allows 17198GCC to use the optional PowerPC architecture instructions in the 17199General Purpose group, including floating-point square root. Specifying 17200@option{-mpowerpc-gfxopt} allows GCC to 17201use the optional PowerPC architecture instructions in the Graphics 17202group, including floating-point select. 17203 17204The @option{-mmfcrf} option allows GCC to generate the move from 17205condition register field instruction implemented on the POWER4 17206processor and other processors that support the PowerPC V2.01 17207architecture. 17208The @option{-mpopcntb} option allows GCC to generate the popcount and 17209double-precision FP reciprocal estimate instruction implemented on the 17210POWER5 processor and other processors that support the PowerPC V2.02 17211architecture. 17212The @option{-mpopcntd} option allows GCC to generate the popcount 17213instruction implemented on the POWER7 processor and other processors 17214that support the PowerPC V2.06 architecture. 17215The @option{-mfprnd} option allows GCC to generate the FP round to 17216integer instructions implemented on the POWER5+ processor and other 17217processors that support the PowerPC V2.03 architecture. 17218The @option{-mcmpb} option allows GCC to generate the compare bytes 17219instruction implemented on the POWER6 processor and other processors 17220that support the PowerPC V2.05 architecture. 17221The @option{-mmfpgpr} option allows GCC to generate the FP move to/from 17222general-purpose register instructions implemented on the POWER6X 17223processor and other processors that support the extended PowerPC V2.05 17224architecture. 17225The @option{-mhard-dfp} option allows GCC to generate the decimal 17226floating-point instructions implemented on some POWER processors. 17227 17228The @option{-mpowerpc64} option allows GCC to generate the additional 1722964-bit instructions that are found in the full PowerPC64 architecture 17230and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to 17231@option{-mno-powerpc64}. 17232 17233@item -mcpu=@var{cpu_type} 17234@opindex mcpu 17235Set architecture type, register usage, and 17236instruction scheduling parameters for machine type @var{cpu_type}. 17237Supported values for @var{cpu_type} are @samp{401}, @samp{403}, 17238@samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp}, 17239@samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603}, 17240@samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740}, 17241@samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823}, 17242@samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2}, 17243@samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500}, 17244@samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5}, 17245@samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+}, 17246@samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8}, @samp{powerpc}, 17247@samp{powerpc64}, @samp{powerpc64le}, and @samp{rs64}. 17248 17249@option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and 17250@option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either 17251endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC 17252architecture machine types, with an appropriate, generic processor 17253model assumed for scheduling purposes. 17254 17255The other options specify a specific processor. Code generated under 17256those options runs best on that processor, and may not run at all on 17257others. 17258 17259The @option{-mcpu} options automatically enable or disable the 17260following options: 17261 17262@gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol 17263-mpopcntb -mpopcntd -mpowerpc64 @gol 17264-mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol 17265-msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx @gol 17266-mcrypto -mdirect-move -mpower8-fusion -mpower8-vector @gol 17267-mquad-memory -mquad-memory-atomic} 17268 17269The particular options set for any particular CPU varies between 17270compiler versions, depending on what setting seems to produce optimal 17271code for that CPU; it doesn't necessarily reflect the actual hardware's 17272capabilities. If you wish to set an individual option to a particular 17273value, you may specify it after the @option{-mcpu} option, like 17274@option{-mcpu=970 -mno-altivec}. 17275 17276On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are 17277not enabled or disabled by the @option{-mcpu} option at present because 17278AIX does not have full support for these options. You may still 17279enable or disable them individually if you're sure it'll work in your 17280environment. 17281 17282@item -mtune=@var{cpu_type} 17283@opindex mtune 17284Set the instruction scheduling parameters for machine type 17285@var{cpu_type}, but do not set the architecture type or register usage, 17286as @option{-mcpu=@var{cpu_type}} does. The same 17287values for @var{cpu_type} are used for @option{-mtune} as for 17288@option{-mcpu}. If both are specified, the code generated uses the 17289architecture and registers set by @option{-mcpu}, but the 17290scheduling parameters set by @option{-mtune}. 17291 17292@item -mcmodel=small 17293@opindex mcmodel=small 17294Generate PowerPC64 code for the small model: The TOC is limited to 1729564k. 17296 17297@item -mcmodel=medium 17298@opindex mcmodel=medium 17299Generate PowerPC64 code for the medium model: The TOC and other static 17300data may be up to a total of 4G in size. 17301 17302@item -mcmodel=large 17303@opindex mcmodel=large 17304Generate PowerPC64 code for the large model: The TOC may be up to 4G 17305in size. Other data and code is only limited by the 64-bit address 17306space. 17307 17308@item -maltivec 17309@itemx -mno-altivec 17310@opindex maltivec 17311@opindex mno-altivec 17312Generate code that uses (does not use) AltiVec instructions, and also 17313enable the use of built-in functions that allow more direct access to 17314the AltiVec instruction set. You may also need to set 17315@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI 17316enhancements. 17317 17318When @option{-maltivec} is used, rather than @option{-maltivec=le} or 17319@option{-maltivec=be}, the element order for Altivec intrinsics such 17320as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert} will 17321match array element order corresponding to the endianness of the 17322target. That is, element zero identifies the leftmost element in a 17323vector register when targeting a big-endian platform, and identifies 17324the rightmost element in a vector register when targeting a 17325little-endian platform. 17326 17327@item -maltivec=be 17328@opindex maltivec=be 17329Generate Altivec instructions using big-endian element order, 17330regardless of whether the target is big- or little-endian. This is 17331the default when targeting a big-endian platform. 17332 17333The element order is used to interpret element numbers in Altivec 17334intrinsics such as @code{vec_splat}, @code{vec_extract}, and 17335@code{vec_insert}. By default, these will match array element order 17336corresponding to the endianness for the target. 17337 17338@item -maltivec=le 17339@opindex maltivec=le 17340Generate Altivec instructions using little-endian element order, 17341regardless of whether the target is big- or little-endian. This is 17342the default when targeting a little-endian platform. This option is 17343currently ignored when targeting a big-endian platform. 17344 17345The element order is used to interpret element numbers in Altivec 17346intrinsics such as @code{vec_splat}, @code{vec_extract}, and 17347@code{vec_insert}. By default, these will match array element order 17348corresponding to the endianness for the target. 17349 17350@item -mvrsave 17351@itemx -mno-vrsave 17352@opindex mvrsave 17353@opindex mno-vrsave 17354Generate VRSAVE instructions when generating AltiVec code. 17355 17356@item -mgen-cell-microcode 17357@opindex mgen-cell-microcode 17358Generate Cell microcode instructions. 17359 17360@item -mwarn-cell-microcode 17361@opindex mwarn-cell-microcode 17362Warn when a Cell microcode instruction is emitted. An example 17363of a Cell microcode instruction is a variable shift. 17364 17365@item -msecure-plt 17366@opindex msecure-plt 17367Generate code that allows @command{ld} and @command{ld.so} 17368to build executables and shared 17369libraries with non-executable @code{.plt} and @code{.got} sections. 17370This is a PowerPC 1737132-bit SYSV ABI option. 17372 17373@item -mbss-plt 17374@opindex mbss-plt 17375Generate code that uses a BSS @code{.plt} section that @command{ld.so} 17376fills in, and 17377requires @code{.plt} and @code{.got} 17378sections that are both writable and executable. 17379This is a PowerPC 32-bit SYSV ABI option. 17380 17381@item -misel 17382@itemx -mno-isel 17383@opindex misel 17384@opindex mno-isel 17385This switch enables or disables the generation of ISEL instructions. 17386 17387@item -misel=@var{yes/no} 17388This switch has been deprecated. Use @option{-misel} and 17389@option{-mno-isel} instead. 17390 17391@item -mspe 17392@itemx -mno-spe 17393@opindex mspe 17394@opindex mno-spe 17395This switch enables or disables the generation of SPE simd 17396instructions. 17397 17398@item -mpaired 17399@itemx -mno-paired 17400@opindex mpaired 17401@opindex mno-paired 17402This switch enables or disables the generation of PAIRED simd 17403instructions. 17404 17405@item -mspe=@var{yes/no} 17406This option has been deprecated. Use @option{-mspe} and 17407@option{-mno-spe} instead. 17408 17409@item -mvsx 17410@itemx -mno-vsx 17411@opindex mvsx 17412@opindex mno-vsx 17413Generate code that uses (does not use) vector/scalar (VSX) 17414instructions, and also enable the use of built-in functions that allow 17415more direct access to the VSX instruction set. 17416 17417@item -mcrypto 17418@itemx -mno-crypto 17419@opindex mcrypto 17420@opindex mno-crypto 17421Enable the use (disable) of the built-in functions that allow direct 17422access to the cryptographic instructions that were added in version 174232.07 of the PowerPC ISA. 17424 17425@item -mdirect-move 17426@itemx -mno-direct-move 17427@opindex mdirect-move 17428@opindex mno-direct-move 17429Generate code that uses (does not use) the instructions to move data 17430between the general purpose registers and the vector/scalar (VSX) 17431registers that were added in version 2.07 of the PowerPC ISA. 17432 17433@item -mpower8-fusion 17434@itemx -mno-power8-fusion 17435@opindex mpower8-fusion 17436@opindex mno-power8-fusion 17437Generate code that keeps (does not keeps) some integer operations 17438adjacent so that the instructions can be fused together on power8 and 17439later processors. 17440 17441@item -mpower8-vector 17442@itemx -mno-power8-vector 17443@opindex mpower8-vector 17444@opindex mno-power8-vector 17445Generate code that uses (does not use) the vector and scalar 17446instructions that were added in version 2.07 of the PowerPC ISA. Also 17447enable the use of built-in functions that allow more direct access to 17448the vector instructions. 17449 17450@item -mquad-memory 17451@itemx -mno-quad-memory 17452@opindex mquad-memory 17453@opindex mno-quad-memory 17454Generate code that uses (does not use) the non-atomic quad word memory 17455instructions. The @option{-mquad-memory} option requires use of 1745664-bit mode. 17457 17458@item -mquad-memory-atomic 17459@itemx -mno-quad-memory-atomic 17460@opindex mquad-memory-atomic 17461@opindex mno-quad-memory-atomic 17462Generate code that uses (does not use) the atomic quad word memory 17463instructions. The @option{-mquad-memory-atomic} option requires use of 1746464-bit mode. 17465 17466@item -mfloat-gprs=@var{yes/single/double/no} 17467@itemx -mfloat-gprs 17468@opindex mfloat-gprs 17469This switch enables or disables the generation of floating-point 17470operations on the general-purpose registers for architectures that 17471support it. 17472 17473The argument @var{yes} or @var{single} enables the use of 17474single-precision floating-point operations. 17475 17476The argument @var{double} enables the use of single and 17477double-precision floating-point operations. 17478 17479The argument @var{no} disables floating-point operations on the 17480general-purpose registers. 17481 17482This option is currently only available on the MPC854x. 17483 17484@item -m32 17485@itemx -m64 17486@opindex m32 17487@opindex m64 17488Generate code for 32-bit or 64-bit environments of Darwin and SVR4 17489targets (including GNU/Linux). The 32-bit environment sets int, long 17490and pointer to 32 bits and generates code that runs on any PowerPC 17491variant. The 64-bit environment sets int to 32 bits and long and 17492pointer to 64 bits, and generates code for PowerPC64, as for 17493@option{-mpowerpc64}. 17494 17495@item -mfull-toc 17496@itemx -mno-fp-in-toc 17497@itemx -mno-sum-in-toc 17498@itemx -mminimal-toc 17499@opindex mfull-toc 17500@opindex mno-fp-in-toc 17501@opindex mno-sum-in-toc 17502@opindex mminimal-toc 17503Modify generation of the TOC (Table Of Contents), which is created for 17504every executable file. The @option{-mfull-toc} option is selected by 17505default. In that case, GCC allocates at least one TOC entry for 17506each unique non-automatic variable reference in your program. GCC 17507also places floating-point constants in the TOC@. However, only 1750816,384 entries are available in the TOC@. 17509 17510If you receive a linker error message that saying you have overflowed 17511the available TOC space, you can reduce the amount of TOC space used 17512with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options. 17513@option{-mno-fp-in-toc} prevents GCC from putting floating-point 17514constants in the TOC and @option{-mno-sum-in-toc} forces GCC to 17515generate code to calculate the sum of an address and a constant at 17516run time instead of putting that sum into the TOC@. You may specify one 17517or both of these options. Each causes GCC to produce very slightly 17518slower and larger code at the expense of conserving TOC space. 17519 17520If you still run out of space in the TOC even when you specify both of 17521these options, specify @option{-mminimal-toc} instead. This option causes 17522GCC to make only one TOC entry for every file. When you specify this 17523option, GCC produces code that is slower and larger but which 17524uses extremely little TOC space. You may wish to use this option 17525only on files that contain less frequently-executed code. 17526 17527@item -maix64 17528@itemx -maix32 17529@opindex maix64 17530@opindex maix32 17531Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit 17532@code{long} type, and the infrastructure needed to support them. 17533Specifying @option{-maix64} implies @option{-mpowerpc64}, 17534while @option{-maix32} disables the 64-bit ABI and 17535implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}. 17536 17537@item -mxl-compat 17538@itemx -mno-xl-compat 17539@opindex mxl-compat 17540@opindex mno-xl-compat 17541Produce code that conforms more closely to IBM XL compiler semantics 17542when using AIX-compatible ABI@. Pass floating-point arguments to 17543prototyped functions beyond the register save area (RSA) on the stack 17544in addition to argument FPRs. Do not assume that most significant 17545double in 128-bit long double value is properly rounded when comparing 17546values and converting to double. Use XL symbol names for long double 17547support routines. 17548 17549The AIX calling convention was extended but not initially documented to 17550handle an obscure K&R C case of calling a function that takes the 17551address of its arguments with fewer arguments than declared. IBM XL 17552compilers access floating-point arguments that do not fit in the 17553RSA from the stack when a subroutine is compiled without 17554optimization. Because always storing floating-point arguments on the 17555stack is inefficient and rarely needed, this option is not enabled by 17556default and only is necessary when calling subroutines compiled by IBM 17557XL compilers without optimization. 17558 17559@item -mpe 17560@opindex mpe 17561Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an 17562application written to use message passing with special startup code to 17563enable the application to run. The system must have PE installed in the 17564standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file 17565must be overridden with the @option{-specs=} option to specify the 17566appropriate directory location. The Parallel Environment does not 17567support threads, so the @option{-mpe} option and the @option{-pthread} 17568option are incompatible. 17569 17570@item -malign-natural 17571@itemx -malign-power 17572@opindex malign-natural 17573@opindex malign-power 17574On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option 17575@option{-malign-natural} overrides the ABI-defined alignment of larger 17576types, such as floating-point doubles, on their natural size-based boundary. 17577The option @option{-malign-power} instructs GCC to follow the ABI-specified 17578alignment rules. GCC defaults to the standard alignment defined in the ABI@. 17579 17580On 64-bit Darwin, natural alignment is the default, and @option{-malign-power} 17581is not supported. 17582 17583@item -msoft-float 17584@itemx -mhard-float 17585@opindex msoft-float 17586@opindex mhard-float 17587Generate code that does not use (uses) the floating-point register set. 17588Software floating-point emulation is provided if you use the 17589@option{-msoft-float} option, and pass the option to GCC when linking. 17590 17591@item -msingle-float 17592@itemx -mdouble-float 17593@opindex msingle-float 17594@opindex mdouble-float 17595Generate code for single- or double-precision floating-point operations. 17596@option{-mdouble-float} implies @option{-msingle-float}. 17597 17598@item -msimple-fpu 17599@opindex msimple-fpu 17600Do not generate @code{sqrt} and @code{div} instructions for hardware 17601floating-point unit. 17602 17603@item -mfpu=@var{name} 17604@opindex mfpu 17605Specify type of floating-point unit. Valid values for @var{name} are 17606@samp{sp_lite} (equivalent to @option{-msingle-float -msimple-fpu}), 17607@samp{dp_lite} (equivalent to @option{-mdouble-float -msimple-fpu}), 17608@samp{sp_full} (equivalent to @option{-msingle-float}), 17609and @samp{dp_full} (equivalent to @option{-mdouble-float}). 17610 17611@item -mxilinx-fpu 17612@opindex mxilinx-fpu 17613Perform optimizations for the floating-point unit on Xilinx PPC 405/440. 17614 17615@item -mmultiple 17616@itemx -mno-multiple 17617@opindex mmultiple 17618@opindex mno-multiple 17619Generate code that uses (does not use) the load multiple word 17620instructions and the store multiple word instructions. These 17621instructions are generated by default on POWER systems, and not 17622generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian 17623PowerPC systems, since those instructions do not work when the 17624processor is in little-endian mode. The exceptions are PPC740 and 17625PPC750 which permit these instructions in little-endian mode. 17626 17627@item -mstring 17628@itemx -mno-string 17629@opindex mstring 17630@opindex mno-string 17631Generate code that uses (does not use) the load string instructions 17632and the store string word instructions to save multiple registers and 17633do small block moves. These instructions are generated by default on 17634POWER systems, and not generated on PowerPC systems. Do not use 17635@option{-mstring} on little-endian PowerPC systems, since those 17636instructions do not work when the processor is in little-endian mode. 17637The exceptions are PPC740 and PPC750 which permit these instructions 17638in little-endian mode. 17639 17640@item -mupdate 17641@itemx -mno-update 17642@opindex mupdate 17643@opindex mno-update 17644Generate code that uses (does not use) the load or store instructions 17645that update the base register to the address of the calculated memory 17646location. These instructions are generated by default. If you use 17647@option{-mno-update}, there is a small window between the time that the 17648stack pointer is updated and the address of the previous frame is 17649stored, which means code that walks the stack frame across interrupts or 17650signals may get corrupted data. 17651 17652@item -mavoid-indexed-addresses 17653@itemx -mno-avoid-indexed-addresses 17654@opindex mavoid-indexed-addresses 17655@opindex mno-avoid-indexed-addresses 17656Generate code that tries to avoid (not avoid) the use of indexed load 17657or store instructions. These instructions can incur a performance 17658penalty on Power6 processors in certain situations, such as when 17659stepping through large arrays that cross a 16M boundary. This option 17660is enabled by default when targeting Power6 and disabled otherwise. 17661 17662@item -mfused-madd 17663@itemx -mno-fused-madd 17664@opindex mfused-madd 17665@opindex mno-fused-madd 17666Generate code that uses (does not use) the floating-point multiply and 17667accumulate instructions. These instructions are generated by default 17668if hardware floating point is used. The machine-dependent 17669@option{-mfused-madd} option is now mapped to the machine-independent 17670@option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is 17671mapped to @option{-ffp-contract=off}. 17672 17673@item -mmulhw 17674@itemx -mno-mulhw 17675@opindex mmulhw 17676@opindex mno-mulhw 17677Generate code that uses (does not use) the half-word multiply and 17678multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors. 17679These instructions are generated by default when targeting those 17680processors. 17681 17682@item -mdlmzb 17683@itemx -mno-dlmzb 17684@opindex mdlmzb 17685@opindex mno-dlmzb 17686Generate code that uses (does not use) the string-search @samp{dlmzb} 17687instruction on the IBM 405, 440, 464 and 476 processors. This instruction is 17688generated by default when targeting those processors. 17689 17690@item -mno-bit-align 17691@itemx -mbit-align 17692@opindex mno-bit-align 17693@opindex mbit-align 17694On System V.4 and embedded PowerPC systems do not (do) force structures 17695and unions that contain bit-fields to be aligned to the base type of the 17696bit-field. 17697 17698For example, by default a structure containing nothing but 8 17699@code{unsigned} bit-fields of length 1 is aligned to a 4-byte 17700boundary and has a size of 4 bytes. By using @option{-mno-bit-align}, 17701the structure is aligned to a 1-byte boundary and is 1 byte in 17702size. 17703 17704@item -mno-strict-align 17705@itemx -mstrict-align 17706@opindex mno-strict-align 17707@opindex mstrict-align 17708On System V.4 and embedded PowerPC systems do not (do) assume that 17709unaligned memory references are handled by the system. 17710 17711@item -mrelocatable 17712@itemx -mno-relocatable 17713@opindex mrelocatable 17714@opindex mno-relocatable 17715Generate code that allows (does not allow) a static executable to be 17716relocated to a different address at run time. A simple embedded 17717PowerPC system loader should relocate the entire contents of 17718@code{.got2} and 4-byte locations listed in the @code{.fixup} section, 17719a table of 32-bit addresses generated by this option. For this to 17720work, all objects linked together must be compiled with 17721@option{-mrelocatable} or @option{-mrelocatable-lib}. 17722@option{-mrelocatable} code aligns the stack to an 8-byte boundary. 17723 17724@item -mrelocatable-lib 17725@itemx -mno-relocatable-lib 17726@opindex mrelocatable-lib 17727@opindex mno-relocatable-lib 17728Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a 17729@code{.fixup} section to allow static executables to be relocated at 17730run time, but @option{-mrelocatable-lib} does not use the smaller stack 17731alignment of @option{-mrelocatable}. Objects compiled with 17732@option{-mrelocatable-lib} may be linked with objects compiled with 17733any combination of the @option{-mrelocatable} options. 17734 17735@item -mno-toc 17736@itemx -mtoc 17737@opindex mno-toc 17738@opindex mtoc 17739On System V.4 and embedded PowerPC systems do not (do) assume that 17740register 2 contains a pointer to a global area pointing to the addresses 17741used in the program. 17742 17743@item -mlittle 17744@itemx -mlittle-endian 17745@opindex mlittle 17746@opindex mlittle-endian 17747On System V.4 and embedded PowerPC systems compile code for the 17748processor in little-endian mode. The @option{-mlittle-endian} option is 17749the same as @option{-mlittle}. 17750 17751@item -mbig 17752@itemx -mbig-endian 17753@opindex mbig 17754@opindex mbig-endian 17755On System V.4 and embedded PowerPC systems compile code for the 17756processor in big-endian mode. The @option{-mbig-endian} option is 17757the same as @option{-mbig}. 17758 17759@item -mdynamic-no-pic 17760@opindex mdynamic-no-pic 17761On Darwin and Mac OS X systems, compile code so that it is not 17762relocatable, but that its external references are relocatable. The 17763resulting code is suitable for applications, but not shared 17764libraries. 17765 17766@item -msingle-pic-base 17767@opindex msingle-pic-base 17768Treat the register used for PIC addressing as read-only, rather than 17769loading it in the prologue for each function. The runtime system is 17770responsible for initializing this register with an appropriate value 17771before execution begins. 17772 17773@item -mprioritize-restricted-insns=@var{priority} 17774@opindex mprioritize-restricted-insns 17775This option controls the priority that is assigned to 17776dispatch-slot restricted instructions during the second scheduling 17777pass. The argument @var{priority} takes the value @samp{0}, @samp{1}, 17778or @samp{2} to assign no, highest, or second-highest (respectively) 17779priority to dispatch-slot restricted 17780instructions. 17781 17782@item -msched-costly-dep=@var{dependence_type} 17783@opindex msched-costly-dep 17784This option controls which dependences are considered costly 17785by the target during instruction scheduling. The argument 17786@var{dependence_type} takes one of the following values: 17787 17788@table @asis 17789@item @samp{no} 17790No dependence is costly. 17791 17792@item @samp{all} 17793All dependences are costly. 17794 17795@item @samp{true_store_to_load} 17796A true dependence from store to load is costly. 17797 17798@item @samp{store_to_load} 17799Any dependence from store to load is costly. 17800 17801@item @var{number} 17802Any dependence for which the latency is greater than or equal to 17803@var{number} is costly. 17804@end table 17805 17806@item -minsert-sched-nops=@var{scheme} 17807@opindex minsert-sched-nops 17808This option controls which NOP insertion scheme is used during 17809the second scheduling pass. The argument @var{scheme} takes one of the 17810following values: 17811 17812@table @asis 17813@item @samp{no} 17814Don't insert NOPs. 17815 17816@item @samp{pad} 17817Pad with NOPs any dispatch group that has vacant issue slots, 17818according to the scheduler's grouping. 17819 17820@item @samp{regroup_exact} 17821Insert NOPs to force costly dependent insns into 17822separate groups. Insert exactly as many NOPs as needed to force an insn 17823to a new group, according to the estimated processor grouping. 17824 17825@item @var{number} 17826Insert NOPs to force costly dependent insns into 17827separate groups. Insert @var{number} NOPs to force an insn to a new group. 17828@end table 17829 17830@item -mcall-sysv 17831@opindex mcall-sysv 17832On System V.4 and embedded PowerPC systems compile code using calling 17833conventions that adhere to the March 1995 draft of the System V 17834Application Binary Interface, PowerPC processor supplement. This is the 17835default unless you configured GCC using @samp{powerpc-*-eabiaix}. 17836 17837@item -mcall-sysv-eabi 17838@itemx -mcall-eabi 17839@opindex mcall-sysv-eabi 17840@opindex mcall-eabi 17841Specify both @option{-mcall-sysv} and @option{-meabi} options. 17842 17843@item -mcall-sysv-noeabi 17844@opindex mcall-sysv-noeabi 17845Specify both @option{-mcall-sysv} and @option{-mno-eabi} options. 17846 17847@item -mcall-aixdesc 17848@opindex m 17849On System V.4 and embedded PowerPC systems compile code for the AIX 17850operating system. 17851 17852@item -mcall-linux 17853@opindex mcall-linux 17854On System V.4 and embedded PowerPC systems compile code for the 17855Linux-based GNU system. 17856 17857@item -mcall-freebsd 17858@opindex mcall-freebsd 17859On System V.4 and embedded PowerPC systems compile code for the 17860FreeBSD operating system. 17861 17862@item -mcall-netbsd 17863@opindex mcall-netbsd 17864On System V.4 and embedded PowerPC systems compile code for the 17865NetBSD operating system. 17866 17867@item -mcall-openbsd 17868@opindex mcall-netbsd 17869On System V.4 and embedded PowerPC systems compile code for the 17870OpenBSD operating system. 17871 17872@item -maix-struct-return 17873@opindex maix-struct-return 17874Return all structures in memory (as specified by the AIX ABI)@. 17875 17876@item -msvr4-struct-return 17877@opindex msvr4-struct-return 17878Return structures smaller than 8 bytes in registers (as specified by the 17879SVR4 ABI)@. 17880 17881@item -mabi=@var{abi-type} 17882@opindex mabi 17883Extend the current ABI with a particular extension, or remove such extension. 17884Valid values are @var{altivec}, @var{no-altivec}, @var{spe}, 17885@var{no-spe}, @var{ibmlongdouble}, @var{ieeelongdouble}, 17886@var{elfv1}, @var{elfv2}@. 17887 17888@item -mabi=spe 17889@opindex mabi=spe 17890Extend the current ABI with SPE ABI extensions. This does not change 17891the default ABI, instead it adds the SPE ABI extensions to the current 17892ABI@. 17893 17894@item -mabi=no-spe 17895@opindex mabi=no-spe 17896Disable Book-E SPE ABI extensions for the current ABI@. 17897 17898@item -mabi=ibmlongdouble 17899@opindex mabi=ibmlongdouble 17900Change the current ABI to use IBM extended-precision long double. 17901This is a PowerPC 32-bit SYSV ABI option. 17902 17903@item -mabi=ieeelongdouble 17904@opindex mabi=ieeelongdouble 17905Change the current ABI to use IEEE extended-precision long double. 17906This is a PowerPC 32-bit Linux ABI option. 17907 17908@item -mabi=elfv1 17909@opindex mabi=elfv1 17910Change the current ABI to use the ELFv1 ABI. 17911This is the default ABI for big-endian PowerPC 64-bit Linux. 17912Overriding the default ABI requires special system support and is 17913likely to fail in spectacular ways. 17914 17915@item -mabi=elfv2 17916@opindex mabi=elfv2 17917Change the current ABI to use the ELFv2 ABI. 17918This is the default ABI for little-endian PowerPC 64-bit Linux. 17919Overriding the default ABI requires special system support and is 17920likely to fail in spectacular ways. 17921 17922@item -mprototype 17923@itemx -mno-prototype 17924@opindex mprototype 17925@opindex mno-prototype 17926On System V.4 and embedded PowerPC systems assume that all calls to 17927variable argument functions are properly prototyped. Otherwise, the 17928compiler must insert an instruction before every non-prototyped call to 17929set or clear bit 6 of the condition code register (@var{CR}) to 17930indicate whether floating-point values are passed in the floating-point 17931registers in case the function takes variable arguments. With 17932@option{-mprototype}, only calls to prototyped variable argument functions 17933set or clear the bit. 17934 17935@item -msim 17936@opindex msim 17937On embedded PowerPC systems, assume that the startup module is called 17938@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and 17939@file{libc.a}. This is the default for @samp{powerpc-*-eabisim} 17940configurations. 17941 17942@item -mmvme 17943@opindex mmvme 17944On embedded PowerPC systems, assume that the startup module is called 17945@file{crt0.o} and the standard C libraries are @file{libmvme.a} and 17946@file{libc.a}. 17947 17948@item -mads 17949@opindex mads 17950On embedded PowerPC systems, assume that the startup module is called 17951@file{crt0.o} and the standard C libraries are @file{libads.a} and 17952@file{libc.a}. 17953 17954@item -myellowknife 17955@opindex myellowknife 17956On embedded PowerPC systems, assume that the startup module is called 17957@file{crt0.o} and the standard C libraries are @file{libyk.a} and 17958@file{libc.a}. 17959 17960@item -mvxworks 17961@opindex mvxworks 17962On System V.4 and embedded PowerPC systems, specify that you are 17963compiling for a VxWorks system. 17964 17965@item -memb 17966@opindex memb 17967On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags 17968header to indicate that @samp{eabi} extended relocations are used. 17969 17970@item -meabi 17971@itemx -mno-eabi 17972@opindex meabi 17973@opindex mno-eabi 17974On System V.4 and embedded PowerPC systems do (do not) adhere to the 17975Embedded Applications Binary Interface (EABI), which is a set of 17976modifications to the System V.4 specifications. Selecting @option{-meabi} 17977means that the stack is aligned to an 8-byte boundary, a function 17978@code{__eabi} is called from @code{main} to set up the EABI 17979environment, and the @option{-msdata} option can use both @code{r2} and 17980@code{r13} to point to two separate small data areas. Selecting 17981@option{-mno-eabi} means that the stack is aligned to a 16-byte boundary, 17982no EABI initialization function is called from @code{main}, and the 17983@option{-msdata} option only uses @code{r13} to point to a single 17984small data area. The @option{-meabi} option is on by default if you 17985configured GCC using one of the @samp{powerpc*-*-eabi*} options. 17986 17987@item -msdata=eabi 17988@opindex msdata=eabi 17989On System V.4 and embedded PowerPC systems, put small initialized 17990@code{const} global and static data in the @samp{.sdata2} section, which 17991is pointed to by register @code{r2}. Put small initialized 17992non-@code{const} global and static data in the @samp{.sdata} section, 17993which is pointed to by register @code{r13}. Put small uninitialized 17994global and static data in the @samp{.sbss} section, which is adjacent to 17995the @samp{.sdata} section. The @option{-msdata=eabi} option is 17996incompatible with the @option{-mrelocatable} option. The 17997@option{-msdata=eabi} option also sets the @option{-memb} option. 17998 17999@item -msdata=sysv 18000@opindex msdata=sysv 18001On System V.4 and embedded PowerPC systems, put small global and static 18002data in the @samp{.sdata} section, which is pointed to by register 18003@code{r13}. Put small uninitialized global and static data in the 18004@samp{.sbss} section, which is adjacent to the @samp{.sdata} section. 18005The @option{-msdata=sysv} option is incompatible with the 18006@option{-mrelocatable} option. 18007 18008@item -msdata=default 18009@itemx -msdata 18010@opindex msdata=default 18011@opindex msdata 18012On System V.4 and embedded PowerPC systems, if @option{-meabi} is used, 18013compile code the same as @option{-msdata=eabi}, otherwise compile code the 18014same as @option{-msdata=sysv}. 18015 18016@item -msdata=data 18017@opindex msdata=data 18018On System V.4 and embedded PowerPC systems, put small global 18019data in the @samp{.sdata} section. Put small uninitialized global 18020data in the @samp{.sbss} section. Do not use register @code{r13} 18021to address small data however. This is the default behavior unless 18022other @option{-msdata} options are used. 18023 18024@item -msdata=none 18025@itemx -mno-sdata 18026@opindex msdata=none 18027@opindex mno-sdata 18028On embedded PowerPC systems, put all initialized global and static data 18029in the @samp{.data} section, and all uninitialized data in the 18030@samp{.bss} section. 18031 18032@item -mblock-move-inline-limit=@var{num} 18033@opindex mblock-move-inline-limit 18034Inline all block moves (such as calls to @code{memcpy} or structure 18035copies) less than or equal to @var{num} bytes. The minimum value for 18036@var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit 18037targets. The default value is target-specific. 18038 18039@item -G @var{num} 18040@opindex G 18041@cindex smaller data references (PowerPC) 18042@cindex .sdata/.sdata2 references (PowerPC) 18043On embedded PowerPC systems, put global and static items less than or 18044equal to @var{num} bytes into the small data or BSS sections instead of 18045the normal data or BSS section. By default, @var{num} is 8. The 18046@option{-G @var{num}} switch is also passed to the linker. 18047All modules should be compiled with the same @option{-G @var{num}} value. 18048 18049@item -mregnames 18050@itemx -mno-regnames 18051@opindex mregnames 18052@opindex mno-regnames 18053On System V.4 and embedded PowerPC systems do (do not) emit register 18054names in the assembly language output using symbolic forms. 18055 18056@item -mlongcall 18057@itemx -mno-longcall 18058@opindex mlongcall 18059@opindex mno-longcall 18060By default assume that all calls are far away so that a longer and more 18061expensive calling sequence is required. This is required for calls 18062farther than 32 megabytes (33,554,432 bytes) from the current location. 18063A short call is generated if the compiler knows 18064the call cannot be that far away. This setting can be overridden by 18065the @code{shortcall} function attribute, or by @code{#pragma 18066longcall(0)}. 18067 18068Some linkers are capable of detecting out-of-range calls and generating 18069glue code on the fly. On these systems, long calls are unnecessary and 18070generate slower code. As of this writing, the AIX linker can do this, 18071as can the GNU linker for PowerPC/64. It is planned to add this feature 18072to the GNU linker for 32-bit PowerPC systems as well. 18073 18074On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr 18075callee, L42}, plus a @dfn{branch island} (glue code). The two target 18076addresses represent the callee and the branch island. The 18077Darwin/PPC linker prefers the first address and generates a @code{bl 18078callee} if the PPC @code{bl} instruction reaches the callee directly; 18079otherwise, the linker generates @code{bl L42} to call the branch 18080island. The branch island is appended to the body of the 18081calling function; it computes the full 32-bit address of the callee 18082and jumps to it. 18083 18084On Mach-O (Darwin) systems, this option directs the compiler emit to 18085the glue for every direct call, and the Darwin linker decides whether 18086to use or discard it. 18087 18088In the future, GCC may ignore all longcall specifications 18089when the linker is known to generate glue. 18090 18091@item -mtls-markers 18092@itemx -mno-tls-markers 18093@opindex mtls-markers 18094@opindex mno-tls-markers 18095Mark (do not mark) calls to @code{__tls_get_addr} with a relocation 18096specifying the function argument. The relocation allows the linker to 18097reliably associate function call with argument setup instructions for 18098TLS optimization, which in turn allows GCC to better schedule the 18099sequence. 18100 18101@item -pthread 18102@opindex pthread 18103Adds support for multithreading with the @dfn{pthreads} library. 18104This option sets flags for both the preprocessor and linker. 18105 18106@item -mrecip 18107@itemx -mno-recip 18108@opindex mrecip 18109This option enables use of the reciprocal estimate and 18110reciprocal square root estimate instructions with additional 18111Newton-Raphson steps to increase precision instead of doing a divide or 18112square root and divide for floating-point arguments. You should use 18113the @option{-ffast-math} option when using @option{-mrecip} (or at 18114least @option{-funsafe-math-optimizations}, 18115@option{-finite-math-only}, @option{-freciprocal-math} and 18116@option{-fno-trapping-math}). Note that while the throughput of the 18117sequence is generally higher than the throughput of the non-reciprocal 18118instruction, the precision of the sequence can be decreased by up to 2 18119ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square 18120roots. 18121 18122@item -mrecip=@var{opt} 18123@opindex mrecip=opt 18124This option controls which reciprocal estimate instructions 18125may be used. @var{opt} is a comma-separated list of options, which may 18126be preceded by a @code{!} to invert the option: 18127@code{all}: enable all estimate instructions, 18128@code{default}: enable the default instructions, equivalent to @option{-mrecip}, 18129@code{none}: disable all estimate instructions, equivalent to @option{-mno-recip}; 18130@code{div}: enable the reciprocal approximation instructions for both single and double precision; 18131@code{divf}: enable the single-precision reciprocal approximation instructions; 18132@code{divd}: enable the double-precision reciprocal approximation instructions; 18133@code{rsqrt}: enable the reciprocal square root approximation instructions for both single and double precision; 18134@code{rsqrtf}: enable the single-precision reciprocal square root approximation instructions; 18135@code{rsqrtd}: enable the double-precision reciprocal square root approximation instructions; 18136 18137So, for example, @option{-mrecip=all,!rsqrtd} enables 18138all of the reciprocal estimate instructions, except for the 18139@code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions 18140which handle the double-precision reciprocal square root calculations. 18141 18142@item -mrecip-precision 18143@itemx -mno-recip-precision 18144@opindex mrecip-precision 18145Assume (do not assume) that the reciprocal estimate instructions 18146provide higher-precision estimates than is mandated by the PowerPC 18147ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or 18148@option{-mcpu=power8} automatically selects @option{-mrecip-precision}. 18149The double-precision square root estimate instructions are not generated by 18150default on low-precision machines, since they do not provide an 18151estimate that converges after three steps. 18152 18153@item -mveclibabi=@var{type} 18154@opindex mveclibabi 18155Specifies the ABI type to use for vectorizing intrinsics using an 18156external library. The only type supported at present is @code{mass}, 18157which specifies to use IBM's Mathematical Acceleration Subsystem 18158(MASS) libraries for vectorizing intrinsics using external libraries. 18159GCC currently emits calls to @code{acosd2}, @code{acosf4}, 18160@code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4}, 18161@code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4}, 18162@code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4}, 18163@code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4}, 18164@code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4}, 18165@code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4}, 18166@code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4}, 18167@code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4}, 18168@code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4}, 18169@code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4}, 18170@code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2}, 18171@code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2}, 18172@code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code 18173for power7. Both @option{-ftree-vectorize} and 18174@option{-funsafe-math-optimizations} must also be enabled. The MASS 18175libraries must be specified at link time. 18176 18177@item -mfriz 18178@itemx -mno-friz 18179@opindex mfriz 18180Generate (do not generate) the @code{friz} instruction when the 18181@option{-funsafe-math-optimizations} option is used to optimize 18182rounding of floating-point values to 64-bit integer and back to floating 18183point. The @code{friz} instruction does not return the same value if 18184the floating-point number is too large to fit in an integer. 18185 18186@item -mpointers-to-nested-functions 18187@itemx -mno-pointers-to-nested-functions 18188@opindex mpointers-to-nested-functions 18189Generate (do not generate) code to load up the static chain register 18190(@var{r11}) when calling through a pointer on AIX and 64-bit Linux 18191systems where a function pointer points to a 3-word descriptor giving 18192the function address, TOC value to be loaded in register @var{r2}, and 18193static chain value to be loaded in register @var{r11}. The 18194@option{-mpointers-to-nested-functions} is on by default. You cannot 18195call through pointers to nested functions or pointers 18196to functions compiled in other languages that use the static chain if 18197you use the @option{-mno-pointers-to-nested-functions}. 18198 18199@item -msave-toc-indirect 18200@itemx -mno-save-toc-indirect 18201@opindex msave-toc-indirect 18202Generate (do not generate) code to save the TOC value in the reserved 18203stack location in the function prologue if the function calls through 18204a pointer on AIX and 64-bit Linux systems. If the TOC value is not 18205saved in the prologue, it is saved just before the call through the 18206pointer. The @option{-mno-save-toc-indirect} option is the default. 18207 18208@item -mcompat-align-parm 18209@itemx -mno-compat-align-parm 18210@opindex mcompat-align-parm 18211Generate (do not generate) code to pass structure parameters with a 18212maximum alignment of 64 bits, for compatibility with older versions 18213of GCC. 18214 18215Older versions of GCC (prior to 4.9.0) incorrectly did not align a 18216structure parameter on a 128-bit boundary when that structure contained 18217a member requiring 128-bit alignment. This is corrected in more 18218recent versions of GCC. This option may be used to generate code 18219that is compatible with functions compiled with older versions of 18220GCC. 18221 18222In this version of the compiler, the @option{-mcompat-align-parm} 18223is the default, except when using the Linux ELFv2 ABI. 18224@end table 18225 18226@node RX Options 18227@subsection RX Options 18228@cindex RX Options 18229 18230These command-line options are defined for RX targets: 18231 18232@table @gcctabopt 18233@item -m64bit-doubles 18234@itemx -m32bit-doubles 18235@opindex m64bit-doubles 18236@opindex m32bit-doubles 18237Make the @code{double} data type be 64 bits (@option{-m64bit-doubles}) 18238or 32 bits (@option{-m32bit-doubles}) in size. The default is 18239@option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only 18240works on 32-bit values, which is why the default is 18241@option{-m32bit-doubles}. 18242 18243@item -fpu 18244@itemx -nofpu 18245@opindex fpu 18246@opindex nofpu 18247Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX 18248floating-point hardware. The default is enabled for the @var{RX600} 18249series and disabled for the @var{RX200} series. 18250 18251Floating-point instructions are only generated for 32-bit floating-point 18252values, however, so the FPU hardware is not used for doubles if the 18253@option{-m64bit-doubles} option is used. 18254 18255@emph{Note} If the @option{-fpu} option is enabled then 18256@option{-funsafe-math-optimizations} is also enabled automatically. 18257This is because the RX FPU instructions are themselves unsafe. 18258 18259@item -mcpu=@var{name} 18260@opindex -mcpu 18261Selects the type of RX CPU to be targeted. Currently three types are 18262supported, the generic @var{RX600} and @var{RX200} series hardware and 18263the specific @var{RX610} CPU. The default is @var{RX600}. 18264 18265The only difference between @var{RX600} and @var{RX610} is that the 18266@var{RX610} does not support the @code{MVTIPL} instruction. 18267 18268The @var{RX200} series does not have a hardware floating-point unit 18269and so @option{-nofpu} is enabled by default when this type is 18270selected. 18271 18272@item -mbig-endian-data 18273@itemx -mlittle-endian-data 18274@opindex mbig-endian-data 18275@opindex mlittle-endian-data 18276Store data (but not code) in the big-endian format. The default is 18277@option{-mlittle-endian-data}, i.e.@: to store data in the little-endian 18278format. 18279 18280@item -msmall-data-limit=@var{N} 18281@opindex msmall-data-limit 18282Specifies the maximum size in bytes of global and static variables 18283which can be placed into the small data area. Using the small data 18284area can lead to smaller and faster code, but the size of area is 18285limited and it is up to the programmer to ensure that the area does 18286not overflow. Also when the small data area is used one of the RX's 18287registers (usually @code{r13}) is reserved for use pointing to this 18288area, so it is no longer available for use by the compiler. This 18289could result in slower and/or larger code if variables are pushed onto 18290the stack instead of being held in this register. 18291 18292Note, common variables (variables that have not been initialized) and 18293constants are not placed into the small data area as they are assigned 18294to other sections in the output executable. 18295 18296The default value is zero, which disables this feature. Note, this 18297feature is not enabled by default with higher optimization levels 18298(@option{-O2} etc) because of the potentially detrimental effects of 18299reserving a register. It is up to the programmer to experiment and 18300discover whether this feature is of benefit to their program. See the 18301description of the @option{-mpid} option for a description of how the 18302actual register to hold the small data area pointer is chosen. 18303 18304@item -msim 18305@itemx -mno-sim 18306@opindex msim 18307@opindex mno-sim 18308Use the simulator runtime. The default is to use the libgloss 18309board-specific runtime. 18310 18311@item -mas100-syntax 18312@itemx -mno-as100-syntax 18313@opindex mas100-syntax 18314@opindex mno-as100-syntax 18315When generating assembler output use a syntax that is compatible with 18316Renesas's AS100 assembler. This syntax can also be handled by the GAS 18317assembler, but it has some restrictions so it is not generated by default. 18318 18319@item -mmax-constant-size=@var{N} 18320@opindex mmax-constant-size 18321Specifies the maximum size, in bytes, of a constant that can be used as 18322an operand in a RX instruction. Although the RX instruction set does 18323allow constants of up to 4 bytes in length to be used in instructions, 18324a longer value equates to a longer instruction. Thus in some 18325circumstances it can be beneficial to restrict the size of constants 18326that are used in instructions. Constants that are too big are instead 18327placed into a constant pool and referenced via register indirection. 18328 18329The value @var{N} can be between 0 and 4. A value of 0 (the default) 18330or 4 means that constants of any size are allowed. 18331 18332@item -mrelax 18333@opindex mrelax 18334Enable linker relaxation. Linker relaxation is a process whereby the 18335linker attempts to reduce the size of a program by finding shorter 18336versions of various instructions. Disabled by default. 18337 18338@item -mint-register=@var{N} 18339@opindex mint-register 18340Specify the number of registers to reserve for fast interrupt handler 18341functions. The value @var{N} can be between 0 and 4. A value of 1 18342means that register @code{r13} is reserved for the exclusive use 18343of fast interrupt handlers. A value of 2 reserves @code{r13} and 18344@code{r12}. A value of 3 reserves @code{r13}, @code{r12} and 18345@code{r11}, and a value of 4 reserves @code{r13} through @code{r10}. 18346A value of 0, the default, does not reserve any registers. 18347 18348@item -msave-acc-in-interrupts 18349@opindex msave-acc-in-interrupts 18350Specifies that interrupt handler functions should preserve the 18351accumulator register. This is only necessary if normal code might use 18352the accumulator register, for example because it performs 64-bit 18353multiplications. The default is to ignore the accumulator as this 18354makes the interrupt handlers faster. 18355 18356@item -mpid 18357@itemx -mno-pid 18358@opindex mpid 18359@opindex mno-pid 18360Enables the generation of position independent data. When enabled any 18361access to constant data is done via an offset from a base address 18362held in a register. This allows the location of constant data to be 18363determined at run time without requiring the executable to be 18364relocated, which is a benefit to embedded applications with tight 18365memory constraints. Data that can be modified is not affected by this 18366option. 18367 18368Note, using this feature reserves a register, usually @code{r13}, for 18369the constant data base address. This can result in slower and/or 18370larger code, especially in complicated functions. 18371 18372The actual register chosen to hold the constant data base address 18373depends upon whether the @option{-msmall-data-limit} and/or the 18374@option{-mint-register} command-line options are enabled. Starting 18375with register @code{r13} and proceeding downwards, registers are 18376allocated first to satisfy the requirements of @option{-mint-register}, 18377then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it 18378is possible for the small data area register to be @code{r8} if both 18379@option{-mint-register=4} and @option{-mpid} are specified on the 18380command line. 18381 18382By default this feature is not enabled. The default can be restored 18383via the @option{-mno-pid} command-line option. 18384 18385@item -mno-warn-multiple-fast-interrupts 18386@itemx -mwarn-multiple-fast-interrupts 18387@opindex mno-warn-multiple-fast-interrupts 18388@opindex mwarn-multiple-fast-interrupts 18389Prevents GCC from issuing a warning message if it finds more than one 18390fast interrupt handler when it is compiling a file. The default is to 18391issue a warning for each extra fast interrupt handler found, as the RX 18392only supports one such interrupt. 18393 18394@end table 18395 18396@emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}} 18397has special significance to the RX port when used with the 18398@code{interrupt} function attribute. This attribute indicates a 18399function intended to process fast interrupts. GCC ensures 18400that it only uses the registers @code{r10}, @code{r11}, @code{r12} 18401and/or @code{r13} and only provided that the normal use of the 18402corresponding registers have been restricted via the 18403@option{-ffixed-@var{reg}} or @option{-mint-register} command-line 18404options. 18405 18406@node S/390 and zSeries Options 18407@subsection S/390 and zSeries Options 18408@cindex S/390 and zSeries Options 18409 18410These are the @samp{-m} options defined for the S/390 and zSeries architecture. 18411 18412@table @gcctabopt 18413@item -mhard-float 18414@itemx -msoft-float 18415@opindex mhard-float 18416@opindex msoft-float 18417Use (do not use) the hardware floating-point instructions and registers 18418for floating-point operations. When @option{-msoft-float} is specified, 18419functions in @file{libgcc.a} are used to perform floating-point 18420operations. When @option{-mhard-float} is specified, the compiler 18421generates IEEE floating-point instructions. This is the default. 18422 18423@item -mhard-dfp 18424@itemx -mno-hard-dfp 18425@opindex mhard-dfp 18426@opindex mno-hard-dfp 18427Use (do not use) the hardware decimal-floating-point instructions for 18428decimal-floating-point operations. When @option{-mno-hard-dfp} is 18429specified, functions in @file{libgcc.a} are used to perform 18430decimal-floating-point operations. When @option{-mhard-dfp} is 18431specified, the compiler generates decimal-floating-point hardware 18432instructions. This is the default for @option{-march=z9-ec} or higher. 18433 18434@item -mlong-double-64 18435@itemx -mlong-double-128 18436@opindex mlong-double-64 18437@opindex mlong-double-128 18438These switches control the size of @code{long double} type. A size 18439of 64 bits makes the @code{long double} type equivalent to the @code{double} 18440type. This is the default. 18441 18442@item -mbackchain 18443@itemx -mno-backchain 18444@opindex mbackchain 18445@opindex mno-backchain 18446Store (do not store) the address of the caller's frame as backchain pointer 18447into the callee's stack frame. 18448A backchain may be needed to allow debugging using tools that do not understand 18449DWARF 2 call frame information. 18450When @option{-mno-packed-stack} is in effect, the backchain pointer is stored 18451at the bottom of the stack frame; when @option{-mpacked-stack} is in effect, 18452the backchain is placed into the topmost word of the 96/160 byte register 18453save area. 18454 18455In general, code compiled with @option{-mbackchain} is call-compatible with 18456code compiled with @option{-mmo-backchain}; however, use of the backchain 18457for debugging purposes usually requires that the whole binary is built with 18458@option{-mbackchain}. Note that the combination of @option{-mbackchain}, 18459@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order 18460to build a linux kernel use @option{-msoft-float}. 18461 18462The default is to not maintain the backchain. 18463 18464@item -mpacked-stack 18465@itemx -mno-packed-stack 18466@opindex mpacked-stack 18467@opindex mno-packed-stack 18468Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is 18469specified, the compiler uses the all fields of the 96/160 byte register save 18470area only for their default purpose; unused fields still take up stack space. 18471When @option{-mpacked-stack} is specified, register save slots are densely 18472packed at the top of the register save area; unused space is reused for other 18473purposes, allowing for more efficient use of the available stack space. 18474However, when @option{-mbackchain} is also in effect, the topmost word of 18475the save area is always used to store the backchain, and the return address 18476register is always saved two words below the backchain. 18477 18478As long as the stack frame backchain is not used, code generated with 18479@option{-mpacked-stack} is call-compatible with code generated with 18480@option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for 18481S/390 or zSeries generated code that uses the stack frame backchain at run 18482time, not just for debugging purposes. Such code is not call-compatible 18483with code compiled with @option{-mpacked-stack}. Also, note that the 18484combination of @option{-mbackchain}, 18485@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order 18486to build a linux kernel use @option{-msoft-float}. 18487 18488The default is to not use the packed stack layout. 18489 18490@item -msmall-exec 18491@itemx -mno-small-exec 18492@opindex msmall-exec 18493@opindex mno-small-exec 18494Generate (or do not generate) code using the @code{bras} instruction 18495to do subroutine calls. 18496This only works reliably if the total executable size does not 18497exceed 64k. The default is to use the @code{basr} instruction instead, 18498which does not have this limitation. 18499 18500@item -m64 18501@itemx -m31 18502@opindex m64 18503@opindex m31 18504When @option{-m31} is specified, generate code compliant to the 18505GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate 18506code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in 18507particular to generate 64-bit instructions. For the @samp{s390} 18508targets, the default is @option{-m31}, while the @samp{s390x} 18509targets default to @option{-m64}. 18510 18511@item -mzarch 18512@itemx -mesa 18513@opindex mzarch 18514@opindex mesa 18515When @option{-mzarch} is specified, generate code using the 18516instructions available on z/Architecture. 18517When @option{-mesa} is specified, generate code using the 18518instructions available on ESA/390. Note that @option{-mesa} is 18519not possible with @option{-m64}. 18520When generating code compliant to the GNU/Linux for S/390 ABI, 18521the default is @option{-mesa}. When generating code compliant 18522to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}. 18523 18524@item -mmvcle 18525@itemx -mno-mvcle 18526@opindex mmvcle 18527@opindex mno-mvcle 18528Generate (or do not generate) code using the @code{mvcle} instruction 18529to perform block moves. When @option{-mno-mvcle} is specified, 18530use a @code{mvc} loop instead. This is the default unless optimizing for 18531size. 18532 18533@item -mdebug 18534@itemx -mno-debug 18535@opindex mdebug 18536@opindex mno-debug 18537Print (or do not print) additional debug information when compiling. 18538The default is to not print debug information. 18539 18540@item -march=@var{cpu-type} 18541@opindex march 18542Generate code that runs on @var{cpu-type}, which is the name of a system 18543representing a certain processor type. Possible values for 18544@var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, @samp{z990}, 18545@samp{z9-109}, @samp{z9-ec}, @samp{z10}, @samp{z196}, and @samp{zEC12}. 18546When generating code using the instructions available on z/Architecture, 18547the default is @option{-march=z900}. Otherwise, the default is 18548@option{-march=g5}. 18549 18550@item -mtune=@var{cpu-type} 18551@opindex mtune 18552Tune to @var{cpu-type} everything applicable about the generated code, 18553except for the ABI and the set of available instructions. 18554The list of @var{cpu-type} values is the same as for @option{-march}. 18555The default is the value used for @option{-march}. 18556 18557@item -mtpf-trace 18558@itemx -mno-tpf-trace 18559@opindex mtpf-trace 18560@opindex mno-tpf-trace 18561Generate code that adds (does not add) in TPF OS specific branches to trace 18562routines in the operating system. This option is off by default, even 18563when compiling for the TPF OS@. 18564 18565@item -mfused-madd 18566@itemx -mno-fused-madd 18567@opindex mfused-madd 18568@opindex mno-fused-madd 18569Generate code that uses (does not use) the floating-point multiply and 18570accumulate instructions. These instructions are generated by default if 18571hardware floating point is used. 18572 18573@item -mwarn-framesize=@var{framesize} 18574@opindex mwarn-framesize 18575Emit a warning if the current function exceeds the given frame size. Because 18576this is a compile-time check it doesn't need to be a real problem when the program 18577runs. It is intended to identify functions that most probably cause 18578a stack overflow. It is useful to be used in an environment with limited stack 18579size e.g.@: the linux kernel. 18580 18581@item -mwarn-dynamicstack 18582@opindex mwarn-dynamicstack 18583Emit a warning if the function calls @code{alloca} or uses dynamically-sized 18584arrays. This is generally a bad idea with a limited stack size. 18585 18586@item -mstack-guard=@var{stack-guard} 18587@itemx -mstack-size=@var{stack-size} 18588@opindex mstack-guard 18589@opindex mstack-size 18590If these options are provided the S/390 back end emits additional instructions in 18591the function prologue that trigger a trap if the stack size is @var{stack-guard} 18592bytes above the @var{stack-size} (remember that the stack on S/390 grows downward). 18593If the @var{stack-guard} option is omitted the smallest power of 2 larger than 18594the frame size of the compiled function is chosen. 18595These options are intended to be used to help debugging stack overflow problems. 18596The additionally emitted code causes only little overhead and hence can also be 18597used in production-like systems without greater performance degradation. The given 18598values have to be exact powers of 2 and @var{stack-size} has to be greater than 18599@var{stack-guard} without exceeding 64k. 18600In order to be efficient the extra code makes the assumption that the stack starts 18601at an address aligned to the value given by @var{stack-size}. 18602The @var{stack-guard} option can only be used in conjunction with @var{stack-size}. 18603 18604@item -mhotpatch=@var{pre-halfwords},@var{post-halfwords} 18605@opindex mhotpatch 18606If the hotpatch option is enabled, a ``hot-patching'' function 18607prologue is generated for all functions in the compilation unit. 18608The funtion label is prepended with the given number of two-byte 18609NOP instructions (@var{pre-halfwords}, maximum 1000000). After 18610the label, 2 * @var{post-halfwords} bytes are appended, using the 18611largest NOP like instructions the architecture allows (maximum 186121000000). 18613 18614If both arguments are zero, hotpatching is disabled. 18615 18616This option can be overridden for individual functions with the 18617@code{hotpatch} attribute. 18618@end table 18619 18620@node Score Options 18621@subsection Score Options 18622@cindex Score Options 18623 18624These options are defined for Score implementations: 18625 18626@table @gcctabopt 18627@item -meb 18628@opindex meb 18629Compile code for big-endian mode. This is the default. 18630 18631@item -mel 18632@opindex mel 18633Compile code for little-endian mode. 18634 18635@item -mnhwloop 18636@opindex mnhwloop 18637Disable generation of @code{bcnz} instructions. 18638 18639@item -muls 18640@opindex muls 18641Enable generation of unaligned load and store instructions. 18642 18643@item -mmac 18644@opindex mmac 18645Enable the use of multiply-accumulate instructions. Disabled by default. 18646 18647@item -mscore5 18648@opindex mscore5 18649Specify the SCORE5 as the target architecture. 18650 18651@item -mscore5u 18652@opindex mscore5u 18653Specify the SCORE5U of the target architecture. 18654 18655@item -mscore7 18656@opindex mscore7 18657Specify the SCORE7 as the target architecture. This is the default. 18658 18659@item -mscore7d 18660@opindex mscore7d 18661Specify the SCORE7D as the target architecture. 18662@end table 18663 18664@node SH Options 18665@subsection SH Options 18666 18667These @samp{-m} options are defined for the SH implementations: 18668 18669@table @gcctabopt 18670@item -m1 18671@opindex m1 18672Generate code for the SH1. 18673 18674@item -m2 18675@opindex m2 18676Generate code for the SH2. 18677 18678@item -m2e 18679Generate code for the SH2e. 18680 18681@item -m2a-nofpu 18682@opindex m2a-nofpu 18683Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way 18684that the floating-point unit is not used. 18685 18686@item -m2a-single-only 18687@opindex m2a-single-only 18688Generate code for the SH2a-FPU, in such a way that no double-precision 18689floating-point operations are used. 18690 18691@item -m2a-single 18692@opindex m2a-single 18693Generate code for the SH2a-FPU assuming the floating-point unit is in 18694single-precision mode by default. 18695 18696@item -m2a 18697@opindex m2a 18698Generate code for the SH2a-FPU assuming the floating-point unit is in 18699double-precision mode by default. 18700 18701@item -m3 18702@opindex m3 18703Generate code for the SH3. 18704 18705@item -m3e 18706@opindex m3e 18707Generate code for the SH3e. 18708 18709@item -m4-nofpu 18710@opindex m4-nofpu 18711Generate code for the SH4 without a floating-point unit. 18712 18713@item -m4-single-only 18714@opindex m4-single-only 18715Generate code for the SH4 with a floating-point unit that only 18716supports single-precision arithmetic. 18717 18718@item -m4-single 18719@opindex m4-single 18720Generate code for the SH4 assuming the floating-point unit is in 18721single-precision mode by default. 18722 18723@item -m4 18724@opindex m4 18725Generate code for the SH4. 18726 18727@item -m4-100 18728@opindex m4-100 18729Generate code for SH4-100. 18730 18731@item -m4-100-nofpu 18732@opindex m4-100-nofpu 18733Generate code for SH4-100 in such a way that the 18734floating-point unit is not used. 18735 18736@item -m4-100-single 18737@opindex m4-100-single 18738Generate code for SH4-100 assuming the floating-point unit is in 18739single-precision mode by default. 18740 18741@item -m4-100-single-only 18742@opindex m4-100-single-only 18743Generate code for SH4-100 in such a way that no double-precision 18744floating-point operations are used. 18745 18746@item -m4-200 18747@opindex m4-200 18748Generate code for SH4-200. 18749 18750@item -m4-200-nofpu 18751@opindex m4-200-nofpu 18752Generate code for SH4-200 without in such a way that the 18753floating-point unit is not used. 18754 18755@item -m4-200-single 18756@opindex m4-200-single 18757Generate code for SH4-200 assuming the floating-point unit is in 18758single-precision mode by default. 18759 18760@item -m4-200-single-only 18761@opindex m4-200-single-only 18762Generate code for SH4-200 in such a way that no double-precision 18763floating-point operations are used. 18764 18765@item -m4-300 18766@opindex m4-300 18767Generate code for SH4-300. 18768 18769@item -m4-300-nofpu 18770@opindex m4-300-nofpu 18771Generate code for SH4-300 without in such a way that the 18772floating-point unit is not used. 18773 18774@item -m4-300-single 18775@opindex m4-300-single 18776Generate code for SH4-300 in such a way that no double-precision 18777floating-point operations are used. 18778 18779@item -m4-300-single-only 18780@opindex m4-300-single-only 18781Generate code for SH4-300 in such a way that no double-precision 18782floating-point operations are used. 18783 18784@item -m4-340 18785@opindex m4-340 18786Generate code for SH4-340 (no MMU, no FPU). 18787 18788@item -m4-500 18789@opindex m4-500 18790Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the 18791assembler. 18792 18793@item -m4a-nofpu 18794@opindex m4a-nofpu 18795Generate code for the SH4al-dsp, or for a SH4a in such a way that the 18796floating-point unit is not used. 18797 18798@item -m4a-single-only 18799@opindex m4a-single-only 18800Generate code for the SH4a, in such a way that no double-precision 18801floating-point operations are used. 18802 18803@item -m4a-single 18804@opindex m4a-single 18805Generate code for the SH4a assuming the floating-point unit is in 18806single-precision mode by default. 18807 18808@item -m4a 18809@opindex m4a 18810Generate code for the SH4a. 18811 18812@item -m4al 18813@opindex m4al 18814Same as @option{-m4a-nofpu}, except that it implicitly passes 18815@option{-dsp} to the assembler. GCC doesn't generate any DSP 18816instructions at the moment. 18817 18818@item -m5-32media 18819@opindex m5-32media 18820Generate 32-bit code for SHmedia. 18821 18822@item -m5-32media-nofpu 18823@opindex m5-32media-nofpu 18824Generate 32-bit code for SHmedia in such a way that the 18825floating-point unit is not used. 18826 18827@item -m5-64media 18828@opindex m5-64media 18829Generate 64-bit code for SHmedia. 18830 18831@item -m5-64media-nofpu 18832@opindex m5-64media-nofpu 18833Generate 64-bit code for SHmedia in such a way that the 18834floating-point unit is not used. 18835 18836@item -m5-compact 18837@opindex m5-compact 18838Generate code for SHcompact. 18839 18840@item -m5-compact-nofpu 18841@opindex m5-compact-nofpu 18842Generate code for SHcompact in such a way that the 18843floating-point unit is not used. 18844 18845@item -mb 18846@opindex mb 18847Compile code for the processor in big-endian mode. 18848 18849@item -ml 18850@opindex ml 18851Compile code for the processor in little-endian mode. 18852 18853@item -mdalign 18854@opindex mdalign 18855Align doubles at 64-bit boundaries. Note that this changes the calling 18856conventions, and thus some functions from the standard C library do 18857not work unless you recompile it first with @option{-mdalign}. 18858 18859@item -mrelax 18860@opindex mrelax 18861Shorten some address references at link time, when possible; uses the 18862linker option @option{-relax}. 18863 18864@item -mbigtable 18865@opindex mbigtable 18866Use 32-bit offsets in @code{switch} tables. The default is to use 1886716-bit offsets. 18868 18869@item -mbitops 18870@opindex mbitops 18871Enable the use of bit manipulation instructions on SH2A. 18872 18873@item -mfmovd 18874@opindex mfmovd 18875Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for 18876alignment constraints. 18877 18878@item -mrenesas 18879@opindex mrenesas 18880Comply with the calling conventions defined by Renesas. 18881 18882@item -mno-renesas 18883@opindex mno-renesas 18884Comply with the calling conventions defined for GCC before the Renesas 18885conventions were available. This option is the default for all 18886targets of the SH toolchain. 18887 18888@item -mnomacsave 18889@opindex mnomacsave 18890Mark the @code{MAC} register as call-clobbered, even if 18891@option{-mrenesas} is given. 18892 18893@item -mieee 18894@itemx -mno-ieee 18895@opindex mieee 18896@opindex mno-ieee 18897Control the IEEE compliance of floating-point comparisons, which affects the 18898handling of cases where the result of a comparison is unordered. By default 18899@option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is 18900enabled @option{-mno-ieee} is implicitly set, which results in faster 18901floating-point greater-equal and less-equal comparisons. The implcit settings 18902can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}. 18903 18904@item -minline-ic_invalidate 18905@opindex minline-ic_invalidate 18906Inline code to invalidate instruction cache entries after setting up 18907nested function trampolines. 18908This option has no effect if @option{-musermode} is in effect and the selected 18909code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi} 18910instruction. 18911If the selected code generation option does not allow the use of the @code{icbi} 18912instruction, and @option{-musermode} is not in effect, the inlined code 18913manipulates the instruction cache address array directly with an associative 18914write. This not only requires privileged mode at run time, but it also 18915fails if the cache line had been mapped via the TLB and has become unmapped. 18916 18917@item -misize 18918@opindex misize 18919Dump instruction size and location in the assembly code. 18920 18921@item -mpadstruct 18922@opindex mpadstruct 18923This option is deprecated. It pads structures to multiple of 4 bytes, 18924which is incompatible with the SH ABI@. 18925 18926@item -matomic-model=@var{model} 18927@opindex matomic-model=@var{model} 18928Sets the model of atomic operations and additional parameters as a comma 18929separated list. For details on the atomic built-in functions see 18930@ref{__atomic Builtins}. The following models and parameters are supported: 18931 18932@table @samp 18933 18934@item none 18935Disable compiler generated atomic sequences and emit library calls for atomic 18936operations. This is the default if the target is not @code{sh*-*-linux*}. 18937 18938@item soft-gusa 18939Generate GNU/Linux compatible gUSA software atomic sequences for the atomic 18940built-in functions. The generated atomic sequences require additional support 18941from the interrupt/exception handling code of the system and are only suitable 18942for SH3* and SH4* single-core systems. This option is enabled by default when 18943the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A, 18944this option will also partially utilize the hardware atomic instructions 18945@code{movli.l} and @code{movco.l} to create more efficient code, unless 18946@samp{strict} is specified. 18947 18948@item soft-tcb 18949Generate software atomic sequences that use a variable in the thread control 18950block. This is a variation of the gUSA sequences which can also be used on 18951SH1* and SH2* targets. The generated atomic sequences require additional 18952support from the interrupt/exception handling code of the system and are only 18953suitable for single-core systems. When using this model, the @samp{gbr-offset=} 18954parameter has to be specified as well. 18955 18956@item soft-imask 18957Generate software atomic sequences that temporarily disable interrupts by 18958setting @code{SR.IMASK = 1111}. This model works only when the program runs 18959in privileged mode and is only suitable for single-core systems. Additional 18960support from the interrupt/exception handling code of the system is not 18961required. This model is enabled by default when the target is 18962@code{sh*-*-linux*} and SH1* or SH2*. 18963 18964@item hard-llcs 18965Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l} 18966instructions only. This is only available on SH4A and is suitable for 18967multi-core systems. Since the hardware instructions support only 32 bit atomic 18968variables access to 8 or 16 bit variables is emulated with 32 bit accesses. 18969Code compiled with this option will also be compatible with other software 18970atomic model interrupt/exception handling systems if executed on an SH4A 18971system. Additional support from the interrupt/exception handling code of the 18972system is not required for this model. 18973 18974@item gbr-offset= 18975This parameter specifies the offset in bytes of the variable in the thread 18976control block structure that should be used by the generated atomic sequences 18977when the @samp{soft-tcb} model has been selected. For other models this 18978parameter is ignored. The specified value must be an integer multiple of four 18979and in the range 0-1020. 18980 18981@item strict 18982This parameter prevents mixed usage of multiple atomic models, even though they 18983would be compatible, and will make the compiler generate atomic sequences of the 18984specified model only. 18985 18986@end table 18987 18988@item -mtas 18989@opindex mtas 18990Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}. 18991Notice that depending on the particular hardware and software configuration 18992this can degrade overall performance due to the operand cache line flushes 18993that are implied by the @code{tas.b} instruction. On multi-core SH4A 18994processors the @code{tas.b} instruction must be used with caution since it 18995can result in data corruption for certain cache configurations. 18996 18997@item -mprefergot 18998@opindex mprefergot 18999When generating position-independent code, emit function calls using 19000the Global Offset Table instead of the Procedure Linkage Table. 19001 19002@item -musermode 19003@itemx -mno-usermode 19004@opindex musermode 19005@opindex mno-usermode 19006Don't allow (allow) the compiler generating privileged mode code. Specifying 19007@option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the 19008inlined code would not work in user mode. @option{-musermode} is the default 19009when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2* 19010@option{-musermode} has no effect, since there is no user mode. 19011 19012@item -multcost=@var{number} 19013@opindex multcost=@var{number} 19014Set the cost to assume for a multiply insn. 19015 19016@item -mdiv=@var{strategy} 19017@opindex mdiv=@var{strategy} 19018Set the division strategy to be used for integer division operations. 19019For SHmedia @var{strategy} can be one of: 19020 19021@table @samp 19022 19023@item fp 19024Performs the operation in floating point. This has a very high latency, 19025but needs only a few instructions, so it might be a good choice if 19026your code has enough easily-exploitable ILP to allow the compiler to 19027schedule the floating-point instructions together with other instructions. 19028Division by zero causes a floating-point exception. 19029 19030@item inv 19031Uses integer operations to calculate the inverse of the divisor, 19032and then multiplies the dividend with the inverse. This strategy allows 19033CSE and hoisting of the inverse calculation. Division by zero calculates 19034an unspecified result, but does not trap. 19035 19036@item inv:minlat 19037A variant of @samp{inv} where, if no CSE or hoisting opportunities 19038have been found, or if the entire operation has been hoisted to the same 19039place, the last stages of the inverse calculation are intertwined with the 19040final multiply to reduce the overall latency, at the expense of using a few 19041more instructions, and thus offering fewer scheduling opportunities with 19042other code. 19043 19044@item call 19045Calls a library function that usually implements the @samp{inv:minlat} 19046strategy. 19047This gives high code density for @code{m5-*media-nofpu} compilations. 19048 19049@item call2 19050Uses a different entry point of the same library function, where it 19051assumes that a pointer to a lookup table has already been set up, which 19052exposes the pointer load to CSE and code hoisting optimizations. 19053 19054@item inv:call 19055@itemx inv:call2 19056@itemx inv:fp 19057Use the @samp{inv} algorithm for initial 19058code generation, but if the code stays unoptimized, revert to the @samp{call}, 19059@samp{call2}, or @samp{fp} strategies, respectively. Note that the 19060potentially-trapping side effect of division by zero is carried by a 19061separate instruction, so it is possible that all the integer instructions 19062are hoisted out, but the marker for the side effect stays where it is. 19063A recombination to floating-point operations or a call is not possible 19064in that case. 19065 19066@item inv20u 19067@itemx inv20l 19068Variants of the @samp{inv:minlat} strategy. In the case 19069that the inverse calculation is not separated from the multiply, they speed 19070up division where the dividend fits into 20 bits (plus sign where applicable) 19071by inserting a test to skip a number of operations in this case; this test 19072slows down the case of larger dividends. @samp{inv20u} assumes the case of a such 19073a small dividend to be unlikely, and @samp{inv20l} assumes it to be likely. 19074 19075@end table 19076 19077For targets other than SHmedia @var{strategy} can be one of: 19078 19079@table @samp 19080 19081@item call-div1 19082Calls a library function that uses the single-step division instruction 19083@code{div1} to perform the operation. Division by zero calculates an 19084unspecified result and does not trap. This is the default except for SH4, 19085SH2A and SHcompact. 19086 19087@item call-fp 19088Calls a library function that performs the operation in double precision 19089floating point. Division by zero causes a floating-point exception. This is 19090the default for SHcompact with FPU. Specifying this for targets that do not 19091have a double precision FPU will default to @code{call-div1}. 19092 19093@item call-table 19094Calls a library function that uses a lookup table for small divisors and 19095the @code{div1} instruction with case distinction for larger divisors. Division 19096by zero calculates an unspecified result and does not trap. This is the default 19097for SH4. Specifying this for targets that do not have dynamic shift 19098instructions will default to @code{call-div1}. 19099 19100@end table 19101 19102When a division strategy has not been specified the default strategy will be 19103selected based on the current target. For SH2A the default strategy is to 19104use the @code{divs} and @code{divu} instructions instead of library function 19105calls. 19106 19107@item -maccumulate-outgoing-args 19108@opindex maccumulate-outgoing-args 19109Reserve space once for outgoing arguments in the function prologue rather 19110than around each call. Generally beneficial for performance and size. Also 19111needed for unwinding to avoid changing the stack frame around conditional code. 19112 19113@item -mdivsi3_libfunc=@var{name} 19114@opindex mdivsi3_libfunc=@var{name} 19115Set the name of the library function used for 32-bit signed division to 19116@var{name}. 19117This only affects the name used in the @samp{call} and @samp{inv:call} 19118division strategies, and the compiler still expects the same 19119sets of input/output/clobbered registers as if this option were not present. 19120 19121@item -mfixed-range=@var{register-range} 19122@opindex mfixed-range 19123Generate code treating the given register range as fixed registers. 19124A fixed register is one that the register allocator can not use. This is 19125useful when compiling kernel code. A register range is specified as 19126two registers separated by a dash. Multiple register ranges can be 19127specified separated by a comma. 19128 19129@item -mindexed-addressing 19130@opindex mindexed-addressing 19131Enable the use of the indexed addressing mode for SHmedia32/SHcompact. 19132This is only safe if the hardware and/or OS implement 32-bit wrap-around 19133semantics for the indexed addressing mode. The architecture allows the 19134implementation of processors with 64-bit MMU, which the OS could use to 19135get 32-bit addressing, but since no current hardware implementation supports 19136this or any other way to make the indexed addressing mode safe to use in 19137the 32-bit ABI, the default is @option{-mno-indexed-addressing}. 19138 19139@item -mgettrcost=@var{number} 19140@opindex mgettrcost=@var{number} 19141Set the cost assumed for the @code{gettr} instruction to @var{number}. 19142The default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise. 19143 19144@item -mpt-fixed 19145@opindex mpt-fixed 19146Assume @code{pt*} instructions won't trap. This generally generates 19147better-scheduled code, but is unsafe on current hardware. 19148The current architecture 19149definition says that @code{ptabs} and @code{ptrel} trap when the target 19150anded with 3 is 3. 19151This has the unintentional effect of making it unsafe to schedule these 19152instructions before a branch, or hoist them out of a loop. For example, 19153@code{__do_global_ctors}, a part of @file{libgcc} 19154that runs constructors at program 19155startup, calls functions in a list which is delimited by @minus{}1. With the 19156@option{-mpt-fixed} option, the @code{ptabs} is done before testing against @minus{}1. 19157That means that all the constructors run a bit more quickly, but when 19158the loop comes to the end of the list, the program crashes because @code{ptabs} 19159loads @minus{}1 into a target register. 19160 19161Since this option is unsafe for any 19162hardware implementing the current architecture specification, the default 19163is @option{-mno-pt-fixed}. Unless specified explicitly with 19164@option{-mgettrcost}, @option{-mno-pt-fixed} also implies @option{-mgettrcost=100}; 19165this deters register allocation from using target registers for storing 19166ordinary integers. 19167 19168@item -minvalid-symbols 19169@opindex minvalid-symbols 19170Assume symbols might be invalid. Ordinary function symbols generated by 19171the compiler are always valid to load with 19172@code{movi}/@code{shori}/@code{ptabs} or 19173@code{movi}/@code{shori}/@code{ptrel}, 19174but with assembler and/or linker tricks it is possible 19175to generate symbols that cause @code{ptabs} or @code{ptrel} to trap. 19176This option is only meaningful when @option{-mno-pt-fixed} is in effect. 19177It prevents cross-basic-block CSE, hoisting and most scheduling 19178of symbol loads. The default is @option{-mno-invalid-symbols}. 19179 19180@item -mbranch-cost=@var{num} 19181@opindex mbranch-cost=@var{num} 19182Assume @var{num} to be the cost for a branch instruction. Higher numbers 19183make the compiler try to generate more branch-free code if possible. 19184If not specified the value is selected depending on the processor type that 19185is being compiled for. 19186 19187@item -mzdcbranch 19188@itemx -mno-zdcbranch 19189@opindex mzdcbranch 19190@opindex mno-zdcbranch 19191Assume (do not assume) that zero displacement conditional branch instructions 19192@code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the 19193compiler will try to prefer zero displacement branch code sequences. This is 19194enabled by default when generating code for SH4 and SH4A. It can be explicitly 19195disabled by specifying @option{-mno-zdcbranch}. 19196 19197@item -mcbranchdi 19198@opindex mcbranchdi 19199Enable the @code{cbranchdi4} instruction pattern. 19200 19201@item -mcmpeqdi 19202@opindex mcmpeqdi 19203Emit the @code{cmpeqdi_t} instruction pattern even when @option{-mcbranchdi} 19204is in effect. 19205 19206@item -mfused-madd 19207@itemx -mno-fused-madd 19208@opindex mfused-madd 19209@opindex mno-fused-madd 19210Generate code that uses (does not use) the floating-point multiply and 19211accumulate instructions. These instructions are generated by default 19212if hardware floating point is used. The machine-dependent 19213@option{-mfused-madd} option is now mapped to the machine-independent 19214@option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is 19215mapped to @option{-ffp-contract=off}. 19216 19217@item -mfsca 19218@itemx -mno-fsca 19219@opindex mfsca 19220@opindex mno-fsca 19221Allow or disallow the compiler to emit the @code{fsca} instruction for sine 19222and cosine approximations. The option @code{-mfsca} must be used in 19223combination with @code{-funsafe-math-optimizations}. It is enabled by default 19224when generating code for SH4A. Using @code{-mno-fsca} disables sine and cosine 19225approximations even if @code{-funsafe-math-optimizations} is in effect. 19226 19227@item -mfsrra 19228@itemx -mno-fsrra 19229@opindex mfsrra 19230@opindex mno-fsrra 19231Allow or disallow the compiler to emit the @code{fsrra} instruction for 19232reciprocal square root approximations. The option @code{-mfsrra} must be used 19233in combination with @code{-funsafe-math-optimizations} and 19234@code{-ffinite-math-only}. It is enabled by default when generating code for 19235SH4A. Using @code{-mno-fsrra} disables reciprocal square root approximations 19236even if @code{-funsafe-math-optimizations} and @code{-ffinite-math-only} are 19237in effect. 19238 19239@item -mpretend-cmove 19240@opindex mpretend-cmove 19241Prefer zero-displacement conditional branches for conditional move instruction 19242patterns. This can result in faster code on the SH4 processor. 19243 19244@end table 19245 19246@node Solaris 2 Options 19247@subsection Solaris 2 Options 19248@cindex Solaris 2 options 19249 19250These @samp{-m} options are supported on Solaris 2: 19251 19252@table @gcctabopt 19253@item -mimpure-text 19254@opindex mimpure-text 19255@option{-mimpure-text}, used in addition to @option{-shared}, tells 19256the compiler to not pass @option{-z text} to the linker when linking a 19257shared object. Using this option, you can link position-dependent 19258code into a shared object. 19259 19260@option{-mimpure-text} suppresses the ``relocations remain against 19261allocatable but non-writable sections'' linker error message. 19262However, the necessary relocations trigger copy-on-write, and the 19263shared object is not actually shared across processes. Instead of 19264using @option{-mimpure-text}, you should compile all source code with 19265@option{-fpic} or @option{-fPIC}. 19266 19267@end table 19268 19269These switches are supported in addition to the above on Solaris 2: 19270 19271@table @gcctabopt 19272@item -pthreads 19273@opindex pthreads 19274Add support for multithreading using the POSIX threads library. This 19275option sets flags for both the preprocessor and linker. This option does 19276not affect the thread safety of object code produced by the compiler or 19277that of libraries supplied with it. 19278 19279@item -pthread 19280@opindex pthread 19281This is a synonym for @option{-pthreads}. 19282@end table 19283 19284@node SPARC Options 19285@subsection SPARC Options 19286@cindex SPARC options 19287 19288These @samp{-m} options are supported on the SPARC: 19289 19290@table @gcctabopt 19291@item -mno-app-regs 19292@itemx -mapp-regs 19293@opindex mno-app-regs 19294@opindex mapp-regs 19295Specify @option{-mapp-regs} to generate output using the global registers 192962 through 4, which the SPARC SVR4 ABI reserves for applications. Like the 19297global register 1, each global register 2 through 4 is then treated as an 19298allocable register that is clobbered by function calls. This is the default. 19299 19300To be fully SVR4 ABI-compliant at the cost of some performance loss, 19301specify @option{-mno-app-regs}. You should compile libraries and system 19302software with this option. 19303 19304@item -mflat 19305@itemx -mno-flat 19306@opindex mflat 19307@opindex mno-flat 19308With @option{-mflat}, the compiler does not generate save/restore instructions 19309and uses a ``flat'' or single register window model. This model is compatible 19310with the regular register window model. The local registers and the input 19311registers (0--5) are still treated as ``call-saved'' registers and are 19312saved on the stack as needed. 19313 19314With @option{-mno-flat} (the default), the compiler generates save/restore 19315instructions (except for leaf functions). This is the normal operating mode. 19316 19317@item -mfpu 19318@itemx -mhard-float 19319@opindex mfpu 19320@opindex mhard-float 19321Generate output containing floating-point instructions. This is the 19322default. 19323 19324@item -mno-fpu 19325@itemx -msoft-float 19326@opindex mno-fpu 19327@opindex msoft-float 19328Generate output containing library calls for floating point. 19329@strong{Warning:} the requisite libraries are not available for all SPARC 19330targets. Normally the facilities of the machine's usual C compiler are 19331used, but this cannot be done directly in cross-compilation. You must make 19332your own arrangements to provide suitable library functions for 19333cross-compilation. The embedded targets @samp{sparc-*-aout} and 19334@samp{sparclite-*-*} do provide software floating-point support. 19335 19336@option{-msoft-float} changes the calling convention in the output file; 19337therefore, it is only useful if you compile @emph{all} of a program with 19338this option. In particular, you need to compile @file{libgcc.a}, the 19339library that comes with GCC, with @option{-msoft-float} in order for 19340this to work. 19341 19342@item -mhard-quad-float 19343@opindex mhard-quad-float 19344Generate output containing quad-word (long double) floating-point 19345instructions. 19346 19347@item -msoft-quad-float 19348@opindex msoft-quad-float 19349Generate output containing library calls for quad-word (long double) 19350floating-point instructions. The functions called are those specified 19351in the SPARC ABI@. This is the default. 19352 19353As of this writing, there are no SPARC implementations that have hardware 19354support for the quad-word floating-point instructions. They all invoke 19355a trap handler for one of these instructions, and then the trap handler 19356emulates the effect of the instruction. Because of the trap handler overhead, 19357this is much slower than calling the ABI library routines. Thus the 19358@option{-msoft-quad-float} option is the default. 19359 19360@item -mno-unaligned-doubles 19361@itemx -munaligned-doubles 19362@opindex mno-unaligned-doubles 19363@opindex munaligned-doubles 19364Assume that doubles have 8-byte alignment. This is the default. 19365 19366With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte 19367alignment only if they are contained in another type, or if they have an 19368absolute address. Otherwise, it assumes they have 4-byte alignment. 19369Specifying this option avoids some rare compatibility problems with code 19370generated by other compilers. It is not the default because it results 19371in a performance loss, especially for floating-point code. 19372 19373@item -muser-mode 19374@itemx -mno-user-mode 19375@opindex muser-mode 19376@opindex mno-user-mode 19377Do not generate code that can only run in supervisor mode. This is relevant 19378only for the @code{casa} instruction emitted for the LEON3 processor. The 19379default is @option{-mno-user-mode}. 19380 19381@item -mno-faster-structs 19382@itemx -mfaster-structs 19383@opindex mno-faster-structs 19384@opindex mfaster-structs 19385With @option{-mfaster-structs}, the compiler assumes that structures 19386should have 8-byte alignment. This enables the use of pairs of 19387@code{ldd} and @code{std} instructions for copies in structure 19388assignment, in place of twice as many @code{ld} and @code{st} pairs. 19389However, the use of this changed alignment directly violates the SPARC 19390ABI@. Thus, it's intended only for use on targets where the developer 19391acknowledges that their resulting code is not directly in line with 19392the rules of the ABI@. 19393 19394@item -mcpu=@var{cpu_type} 19395@opindex mcpu 19396Set the instruction set, register set, and instruction scheduling parameters 19397for machine type @var{cpu_type}. Supported values for @var{cpu_type} are 19398@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc}, 19399@samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930}, 19400@samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9}, 19401@samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, 19402@samp{niagara3} and @samp{niagara4}. 19403 19404Native Solaris and GNU/Linux toolchains also support the value @samp{native}, 19405which selects the best architecture option for the host processor. 19406@option{-mcpu=native} has no effect if GCC does not recognize 19407the processor. 19408 19409Default instruction scheduling parameters are used for values that select 19410an architecture and not an implementation. These are @samp{v7}, @samp{v8}, 19411@samp{sparclite}, @samp{sparclet}, @samp{v9}. 19412 19413Here is a list of each supported architecture and their supported 19414implementations. 19415 19416@table @asis 19417@item v7 19418cypress, leon3v7 19419 19420@item v8 19421supersparc, hypersparc, leon, leon3 19422 19423@item sparclite 19424f930, f934, sparclite86x 19425 19426@item sparclet 19427tsc701 19428 19429@item v9 19430ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4 19431@end table 19432 19433By default (unless configured otherwise), GCC generates code for the V7 19434variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler 19435additionally optimizes it for the Cypress CY7C602 chip, as used in the 19436SPARCStation/SPARCServer 3xx series. This is also appropriate for the older 19437SPARCStation 1, 2, IPX etc. 19438 19439With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC 19440architecture. The only difference from V7 code is that the compiler emits 19441the integer multiply and integer divide instructions which exist in SPARC-V8 19442but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally 19443optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and 194442000 series. 19445 19446With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of 19447the SPARC architecture. This adds the integer multiply, integer divide step 19448and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7. 19449With @option{-mcpu=f930}, the compiler additionally optimizes it for the 19450Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With 19451@option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu 19452MB86934 chip, which is the more recent SPARClite with FPU@. 19453 19454With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of 19455the SPARC architecture. This adds the integer multiply, multiply/accumulate, 19456integer divide step and scan (@code{ffs}) instructions which exist in SPARClet 19457but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally 19458optimizes it for the TEMIC SPARClet chip. 19459 19460With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC 19461architecture. This adds 64-bit integer and floating-point move instructions, 194623 additional floating-point condition code registers and conditional move 19463instructions. With @option{-mcpu=ultrasparc}, the compiler additionally 19464optimizes it for the Sun UltraSPARC I/II/IIi chips. With 19465@option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the 19466Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With 19467@option{-mcpu=niagara}, the compiler additionally optimizes it for 19468Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler 19469additionally optimizes it for Sun UltraSPARC T2 chips. With 19470@option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun 19471UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler 19472additionally optimizes it for Sun UltraSPARC T4 chips. 19473 19474@item -mtune=@var{cpu_type} 19475@opindex mtune 19476Set the instruction scheduling parameters for machine type 19477@var{cpu_type}, but do not set the instruction set or register set that the 19478option @option{-mcpu=@var{cpu_type}} does. 19479 19480The same values for @option{-mcpu=@var{cpu_type}} can be used for 19481@option{-mtune=@var{cpu_type}}, but the only useful values are those 19482that select a particular CPU implementation. Those are @samp{cypress}, 19483@samp{supersparc}, @samp{hypersparc}, @samp{leon}, @samp{leon3}, 19484@samp{leon3v7}, @samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{tsc701}, 19485@samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, 19486@samp{niagara3} and @samp{niagara4}. With native Solaris and GNU/Linux 19487toolchains, @samp{native} can also be used. 19488 19489@item -mv8plus 19490@itemx -mno-v8plus 19491@opindex mv8plus 19492@opindex mno-v8plus 19493With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The 19494difference from the V8 ABI is that the global and out registers are 19495considered 64 bits wide. This is enabled by default on Solaris in 32-bit 19496mode for all SPARC-V9 processors. 19497 19498@item -mvis 19499@itemx -mno-vis 19500@opindex mvis 19501@opindex mno-vis 19502With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC 19503Visual Instruction Set extensions. The default is @option{-mno-vis}. 19504 19505@item -mvis2 19506@itemx -mno-vis2 19507@opindex mvis2 19508@opindex mno-vis2 19509With @option{-mvis2}, GCC generates code that takes advantage of 19510version 2.0 of the UltraSPARC Visual Instruction Set extensions. The 19511default is @option{-mvis2} when targeting a cpu that supports such 19512instructions, such as UltraSPARC-III and later. Setting @option{-mvis2} 19513also sets @option{-mvis}. 19514 19515@item -mvis3 19516@itemx -mno-vis3 19517@opindex mvis3 19518@opindex mno-vis3 19519With @option{-mvis3}, GCC generates code that takes advantage of 19520version 3.0 of the UltraSPARC Visual Instruction Set extensions. The 19521default is @option{-mvis3} when targeting a cpu that supports such 19522instructions, such as niagara-3 and later. Setting @option{-mvis3} 19523also sets @option{-mvis2} and @option{-mvis}. 19524 19525@item -mcbcond 19526@itemx -mno-cbcond 19527@opindex mcbcond 19528@opindex mno-cbcond 19529With @option{-mcbcond}, GCC generates code that takes advantage of 19530compare-and-branch instructions, as defined in the Sparc Architecture 2011. 19531The default is @option{-mcbcond} when targeting a cpu that supports such 19532instructions, such as niagara-4 and later. 19533 19534@item -mpopc 19535@itemx -mno-popc 19536@opindex mpopc 19537@opindex mno-popc 19538With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC 19539population count instruction. The default is @option{-mpopc} 19540when targeting a cpu that supports such instructions, such as Niagara-2 and 19541later. 19542 19543@item -mfmaf 19544@itemx -mno-fmaf 19545@opindex mfmaf 19546@opindex mno-fmaf 19547With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC 19548Fused Multiply-Add Floating-point extensions. The default is @option{-mfmaf} 19549when targeting a cpu that supports such instructions, such as Niagara-3 and 19550later. 19551 19552@item -mfix-at697f 19553@opindex mfix-at697f 19554Enable the documented workaround for the single erratum of the Atmel AT697F 19555processor (which corresponds to erratum #13 of the AT697E processor). 19556 19557@item -mfix-ut699 19558@opindex mfix-ut699 19559Enable the documented workarounds for the floating-point errata and the data 19560cache nullify errata of the UT699 processor. 19561@end table 19562 19563These @samp{-m} options are supported in addition to the above 19564on SPARC-V9 processors in 64-bit environments: 19565 19566@table @gcctabopt 19567@item -m32 19568@itemx -m64 19569@opindex m32 19570@opindex m64 19571Generate code for a 32-bit or 64-bit environment. 19572The 32-bit environment sets int, long and pointer to 32 bits. 19573The 64-bit environment sets int to 32 bits and long and pointer 19574to 64 bits. 19575 19576@item -mcmodel=@var{which} 19577@opindex mcmodel 19578Set the code model to one of 19579 19580@table @samp 19581@item medlow 19582The Medium/Low code model: 64-bit addresses, programs 19583must be linked in the low 32 bits of memory. Programs can be statically 19584or dynamically linked. 19585 19586@item medmid 19587The Medium/Middle code model: 64-bit addresses, programs 19588must be linked in the low 44 bits of memory, the text and data segments must 19589be less than 2GB in size and the data segment must be located within 2GB of 19590the text segment. 19591 19592@item medany 19593The Medium/Anywhere code model: 64-bit addresses, programs 19594may be linked anywhere in memory, the text and data segments must be less 19595than 2GB in size and the data segment must be located within 2GB of the 19596text segment. 19597 19598@item embmedany 19599The Medium/Anywhere code model for embedded systems: 1960064-bit addresses, the text and data segments must be less than 2GB in 19601size, both starting anywhere in memory (determined at link time). The 19602global register %g4 points to the base of the data segment. Programs 19603are statically linked and PIC is not supported. 19604@end table 19605 19606@item -mmemory-model=@var{mem-model} 19607@opindex mmemory-model 19608Set the memory model in force on the processor to one of 19609 19610@table @samp 19611@item default 19612The default memory model for the processor and operating system. 19613 19614@item rmo 19615Relaxed Memory Order 19616 19617@item pso 19618Partial Store Order 19619 19620@item tso 19621Total Store Order 19622 19623@item sc 19624Sequential Consistency 19625@end table 19626 19627These memory models are formally defined in Appendix D of the Sparc V9 19628architecture manual, as set in the processor's @code{PSTATE.MM} field. 19629 19630@item -mstack-bias 19631@itemx -mno-stack-bias 19632@opindex mstack-bias 19633@opindex mno-stack-bias 19634With @option{-mstack-bias}, GCC assumes that the stack pointer, and 19635frame pointer if present, are offset by @minus{}2047 which must be added back 19636when making stack frame references. This is the default in 64-bit mode. 19637Otherwise, assume no such offset is present. 19638@end table 19639 19640@node SPU Options 19641@subsection SPU Options 19642@cindex SPU options 19643 19644These @samp{-m} options are supported on the SPU: 19645 19646@table @gcctabopt 19647@item -mwarn-reloc 19648@itemx -merror-reloc 19649@opindex mwarn-reloc 19650@opindex merror-reloc 19651 19652The loader for SPU does not handle dynamic relocations. By default, GCC 19653gives an error when it generates code that requires a dynamic 19654relocation. @option{-mno-error-reloc} disables the error, 19655@option{-mwarn-reloc} generates a warning instead. 19656 19657@item -msafe-dma 19658@itemx -munsafe-dma 19659@opindex msafe-dma 19660@opindex munsafe-dma 19661 19662Instructions that initiate or test completion of DMA must not be 19663reordered with respect to loads and stores of the memory that is being 19664accessed. 19665With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect 19666memory accesses, but that can lead to inefficient code in places where the 19667memory is known to not change. Rather than mark the memory as volatile, 19668you can use @option{-msafe-dma} to tell the compiler to treat 19669the DMA instructions as potentially affecting all memory. 19670 19671@item -mbranch-hints 19672@opindex mbranch-hints 19673 19674By default, GCC generates a branch hint instruction to avoid 19675pipeline stalls for always-taken or probably-taken branches. A hint 19676is not generated closer than 8 instructions away from its branch. 19677There is little reason to disable them, except for debugging purposes, 19678or to make an object a little bit smaller. 19679 19680@item -msmall-mem 19681@itemx -mlarge-mem 19682@opindex msmall-mem 19683@opindex mlarge-mem 19684 19685By default, GCC generates code assuming that addresses are never larger 19686than 18 bits. With @option{-mlarge-mem} code is generated that assumes 19687a full 32-bit address. 19688 19689@item -mstdmain 19690@opindex mstdmain 19691 19692By default, GCC links against startup code that assumes the SPU-style 19693main function interface (which has an unconventional parameter list). 19694With @option{-mstdmain}, GCC links your program against startup 19695code that assumes a C99-style interface to @code{main}, including a 19696local copy of @code{argv} strings. 19697 19698@item -mfixed-range=@var{register-range} 19699@opindex mfixed-range 19700Generate code treating the given register range as fixed registers. 19701A fixed register is one that the register allocator cannot use. This is 19702useful when compiling kernel code. A register range is specified as 19703two registers separated by a dash. Multiple register ranges can be 19704specified separated by a comma. 19705 19706@item -mea32 19707@itemx -mea64 19708@opindex mea32 19709@opindex mea64 19710Compile code assuming that pointers to the PPU address space accessed 19711via the @code{__ea} named address space qualifier are either 32 or 64 19712bits wide. The default is 32 bits. As this is an ABI-changing option, 19713all object code in an executable must be compiled with the same setting. 19714 19715@item -maddress-space-conversion 19716@itemx -mno-address-space-conversion 19717@opindex maddress-space-conversion 19718@opindex mno-address-space-conversion 19719Allow/disallow treating the @code{__ea} address space as superset 19720of the generic address space. This enables explicit type casts 19721between @code{__ea} and generic pointer as well as implicit 19722conversions of generic pointers to @code{__ea} pointers. The 19723default is to allow address space pointer conversions. 19724 19725@item -mcache-size=@var{cache-size} 19726@opindex mcache-size 19727This option controls the version of libgcc that the compiler links to an 19728executable and selects a software-managed cache for accessing variables 19729in the @code{__ea} address space with a particular cache size. Possible 19730options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64} 19731and @samp{128}. The default cache size is 64KB. 19732 19733@item -matomic-updates 19734@itemx -mno-atomic-updates 19735@opindex matomic-updates 19736@opindex mno-atomic-updates 19737This option controls the version of libgcc that the compiler links to an 19738executable and selects whether atomic updates to the software-managed 19739cache of PPU-side variables are used. If you use atomic updates, changes 19740to a PPU variable from SPU code using the @code{__ea} named address space 19741qualifier do not interfere with changes to other PPU variables residing 19742in the same cache line from PPU code. If you do not use atomic updates, 19743such interference may occur; however, writing back cache lines is 19744more efficient. The default behavior is to use atomic updates. 19745 19746@item -mdual-nops 19747@itemx -mdual-nops=@var{n} 19748@opindex mdual-nops 19749By default, GCC inserts nops to increase dual issue when it expects 19750it to increase performance. @var{n} can be a value from 0 to 10. A 19751smaller @var{n} inserts fewer nops. 10 is the default, 0 is the 19752same as @option{-mno-dual-nops}. Disabled with @option{-Os}. 19753 19754@item -mhint-max-nops=@var{n} 19755@opindex mhint-max-nops 19756Maximum number of nops to insert for a branch hint. A branch hint must 19757be at least 8 instructions away from the branch it is affecting. GCC 19758inserts up to @var{n} nops to enforce this, otherwise it does not 19759generate the branch hint. 19760 19761@item -mhint-max-distance=@var{n} 19762@opindex mhint-max-distance 19763The encoding of the branch hint instruction limits the hint to be within 19764256 instructions of the branch it is affecting. By default, GCC makes 19765sure it is within 125. 19766 19767@item -msafe-hints 19768@opindex msafe-hints 19769Work around a hardware bug that causes the SPU to stall indefinitely. 19770By default, GCC inserts the @code{hbrp} instruction to make sure 19771this stall won't happen. 19772 19773@end table 19774 19775@node System V Options 19776@subsection Options for System V 19777 19778These additional options are available on System V Release 4 for 19779compatibility with other compilers on those systems: 19780 19781@table @gcctabopt 19782@item -G 19783@opindex G 19784Create a shared object. 19785It is recommended that @option{-symbolic} or @option{-shared} be used instead. 19786 19787@item -Qy 19788@opindex Qy 19789Identify the versions of each tool used by the compiler, in a 19790@code{.ident} assembler directive in the output. 19791 19792@item -Qn 19793@opindex Qn 19794Refrain from adding @code{.ident} directives to the output file (this is 19795the default). 19796 19797@item -YP,@var{dirs} 19798@opindex YP 19799Search the directories @var{dirs}, and no others, for libraries 19800specified with @option{-l}. 19801 19802@item -Ym,@var{dir} 19803@opindex Ym 19804Look in the directory @var{dir} to find the M4 preprocessor. 19805The assembler uses this option. 19806@c This is supposed to go with a -Yd for predefined M4 macro files, but 19807@c the generic assembler that comes with Solaris takes just -Ym. 19808@end table 19809 19810@node TILE-Gx Options 19811@subsection TILE-Gx Options 19812@cindex TILE-Gx options 19813 19814These @samp{-m} options are supported on the TILE-Gx: 19815 19816@table @gcctabopt 19817@item -mcmodel=small 19818@opindex mcmodel=small 19819Generate code for the small model. The distance for direct calls is 19820limited to 500M in either direction. PC-relative addresses are 32 19821bits. Absolute addresses support the full address range. 19822 19823@item -mcmodel=large 19824@opindex mcmodel=large 19825Generate code for the large model. There is no limitation on call 19826distance, pc-relative addresses, or absolute addresses. 19827 19828@item -mcpu=@var{name} 19829@opindex mcpu 19830Selects the type of CPU to be targeted. Currently the only supported 19831type is @samp{tilegx}. 19832 19833@item -m32 19834@itemx -m64 19835@opindex m32 19836@opindex m64 19837Generate code for a 32-bit or 64-bit environment. The 32-bit 19838environment sets int, long, and pointer to 32 bits. The 64-bit 19839environment sets int to 32 bits and long and pointer to 64 bits. 19840@end table 19841 19842@node TILEPro Options 19843@subsection TILEPro Options 19844@cindex TILEPro options 19845 19846These @samp{-m} options are supported on the TILEPro: 19847 19848@table @gcctabopt 19849@item -mcpu=@var{name} 19850@opindex mcpu 19851Selects the type of CPU to be targeted. Currently the only supported 19852type is @samp{tilepro}. 19853 19854@item -m32 19855@opindex m32 19856Generate code for a 32-bit environment, which sets int, long, and 19857pointer to 32 bits. This is the only supported behavior so the flag 19858is essentially ignored. 19859@end table 19860 19861@node V850 Options 19862@subsection V850 Options 19863@cindex V850 Options 19864 19865These @samp{-m} options are defined for V850 implementations: 19866 19867@table @gcctabopt 19868@item -mlong-calls 19869@itemx -mno-long-calls 19870@opindex mlong-calls 19871@opindex mno-long-calls 19872Treat all calls as being far away (near). If calls are assumed to be 19873far away, the compiler always loads the function's address into a 19874register, and calls indirect through the pointer. 19875 19876@item -mno-ep 19877@itemx -mep 19878@opindex mno-ep 19879@opindex mep 19880Do not optimize (do optimize) basic blocks that use the same index 19881pointer 4 or more times to copy pointer into the @code{ep} register, and 19882use the shorter @code{sld} and @code{sst} instructions. The @option{-mep} 19883option is on by default if you optimize. 19884 19885@item -mno-prolog-function 19886@itemx -mprolog-function 19887@opindex mno-prolog-function 19888@opindex mprolog-function 19889Do not use (do use) external functions to save and restore registers 19890at the prologue and epilogue of a function. The external functions 19891are slower, but use less code space if more than one function saves 19892the same number of registers. The @option{-mprolog-function} option 19893is on by default if you optimize. 19894 19895@item -mspace 19896@opindex mspace 19897Try to make the code as small as possible. At present, this just turns 19898on the @option{-mep} and @option{-mprolog-function} options. 19899 19900@item -mtda=@var{n} 19901@opindex mtda 19902Put static or global variables whose size is @var{n} bytes or less into 19903the tiny data area that register @code{ep} points to. The tiny data 19904area can hold up to 256 bytes in total (128 bytes for byte references). 19905 19906@item -msda=@var{n} 19907@opindex msda 19908Put static or global variables whose size is @var{n} bytes or less into 19909the small data area that register @code{gp} points to. The small data 19910area can hold up to 64 kilobytes. 19911 19912@item -mzda=@var{n} 19913@opindex mzda 19914Put static or global variables whose size is @var{n} bytes or less into 19915the first 32 kilobytes of memory. 19916 19917@item -mv850 19918@opindex mv850 19919Specify that the target processor is the V850. 19920 19921@item -mv850e3v5 19922@opindex mv850e3v5 19923Specify that the target processor is the V850E3V5. The preprocessor 19924constant @samp{__v850e3v5__} is defined if this option is used. 19925 19926@item -mv850e2v4 19927@opindex mv850e2v4 19928Specify that the target processor is the V850E3V5. This is an alias for 19929the @option{-mv850e3v5} option. 19930 19931@item -mv850e2v3 19932@opindex mv850e2v3 19933Specify that the target processor is the V850E2V3. The preprocessor 19934constant @samp{__v850e2v3__} is defined if this option is used. 19935 19936@item -mv850e2 19937@opindex mv850e2 19938Specify that the target processor is the V850E2. The preprocessor 19939constant @samp{__v850e2__} is defined if this option is used. 19940 19941@item -mv850e1 19942@opindex mv850e1 19943Specify that the target processor is the V850E1. The preprocessor 19944constants @samp{__v850e1__} and @samp{__v850e__} are defined if 19945this option is used. 19946 19947@item -mv850es 19948@opindex mv850es 19949Specify that the target processor is the V850ES. This is an alias for 19950the @option{-mv850e1} option. 19951 19952@item -mv850e 19953@opindex mv850e 19954Specify that the target processor is the V850E@. The preprocessor 19955constant @samp{__v850e__} is defined if this option is used. 19956 19957If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1} 19958nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5} 19959are defined then a default target processor is chosen and the 19960relevant @samp{__v850*__} preprocessor constant is defined. 19961 19962The preprocessor constants @samp{__v850} and @samp{__v851__} are always 19963defined, regardless of which processor variant is the target. 19964 19965@item -mdisable-callt 19966@itemx -mno-disable-callt 19967@opindex mdisable-callt 19968@opindex mno-disable-callt 19969This option suppresses generation of the @code{CALLT} instruction for the 19970v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850 19971architecture. 19972 19973This option is enabled by default when the RH850 ABI is 19974in use (see @option{-mrh850-abi}), and disabled by default when the 19975GCC ABI is in use. If @code{CALLT} instructions are being generated 19976then the C preprocessor symbol @code{__V850_CALLT__} will be defined. 19977 19978@item -mrelax 19979@itemx -mno-relax 19980@opindex mrelax 19981@opindex mno-relax 19982Pass on (or do not pass on) the @option{-mrelax} command line option 19983to the assembler. 19984 19985@item -mlong-jumps 19986@itemx -mno-long-jumps 19987@opindex mlong-jumps 19988@opindex mno-long-jumps 19989Disable (or re-enable) the generation of PC-relative jump instructions. 19990 19991@item -msoft-float 19992@itemx -mhard-float 19993@opindex msoft-float 19994@opindex mhard-float 19995Disable (or re-enable) the generation of hardware floating point 19996instructions. This option is only significant when the target 19997architecture is @samp{V850E2V3} or higher. If hardware floating point 19998instructions are being generated then the C preprocessor symbol 19999@code{__FPU_OK__} will be defined, otherwise the symbol 20000@code{__NO_FPU__} will be defined. 20001 20002@item -mloop 20003@opindex mloop 20004Enables the use of the e3v5 LOOP instruction. The use of this 20005instruction is not enabled by default when the e3v5 architecture is 20006selected because its use is still experimental. 20007 20008@item -mrh850-abi 20009@itemx -mghs 20010@opindex mrh850-abi 20011@opindex mghs 20012Enables support for the RH850 version of the V850 ABI. This is the 20013default. With this version of the ABI the following rules apply: 20014 20015@itemize 20016@item 20017Integer sized structures and unions are returned via a memory pointer 20018rather than a register. 20019 20020@item 20021Large structures and unions (more than 8 bytes in size) are passed by 20022value. 20023 20024@item 20025Functions are aligned to 16-bit boundaries. 20026 20027@item 20028The @option{-m8byte-align} command line option is supported. 20029 20030@item 20031The @option{-mdisable-callt} command line option is enabled by 20032default. The @option{-mno-disable-callt} command line option is not 20033supported. 20034@end itemize 20035 20036When this version of the ABI is enabled the C preprocessor symbol 20037@code{__V850_RH850_ABI__} is defined. 20038 20039@item -mgcc-abi 20040@opindex mgcc-abi 20041Enables support for the old GCC version of the V850 ABI. With this 20042version of the ABI the following rules apply: 20043 20044@itemize 20045@item 20046Integer sized structures and unions are returned in register @code{r10}. 20047 20048@item 20049Large structures and unions (more than 8 bytes in size) are passed by 20050reference. 20051 20052@item 20053Functions are aligned to 32-bit boundaries, unless optimizing for 20054size. 20055 20056@item 20057The @option{-m8byte-align} command line option is not supported. 20058 20059@item 20060The @option{-mdisable-callt} command line option is supported but not 20061enabled by default. 20062@end itemize 20063 20064When this version of the ABI is enabled the C preprocessor symbol 20065@code{__V850_GCC_ABI__} is defined. 20066 20067@item -m8byte-align 20068@itemx -mno-8byte-align 20069@opindex m8byte-align 20070@opindex mno-8byte-align 20071Enables support for @code{doubles} and @code{long long} types to be 20072aligned on 8-byte boundaries. The default is to restrict the 20073alignment of all objects to at most 4-bytes. When 20074@option{-m8byte-align} is in effect the C preprocessor symbol 20075@code{__V850_8BYTE_ALIGN__} will be defined. 20076 20077@item -mbig-switch 20078@opindex mbig-switch 20079Generate code suitable for big switch tables. Use this option only if 20080the assembler/linker complain about out of range branches within a switch 20081table. 20082 20083@item -mapp-regs 20084@opindex mapp-regs 20085This option causes r2 and r5 to be used in the code generated by 20086the compiler. This setting is the default. 20087 20088@item -mno-app-regs 20089@opindex mno-app-regs 20090This option causes r2 and r5 to be treated as fixed registers. 20091 20092@end table 20093 20094@node VAX Options 20095@subsection VAX Options 20096@cindex VAX options 20097 20098These @samp{-m} options are defined for the VAX: 20099 20100@table @gcctabopt 20101@item -munix 20102@opindex munix 20103Do not output certain jump instructions (@code{aobleq} and so on) 20104that the Unix assembler for the VAX cannot handle across long 20105ranges. 20106 20107@item -mgnu 20108@opindex mgnu 20109Do output those jump instructions, on the assumption that the 20110GNU assembler is being used. 20111 20112@item -mg 20113@opindex mg 20114Output code for G-format floating-point numbers instead of D-format. 20115@end table 20116 20117@node VMS Options 20118@subsection VMS Options 20119 20120These @samp{-m} options are defined for the VMS implementations: 20121 20122@table @gcctabopt 20123@item -mvms-return-codes 20124@opindex mvms-return-codes 20125Return VMS condition codes from @code{main}. The default is to return POSIX-style 20126condition (e.g.@ error) codes. 20127 20128@item -mdebug-main=@var{prefix} 20129@opindex mdebug-main=@var{prefix} 20130Flag the first routine whose name starts with @var{prefix} as the main 20131routine for the debugger. 20132 20133@item -mmalloc64 20134@opindex mmalloc64 20135Default to 64-bit memory allocation routines. 20136 20137@item -mpointer-size=@var{size} 20138@opindex -mpointer-size=@var{size} 20139Set the default size of pointers. Possible options for @var{size} are 20140@samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long} 20141for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers. 20142The later option disables @code{pragma pointer_size}. 20143@end table 20144 20145@node VxWorks Options 20146@subsection VxWorks Options 20147@cindex VxWorks Options 20148 20149The options in this section are defined for all VxWorks targets. 20150Options specific to the target hardware are listed with the other 20151options for that target. 20152 20153@table @gcctabopt 20154@item -mrtp 20155@opindex mrtp 20156GCC can generate code for both VxWorks kernels and real time processes 20157(RTPs). This option switches from the former to the latter. It also 20158defines the preprocessor macro @code{__RTP__}. 20159 20160@item -non-static 20161@opindex non-static 20162Link an RTP executable against shared libraries rather than static 20163libraries. The options @option{-static} and @option{-shared} can 20164also be used for RTPs (@pxref{Link Options}); @option{-static} 20165is the default. 20166 20167@item -Bstatic 20168@itemx -Bdynamic 20169@opindex Bstatic 20170@opindex Bdynamic 20171These options are passed down to the linker. They are defined for 20172compatibility with Diab. 20173 20174@item -Xbind-lazy 20175@opindex Xbind-lazy 20176Enable lazy binding of function calls. This option is equivalent to 20177@option{-Wl,-z,now} and is defined for compatibility with Diab. 20178 20179@item -Xbind-now 20180@opindex Xbind-now 20181Disable lazy binding of function calls. This option is the default and 20182is defined for compatibility with Diab. 20183@end table 20184 20185@node x86-64 Options 20186@subsection x86-64 Options 20187@cindex x86-64 options 20188 20189These are listed under @xref{i386 and x86-64 Options}. 20190 20191@node Xstormy16 Options 20192@subsection Xstormy16 Options 20193@cindex Xstormy16 Options 20194 20195These options are defined for Xstormy16: 20196 20197@table @gcctabopt 20198@item -msim 20199@opindex msim 20200Choose startup files and linker script suitable for the simulator. 20201@end table 20202 20203@node Xtensa Options 20204@subsection Xtensa Options 20205@cindex Xtensa Options 20206 20207These options are supported for Xtensa targets: 20208 20209@table @gcctabopt 20210@item -mconst16 20211@itemx -mno-const16 20212@opindex mconst16 20213@opindex mno-const16 20214Enable or disable use of @code{CONST16} instructions for loading 20215constant values. The @code{CONST16} instruction is currently not a 20216standard option from Tensilica. When enabled, @code{CONST16} 20217instructions are always used in place of the standard @code{L32R} 20218instructions. The use of @code{CONST16} is enabled by default only if 20219the @code{L32R} instruction is not available. 20220 20221@item -mfused-madd 20222@itemx -mno-fused-madd 20223@opindex mfused-madd 20224@opindex mno-fused-madd 20225Enable or disable use of fused multiply/add and multiply/subtract 20226instructions in the floating-point option. This has no effect if the 20227floating-point option is not also enabled. Disabling fused multiply/add 20228and multiply/subtract instructions forces the compiler to use separate 20229instructions for the multiply and add/subtract operations. This may be 20230desirable in some cases where strict IEEE 754-compliant results are 20231required: the fused multiply add/subtract instructions do not round the 20232intermediate result, thereby producing results with @emph{more} bits of 20233precision than specified by the IEEE standard. Disabling fused multiply 20234add/subtract instructions also ensures that the program output is not 20235sensitive to the compiler's ability to combine multiply and add/subtract 20236operations. 20237 20238@item -mserialize-volatile 20239@itemx -mno-serialize-volatile 20240@opindex mserialize-volatile 20241@opindex mno-serialize-volatile 20242When this option is enabled, GCC inserts @code{MEMW} instructions before 20243@code{volatile} memory references to guarantee sequential consistency. 20244The default is @option{-mserialize-volatile}. Use 20245@option{-mno-serialize-volatile} to omit the @code{MEMW} instructions. 20246 20247@item -mforce-no-pic 20248@opindex mforce-no-pic 20249For targets, like GNU/Linux, where all user-mode Xtensa code must be 20250position-independent code (PIC), this option disables PIC for compiling 20251kernel code. 20252 20253@item -mtext-section-literals 20254@itemx -mno-text-section-literals 20255@opindex mtext-section-literals 20256@opindex mno-text-section-literals 20257Control the treatment of literal pools. The default is 20258@option{-mno-text-section-literals}, which places literals in a separate 20259section in the output file. This allows the literal pool to be placed 20260in a data RAM/ROM, and it also allows the linker to combine literal 20261pools from separate object files to remove redundant literals and 20262improve code size. With @option{-mtext-section-literals}, the literals 20263are interspersed in the text section in order to keep them as close as 20264possible to their references. This may be necessary for large assembly 20265files. 20266 20267@item -mtarget-align 20268@itemx -mno-target-align 20269@opindex mtarget-align 20270@opindex mno-target-align 20271When this option is enabled, GCC instructs the assembler to 20272automatically align instructions to reduce branch penalties at the 20273expense of some code density. The assembler attempts to widen density 20274instructions to align branch targets and the instructions following call 20275instructions. If there are not enough preceding safe density 20276instructions to align a target, no widening is performed. The 20277default is @option{-mtarget-align}. These options do not affect the 20278treatment of auto-aligned instructions like @code{LOOP}, which the 20279assembler always aligns, either by widening density instructions or 20280by inserting NOP instructions. 20281 20282@item -mlongcalls 20283@itemx -mno-longcalls 20284@opindex mlongcalls 20285@opindex mno-longcalls 20286When this option is enabled, GCC instructs the assembler to translate 20287direct calls to indirect calls unless it can determine that the target 20288of a direct call is in the range allowed by the call instruction. This 20289translation typically occurs for calls to functions in other source 20290files. Specifically, the assembler translates a direct @code{CALL} 20291instruction into an @code{L32R} followed by a @code{CALLX} instruction. 20292The default is @option{-mno-longcalls}. This option should be used in 20293programs where the call target can potentially be out of range. This 20294option is implemented in the assembler, not the compiler, so the 20295assembly code generated by GCC still shows direct call 20296instructions---look at the disassembled object code to see the actual 20297instructions. Note that the assembler uses an indirect call for 20298every cross-file call, not just those that really are out of range. 20299@end table 20300 20301@node zSeries Options 20302@subsection zSeries Options 20303@cindex zSeries options 20304 20305These are listed under @xref{S/390 and zSeries Options}. 20306 20307@node Code Gen Options 20308@section Options for Code Generation Conventions 20309@cindex code generation conventions 20310@cindex options, code generation 20311@cindex run-time options 20312 20313These machine-independent options control the interface conventions 20314used in code generation. 20315 20316Most of them have both positive and negative forms; the negative form 20317of @option{-ffoo} is @option{-fno-foo}. In the table below, only 20318one of the forms is listed---the one that is not the default. You 20319can figure out the other form by either removing @samp{no-} or adding 20320it. 20321 20322@table @gcctabopt 20323@item -fbounds-check 20324@opindex fbounds-check 20325For front ends that support it, generate additional code to check that 20326indices used to access arrays are within the declared range. This is 20327currently only supported by the Java and Fortran front ends, where 20328this option defaults to true and false respectively. 20329 20330@item -fstack-reuse=@var{reuse-level} 20331@opindex fstack_reuse 20332This option controls stack space reuse for user declared local/auto variables 20333and compiler generated temporaries. @var{reuse_level} can be @samp{all}, 20334@samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all 20335local variables and temporaries, @samp{named_vars} enables the reuse only for 20336user defined local variables with names, and @samp{none} disables stack reuse 20337completely. The default value is @samp{all}. The option is needed when the 20338program extends the lifetime of a scoped local variable or a compiler generated 20339temporary beyond the end point defined by the language. When a lifetime of 20340a variable ends, and if the variable lives in memory, the optimizing compiler 20341has the freedom to reuse its stack space with other temporaries or scoped 20342local variables whose live range does not overlap with it. Legacy code extending 20343local lifetime will likely to break with the stack reuse optimization. 20344 20345For example, 20346 20347@smallexample 20348 int *p; 20349 @{ 20350 int local1; 20351 20352 p = &local1; 20353 local1 = 10; 20354 .... 20355 @} 20356 @{ 20357 int local2; 20358 local2 = 20; 20359 ... 20360 @} 20361 20362 if (*p == 10) // out of scope use of local1 20363 @{ 20364 20365 @} 20366@end smallexample 20367 20368Another example: 20369@smallexample 20370 20371 struct A 20372 @{ 20373 A(int k) : i(k), j(k) @{ @} 20374 int i; 20375 int j; 20376 @}; 20377 20378 A *ap; 20379 20380 void foo(const A& ar) 20381 @{ 20382 ap = &ar; 20383 @} 20384 20385 void bar() 20386 @{ 20387 foo(A(10)); // temp object's lifetime ends when foo returns 20388 20389 @{ 20390 A a(20); 20391 .... 20392 @} 20393 ap->i+= 10; // ap references out of scope temp whose space 20394 // is reused with a. What is the value of ap->i? 20395 @} 20396 20397@end smallexample 20398 20399The lifetime of a compiler generated temporary is well defined by the C++ 20400standard. When a lifetime of a temporary ends, and if the temporary lives 20401in memory, the optimizing compiler has the freedom to reuse its stack 20402space with other temporaries or scoped local variables whose live range 20403does not overlap with it. However some of the legacy code relies on 20404the behavior of older compilers in which temporaries' stack space is 20405not reused, the aggressive stack reuse can lead to runtime errors. This 20406option is used to control the temporary stack reuse optimization. 20407 20408@item -ftrapv 20409@opindex ftrapv 20410This option generates traps for signed overflow on addition, subtraction, 20411multiplication operations. 20412 20413@item -fwrapv 20414@opindex fwrapv 20415This option instructs the compiler to assume that signed arithmetic 20416overflow of addition, subtraction and multiplication wraps around 20417using twos-complement representation. This flag enables some optimizations 20418and disables others. This option is enabled by default for the Java 20419front end, as required by the Java language specification. 20420 20421@item -fexceptions 20422@opindex fexceptions 20423Enable exception handling. Generates extra code needed to propagate 20424exceptions. For some targets, this implies GCC generates frame 20425unwind information for all functions, which can produce significant data 20426size overhead, although it does not affect execution. If you do not 20427specify this option, GCC enables it by default for languages like 20428C++ that normally require exception handling, and disables it for 20429languages like C that do not normally require it. However, you may need 20430to enable this option when compiling C code that needs to interoperate 20431properly with exception handlers written in C++. You may also wish to 20432disable this option if you are compiling older C++ programs that don't 20433use exception handling. 20434 20435@item -fnon-call-exceptions 20436@opindex fnon-call-exceptions 20437Generate code that allows trapping instructions to throw exceptions. 20438Note that this requires platform-specific runtime support that does 20439not exist everywhere. Moreover, it only allows @emph{trapping} 20440instructions to throw exceptions, i.e.@: memory references or floating-point 20441instructions. It does not allow exceptions to be thrown from 20442arbitrary signal handlers such as @code{SIGALRM}. 20443 20444@item -fdelete-dead-exceptions 20445@opindex fdelete-dead-exceptions 20446Consider that instructions that may throw exceptions but don't otherwise 20447contribute to the execution of the program can be optimized away. 20448This option is enabled by default for the Ada front end, as permitted by 20449the Ada language specification. 20450Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels. 20451 20452@item -funwind-tables 20453@opindex funwind-tables 20454Similar to @option{-fexceptions}, except that it just generates any needed 20455static data, but does not affect the generated code in any other way. 20456You normally do not need to enable this option; instead, a language processor 20457that needs this handling enables it on your behalf. 20458 20459@item -fasynchronous-unwind-tables 20460@opindex fasynchronous-unwind-tables 20461Generate unwind table in DWARF 2 format, if supported by target machine. The 20462table is exact at each instruction boundary, so it can be used for stack 20463unwinding from asynchronous events (such as debugger or garbage collector). 20464 20465@item -fno-gnu-unique 20466@opindex fno-gnu-unique 20467On systems with recent GNU assembler and C library, the C++ compiler 20468uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions 20469of template static data members and static local variables in inline 20470functions are unique even in the presence of @code{RTLD_LOCAL}; this 20471is necessary to avoid problems with a library used by two different 20472@code{RTLD_LOCAL} plugins depending on a definition in one of them and 20473therefore disagreeing with the other one about the binding of the 20474symbol. But this causes @code{dlclose} to be ignored for affected 20475DSOs; if your program relies on reinitialization of a DSO via 20476@code{dlclose} and @code{dlopen}, you can use 20477@option{-fno-gnu-unique}. 20478 20479@item -fpcc-struct-return 20480@opindex fpcc-struct-return 20481Return ``short'' @code{struct} and @code{union} values in memory like 20482longer ones, rather than in registers. This convention is less 20483efficient, but it has the advantage of allowing intercallability between 20484GCC-compiled files and files compiled with other compilers, particularly 20485the Portable C Compiler (pcc). 20486 20487The precise convention for returning structures in memory depends 20488on the target configuration macros. 20489 20490Short structures and unions are those whose size and alignment match 20491that of some integer type. 20492 20493@strong{Warning:} code compiled with the @option{-fpcc-struct-return} 20494switch is not binary compatible with code compiled with the 20495@option{-freg-struct-return} switch. 20496Use it to conform to a non-default application binary interface. 20497 20498@item -freg-struct-return 20499@opindex freg-struct-return 20500Return @code{struct} and @code{union} values in registers when possible. 20501This is more efficient for small structures than 20502@option{-fpcc-struct-return}. 20503 20504If you specify neither @option{-fpcc-struct-return} nor 20505@option{-freg-struct-return}, GCC defaults to whichever convention is 20506standard for the target. If there is no standard convention, GCC 20507defaults to @option{-fpcc-struct-return}, except on targets where GCC is 20508the principal compiler. In those cases, we can choose the standard, and 20509we chose the more efficient register return alternative. 20510 20511@strong{Warning:} code compiled with the @option{-freg-struct-return} 20512switch is not binary compatible with code compiled with the 20513@option{-fpcc-struct-return} switch. 20514Use it to conform to a non-default application binary interface. 20515 20516@item -fshort-enums 20517@opindex fshort-enums 20518Allocate to an @code{enum} type only as many bytes as it needs for the 20519declared range of possible values. Specifically, the @code{enum} type 20520is equivalent to the smallest integer type that has enough room. 20521 20522@strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate 20523code that is not binary compatible with code generated without that switch. 20524Use it to conform to a non-default application binary interface. 20525 20526@item -fshort-double 20527@opindex fshort-double 20528Use the same size for @code{double} as for @code{float}. 20529 20530@strong{Warning:} the @option{-fshort-double} switch causes GCC to generate 20531code that is not binary compatible with code generated without that switch. 20532Use it to conform to a non-default application binary interface. 20533 20534@item -fshort-wchar 20535@opindex fshort-wchar 20536Override the underlying type for @samp{wchar_t} to be @samp{short 20537unsigned int} instead of the default for the target. This option is 20538useful for building programs to run under WINE@. 20539 20540@strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate 20541code that is not binary compatible with code generated without that switch. 20542Use it to conform to a non-default application binary interface. 20543 20544@item -fno-common 20545@opindex fno-common 20546In C code, controls the placement of uninitialized global variables. 20547Unix C compilers have traditionally permitted multiple definitions of 20548such variables in different compilation units by placing the variables 20549in a common block. 20550This is the behavior specified by @option{-fcommon}, and is the default 20551for GCC on most targets. 20552On the other hand, this behavior is not required by ISO C, and on some 20553targets may carry a speed or code size penalty on variable references. 20554The @option{-fno-common} option specifies that the compiler should place 20555uninitialized global variables in the data section of the object file, 20556rather than generating them as common blocks. 20557This has the effect that if the same variable is declared 20558(without @code{extern}) in two different compilations, 20559you get a multiple-definition error when you link them. 20560In this case, you must compile with @option{-fcommon} instead. 20561Compiling with @option{-fno-common} is useful on targets for which 20562it provides better performance, or if you wish to verify that the 20563program will work on other systems that always treat uninitialized 20564variable declarations this way. 20565 20566@item -fno-ident 20567@opindex fno-ident 20568Ignore the @samp{#ident} directive. 20569 20570@item -finhibit-size-directive 20571@opindex finhibit-size-directive 20572Don't output a @code{.size} assembler directive, or anything else that 20573would cause trouble if the function is split in the middle, and the 20574two halves are placed at locations far apart in memory. This option is 20575used when compiling @file{crtstuff.c}; you should not need to use it 20576for anything else. 20577 20578@item -fverbose-asm 20579@opindex fverbose-asm 20580Put extra commentary information in the generated assembly code to 20581make it more readable. This option is generally only of use to those 20582who actually need to read the generated assembly code (perhaps while 20583debugging the compiler itself). 20584 20585@option{-fno-verbose-asm}, the default, causes the 20586extra information to be omitted and is useful when comparing two assembler 20587files. 20588 20589@item -frecord-gcc-switches 20590@opindex frecord-gcc-switches 20591This switch causes the command line used to invoke the 20592compiler to be recorded into the object file that is being created. 20593This switch is only implemented on some targets and the exact format 20594of the recording is target and binary file format dependent, but it 20595usually takes the form of a section containing ASCII text. This 20596switch is related to the @option{-fverbose-asm} switch, but that 20597switch only records information in the assembler output file as 20598comments, so it never reaches the object file. 20599See also @option{-grecord-gcc-switches} for another 20600way of storing compiler options into the object file. 20601 20602@item -fpic 20603@opindex fpic 20604@cindex global offset table 20605@cindex PIC 20606Generate position-independent code (PIC) suitable for use in a shared 20607library, if supported for the target machine. Such code accesses all 20608constant addresses through a global offset table (GOT)@. The dynamic 20609loader resolves the GOT entries when the program starts (the dynamic 20610loader is not part of GCC; it is part of the operating system). If 20611the GOT size for the linked executable exceeds a machine-specific 20612maximum size, you get an error message from the linker indicating that 20613@option{-fpic} does not work; in that case, recompile with @option{-fPIC} 20614instead. (These maximums are 8k on the SPARC and 32k 20615on the m68k and RS/6000. The 386 has no such limit.) 20616 20617Position-independent code requires special support, and therefore works 20618only on certain machines. For the 386, GCC supports PIC for System V 20619but not for the Sun 386i. Code generated for the IBM RS/6000 is always 20620position-independent. 20621 20622When this flag is set, the macros @code{__pic__} and @code{__PIC__} 20623are defined to 1. 20624 20625@item -fPIC 20626@opindex fPIC 20627If supported for the target machine, emit position-independent code, 20628suitable for dynamic linking and avoiding any limit on the size of the 20629global offset table. This option makes a difference on the m68k, 20630PowerPC and SPARC@. 20631 20632Position-independent code requires special support, and therefore works 20633only on certain machines. 20634 20635When this flag is set, the macros @code{__pic__} and @code{__PIC__} 20636are defined to 2. 20637 20638@item -fpie 20639@itemx -fPIE 20640@opindex fpie 20641@opindex fPIE 20642These options are similar to @option{-fpic} and @option{-fPIC}, but 20643generated position independent code can be only linked into executables. 20644Usually these options are used when @option{-pie} GCC option is 20645used during linking. 20646 20647@option{-fpie} and @option{-fPIE} both define the macros 20648@code{__pie__} and @code{__PIE__}. The macros have the value 1 20649for @option{-fpie} and 2 for @option{-fPIE}. 20650 20651@item -fno-jump-tables 20652@opindex fno-jump-tables 20653Do not use jump tables for switch statements even where it would be 20654more efficient than other code generation strategies. This option is 20655of use in conjunction with @option{-fpic} or @option{-fPIC} for 20656building code that forms part of a dynamic linker and cannot 20657reference the address of a jump table. On some targets, jump tables 20658do not require a GOT and this option is not needed. 20659 20660@item -ffixed-@var{reg} 20661@opindex ffixed 20662Treat the register named @var{reg} as a fixed register; generated code 20663should never refer to it (except perhaps as a stack pointer, frame 20664pointer or in some other fixed role). 20665 20666@var{reg} must be the name of a register. The register names accepted 20667are machine-specific and are defined in the @code{REGISTER_NAMES} 20668macro in the machine description macro file. 20669 20670This flag does not have a negative form, because it specifies a 20671three-way choice. 20672 20673@item -fcall-used-@var{reg} 20674@opindex fcall-used 20675Treat the register named @var{reg} as an allocable register that is 20676clobbered by function calls. It may be allocated for temporaries or 20677variables that do not live across a call. Functions compiled this way 20678do not save and restore the register @var{reg}. 20679 20680It is an error to use this flag with the frame pointer or stack pointer. 20681Use of this flag for other registers that have fixed pervasive roles in 20682the machine's execution model produces disastrous results. 20683 20684This flag does not have a negative form, because it specifies a 20685three-way choice. 20686 20687@item -fcall-saved-@var{reg} 20688@opindex fcall-saved 20689Treat the register named @var{reg} as an allocable register saved by 20690functions. It may be allocated even for temporaries or variables that 20691live across a call. Functions compiled this way save and restore 20692the register @var{reg} if they use it. 20693 20694It is an error to use this flag with the frame pointer or stack pointer. 20695Use of this flag for other registers that have fixed pervasive roles in 20696the machine's execution model produces disastrous results. 20697 20698A different sort of disaster results from the use of this flag for 20699a register in which function values may be returned. 20700 20701This flag does not have a negative form, because it specifies a 20702three-way choice. 20703 20704@item -fpack-struct[=@var{n}] 20705@opindex fpack-struct 20706Without a value specified, pack all structure members together without 20707holes. When a value is specified (which must be a small power of two), pack 20708structure members according to this value, representing the maximum 20709alignment (that is, objects with default alignment requirements larger than 20710this are output potentially unaligned at the next fitting location. 20711 20712@strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate 20713code that is not binary compatible with code generated without that switch. 20714Additionally, it makes the code suboptimal. 20715Use it to conform to a non-default application binary interface. 20716 20717@item -finstrument-functions 20718@opindex finstrument-functions 20719Generate instrumentation calls for entry and exit to functions. Just 20720after function entry and just before function exit, the following 20721profiling functions are called with the address of the current 20722function and its call site. (On some platforms, 20723@code{__builtin_return_address} does not work beyond the current 20724function, so the call site information may not be available to the 20725profiling functions otherwise.) 20726 20727@smallexample 20728void __cyg_profile_func_enter (void *this_fn, 20729 void *call_site); 20730void __cyg_profile_func_exit (void *this_fn, 20731 void *call_site); 20732@end smallexample 20733 20734The first argument is the address of the start of the current function, 20735which may be looked up exactly in the symbol table. 20736 20737This instrumentation is also done for functions expanded inline in other 20738functions. The profiling calls indicate where, conceptually, the 20739inline function is entered and exited. This means that addressable 20740versions of such functions must be available. If all your uses of a 20741function are expanded inline, this may mean an additional expansion of 20742code size. If you use @samp{extern inline} in your C code, an 20743addressable version of such functions must be provided. (This is 20744normally the case anyway, but if you get lucky and the optimizer always 20745expands the functions inline, you might have gotten away without 20746providing static copies.) 20747 20748A function may be given the attribute @code{no_instrument_function}, in 20749which case this instrumentation is not done. This can be used, for 20750example, for the profiling functions listed above, high-priority 20751interrupt routines, and any functions from which the profiling functions 20752cannot safely be called (perhaps signal handlers, if the profiling 20753routines generate output or allocate memory). 20754 20755@item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} 20756@opindex finstrument-functions-exclude-file-list 20757 20758Set the list of functions that are excluded from instrumentation (see 20759the description of @code{-finstrument-functions}). If the file that 20760contains a function definition matches with one of @var{file}, then 20761that function is not instrumented. The match is done on substrings: 20762if the @var{file} parameter is a substring of the file name, it is 20763considered to be a match. 20764 20765For example: 20766 20767@smallexample 20768-finstrument-functions-exclude-file-list=/bits/stl,include/sys 20769@end smallexample 20770 20771@noindent 20772excludes any inline function defined in files whose pathnames 20773contain @code{/bits/stl} or @code{include/sys}. 20774 20775If, for some reason, you want to include letter @code{','} in one of 20776@var{sym}, write @code{'\,'}. For example, 20777@code{-finstrument-functions-exclude-file-list='\,\,tmp'} 20778(note the single quote surrounding the option). 20779 20780@item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} 20781@opindex finstrument-functions-exclude-function-list 20782 20783This is similar to @code{-finstrument-functions-exclude-file-list}, 20784but this option sets the list of function names to be excluded from 20785instrumentation. The function name to be matched is its user-visible 20786name, such as @code{vector<int> blah(const vector<int> &)}, not the 20787internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The 20788match is done on substrings: if the @var{sym} parameter is a substring 20789of the function name, it is considered to be a match. For C99 and C++ 20790extended identifiers, the function name must be given in UTF-8, not 20791using universal character names. 20792 20793@item -fstack-check 20794@opindex fstack-check 20795Generate code to verify that you do not go beyond the boundary of the 20796stack. You should specify this flag if you are running in an 20797environment with multiple threads, but you only rarely need to specify it in 20798a single-threaded environment since stack overflow is automatically 20799detected on nearly all systems if there is only one stack. 20800 20801Note that this switch does not actually cause checking to be done; the 20802operating system or the language runtime must do that. The switch causes 20803generation of code to ensure that they see the stack being extended. 20804 20805You can additionally specify a string parameter: @code{no} means no 20806checking, @code{generic} means force the use of old-style checking, 20807@code{specific} means use the best checking method and is equivalent 20808to bare @option{-fstack-check}. 20809 20810Old-style checking is a generic mechanism that requires no specific 20811target support in the compiler but comes with the following drawbacks: 20812 20813@enumerate 20814@item 20815Modified allocation strategy for large objects: they are always 20816allocated dynamically if their size exceeds a fixed threshold. 20817 20818@item 20819Fixed limit on the size of the static frame of functions: when it is 20820topped by a particular function, stack checking is not reliable and 20821a warning is issued by the compiler. 20822 20823@item 20824Inefficiency: because of both the modified allocation strategy and the 20825generic implementation, code performance is hampered. 20826@end enumerate 20827 20828Note that old-style stack checking is also the fallback method for 20829@code{specific} if no target support has been added in the compiler. 20830 20831@item -fstack-limit-register=@var{reg} 20832@itemx -fstack-limit-symbol=@var{sym} 20833@itemx -fno-stack-limit 20834@opindex fstack-limit-register 20835@opindex fstack-limit-symbol 20836@opindex fno-stack-limit 20837Generate code to ensure that the stack does not grow beyond a certain value, 20838either the value of a register or the address of a symbol. If a larger 20839stack is required, a signal is raised at run time. For most targets, 20840the signal is raised before the stack overruns the boundary, so 20841it is possible to catch the signal without taking special precautions. 20842 20843For instance, if the stack starts at absolute address @samp{0x80000000} 20844and grows downwards, you can use the flags 20845@option{-fstack-limit-symbol=__stack_limit} and 20846@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit 20847of 128KB@. Note that this may only work with the GNU linker. 20848 20849@item -fsplit-stack 20850@opindex fsplit-stack 20851Generate code to automatically split the stack before it overflows. 20852The resulting program has a discontiguous stack which can only 20853overflow if the program is unable to allocate any more memory. This 20854is most useful when running threaded programs, as it is no longer 20855necessary to calculate a good stack size to use for each thread. This 20856is currently only implemented for the i386 and x86_64 back ends running 20857GNU/Linux. 20858 20859When code compiled with @option{-fsplit-stack} calls code compiled 20860without @option{-fsplit-stack}, there may not be much stack space 20861available for the latter code to run. If compiling all code, 20862including library code, with @option{-fsplit-stack} is not an option, 20863then the linker can fix up these calls so that the code compiled 20864without @option{-fsplit-stack} always has a large stack. Support for 20865this is implemented in the gold linker in GNU binutils release 2.21 20866and later. 20867 20868@item -fleading-underscore 20869@opindex fleading-underscore 20870This option and its counterpart, @option{-fno-leading-underscore}, forcibly 20871change the way C symbols are represented in the object file. One use 20872is to help link with legacy assembly code. 20873 20874@strong{Warning:} the @option{-fleading-underscore} switch causes GCC to 20875generate code that is not binary compatible with code generated without that 20876switch. Use it to conform to a non-default application binary interface. 20877Not all targets provide complete support for this switch. 20878 20879@item -ftls-model=@var{model} 20880@opindex ftls-model 20881Alter the thread-local storage model to be used (@pxref{Thread-Local}). 20882The @var{model} argument should be one of @code{global-dynamic}, 20883@code{local-dynamic}, @code{initial-exec} or @code{local-exec}. 20884 20885The default without @option{-fpic} is @code{initial-exec}; with 20886@option{-fpic} the default is @code{global-dynamic}. 20887 20888@item -fvisibility=@var{default|internal|hidden|protected} 20889@opindex fvisibility 20890Set the default ELF image symbol visibility to the specified option---all 20891symbols are marked with this unless overridden within the code. 20892Using this feature can very substantially improve linking and 20893load times of shared object libraries, produce more optimized 20894code, provide near-perfect API export and prevent symbol clashes. 20895It is @strong{strongly} recommended that you use this in any shared objects 20896you distribute. 20897 20898Despite the nomenclature, @code{default} always means public; i.e., 20899available to be linked against from outside the shared object. 20900@code{protected} and @code{internal} are pretty useless in real-world 20901usage so the only other commonly used option is @code{hidden}. 20902The default if @option{-fvisibility} isn't specified is 20903@code{default}, i.e., make every 20904symbol public---this causes the same behavior as previous versions of 20905GCC@. 20906 20907A good explanation of the benefits offered by ensuring ELF 20908symbols have the correct visibility is given by ``How To Write 20909Shared Libraries'' by Ulrich Drepper (which can be found at 20910@w{@uref{http://people.redhat.com/~drepper/}})---however a superior 20911solution made possible by this option to marking things hidden when 20912the default is public is to make the default hidden and mark things 20913public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden} 20914and @code{__attribute__ ((visibility("default")))} instead of 20915@code{__declspec(dllexport)} you get almost identical semantics with 20916identical syntax. This is a great boon to those working with 20917cross-platform projects. 20918 20919For those adding visibility support to existing code, you may find 20920@samp{#pragma GCC visibility} of use. This works by you enclosing 20921the declarations you wish to set visibility for with (for example) 20922@samp{#pragma GCC visibility push(hidden)} and 20923@samp{#pragma GCC visibility pop}. 20924Bear in mind that symbol visibility should be viewed @strong{as 20925part of the API interface contract} and thus all new code should 20926always specify visibility when it is not the default; i.e., declarations 20927only for use within the local DSO should @strong{always} be marked explicitly 20928as hidden as so to avoid PLT indirection overheads---making this 20929abundantly clear also aids readability and self-documentation of the code. 20930Note that due to ISO C++ specification requirements, @code{operator new} and 20931@code{operator delete} must always be of default visibility. 20932 20933Be aware that headers from outside your project, in particular system 20934headers and headers from any other library you use, may not be 20935expecting to be compiled with visibility other than the default. You 20936may need to explicitly say @samp{#pragma GCC visibility push(default)} 20937before including any such headers. 20938 20939@samp{extern} declarations are not affected by @option{-fvisibility}, so 20940a lot of code can be recompiled with @option{-fvisibility=hidden} with 20941no modifications. However, this means that calls to @code{extern} 20942functions with no explicit visibility use the PLT, so it is more 20943effective to use @code{__attribute ((visibility))} and/or 20944@code{#pragma GCC visibility} to tell the compiler which @code{extern} 20945declarations should be treated as hidden. 20946 20947Note that @option{-fvisibility} does affect C++ vague linkage 20948entities. This means that, for instance, an exception class that is 20949be thrown between DSOs must be explicitly marked with default 20950visibility so that the @samp{type_info} nodes are unified between 20951the DSOs. 20952 20953An overview of these techniques, their benefits and how to use them 20954is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}. 20955 20956@item -fstrict-volatile-bitfields 20957@opindex fstrict-volatile-bitfields 20958This option should be used if accesses to volatile bit-fields (or other 20959structure fields, although the compiler usually honors those types 20960anyway) should use a single access of the width of the 20961field's type, aligned to a natural alignment if possible. For 20962example, targets with memory-mapped peripheral registers might require 20963all such accesses to be 16 bits wide; with this flag you can 20964declare all peripheral bit-fields as @code{unsigned short} (assuming short 20965is 16 bits on these targets) to force GCC to use 16-bit accesses 20966instead of, perhaps, a more efficient 32-bit access. 20967 20968If this option is disabled, the compiler uses the most efficient 20969instruction. In the previous example, that might be a 32-bit load 20970instruction, even though that accesses bytes that do not contain 20971any portion of the bit-field, or memory-mapped registers unrelated to 20972the one being updated. 20973 20974If the target requires strict alignment, and honoring the field 20975type would require violating this alignment, a warning is issued. 20976If the field has @code{packed} attribute, the access is done without 20977honoring the field type. If the field doesn't have @code{packed} 20978attribute, the access is done honoring the field type. In both cases, 20979GCC assumes that the user knows something about the target hardware 20980that it is unaware of. 20981 20982The default value of this option is determined by the application binary 20983interface for the target processor. 20984 20985@item -fsync-libcalls 20986@opindex fsync-libcalls 20987This option controls whether any out-of-line instance of the @code{__sync} 20988family of functions may be used to implement the C++11 @code{__atomic} 20989family of functions. 20990 20991The default value of this option is enabled, thus the only useful form 20992of the option is @option{-fno-sync-libcalls}. This option is used in 20993the implementation of the @file{libatomic} runtime library. 20994 20995@end table 20996 20997@c man end 20998 20999@node Environment Variables 21000@section Environment Variables Affecting GCC 21001@cindex environment variables 21002 21003@c man begin ENVIRONMENT 21004This section describes several environment variables that affect how GCC 21005operates. Some of them work by specifying directories or prefixes to use 21006when searching for various kinds of files. Some are used to specify other 21007aspects of the compilation environment. 21008 21009Note that you can also specify places to search using options such as 21010@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These 21011take precedence over places specified using environment variables, which 21012in turn take precedence over those specified by the configuration of GCC@. 21013@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint, 21014GNU Compiler Collection (GCC) Internals}. 21015 21016@table @env 21017@item LANG 21018@itemx LC_CTYPE 21019@c @itemx LC_COLLATE 21020@itemx LC_MESSAGES 21021@c @itemx LC_MONETARY 21022@c @itemx LC_NUMERIC 21023@c @itemx LC_TIME 21024@itemx LC_ALL 21025@findex LANG 21026@findex LC_CTYPE 21027@c @findex LC_COLLATE 21028@findex LC_MESSAGES 21029@c @findex LC_MONETARY 21030@c @findex LC_NUMERIC 21031@c @findex LC_TIME 21032@findex LC_ALL 21033@cindex locale 21034These environment variables control the way that GCC uses 21035localization information which allows GCC to work with different 21036national conventions. GCC inspects the locale categories 21037@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do 21038so. These locale categories can be set to any value supported by your 21039installation. A typical value is @samp{en_GB.UTF-8} for English in the United 21040Kingdom encoded in UTF-8. 21041 21042The @env{LC_CTYPE} environment variable specifies character 21043classification. GCC uses it to determine the character boundaries in 21044a string; this is needed for some multibyte encodings that contain quote 21045and escape characters that are otherwise interpreted as a string 21046end or escape. 21047 21048The @env{LC_MESSAGES} environment variable specifies the language to 21049use in diagnostic messages. 21050 21051If the @env{LC_ALL} environment variable is set, it overrides the value 21052of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE} 21053and @env{LC_MESSAGES} default to the value of the @env{LANG} 21054environment variable. If none of these variables are set, GCC 21055defaults to traditional C English behavior. 21056 21057@item TMPDIR 21058@findex TMPDIR 21059If @env{TMPDIR} is set, it specifies the directory to use for temporary 21060files. GCC uses temporary files to hold the output of one stage of 21061compilation which is to be used as input to the next stage: for example, 21062the output of the preprocessor, which is the input to the compiler 21063proper. 21064 21065@item GCC_COMPARE_DEBUG 21066@findex GCC_COMPARE_DEBUG 21067Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing 21068@option{-fcompare-debug} to the compiler driver. See the documentation 21069of this option for more details. 21070 21071@item GCC_EXEC_PREFIX 21072@findex GCC_EXEC_PREFIX 21073If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the 21074names of the subprograms executed by the compiler. No slash is added 21075when this prefix is combined with the name of a subprogram, but you can 21076specify a prefix that ends with a slash if you wish. 21077 21078If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out 21079an appropriate prefix to use based on the pathname it is invoked with. 21080 21081If GCC cannot find the subprogram using the specified prefix, it 21082tries looking in the usual places for the subprogram. 21083 21084The default value of @env{GCC_EXEC_PREFIX} is 21085@file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to 21086the installed compiler. In many cases @var{prefix} is the value 21087of @code{prefix} when you ran the @file{configure} script. 21088 21089Other prefixes specified with @option{-B} take precedence over this prefix. 21090 21091This prefix is also used for finding files such as @file{crt0.o} that are 21092used for linking. 21093 21094In addition, the prefix is used in an unusual way in finding the 21095directories to search for header files. For each of the standard 21096directories whose name normally begins with @samp{/usr/local/lib/gcc} 21097(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries 21098replacing that beginning with the specified prefix to produce an 21099alternate directory name. Thus, with @option{-Bfoo/}, GCC searches 21100@file{foo/bar} just before it searches the standard directory 21101@file{/usr/local/lib/bar}. 21102If a standard directory begins with the configured 21103@var{prefix} then the value of @var{prefix} is replaced by 21104@env{GCC_EXEC_PREFIX} when looking for header files. 21105 21106@item COMPILER_PATH 21107@findex COMPILER_PATH 21108The value of @env{COMPILER_PATH} is a colon-separated list of 21109directories, much like @env{PATH}. GCC tries the directories thus 21110specified when searching for subprograms, if it can't find the 21111subprograms using @env{GCC_EXEC_PREFIX}. 21112 21113@item LIBRARY_PATH 21114@findex LIBRARY_PATH 21115The value of @env{LIBRARY_PATH} is a colon-separated list of 21116directories, much like @env{PATH}. When configured as a native compiler, 21117GCC tries the directories thus specified when searching for special 21118linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking 21119using GCC also uses these directories when searching for ordinary 21120libraries for the @option{-l} option (but directories specified with 21121@option{-L} come first). 21122 21123@item LANG 21124@findex LANG 21125@cindex locale definition 21126This variable is used to pass locale information to the compiler. One way in 21127which this information is used is to determine the character set to be used 21128when character literals, string literals and comments are parsed in C and C++. 21129When the compiler is configured to allow multibyte characters, 21130the following values for @env{LANG} are recognized: 21131 21132@table @samp 21133@item C-JIS 21134Recognize JIS characters. 21135@item C-SJIS 21136Recognize SJIS characters. 21137@item C-EUCJP 21138Recognize EUCJP characters. 21139@end table 21140 21141If @env{LANG} is not defined, or if it has some other value, then the 21142compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to 21143recognize and translate multibyte characters. 21144@end table 21145 21146@noindent 21147Some additional environment variables affect the behavior of the 21148preprocessor. 21149 21150@include cppenv.texi 21151 21152@c man end 21153 21154@node Precompiled Headers 21155@section Using Precompiled Headers 21156@cindex precompiled headers 21157@cindex speed of compilation 21158 21159Often large projects have many header files that are included in every 21160source file. The time the compiler takes to process these header files 21161over and over again can account for nearly all of the time required to 21162build the project. To make builds faster, GCC allows you to 21163@dfn{precompile} a header file. 21164 21165To create a precompiled header file, simply compile it as you would any 21166other file, if necessary using the @option{-x} option to make the driver 21167treat it as a C or C++ header file. You may want to use a 21168tool like @command{make} to keep the precompiled header up-to-date when 21169the headers it contains change. 21170 21171A precompiled header file is searched for when @code{#include} is 21172seen in the compilation. As it searches for the included file 21173(@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the 21174compiler looks for a precompiled header in each directory just before it 21175looks for the include file in that directory. The name searched for is 21176the name specified in the @code{#include} with @samp{.gch} appended. If 21177the precompiled header file can't be used, it is ignored. 21178 21179For instance, if you have @code{#include "all.h"}, and you have 21180@file{all.h.gch} in the same directory as @file{all.h}, then the 21181precompiled header file is used if possible, and the original 21182header is used otherwise. 21183 21184Alternatively, you might decide to put the precompiled header file in a 21185directory and use @option{-I} to ensure that directory is searched 21186before (or instead of) the directory containing the original header. 21187Then, if you want to check that the precompiled header file is always 21188used, you can put a file of the same name as the original header in this 21189directory containing an @code{#error} command. 21190 21191This also works with @option{-include}. So yet another way to use 21192precompiled headers, good for projects not designed with precompiled 21193header files in mind, is to simply take most of the header files used by 21194a project, include them from another header file, precompile that header 21195file, and @option{-include} the precompiled header. If the header files 21196have guards against multiple inclusion, they are skipped because 21197they've already been included (in the precompiled header). 21198 21199If you need to precompile the same header file for different 21200languages, targets, or compiler options, you can instead make a 21201@emph{directory} named like @file{all.h.gch}, and put each precompiled 21202header in the directory, perhaps using @option{-o}. It doesn't matter 21203what you call the files in the directory; every precompiled header in 21204the directory is considered. The first precompiled header 21205encountered in the directory that is valid for this compilation is 21206used; they're searched in no particular order. 21207 21208There are many other possibilities, limited only by your imagination, 21209good sense, and the constraints of your build system. 21210 21211A precompiled header file can be used only when these conditions apply: 21212 21213@itemize 21214@item 21215Only one precompiled header can be used in a particular compilation. 21216 21217@item 21218A precompiled header can't be used once the first C token is seen. You 21219can have preprocessor directives before a precompiled header; you cannot 21220include a precompiled header from inside another header. 21221 21222@item 21223The precompiled header file must be produced for the same language as 21224the current compilation. You can't use a C precompiled header for a C++ 21225compilation. 21226 21227@item 21228The precompiled header file must have been produced by the same compiler 21229binary as the current compilation is using. 21230 21231@item 21232Any macros defined before the precompiled header is included must 21233either be defined in the same way as when the precompiled header was 21234generated, or must not affect the precompiled header, which usually 21235means that they don't appear in the precompiled header at all. 21236 21237The @option{-D} option is one way to define a macro before a 21238precompiled header is included; using a @code{#define} can also do it. 21239There are also some options that define macros implicitly, like 21240@option{-O} and @option{-Wdeprecated}; the same rule applies to macros 21241defined this way. 21242 21243@item If debugging information is output when using the precompiled 21244header, using @option{-g} or similar, the same kind of debugging information 21245must have been output when building the precompiled header. However, 21246a precompiled header built using @option{-g} can be used in a compilation 21247when no debugging information is being output. 21248 21249@item The same @option{-m} options must generally be used when building 21250and using the precompiled header. @xref{Submodel Options}, 21251for any cases where this rule is relaxed. 21252 21253@item Each of the following options must be the same when building and using 21254the precompiled header: 21255 21256@gccoptlist{-fexceptions} 21257 21258@item 21259Some other command-line options starting with @option{-f}, 21260@option{-p}, or @option{-O} must be defined in the same way as when 21261the precompiled header was generated. At present, it's not clear 21262which options are safe to change and which are not; the safest choice 21263is to use exactly the same options when generating and using the 21264precompiled header. The following are known to be safe: 21265 21266@gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol 21267-fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol 21268-fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol 21269-pedantic-errors} 21270 21271@end itemize 21272 21273For all of these except the last, the compiler automatically 21274ignores the precompiled header if the conditions aren't met. If you 21275find an option combination that doesn't work and doesn't cause the 21276precompiled header to be ignored, please consider filing a bug report, 21277see @ref{Bugs}. 21278 21279If you do use differing options when generating and using the 21280precompiled header, the actual behavior is a mixture of the 21281behavior for the options. For instance, if you use @option{-g} to 21282generate the precompiled header but not when using it, you may or may 21283not get debugging information for routines in the precompiled header. 21284