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. @command{g++} accepts mostly the same options as @command{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 -fopenacc -fopenmp -fopenmp-simd @gol 172-fms-extensions -fplan9-extensions -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 -fsized-deallocation @gol 191-fstats -ftemplate-backtrace-limit=@var{n} @gol 192-ftemplate-depth=@var{n} @gol 193-fno-threadsafe-statics -fuse-cxa-atexit @gol 194-fno-weak -nostdinc++ @gol 195-fvisibility-inlines-hidden @gol 196-fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol 197-fvtv-counts -fvtv-debug @gol 198-fvisibility-ms-compat @gol 199-fext-numeric-literals @gol 200-Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol 201-Wdelete-non-virtual-dtor -Wliteral-suffix -Wnarrowing @gol 202-Wnoexcept -Wnon-virtual-dtor -Wreorder @gol 203-Weffc++ -Wstrict-null-sentinel @gol 204-Wno-non-template-friend -Wold-style-cast @gol 205-Woverloaded-virtual -Wno-pmf-conversions @gol 206-Wsign-promo} 207 208@item Objective-C and Objective-C++ Language Options 209@xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling 210Objective-C and Objective-C++ Dialects}. 211@gccoptlist{-fconstant-string-class=@var{class-name} @gol 212-fgnu-runtime -fnext-runtime @gol 213-fno-nil-receivers @gol 214-fobjc-abi-version=@var{n} @gol 215-fobjc-call-cxx-cdtors @gol 216-fobjc-direct-dispatch @gol 217-fobjc-exceptions @gol 218-fobjc-gc @gol 219-fobjc-nilcheck @gol 220-fobjc-std=objc1 @gol 221-fno-local-ivars @gol 222-fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol 223-freplace-objc-classes @gol 224-fzero-link @gol 225-gen-decls @gol 226-Wassign-intercept @gol 227-Wno-protocol -Wselector @gol 228-Wstrict-selector-match @gol 229-Wundeclared-selector} 230 231@item Language Independent Options 232@xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}. 233@gccoptlist{-fmessage-length=@var{n} @gol 234-fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol 235-fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol 236-fno-diagnostics-show-option -fno-diagnostics-show-caret} 237 238@item Warning Options 239@xref{Warning Options,,Options to Request or Suppress Warnings}. 240@gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol 241-pedantic-errors @gol 242-w -Wextra -Wall -Waddress -Waggregate-return @gol 243-Waggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol 244-Wbool-compare @gol 245-Wno-attributes -Wno-builtin-macro-redefined @gol 246-Wc90-c99-compat -Wc99-c11-compat @gol 247-Wc++-compat -Wc++11-compat -Wc++14-compat -Wcast-align -Wcast-qual @gol 248-Wchar-subscripts -Wchkp -Wclobbered -Wcomment -Wconditionally-supported @gol 249-Wconversion -Wcoverage-mismatch -Wdate-time -Wdelete-incomplete -Wno-cpp @gol 250-Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol 251-Wdisabled-optimization @gol 252-Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol 253-Wno-div-by-zero -Wdouble-promotion -Wempty-body -Wenum-compare @gol 254-Wno-endif-labels -Werror -Werror=* @gol 255-Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol 256-Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol 257-Wformat-security -Wformat-signedness -Wformat-y2k @gol 258-Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol 259-Wignored-qualifiers -Wincompatible-pointer-types @gol 260-Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol 261-Winit-self -Winline -Wno-int-conversion @gol 262-Wno-int-to-pointer-cast -Wno-invalid-offsetof @gol 263-Winvalid-pch -Wlarger-than=@var{len} -Wunsafe-loop-optimizations @gol 264-Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol 265-Wmain -Wmaybe-uninitialized -Wmemset-transposed-args -Wmissing-braces @gol 266-Wmissing-field-initializers -Wmissing-include-dirs @gol 267-Wno-multichar -Wnonnull -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol 268 -Wodr -Wno-overflow -Wopenmp-simd @gol 269-Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol 270-Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol 271-Wpointer-arith -Wno-pointer-to-int-cast @gol 272-Wredundant-decls -Wno-return-local-addr @gol 273-Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol 274-Wshift-count-negative -Wshift-count-overflow @gol 275-Wsign-compare -Wsign-conversion -Wfloat-conversion @gol 276-Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol 277-Wstack-protector -Wstack-usage=@var{len} -Wstrict-aliasing @gol 278-Wstrict-aliasing=n @gol -Wstrict-overflow -Wstrict-overflow=@var{n} @gol 279-Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]} @gol 280-Wsuggest-final-types @gol -Wsuggest-final-methods @gol -Wsuggest-override @gol 281-Wmissing-format-attribute @gol 282-Wswitch -Wswitch-default -Wswitch-enum -Wswitch-bool -Wsync-nand @gol 283-Wsystem-headers -Wtrampolines -Wtrigraphs -Wtype-limits -Wundef @gol 284-Wuninitialized -Wunknown-pragmas -Wno-pragmas @gol 285-Wunsuffixed-float-constants -Wunused -Wunused-function @gol 286-Wunused-label -Wunused-local-typedefs -Wunused-parameter @gol 287-Wno-unused-result -Wunused-value @gol -Wunused-variable @gol 288-Wunused-but-set-parameter -Wunused-but-set-variable @gol 289-Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol 290-Wvla -Wvolatile-register-var -Wwrite-strings @gol 291-Wzero-as-null-pointer-constant} 292 293@item C and Objective-C-only Warning Options 294@gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol 295-Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol 296-Wold-style-declaration -Wold-style-definition @gol 297-Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol 298-Wdeclaration-after-statement -Wpointer-sign} 299 300@item Debugging Options 301@xref{Debugging Options,,Options for Debugging Your Program or GCC}. 302@gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol 303-fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol 304-fasan-shadow-offset=@var{number} -fsanitize-undefined-trap-on-error @gol 305-fcheck-pointer-bounds -fchkp-check-incomplete-type @gol 306-fchkp-first-field-has-own-bounds -fchkp-narrow-bounds @gol 307-fchkp-narrow-to-innermost-array -fchkp-optimize @gol 308-fchkp-use-fast-string-functions -fchkp-use-nochk-string-functions @gol 309-fchkp-use-static-bounds -fchkp-use-static-const-bounds @gol 310-fchkp-treat-zero-dynamic-size-as-infinite -fchkp-check-read @gol 311-fchkp-check-read -fchkp-check-write -fchkp-store-bounds @gol 312-fchkp-instrument-calls -fchkp-instrument-marked-only @gol 313-fchkp-use-wrappers @gol 314-fdbg-cnt-list -fdbg-cnt=@var{counter-value-list} @gol 315-fdisable-ipa-@var{pass_name} @gol 316-fdisable-rtl-@var{pass_name} @gol 317-fdisable-rtl-@var{pass-name}=@var{range-list} @gol 318-fdisable-tree-@var{pass_name} @gol 319-fdisable-tree-@var{pass-name}=@var{range-list} @gol 320-fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol 321-fdump-translation-unit@r{[}-@var{n}@r{]} @gol 322-fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol 323-fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol 324-fdump-passes @gol 325-fdump-statistics @gol 326-fdump-tree-all @gol 327-fdump-tree-original@r{[}-@var{n}@r{]} @gol 328-fdump-tree-optimized@r{[}-@var{n}@r{]} @gol 329-fdump-tree-cfg -fdump-tree-alias @gol 330-fdump-tree-ch @gol 331-fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol 332-fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol 333-fdump-tree-gimple@r{[}-raw@r{]} @gol 334-fdump-tree-dom@r{[}-@var{n}@r{]} @gol 335-fdump-tree-dse@r{[}-@var{n}@r{]} @gol 336-fdump-tree-phiprop@r{[}-@var{n}@r{]} @gol 337-fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol 338-fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol 339-fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol 340-fdump-tree-nrv -fdump-tree-vect @gol 341-fdump-tree-sink @gol 342-fdump-tree-sra@r{[}-@var{n}@r{]} @gol 343-fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol 344-fdump-tree-fre@r{[}-@var{n}@r{]} @gol 345-fdump-tree-vtable-verify @gol 346-fdump-tree-vrp@r{[}-@var{n}@r{]} @gol 347-fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol 348-fdump-final-insns=@var{file} @gol 349-fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol 350-feliminate-dwarf2-dups -fno-eliminate-unused-debug-types @gol 351-feliminate-unused-debug-symbols -femit-class-debug-always @gol 352-fenable-@var{kind}-@var{pass} @gol 353-fenable-@var{kind}-@var{pass}=@var{range-list} @gol 354-fdebug-types-section -fmem-report-wpa @gol 355-fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs @gol 356-fopt-info @gol 357-fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol 358-frandom-seed=@var{string} -fsched-verbose=@var{n} @gol 359-fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol 360-fstack-usage -ftest-coverage -ftime-report -fvar-tracking @gol 361-fvar-tracking-assignments -fvar-tracking-assignments-toggle @gol 362-g -g@var{level} -gtoggle -gcoff -gdwarf-@var{version} @gol 363-ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol 364-gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol 365-gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol 366-fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol 367-fdebug-prefix-map=@var{old}=@var{new} @gol 368-femit-struct-debug-baseonly -femit-struct-debug-reduced @gol 369-femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol 370-p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol 371-print-multi-directory -print-multi-lib -print-multi-os-directory @gol 372-print-prog-name=@var{program} -print-search-dirs -Q @gol 373-print-sysroot -print-sysroot-headers-suffix @gol 374-save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}} 375 376@item Optimization Options 377@xref{Optimize Options,,Options that Control Optimization}. 378@gccoptlist{-faggressive-loop-optimizations -falign-functions[=@var{n}] @gol 379-falign-jumps[=@var{n}] @gol 380-falign-labels[=@var{n}] -falign-loops[=@var{n}] @gol 381-fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol 382-fauto-inc-dec -fbranch-probabilities @gol 383-fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol 384-fbtr-bb-exclusive -fcaller-saves @gol 385-fcheck-data-deps -fcombine-stack-adjustments -fconserve-stack @gol 386-fcompare-elim -fcprop-registers -fcrossjumping @gol 387-fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol 388-fcx-limited-range @gol 389-fdata-sections -fdce -fdelayed-branch @gol 390-fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol 391-fdevirtualize-at-ltrans -fdse @gol 392-fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol 393-ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol 394-fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol 395-fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol 396-fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol 397-fif-conversion2 -findirect-inlining @gol 398-finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol 399-finline-small-functions -fipa-cp -fipa-cp-clone -fipa-cp-alignment @gol 400-fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-icf @gol 401-fira-algorithm=@var{algorithm} @gol 402-fira-region=@var{region} -fira-hoist-pressure @gol 403-fira-loop-pressure -fno-ira-share-save-slots @gol 404-fno-ira-share-spill-slots -fira-verbose=@var{n} @gol 405-fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol 406-fivopts -fkeep-inline-functions -fkeep-static-consts @gol 407-flive-range-shrinkage @gol 408-floop-block -floop-interchange -floop-strip-mine @gol 409-floop-unroll-and-jam -floop-nest-optimize @gol 410-floop-parallelize-all -flra-remat -flto -flto-compression-level @gol 411-flto-partition=@var{alg} -flto-report -flto-report-wpa -fmerge-all-constants @gol 412-fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol 413-fmove-loop-invariants -fno-branch-count-reg @gol 414-fno-defer-pop -fno-function-cse -fno-guess-branch-probability @gol 415-fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol 416-fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol 417-fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol 418-fomit-frame-pointer -foptimize-sibling-calls @gol 419-fpartial-inlining -fpeel-loops -fpredictive-commoning @gol 420-fprefetch-loop-arrays -fprofile-report @gol 421-fprofile-correction -fprofile-dir=@var{path} -fprofile-generate @gol 422-fprofile-generate=@var{path} @gol 423-fprofile-use -fprofile-use=@var{path} -fprofile-values @gol 424-fprofile-reorder-functions @gol 425-freciprocal-math -free -frename-registers -freorder-blocks @gol 426-freorder-blocks-and-partition -freorder-functions @gol 427-frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol 428-frounding-math -fsched2-use-superblocks -fsched-pressure @gol 429-fsched-spec-load -fsched-spec-load-dangerous @gol 430-fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol 431-fsched-group-heuristic -fsched-critical-path-heuristic @gol 432-fsched-spec-insn-heuristic -fsched-rank-heuristic @gol 433-fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol 434-fschedule-fusion @gol 435-fschedule-insns -fschedule-insns2 -fsection-anchors @gol 436-fselective-scheduling -fselective-scheduling2 @gol 437-fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol 438-fsemantic-interposition @gol 439-fshrink-wrap -fsignaling-nans -fsingle-precision-constant @gol 440-fsplit-ivs-in-unroller -fsplit-wide-types -fssa-phiopt @gol 441-fstack-protector -fstack-protector-all -fstack-protector-strong @gol 442-fstack-protector-explicit -fstdarg-opt -fstrict-aliasing @gol 443-fstrict-overflow -fthread-jumps -ftracer -ftree-bit-ccp @gol 444-ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol 445-ftree-coalesce-inline-vars -ftree-coalesce-vars -ftree-copy-prop @gol 446-ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse @gol 447-ftree-forwprop -ftree-fre -ftree-loop-if-convert @gol 448-ftree-loop-if-convert-stores -ftree-loop-im @gol 449-ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol 450-ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol 451-ftree-loop-vectorize @gol 452-ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol 453-ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol 454-ftree-switch-conversion -ftree-tail-merge -ftree-ter @gol 455-ftree-vectorize -ftree-vrp @gol 456-funit-at-a-time -funroll-all-loops -funroll-loops @gol 457-funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol 458-fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol 459-fweb -fwhole-program -fwpa -fuse-linker-plugin @gol 460--param @var{name}=@var{value} 461-O -O0 -O1 -O2 -O3 -Os -Ofast -Og} 462 463@item Preprocessor Options 464@xref{Preprocessor Options,,Options Controlling the Preprocessor}. 465@gccoptlist{-A@var{question}=@var{answer} @gol 466-A-@var{question}@r{[}=@var{answer}@r{]} @gol 467-C -dD -dI -dM -dN @gol 468-D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol 469-idirafter @var{dir} @gol 470-include @var{file} -imacros @var{file} @gol 471-iprefix @var{file} -iwithprefix @var{dir} @gol 472-iwithprefixbefore @var{dir} -isystem @var{dir} @gol 473-cxx-isystem @var{dir} @gol 474-imultilib @var{dir} -isysroot @var{dir} @gol 475-M -MM -MF -MG -MP -MQ -MT -nostdinc @gol 476-P -fdebug-cpp -ftrack-macro-expansion -fworking-directory @gol 477-remap -trigraphs -undef -U@var{macro} @gol 478-Wp,@var{option} -Xpreprocessor @var{option} -no-integrated-cpp} 479 480@item Assembler Option 481@xref{Assembler Options,,Passing Options to the Assembler}. 482@gccoptlist{-Wa,@var{option} -Xassembler @var{option}} 483 484@item Linker Options 485@xref{Link Options,,Options for Linking}. 486@gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol 487-nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol 488-s -static -static-libgcc -static-libstdc++ @gol 489-static-libasan -static-libtsan -static-liblsan -static-libubsan @gol 490-static-libmpx -static-libmpxwrappers @gol 491-shared -shared-libgcc -symbolic @gol 492-T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol 493-u @var{symbol} -z @var{keyword}} 494 495@item Directory Options 496@xref{Directory Options,,Options for Directory Search}. 497@gccoptlist{-B@var{prefix} -I@var{dir} -iquote@var{dir} 498-iremap@var{src}:@var{dst} -L@var{dir} 499-specs=@var{file} -I- --sysroot=@var{dir}} 500 501@item Target Options 502@c I wrote this xref this way to avoid overfull hbox. -- rms 503@xref{Target Options}. 504@gccoptlist{-V @var{version} -b @var{machine}} 505@gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir} @gol 506-iquote@var{dir} -L@var{dir} -specs=@var{file} -I- @gol 507--sysroot=@var{dir} --no-sysroot-suffix} 508 509@item Machine Dependent Options 510@xref{Submodel Options,,Hardware Models and Configurations}. 511@c This list is ordered alphanumerically by subsection name. 512@c Try and put the significant identifier (CPU or system) first, 513@c so users have a clue at guessing where the ones they want will be. 514 515@emph{AArch64 Options} 516@gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol 517-mgeneral-regs-only @gol 518-mcmodel=tiny -mcmodel=small -mcmodel=large @gol 519-mstrict-align @gol 520-momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol 521-mtls-dialect=desc -mtls-dialect=traditional @gol 522-mfix-cortex-a53-835769 -mno-fix-cortex-a53-835769 @gol 523-mfix-cortex-a53-843419 -mno-fix-cortex-a53-843419 @gol 524-march=@var{name} -mcpu=@var{name} -mtune=@var{name}} 525 526@emph{Adapteva Epiphany Options} 527@gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol 528-mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol 529-msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol 530-mround-nearest -mlong-calls -mshort-calls -msmall16 @gol 531-mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol 532-msplit-vecmove-early -m1reg-@var{reg}} 533 534@emph{ARC Options} 535@gccoptlist{-mbarrel-shifter @gol 536-mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol 537-mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol 538-mea -mno-mpy -mmul32x16 -mmul64 @gol 539-mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol 540-mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol 541-mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol 542-mepilogue-cfi -mlong-calls -mmedium-calls -msdata @gol 543-mucb-mcount -mvolatile-cache @gol 544-malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol 545-mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol 546-mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol 547-mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol 548-mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol 549-mtune=@var{cpu} -mmultcost=@var{num} -munalign-prob-threshold=@var{probability}} 550 551@emph{ARM Options} 552@gccoptlist{-mapcs-frame -mno-apcs-frame @gol 553-mabi=@var{name} @gol 554-mapcs-stack-check -mno-apcs-stack-check @gol 555-mapcs-float -mno-apcs-float @gol 556-mapcs-reentrant -mno-apcs-reentrant @gol 557-msched-prolog -mno-sched-prolog @gol 558-mlittle-endian -mbig-endian @gol 559-mfloat-abi=@var{name} @gol 560-mfp16-format=@var{name} 561-mthumb-interwork -mno-thumb-interwork @gol 562-mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol 563-mtune=@var{name} -mprint-tune-info @gol 564-mstructure-size-boundary=@var{n} @gol 565-mabort-on-noreturn @gol 566-mlong-calls -mno-long-calls @gol 567-msingle-pic-base -mno-single-pic-base @gol 568-mpic-register=@var{reg} @gol 569-mnop-fun-dllimport @gol 570-mpoke-function-name @gol 571-mthumb -marm @gol 572-mtpcs-frame -mtpcs-leaf-frame @gol 573-mcaller-super-interworking -mcallee-super-interworking @gol 574-mtp=@var{name} -mtls-dialect=@var{dialect} @gol 575-mword-relocations @gol 576-mfix-cortex-m3-ldrd @gol 577-munaligned-access @gol 578-mneon-for-64bits @gol 579-mslow-flash-data @gol 580-masm-syntax-unified @gol 581-mrestrict-it} 582 583@emph{AVR Options} 584@gccoptlist{-mmcu=@var{mcu} -maccumulate-args -mbranch-cost=@var{cost} @gol 585-mcall-prologues -mint8 -mn_flash=@var{size} -mno-interrupts @gol 586-mrelax -mrmw -mstrict-X -mtiny-stack -nodevicelib -Waddr-space-convert @gol 587-Wmisspelled-isr} 588 589@emph{Blackfin Options} 590@gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol 591-msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol 592-mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol 593-mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol 594-mno-id-shared-library -mshared-library-id=@var{n} @gol 595-mleaf-id-shared-library -mno-leaf-id-shared-library @gol 596-msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol 597-mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol 598-micplb} 599 600@emph{C6X Options} 601@gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol 602-msim -msdata=@var{sdata-type}} 603 604@emph{CRIS Options} 605@gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol 606-mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol 607-metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol 608-mstack-align -mdata-align -mconst-align @gol 609-m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol 610-melf -maout -melinux -mlinux -sim -sim2 @gol 611-mmul-bug-workaround -mno-mul-bug-workaround} 612 613@emph{CR16 Options} 614@gccoptlist{-mmac @gol 615-mcr16cplus -mcr16c @gol 616-msim -mint32 -mbit-ops 617-mdata-model=@var{model}} 618 619@emph{Darwin Options} 620@gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol 621-arch_only -bind_at_load -bundle -bundle_loader @gol 622-client_name -compatibility_version -current_version @gol 623-dead_strip @gol 624-dependency-file -dylib_file -dylinker_install_name @gol 625-dynamic -dynamiclib -exported_symbols_list @gol 626-filelist -flat_namespace -force_cpusubtype_ALL @gol 627-force_flat_namespace -headerpad_max_install_names @gol 628-iframework @gol 629-image_base -init -install_name -keep_private_externs @gol 630-multi_module -multiply_defined -multiply_defined_unused @gol 631-noall_load -no_dead_strip_inits_and_terms @gol 632-nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol 633-pagezero_size -prebind -prebind_all_twolevel_modules @gol 634-private_bundle -read_only_relocs -sectalign @gol 635-sectobjectsymbols -whyload -seg1addr @gol 636-sectcreate -sectobjectsymbols -sectorder @gol 637-segaddr -segs_read_only_addr -segs_read_write_addr @gol 638-seg_addr_table -seg_addr_table_filename -seglinkedit @gol 639-segprot -segs_read_only_addr -segs_read_write_addr @gol 640-single_module -static -sub_library -sub_umbrella @gol 641-twolevel_namespace -umbrella -undefined @gol 642-unexported_symbols_list -weak_reference_mismatches @gol 643-whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol 644-mkernel -mone-byte-bool} 645 646@emph{DEC Alpha Options} 647@gccoptlist{-mno-fp-regs -msoft-float @gol 648-mieee -mieee-with-inexact -mieee-conformant @gol 649-mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol 650-mtrap-precision=@var{mode} -mbuild-constants @gol 651-mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol 652-mbwx -mmax -mfix -mcix @gol 653-mfloat-vax -mfloat-ieee @gol 654-mexplicit-relocs -msmall-data -mlarge-data @gol 655-msmall-text -mlarge-text @gol 656-mmemory-latency=@var{time}} 657 658@emph{FR30 Options} 659@gccoptlist{-msmall-model -mno-lsim} 660 661@emph{FRV Options} 662@gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol 663-mhard-float -msoft-float @gol 664-malloc-cc -mfixed-cc -mdword -mno-dword @gol 665-mdouble -mno-double @gol 666-mmedia -mno-media -mmuladd -mno-muladd @gol 667-mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol 668-mlinked-fp -mlong-calls -malign-labels @gol 669-mlibrary-pic -macc-4 -macc-8 @gol 670-mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol 671-moptimize-membar -mno-optimize-membar @gol 672-mscc -mno-scc -mcond-exec -mno-cond-exec @gol 673-mvliw-branch -mno-vliw-branch @gol 674-mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol 675-mno-nested-cond-exec -mtomcat-stats @gol 676-mTLS -mtls @gol 677-mcpu=@var{cpu}} 678 679@emph{GNU/Linux Options} 680@gccoptlist{-mglibc -muclibc -mbionic -mandroid @gol 681-tno-android-cc -tno-android-ld} 682 683@emph{H8/300 Options} 684@gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300} 685 686@emph{HPPA Options} 687@gccoptlist{-march=@var{architecture-type} @gol 688-mdisable-fpregs -mdisable-indexing @gol 689-mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol 690-mfixed-range=@var{register-range} @gol 691-mjump-in-delay -mlinker-opt -mlong-calls @gol 692-mlong-load-store -mno-disable-fpregs @gol 693-mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol 694-mno-jump-in-delay -mno-long-load-store @gol 695-mno-portable-runtime -mno-soft-float @gol 696-mno-space-regs -msoft-float -mpa-risc-1-0 @gol 697-mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol 698-mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol 699-munix=@var{unix-std} -nolibdld -static -threads} 700 701@emph{IA-64 Options} 702@gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol 703-mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol 704-mconstant-gp -mauto-pic -mfused-madd @gol 705-minline-float-divide-min-latency @gol 706-minline-float-divide-max-throughput @gol 707-mno-inline-float-divide @gol 708-minline-int-divide-min-latency @gol 709-minline-int-divide-max-throughput @gol 710-mno-inline-int-divide @gol 711-minline-sqrt-min-latency -minline-sqrt-max-throughput @gol 712-mno-inline-sqrt @gol 713-mdwarf2-asm -mearly-stop-bits @gol 714-mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol 715-mtune=@var{cpu-type} -milp32 -mlp64 @gol 716-msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol 717-msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol 718-msched-spec-ldc -msched-spec-control-ldc @gol 719-msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol 720-msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol 721-msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol 722-msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}} 723 724@emph{LM32 Options} 725@gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol 726-msign-extend-enabled -muser-enabled} 727 728@emph{M32R/D Options} 729@gccoptlist{-m32r2 -m32rx -m32r @gol 730-mdebug @gol 731-malign-loops -mno-align-loops @gol 732-missue-rate=@var{number} @gol 733-mbranch-cost=@var{number} @gol 734-mmodel=@var{code-size-model-type} @gol 735-msdata=@var{sdata-type} @gol 736-mno-flush-func -mflush-func=@var{name} @gol 737-mno-flush-trap -mflush-trap=@var{number} @gol 738-G @var{num}} 739 740@emph{M32C Options} 741@gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}} 742 743@emph{M680x0 Options} 744@gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol 745-m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol 746-m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol 747-mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol 748-mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol 749-mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol 750-malign-int -mstrict-align -msep-data -mno-sep-data @gol 751-mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol 752-mxgot -mno-xgot} 753 754@emph{MCore Options} 755@gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol 756-mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol 757-m4byte-functions -mno-4byte-functions -mcallgraph-data @gol 758-mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol 759-mlittle-endian -mbig-endian -m210 -m340 -mstack-increment} 760 761@emph{MeP Options} 762@gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol 763-mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol 764-mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol 765-mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol 766-mtiny=@var{n}} 767 768@emph{MicroBlaze Options} 769@gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol 770-mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol 771-mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol 772-mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol 773-mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}} 774 775@emph{MIPS Options} 776@gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol 777-mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol 778-mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol 779-mips16 -mno-mips16 -mflip-mips16 @gol 780-minterlink-compressed -mno-interlink-compressed @gol 781-minterlink-mips16 -mno-interlink-mips16 @gol 782-mabi=@var{abi} -mabicalls -mno-abicalls @gol 783-mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol 784-mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol 785-mno-float -msingle-float -mdouble-float @gol 786-modd-spreg -mno-odd-spreg @gol 787-mabs=@var{mode} -mnan=@var{encoding} @gol 788-mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol 789-mmcu -mmno-mcu @gol 790-meva -mno-eva @gol 791-mvirt -mno-virt @gol 792-mxpa -mno-xpa @gol 793-mmicromips -mno-micromips @gol 794-mfpu=@var{fpu-type} @gol 795-msmartmips -mno-smartmips @gol 796-mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol 797-mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol 798-mlong64 -mlong32 -msym32 -mno-sym32 @gol 799-G@var{num} -mlocal-sdata -mno-local-sdata @gol 800-mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol 801-membedded-data -mno-embedded-data @gol 802-muninit-const-in-rodata -mno-uninit-const-in-rodata @gol 803-mcode-readable=@var{setting} @gol 804-msplit-addresses -mno-split-addresses @gol 805-mexplicit-relocs -mno-explicit-relocs @gol 806-mcheck-zero-division -mno-check-zero-division @gol 807-mdivide-traps -mdivide-breaks @gol 808-mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol 809-mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol 810-mfix-24k -mno-fix-24k @gol 811-mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol 812-mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol 813-mfix-vr4120 -mno-fix-vr4120 @gol 814-mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol 815-mflush-func=@var{func} -mno-flush-func @gol 816-mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol 817-mfp-exceptions -mno-fp-exceptions @gol 818-mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol 819-mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address} 820 821@emph{MMIX Options} 822@gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol 823-mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol 824-melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol 825-mno-base-addresses -msingle-exit -mno-single-exit} 826 827@emph{MN10300 Options} 828@gccoptlist{-mmult-bug -mno-mult-bug @gol 829-mno-am33 -mam33 -mam33-2 -mam34 @gol 830-mtune=@var{cpu-type} @gol 831-mreturn-pointer-on-d0 @gol 832-mno-crt0 -mrelax -mliw -msetlb} 833 834@emph{Moxie Options} 835@gccoptlist{-meb -mel -mmul.x -mno-crt0} 836 837@emph{MSP430 Options} 838@gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol 839-mhwmult= -minrt} 840 841@emph{NDS32 Options} 842@gccoptlist{-mbig-endian -mlittle-endian @gol 843-mreduced-regs -mfull-regs @gol 844-mcmov -mno-cmov @gol 845-mperf-ext -mno-perf-ext @gol 846-mv3push -mno-v3push @gol 847-m16bit -mno-16bit @gol 848-misr-vector-size=@var{num} @gol 849-mcache-block-size=@var{num} @gol 850-march=@var{arch} @gol 851-mcmodel=@var{code-model} @gol 852-mctor-dtor -mrelax} 853 854@emph{Nios II Options} 855@gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol 856-mel -meb @gol 857-mno-bypass-cache -mbypass-cache @gol 858-mno-cache-volatile -mcache-volatile @gol 859-mno-fast-sw-div -mfast-sw-div @gol 860-mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol 861-mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol 862-mcustom-fpu-cfg=@var{name} @gol 863-mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name}} 864 865@emph{Nvidia PTX Options} 866@gccoptlist{-m32 -m64 -mmainkernel} 867 868@emph{PDP-11 Options} 869@gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol 870-mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol 871-mint16 -mno-int32 -mfloat32 -mno-float64 @gol 872-mfloat64 -mno-float32 -mabshi -mno-abshi @gol 873-mbranch-expensive -mbranch-cheap @gol 874-munix-asm -mdec-asm} 875 876@emph{picoChip Options} 877@gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol 878-msymbol-as-address -mno-inefficient-warnings} 879 880@emph{PowerPC Options} 881See RS/6000 and PowerPC Options. 882 883@emph{RL78 Options} 884@gccoptlist{-msim -mmul=none -mmul=g13 -mmul=rl78 @gol 885-m64bit-doubles -m32bit-doubles} 886 887@emph{RS/6000 and PowerPC Options} 888@gccoptlist{-mcpu=@var{cpu-type} @gol 889-mtune=@var{cpu-type} @gol 890-mcmodel=@var{code-model} @gol 891-mpowerpc64 @gol 892-maltivec -mno-altivec @gol 893-mpowerpc-gpopt -mno-powerpc-gpopt @gol 894-mpowerpc-gfxopt -mno-powerpc-gfxopt @gol 895-mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol 896-mfprnd -mno-fprnd @gol 897-mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol 898-mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol 899-m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol 900-malign-power -malign-natural @gol 901-msoft-float -mhard-float -mmultiple -mno-multiple @gol 902-msingle-float -mdouble-float -msimple-fpu @gol 903-mstring -mno-string -mupdate -mno-update @gol 904-mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol 905-mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol 906-mstrict-align -mno-strict-align -mrelocatable @gol 907-mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol 908-mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol 909-mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol 910-mprioritize-restricted-insns=@var{priority} @gol 911-msched-costly-dep=@var{dependence_type} @gol 912-minsert-sched-nops=@var{scheme} @gol 913-mcall-sysv -mcall-netbsd @gol 914-maix-struct-return -msvr4-struct-return @gol 915-mabi=@var{abi-type} -msecure-plt -mbss-plt @gol 916-mblock-move-inline-limit=@var{num} @gol 917-misel -mno-isel @gol 918-misel=yes -misel=no @gol 919-mspe -mno-spe @gol 920-mspe=yes -mspe=no @gol 921-mpaired @gol 922-mgen-cell-microcode -mwarn-cell-microcode @gol 923-mvrsave -mno-vrsave @gol 924-mmulhw -mno-mulhw @gol 925-mdlmzb -mno-dlmzb @gol 926-mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol 927-mprototype -mno-prototype @gol 928-msim -mmvme -mads -myellowknife -memb -msdata @gol 929-msdata=@var{opt} -mvxworks -G @var{num} -pthread @gol 930-mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol 931-mno-recip-precision @gol 932-mveclibabi=@var{type} -mfriz -mno-friz @gol 933-mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol 934-msave-toc-indirect -mno-save-toc-indirect @gol 935-mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol 936-mcrypto -mno-crypto -mhtm -mno-htm -mdirect-move -mno-direct-move @gol 937-mquad-memory -mno-quad-memory @gol 938-mquad-memory-atomic -mno-quad-memory-atomic @gol 939-mcompat-align-parm -mno-compat-align-parm @gol 940-mupper-regs-df -mno-upper-regs-df -mupper-regs-sf -mno-upper-regs-sf @gol 941-mupper-regs -mno-upper-regs} 942 943@emph{RX Options} 944@gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol 945-mcpu=@gol 946-mbig-endian-data -mlittle-endian-data @gol 947-msmall-data @gol 948-msim -mno-sim@gol 949-mas100-syntax -mno-as100-syntax@gol 950-mrelax@gol 951-mmax-constant-size=@gol 952-mint-register=@gol 953-mpid@gol 954-mno-warn-multiple-fast-interrupts@gol 955-msave-acc-in-interrupts} 956 957@emph{S/390 and zSeries Options} 958@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol 959-mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol 960-mlong-double-64 -mlong-double-128 @gol 961-mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol 962-msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol 963-m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol 964-mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol 965-mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol 966-mhotpatch=@var{halfwords},@var{halfwords}} 967 968@emph{Score Options} 969@gccoptlist{-meb -mel @gol 970-mnhwloop @gol 971-muls @gol 972-mmac @gol 973-mscore5 -mscore5u -mscore7 -mscore7d} 974 975@emph{SH Options} 976@gccoptlist{-m1 -m2 -m2e @gol 977-m2a-nofpu -m2a-single-only -m2a-single -m2a @gol 978-m3 -m3e @gol 979-m4-nofpu -m4-single-only -m4-single -m4 @gol 980-m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol 981-m5-64media -m5-64media-nofpu @gol 982-m5-32media -m5-32media-nofpu @gol 983-m5-compact -m5-compact-nofpu @gol 984-mb -ml -mdalign -mrelax @gol 985-mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol 986-mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol 987-mspace -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol 988-mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol 989-mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol 990-maccumulate-outgoing-args -minvalid-symbols @gol 991-matomic-model=@var{atomic-model} @gol 992-mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol 993-mcbranch-force-delay-slot @gol 994-mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol 995-mpretend-cmove -mtas} 996 997@emph{Solaris 2 Options} 998@gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol 999-pthreads -pthread} 1000 1001@emph{SPARC Options} 1002@gccoptlist{-mcpu=@var{cpu-type} @gol 1003-mtune=@var{cpu-type} @gol 1004-mcmodel=@var{code-model} @gol 1005-mmemory-model=@var{mem-model} @gol 1006-m32 -m64 -mapp-regs -mno-app-regs @gol 1007-mfaster-structs -mno-faster-structs -mflat -mno-flat @gol 1008-mfpu -mno-fpu -mhard-float -msoft-float @gol 1009-mhard-quad-float -msoft-quad-float @gol 1010-mstack-bias -mno-stack-bias @gol 1011-munaligned-doubles -mno-unaligned-doubles @gol 1012-muser-mode -mno-user-mode @gol 1013-mv8plus -mno-v8plus -mvis -mno-vis @gol 1014-mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol 1015-mcbcond -mno-cbcond @gol 1016-mfmaf -mno-fmaf -mpopc -mno-popc @gol 1017-mfix-at697f -mfix-ut699} 1018 1019@emph{SPU Options} 1020@gccoptlist{-mwarn-reloc -merror-reloc @gol 1021-msafe-dma -munsafe-dma @gol 1022-mbranch-hints @gol 1023-msmall-mem -mlarge-mem -mstdmain @gol 1024-mfixed-range=@var{register-range} @gol 1025-mea32 -mea64 @gol 1026-maddress-space-conversion -mno-address-space-conversion @gol 1027-mcache-size=@var{cache-size} @gol 1028-matomic-updates -mno-atomic-updates} 1029 1030@emph{System V Options} 1031@gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}} 1032 1033@emph{TILE-Gx Options} 1034@gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol 1035-mcmodel=@var{code-model}} 1036 1037@emph{TILEPro Options} 1038@gccoptlist{-mcpu=@var{cpu} -m32} 1039 1040@emph{V850 Options} 1041@gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol 1042-mprolog-function -mno-prolog-function -mspace @gol 1043-mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol 1044-mapp-regs -mno-app-regs @gol 1045-mdisable-callt -mno-disable-callt @gol 1046-mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol 1047-mv850e -mv850 -mv850e3v5 @gol 1048-mloop @gol 1049-mrelax @gol 1050-mlong-jumps @gol 1051-msoft-float @gol 1052-mhard-float @gol 1053-mgcc-abi @gol 1054-mrh850-abi @gol 1055-mbig-switch} 1056 1057@emph{VAX Options} 1058@gccoptlist{-mg -mgnu -munix} 1059 1060@emph{Visium Options} 1061@gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol 1062-mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode} 1063 1064@emph{VMS Options} 1065@gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol 1066-mpointer-size=@var{size}} 1067 1068@emph{VxWorks Options} 1069@gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol 1070-Xbind-lazy -Xbind-now} 1071 1072@emph{x86 Options} 1073@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol 1074-mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol 1075-mfpmath=@var{unit} @gol 1076-masm=@var{dialect} -mno-fancy-math-387 @gol 1077-mno-fp-ret-in-387 -msoft-float @gol 1078-mno-wide-multiply -mrtd -malign-double @gol 1079-mpreferred-stack-boundary=@var{num} @gol 1080-mincoming-stack-boundary=@var{num} @gol 1081-mcld -mcx16 -msahf -mmovbe -mcrc32 @gol 1082-mrecip -mrecip=@var{opt} @gol 1083-mvzeroupper -mprefer-avx128 @gol 1084-mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol 1085-mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -msha @gol 1086-maes -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mprefetchwt1 @gol 1087-mclflushopt -mxsavec -mxsaves @gol 1088-msse4a -m3dnow -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop -mlzcnt @gol 1089-mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp -mmpx -mmwaitx -mthreads @gol 1090-mno-align-stringops -minline-all-stringops @gol 1091-minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol 1092-mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol 1093-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol 1094-m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol 1095-mregparm=@var{num} -msseregparm @gol 1096-mveclibabi=@var{type} -mvect8-ret-in-mem @gol 1097-mpc32 -mpc64 -mpc80 -mstackrealign @gol 1098-momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol 1099-mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol 1100-m32 -m64 -mx32 -m16 -mlarge-data-threshold=@var{num} @gol 1101-msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol 1102-mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol 1103-malign-data=@var{type} -mstack-protector-guard=@var{guard}} 1104 1105@emph{x86 Windows Options} 1106@gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol 1107-mnop-fun-dllimport -mthread @gol 1108-municode -mwin32 -mwindows -fno-set-stack-executable} 1109 1110@emph{Xstormy16 Options} 1111@gccoptlist{-msim} 1112 1113@emph{Xtensa Options} 1114@gccoptlist{-mconst16 -mno-const16 @gol 1115-mfused-madd -mno-fused-madd @gol 1116-mforce-no-pic @gol 1117-mserialize-volatile -mno-serialize-volatile @gol 1118-mtext-section-literals -mno-text-section-literals @gol 1119-mtarget-align -mno-target-align @gol 1120-mlongcalls -mno-longcalls} 1121 1122@emph{zSeries Options} 1123See S/390 and zSeries Options. 1124 1125@item Code Generation Options 1126@xref{Code Gen Options,,Options for Code Generation Conventions}. 1127@gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol 1128-ffixed-@var{reg} -fexceptions @gol 1129-fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol 1130-fasynchronous-unwind-tables @gol 1131-fno-gnu-unique @gol 1132-finhibit-size-directive -finstrument-functions @gol 1133-finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol 1134-finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @gol 1135-fno-common -fno-ident @gol 1136-fpcc-struct-return -fpic -fPIC -fpie -fPIE @gol 1137-fno-jump-tables @gol 1138-frecord-gcc-switches @gol 1139-freg-struct-return -fshort-enums @gol 1140-fshort-double -fshort-wchar @gol 1141-fverbose-asm -fpack-struct[=@var{n}] -fstack-check @gol 1142-fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol 1143-fno-stack-limit -fsplit-stack @gol 1144-fleading-underscore -ftls-model=@var{model} @gol 1145-fstack-reuse=@var{reuse_level} @gol 1146-ftrapv -fwrapv -fbounds-check @gol 1147-fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol 1148-fstrict-volatile-bitfields -fsync-libcalls} 1149@end table 1150 1151 1152@node Overall Options 1153@section Options Controlling the Kind of Output 1154 1155Compilation can involve up to four stages: preprocessing, compilation 1156proper, assembly and linking, always in that order. GCC is capable of 1157preprocessing and compiling several files either into several 1158assembler input files, or into one assembler input file; then each 1159assembler input file produces an object file, and linking combines all 1160the object files (those newly compiled, and those specified as input) 1161into an executable file. 1162 1163@cindex file name suffix 1164For any given input file, the file name suffix determines what kind of 1165compilation is done: 1166 1167@table @gcctabopt 1168@item @var{file}.c 1169C source code that must be preprocessed. 1170 1171@item @var{file}.i 1172C source code that should not be preprocessed. 1173 1174@item @var{file}.ii 1175C++ source code that should not be preprocessed. 1176 1177@item @var{file}.m 1178Objective-C source code. Note that you must link with the @file{libobjc} 1179library to make an Objective-C program work. 1180 1181@item @var{file}.mi 1182Objective-C source code that should not be preprocessed. 1183 1184@item @var{file}.mm 1185@itemx @var{file}.M 1186Objective-C++ source code. Note that you must link with the @file{libobjc} 1187library to make an Objective-C++ program work. Note that @samp{.M} refers 1188to a literal capital M@. 1189 1190@item @var{file}.mii 1191Objective-C++ source code that should not be preprocessed. 1192 1193@item @var{file}.h 1194C, C++, Objective-C or Objective-C++ header file to be turned into a 1195precompiled header (default), or C, C++ header file to be turned into an 1196Ada spec (via the @option{-fdump-ada-spec} switch). 1197 1198@item @var{file}.cc 1199@itemx @var{file}.cp 1200@itemx @var{file}.cxx 1201@itemx @var{file}.cpp 1202@itemx @var{file}.CPP 1203@itemx @var{file}.c++ 1204@itemx @var{file}.C 1205C++ source code that must be preprocessed. Note that in @samp{.cxx}, 1206the last two letters must both be literally @samp{x}. Likewise, 1207@samp{.C} refers to a literal capital C@. 1208 1209@item @var{file}.mm 1210@itemx @var{file}.M 1211Objective-C++ source code that must be preprocessed. 1212 1213@item @var{file}.mii 1214Objective-C++ source code that should not be preprocessed. 1215 1216@item @var{file}.hh 1217@itemx @var{file}.H 1218@itemx @var{file}.hp 1219@itemx @var{file}.hxx 1220@itemx @var{file}.hpp 1221@itemx @var{file}.HPP 1222@itemx @var{file}.h++ 1223@itemx @var{file}.tcc 1224C++ header file to be turned into a precompiled header or Ada spec. 1225 1226@item @var{file}.f 1227@itemx @var{file}.for 1228@itemx @var{file}.ftn 1229Fixed form Fortran source code that should not be preprocessed. 1230 1231@item @var{file}.F 1232@itemx @var{file}.FOR 1233@itemx @var{file}.fpp 1234@itemx @var{file}.FPP 1235@itemx @var{file}.FTN 1236Fixed form Fortran source code that must be preprocessed (with the traditional 1237preprocessor). 1238 1239@item @var{file}.f90 1240@itemx @var{file}.f95 1241@itemx @var{file}.f03 1242@itemx @var{file}.f08 1243Free form Fortran source code that should not be preprocessed. 1244 1245@item @var{file}.F90 1246@itemx @var{file}.F95 1247@itemx @var{file}.F03 1248@itemx @var{file}.F08 1249Free form Fortran source code that must be preprocessed (with the 1250traditional preprocessor). 1251 1252@item @var{file}.go 1253Go source code. 1254 1255@c FIXME: Descriptions of Java file types. 1256@c @var{file}.java 1257@c @var{file}.class 1258@c @var{file}.zip 1259@c @var{file}.jar 1260 1261@item @var{file}.ads 1262Ada source code file that contains a library unit declaration (a 1263declaration of a package, subprogram, or generic, or a generic 1264instantiation), or a library unit renaming declaration (a package, 1265generic, or subprogram renaming declaration). Such files are also 1266called @dfn{specs}. 1267 1268@item @var{file}.adb 1269Ada source code file containing a library unit body (a subprogram or 1270package body). Such files are also called @dfn{bodies}. 1271 1272@c GCC also knows about some suffixes for languages not yet included: 1273@c Pascal: 1274@c @var{file}.p 1275@c @var{file}.pas 1276@c Ratfor: 1277@c @var{file}.r 1278 1279@item @var{file}.s 1280Assembler code. 1281 1282@item @var{file}.S 1283@itemx @var{file}.sx 1284Assembler code that must be preprocessed. 1285 1286@item @var{other} 1287An object file to be fed straight into linking. 1288Any file name with no recognized suffix is treated this way. 1289@end table 1290 1291@opindex x 1292You can specify the input language explicitly with the @option{-x} option: 1293 1294@table @gcctabopt 1295@item -x @var{language} 1296Specify explicitly the @var{language} for the following input files 1297(rather than letting the compiler choose a default based on the file 1298name suffix). This option applies to all following input files until 1299the next @option{-x} option. Possible values for @var{language} are: 1300@smallexample 1301c c-header cpp-output 1302c++ c++-header c++-cpp-output 1303objective-c objective-c-header objective-c-cpp-output 1304objective-c++ objective-c++-header objective-c++-cpp-output 1305assembler assembler-with-cpp 1306ada 1307f77 f77-cpp-input f95 f95-cpp-input 1308go 1309java 1310@end smallexample 1311 1312@item -x none 1313Turn off any specification of a language, so that subsequent files are 1314handled according to their file name suffixes (as they are if @option{-x} 1315has not been used at all). 1316 1317@item -pass-exit-codes 1318@opindex pass-exit-codes 1319Normally the @command{gcc} program exits with the code of 1 if any 1320phase of the compiler returns a non-success return code. If you specify 1321@option{-pass-exit-codes}, the @command{gcc} program instead returns with 1322the numerically highest error produced by any phase returning an error 1323indication. The C, C++, and Fortran front ends return 4 if an internal 1324compiler error is encountered. 1325@end table 1326 1327If you only want some of the stages of compilation, you can use 1328@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and 1329one of the options @option{-c}, @option{-S}, or @option{-E} to say where 1330@command{gcc} is to stop. Note that some combinations (for example, 1331@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all. 1332 1333@table @gcctabopt 1334@item -c 1335@opindex c 1336Compile or assemble the source files, but do not link. The linking 1337stage simply is not done. The ultimate output is in the form of an 1338object file for each source file. 1339 1340By default, the object file name for a source file is made by replacing 1341the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}. 1342 1343Unrecognized input files, not requiring compilation or assembly, are 1344ignored. 1345 1346@item -S 1347@opindex S 1348Stop after the stage of compilation proper; do not assemble. The output 1349is in the form of an assembler code file for each non-assembler input 1350file specified. 1351 1352By default, the assembler file name for a source file is made by 1353replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}. 1354 1355Input files that don't require compilation are ignored. 1356 1357@item -E 1358@opindex E 1359Stop after the preprocessing stage; do not run the compiler proper. The 1360output is in the form of preprocessed source code, which is sent to the 1361standard output. 1362 1363Input files that don't require preprocessing are ignored. 1364 1365@cindex output file option 1366@item -o @var{file} 1367@opindex o 1368Place output in file @var{file}. This applies to whatever 1369sort of output is being produced, whether it be an executable file, 1370an object file, an assembler file or preprocessed C code. 1371 1372If @option{-o} is not specified, the default is to put an executable 1373file in @file{a.out}, the object file for 1374@file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its 1375assembler file in @file{@var{source}.s}, a precompiled header file in 1376@file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on 1377standard output. 1378 1379@item -v 1380@opindex v 1381Print (on standard error output) the commands executed to run the stages 1382of compilation. Also print the version number of the compiler driver 1383program and of the preprocessor and the compiler proper. 1384 1385@item -### 1386@opindex ### 1387Like @option{-v} except the commands are not executed and arguments 1388are quoted unless they contain only alphanumeric characters or @code{./-_}. 1389This is useful for shell scripts to capture the driver-generated command lines. 1390 1391@item -pipe 1392@opindex pipe 1393Use pipes rather than temporary files for communication between the 1394various stages of compilation. This fails to work on some systems where 1395the assembler is unable to read from a pipe; but the GNU assembler has 1396no trouble. 1397 1398@item --help 1399@opindex help 1400Print (on the standard output) a description of the command-line options 1401understood by @command{gcc}. If the @option{-v} option is also specified 1402then @option{--help} is also passed on to the various processes 1403invoked by @command{gcc}, so that they can display the command-line options 1404they accept. If the @option{-Wextra} option has also been specified 1405(prior to the @option{--help} option), then command-line options that 1406have no documentation associated with them are also displayed. 1407 1408@item --target-help 1409@opindex target-help 1410Print (on the standard output) a description of target-specific command-line 1411options for each tool. For some targets extra target-specific 1412information may also be printed. 1413 1414@item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]} 1415Print (on the standard output) a description of the command-line 1416options understood by the compiler that fit into all specified classes 1417and qualifiers. These are the supported classes: 1418 1419@table @asis 1420@item @samp{optimizers} 1421Display all of the optimization options supported by the 1422compiler. 1423 1424@item @samp{warnings} 1425Display all of the options controlling warning messages 1426produced by the compiler. 1427 1428@item @samp{target} 1429Display target-specific options. Unlike the 1430@option{--target-help} option however, target-specific options of the 1431linker and assembler are not displayed. This is because those 1432tools do not currently support the extended @option{--help=} syntax. 1433 1434@item @samp{params} 1435Display the values recognized by the @option{--param} 1436option. 1437 1438@item @var{language} 1439Display the options supported for @var{language}, where 1440@var{language} is the name of one of the languages supported in this 1441version of GCC@. 1442 1443@item @samp{common} 1444Display the options that are common to all languages. 1445@end table 1446 1447These are the supported qualifiers: 1448 1449@table @asis 1450@item @samp{undocumented} 1451Display only those options that are undocumented. 1452 1453@item @samp{joined} 1454Display options taking an argument that appears after an equal 1455sign in the same continuous piece of text, such as: 1456@samp{--help=target}. 1457 1458@item @samp{separate} 1459Display options taking an argument that appears as a separate word 1460following the original option, such as: @samp{-o output-file}. 1461@end table 1462 1463Thus for example to display all the undocumented target-specific 1464switches supported by the compiler, use: 1465 1466@smallexample 1467--help=target,undocumented 1468@end smallexample 1469 1470The sense of a qualifier can be inverted by prefixing it with the 1471@samp{^} character, so for example to display all binary warning 1472options (i.e., ones that are either on or off and that do not take an 1473argument) that have a description, use: 1474 1475@smallexample 1476--help=warnings,^joined,^undocumented 1477@end smallexample 1478 1479The argument to @option{--help=} should not consist solely of inverted 1480qualifiers. 1481 1482Combining several classes is possible, although this usually 1483restricts the output so much that there is nothing to display. One 1484case where it does work, however, is when one of the classes is 1485@var{target}. For example, to display all the target-specific 1486optimization options, use: 1487 1488@smallexample 1489--help=target,optimizers 1490@end smallexample 1491 1492The @option{--help=} option can be repeated on the command line. Each 1493successive use displays its requested class of options, skipping 1494those that have already been displayed. 1495 1496If the @option{-Q} option appears on the command line before the 1497@option{--help=} option, then the descriptive text displayed by 1498@option{--help=} is changed. Instead of describing the displayed 1499options, an indication is given as to whether the option is enabled, 1500disabled or set to a specific value (assuming that the compiler 1501knows this at the point where the @option{--help=} option is used). 1502 1503Here is a truncated example from the ARM port of @command{gcc}: 1504 1505@smallexample 1506 % gcc -Q -mabi=2 --help=target -c 1507 The following options are target specific: 1508 -mabi= 2 1509 -mabort-on-noreturn [disabled] 1510 -mapcs [disabled] 1511@end smallexample 1512 1513The output is sensitive to the effects of previous command-line 1514options, so for example it is possible to find out which optimizations 1515are enabled at @option{-O2} by using: 1516 1517@smallexample 1518-Q -O2 --help=optimizers 1519@end smallexample 1520 1521Alternatively you can discover which binary optimizations are enabled 1522by @option{-O3} by using: 1523 1524@smallexample 1525gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts 1526gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts 1527diff /tmp/O2-opts /tmp/O3-opts | grep enabled 1528@end smallexample 1529 1530@item -no-canonical-prefixes 1531@opindex no-canonical-prefixes 1532Do not expand any symbolic links, resolve references to @samp{/../} 1533or @samp{/./}, or make the path absolute when generating a relative 1534prefix. 1535 1536@item --version 1537@opindex version 1538Display the version number and copyrights of the invoked GCC@. 1539 1540@item -wrapper 1541@opindex wrapper 1542Invoke all subcommands under a wrapper program. The name of the 1543wrapper program and its parameters are passed as a comma separated 1544list. 1545 1546@smallexample 1547gcc -c t.c -wrapper gdb,--args 1548@end smallexample 1549 1550@noindent 1551This invokes all subprograms of @command{gcc} under 1552@samp{gdb --args}, thus the invocation of @command{cc1} is 1553@samp{gdb --args cc1 @dots{}}. 1554 1555@item -fplugin=@var{name}.so 1556@opindex fplugin 1557Load the plugin code in file @var{name}.so, assumed to be a 1558shared object to be dlopen'd by the compiler. The base name of 1559the shared object file is used to identify the plugin for the 1560purposes of argument parsing (See 1561@option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below). 1562Each plugin should define the callback functions specified in the 1563Plugins API. 1564 1565@item -fplugin-arg-@var{name}-@var{key}=@var{value} 1566@opindex fplugin-arg 1567Define an argument called @var{key} with a value of @var{value} 1568for the plugin called @var{name}. 1569 1570@item -fdump-ada-spec@r{[}-slim@r{]} 1571@opindex fdump-ada-spec 1572For C and C++ source and include files, generate corresponding Ada specs. 1573@xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn, 1574GNAT User's Guide}, which provides detailed documentation on this feature. 1575 1576@item -fada-spec-parent=@var{unit} 1577@opindex fada-spec-parent 1578In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate 1579Ada specs as child units of parent @var{unit}. 1580 1581@item -fdump-go-spec=@var{file} 1582@opindex fdump-go-spec 1583For input files in any language, generate corresponding Go 1584declarations in @var{file}. This generates Go @code{const}, 1585@code{type}, @code{var}, and @code{func} declarations which may be a 1586useful way to start writing a Go interface to code written in some 1587other language. 1588 1589@include @value{srcdir}/../libiberty/at-file.texi 1590@end table 1591 1592@node Invoking G++ 1593@section Compiling C++ Programs 1594 1595@cindex suffixes for C++ source 1596@cindex C++ source file suffixes 1597C++ source files conventionally use one of the suffixes @samp{.C}, 1598@samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or 1599@samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp}, 1600@samp{.H}, or (for shared template code) @samp{.tcc}; and 1601preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes 1602files with these names and compiles them as C++ programs even if you 1603call the compiler the same way as for compiling C programs (usually 1604with the name @command{gcc}). 1605 1606@findex g++ 1607@findex c++ 1608However, the use of @command{gcc} does not add the C++ library. 1609@command{g++} is a program that calls GCC and automatically specifies linking 1610against the C++ library. It treats @samp{.c}, 1611@samp{.h} and @samp{.i} files as C++ source files instead of C source 1612files unless @option{-x} is used. This program is also useful when 1613precompiling a C header file with a @samp{.h} extension for use in C++ 1614compilations. On many systems, @command{g++} is also installed with 1615the name @command{c++}. 1616 1617@cindex invoking @command{g++} 1618When you compile C++ programs, you may specify many of the same 1619command-line options that you use for compiling programs in any 1620language; or command-line options meaningful for C and related 1621languages; or options that are meaningful only for C++ programs. 1622@xref{C Dialect Options,,Options Controlling C Dialect}, for 1623explanations of options for languages related to C@. 1624@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for 1625explanations of options that are meaningful only for C++ programs. 1626 1627@node C Dialect Options 1628@section Options Controlling C Dialect 1629@cindex dialect options 1630@cindex language dialect options 1631@cindex options, dialect 1632 1633The following options control the dialect of C (or languages derived 1634from C, such as C++, Objective-C and Objective-C++) that the compiler 1635accepts: 1636 1637@table @gcctabopt 1638@cindex ANSI support 1639@cindex ISO support 1640@item -ansi 1641@opindex ansi 1642In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is 1643equivalent to @option{-std=c++98}. 1644 1645This turns off certain features of GCC that are incompatible with ISO 1646C90 (when compiling C code), or of standard C++ (when compiling C++ code), 1647such as the @code{asm} and @code{typeof} keywords, and 1648predefined macros such as @code{unix} and @code{vax} that identify the 1649type of system you are using. It also enables the undesirable and 1650rarely used ISO trigraph feature. For the C compiler, 1651it disables recognition of C++ style @samp{//} comments as well as 1652the @code{inline} keyword. 1653 1654The alternate keywords @code{__asm__}, @code{__extension__}, 1655@code{__inline__} and @code{__typeof__} continue to work despite 1656@option{-ansi}. You would not want to use them in an ISO C program, of 1657course, but it is useful to put them in header files that might be included 1658in compilations done with @option{-ansi}. Alternate predefined macros 1659such as @code{__unix__} and @code{__vax__} are also available, with or 1660without @option{-ansi}. 1661 1662The @option{-ansi} option does not cause non-ISO programs to be 1663rejected gratuitously. For that, @option{-Wpedantic} is required in 1664addition to @option{-ansi}. @xref{Warning Options}. 1665 1666The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi} 1667option is used. Some header files may notice this macro and refrain 1668from declaring certain functions or defining certain macros that the 1669ISO standard doesn't call for; this is to avoid interfering with any 1670programs that might use these names for other things. 1671 1672Functions that are normally built in but do not have semantics 1673defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in 1674functions when @option{-ansi} is used. @xref{Other Builtins,,Other 1675built-in functions provided by GCC}, for details of the functions 1676affected. 1677 1678@item -std= 1679@opindex std 1680Determine the language standard. @xref{Standards,,Language Standards 1681Supported by GCC}, for details of these standard versions. This option 1682is currently only supported when compiling C or C++. 1683 1684The compiler can accept several base standards, such as @samp{c90} or 1685@samp{c++98}, and GNU dialects of those standards, such as 1686@samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the 1687compiler accepts all programs following that standard plus those 1688using GNU extensions that do not contradict it. For example, 1689@option{-std=c90} turns off certain features of GCC that are 1690incompatible with ISO C90, such as the @code{asm} and @code{typeof} 1691keywords, but not other GNU extensions that do not have a meaning in 1692ISO C90, such as omitting the middle term of a @code{?:} 1693expression. On the other hand, when a GNU dialect of a standard is 1694specified, all features supported by the compiler are enabled, even when 1695those features change the meaning of the base standard. As a result, some 1696strict-conforming programs may be rejected. The particular standard 1697is used by @option{-Wpedantic} to identify which features are GNU 1698extensions given that version of the standard. For example 1699@option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//} 1700comments, while @option{-std=gnu99 -Wpedantic} does not. 1701 1702A value for this option must be provided; possible values are 1703 1704@table @samp 1705@item c90 1706@itemx c89 1707@itemx iso9899:1990 1708Support all ISO C90 programs (certain GNU extensions that conflict 1709with ISO C90 are disabled). Same as @option{-ansi} for C code. 1710 1711@item iso9899:199409 1712ISO C90 as modified in amendment 1. 1713 1714@item c99 1715@itemx c9x 1716@itemx iso9899:1999 1717@itemx iso9899:199x 1718ISO C99. This standard is substantially completely supported, modulo 1719bugs and floating-point issues 1720(mainly but not entirely relating to optional C99 features from 1721Annexes F and G). See 1722@w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The 1723names @samp{c9x} and @samp{iso9899:199x} are deprecated. 1724 1725@item c11 1726@itemx c1x 1727@itemx iso9899:2011 1728ISO C11, the 2011 revision of the ISO C standard. This standard is 1729substantially completely supported, modulo bugs, floating-point issues 1730(mainly but not entirely relating to optional C11 features from 1731Annexes F and G) and the optional Annexes K (Bounds-checking 1732interfaces) and L (Analyzability). The name @samp{c1x} is deprecated. 1733 1734@item gnu90 1735@itemx gnu89 1736GNU dialect of ISO C90 (including some C99 features). 1737 1738@item gnu99 1739@itemx gnu9x 1740GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated. 1741 1742@item gnu11 1743@itemx gnu1x 1744GNU dialect of ISO C11. This is the default for C code. 1745The name @samp{gnu1x} is deprecated. 1746 1747@item c++98 1748@itemx c++03 1749The 1998 ISO C++ standard plus the 2003 technical corrigendum and some 1750additional defect reports. Same as @option{-ansi} for C++ code. 1751 1752@item gnu++98 1753@itemx gnu++03 1754GNU dialect of @option{-std=c++98}. This is the default for 1755C++ code. 1756 1757@item c++11 1758@itemx c++0x 1759The 2011 ISO C++ standard plus amendments. 1760The name @samp{c++0x} is deprecated. 1761 1762@item gnu++11 1763@itemx gnu++0x 1764GNU dialect of @option{-std=c++11}. 1765The name @samp{gnu++0x} is deprecated. 1766 1767@item c++14 1768@itemx c++1y 1769The 2014 ISO C++ standard plus amendments. 1770The name @samp{c++1y} is deprecated. 1771 1772@item gnu++14 1773@itemx gnu++1y 1774GNU dialect of @option{-std=c++14}. 1775The name @samp{gnu++1y} is deprecated. 1776 1777@item c++1z 1778The next revision of the ISO C++ standard, tentatively planned for 17792017. Support is highly experimental, and will almost certainly 1780change in incompatible ways in future releases. 1781 1782@item gnu++1z 1783GNU dialect of @option{-std=c++1z}. Support is highly experimental, 1784and will almost certainly change in incompatible ways in future 1785releases. 1786@end table 1787 1788@item -fgnu89-inline 1789@opindex fgnu89-inline 1790The option @option{-fgnu89-inline} tells GCC to use the traditional 1791GNU semantics for @code{inline} functions when in C99 mode. 1792@xref{Inline,,An Inline Function is As Fast As a Macro}. 1793Using this option is roughly equivalent to adding the 1794@code{gnu_inline} function attribute to all inline functions 1795(@pxref{Function Attributes}). 1796 1797The option @option{-fno-gnu89-inline} explicitly tells GCC to use the 1798C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it 1799specifies the default behavior). 1800This option is not supported in @option{-std=c90} or 1801@option{-std=gnu90} mode. 1802 1803The preprocessor macros @code{__GNUC_GNU_INLINE__} and 1804@code{__GNUC_STDC_INLINE__} may be used to check which semantics are 1805in effect for @code{inline} functions. @xref{Common Predefined 1806Macros,,,cpp,The C Preprocessor}. 1807 1808@item -aux-info @var{filename} 1809@opindex aux-info 1810Output to the given filename prototyped declarations for all functions 1811declared and/or defined in a translation unit, including those in header 1812files. This option is silently ignored in any language other than C@. 1813 1814Besides declarations, the file indicates, in comments, the origin of 1815each declaration (source file and line), whether the declaration was 1816implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or 1817@samp{O} for old, respectively, in the first character after the line 1818number and the colon), and whether it came from a declaration or a 1819definition (@samp{C} or @samp{F}, respectively, in the following 1820character). In the case of function definitions, a K&R-style list of 1821arguments followed by their declarations is also provided, inside 1822comments, after the declaration. 1823 1824@item -fallow-parameterless-variadic-functions 1825@opindex fallow-parameterless-variadic-functions 1826Accept variadic functions without named parameters. 1827 1828Although it is possible to define such a function, this is not very 1829useful as it is not possible to read the arguments. This is only 1830supported for C as this construct is allowed by C++. 1831 1832@item -fno-asm 1833@opindex fno-asm 1834Do not recognize @code{asm}, @code{inline} or @code{typeof} as a 1835keyword, so that code can use these words as identifiers. You can use 1836the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__} 1837instead. @option{-ansi} implies @option{-fno-asm}. 1838 1839In C++, this switch only affects the @code{typeof} keyword, since 1840@code{asm} and @code{inline} are standard keywords. You may want to 1841use the @option{-fno-gnu-keywords} flag instead, which has the same 1842effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this 1843switch only affects the @code{asm} and @code{typeof} keywords, since 1844@code{inline} is a standard keyword in ISO C99. 1845 1846@item -fno-builtin 1847@itemx -fno-builtin-@var{function} 1848@opindex fno-builtin 1849@cindex built-in functions 1850Don't recognize built-in functions that do not begin with 1851@samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in 1852functions provided by GCC}, for details of the functions affected, 1853including those which are not built-in functions when @option{-ansi} or 1854@option{-std} options for strict ISO C conformance are used because they 1855do not have an ISO standard meaning. 1856 1857GCC normally generates special code to handle certain built-in functions 1858more efficiently; for instance, calls to @code{alloca} may become single 1859instructions which adjust the stack directly, and calls to @code{memcpy} 1860may become inline copy loops. The resulting code is often both smaller 1861and faster, but since the function calls no longer appear as such, you 1862cannot set a breakpoint on those calls, nor can you change the behavior 1863of the functions by linking with a different library. In addition, 1864when a function is recognized as a built-in function, GCC may use 1865information about that function to warn about problems with calls to 1866that function, or to generate more efficient code, even if the 1867resulting code still contains calls to that function. For example, 1868warnings are given with @option{-Wformat} for bad calls to 1869@code{printf} when @code{printf} is built in and @code{strlen} is 1870known not to modify global memory. 1871 1872With the @option{-fno-builtin-@var{function}} option 1873only the built-in function @var{function} is 1874disabled. @var{function} must not begin with @samp{__builtin_}. If a 1875function is named that is not built-in in this version of GCC, this 1876option is ignored. There is no corresponding 1877@option{-fbuiltin-@var{function}} option; if you wish to enable 1878built-in functions selectively when using @option{-fno-builtin} or 1879@option{-ffreestanding}, you may define macros such as: 1880 1881@smallexample 1882#define abs(n) __builtin_abs ((n)) 1883#define strcpy(d, s) __builtin_strcpy ((d), (s)) 1884@end smallexample 1885 1886@item -fhosted 1887@opindex fhosted 1888@cindex hosted environment 1889 1890Assert that compilation targets a hosted environment. This implies 1891@option{-fbuiltin}. A hosted environment is one in which the 1892entire standard library is available, and in which @code{main} has a return 1893type of @code{int}. Examples are nearly everything except a kernel. 1894This is equivalent to @option{-fno-freestanding}. 1895 1896@item -ffreestanding 1897@opindex ffreestanding 1898@cindex hosted environment 1899 1900Assert that compilation targets a freestanding environment. This 1901implies @option{-fno-builtin}. A freestanding environment 1902is one in which the standard library may not exist, and program startup may 1903not necessarily be at @code{main}. The most obvious example is an OS kernel. 1904This is equivalent to @option{-fno-hosted}. 1905 1906@xref{Standards,,Language Standards Supported by GCC}, for details of 1907freestanding and hosted environments. 1908 1909@item -fopenacc 1910@opindex fopenacc 1911@cindex OpenACC accelerator programming 1912Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and 1913@code{!$acc} in Fortran. When @option{-fopenacc} is specified, the 1914compiler generates accelerated code according to the OpenACC Application 1915Programming Interface v2.0 @w{@uref{http://www.openacc.org/}}. This option 1916implies @option{-pthread}, and thus is only supported on targets that 1917have support for @option{-pthread}. 1918 1919Note that this is an experimental feature, incomplete, and subject to 1920change in future versions of GCC. See 1921@w{@uref{https://gcc.gnu.org/wiki/OpenACC}} for more information. 1922 1923@item -fopenmp 1924@opindex fopenmp 1925@cindex OpenMP parallel 1926Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and 1927@code{!$omp} in Fortran. When @option{-fopenmp} is specified, the 1928compiler generates parallel code according to the OpenMP Application 1929Program Interface v4.0 @w{@uref{http://www.openmp.org/}}. This option 1930implies @option{-pthread}, and thus is only supported on targets that 1931have support for @option{-pthread}. @option{-fopenmp} implies 1932@option{-fopenmp-simd}. 1933 1934@item -fopenmp-simd 1935@opindex fopenmp-simd 1936@cindex OpenMP SIMD 1937@cindex SIMD 1938Enable handling of OpenMP's SIMD directives with @code{#pragma omp} 1939in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives 1940are ignored. 1941 1942@item -fcilkplus 1943@opindex fcilkplus 1944@cindex Enable Cilk Plus 1945Enable the usage of Cilk Plus language extension features for C/C++. 1946When the option @option{-fcilkplus} is specified, enable the usage of 1947the Cilk Plus Language extension features for C/C++. The present 1948implementation follows ABI version 1.2. This is an experimental 1949feature that is only partially complete, and whose interface may 1950change in future versions of GCC as the official specification 1951changes. Currently, all features but @code{_Cilk_for} have been 1952implemented. 1953 1954@item -fgnu-tm 1955@opindex fgnu-tm 1956When the option @option{-fgnu-tm} is specified, the compiler 1957generates code for the Linux variant of Intel's current Transactional 1958Memory ABI specification document (Revision 1.1, May 6 2009). This is 1959an experimental feature whose interface may change in future versions 1960of GCC, as the official specification changes. Please note that not 1961all architectures are supported for this feature. 1962 1963For more information on GCC's support for transactional memory, 1964@xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU 1965Transactional Memory Library}. 1966 1967Note that the transactional memory feature is not supported with 1968non-call exceptions (@option{-fnon-call-exceptions}). 1969 1970@item -fms-extensions 1971@opindex fms-extensions 1972Accept some non-standard constructs used in Microsoft header files. 1973 1974In C++ code, this allows member names in structures to be similar 1975to previous types declarations. 1976 1977@smallexample 1978typedef int UOW; 1979struct ABC @{ 1980 UOW UOW; 1981@}; 1982@end smallexample 1983 1984Some cases of unnamed fields in structures and unions are only 1985accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union 1986fields within structs/unions}, for details. 1987 1988Note that this option is off for all targets but x86 1989targets using ms-abi. 1990 1991@item -fplan9-extensions 1992@opindex fplan9-extensions 1993Accept some non-standard constructs used in Plan 9 code. 1994 1995This enables @option{-fms-extensions}, permits passing pointers to 1996structures with anonymous fields to functions that expect pointers to 1997elements of the type of the field, and permits referring to anonymous 1998fields declared using a typedef. @xref{Unnamed Fields,,Unnamed 1999struct/union fields within structs/unions}, for details. This is only 2000supported for C, not C++. 2001 2002@item -trigraphs 2003@opindex trigraphs 2004Support ISO C trigraphs. The @option{-ansi} option (and @option{-std} 2005options for strict ISO C conformance) implies @option{-trigraphs}. 2006 2007@cindex traditional C language 2008@cindex C language, traditional 2009@item -traditional 2010@itemx -traditional-cpp 2011@opindex traditional-cpp 2012@opindex traditional 2013Formerly, these options caused GCC to attempt to emulate a pre-standard 2014C compiler. They are now only supported with the @option{-E} switch. 2015The preprocessor continues to support a pre-standard mode. See the GNU 2016CPP manual for details. 2017 2018@item -fcond-mismatch 2019@opindex fcond-mismatch 2020Allow conditional expressions with mismatched types in the second and 2021third arguments. The value of such an expression is void. This option 2022is not supported for C++. 2023 2024@item -flax-vector-conversions 2025@opindex flax-vector-conversions 2026Allow implicit conversions between vectors with differing numbers of 2027elements and/or incompatible element types. This option should not be 2028used for new code. 2029 2030@item -funsigned-char 2031@opindex funsigned-char 2032Let the type @code{char} be unsigned, like @code{unsigned char}. 2033 2034Each kind of machine has a default for what @code{char} should 2035be. It is either like @code{unsigned char} by default or like 2036@code{signed char} by default. 2037 2038Ideally, a portable program should always use @code{signed char} or 2039@code{unsigned char} when it depends on the signedness of an object. 2040But many programs have been written to use plain @code{char} and 2041expect it to be signed, or expect it to be unsigned, depending on the 2042machines they were written for. This option, and its inverse, let you 2043make such a program work with the opposite default. 2044 2045The type @code{char} is always a distinct type from each of 2046@code{signed char} or @code{unsigned char}, even though its behavior 2047is always just like one of those two. 2048 2049@item -fsigned-char 2050@opindex fsigned-char 2051Let the type @code{char} be signed, like @code{signed char}. 2052 2053Note that this is equivalent to @option{-fno-unsigned-char}, which is 2054the negative form of @option{-funsigned-char}. Likewise, the option 2055@option{-fno-signed-char} is equivalent to @option{-funsigned-char}. 2056 2057@item -fsigned-bitfields 2058@itemx -funsigned-bitfields 2059@itemx -fno-signed-bitfields 2060@itemx -fno-unsigned-bitfields 2061@opindex fsigned-bitfields 2062@opindex funsigned-bitfields 2063@opindex fno-signed-bitfields 2064@opindex fno-unsigned-bitfields 2065These options control whether a bit-field is signed or unsigned, when the 2066declaration does not use either @code{signed} or @code{unsigned}. By 2067default, such a bit-field is signed, because this is consistent: the 2068basic integer types such as @code{int} are signed types. 2069@end table 2070 2071@node C++ Dialect Options 2072@section Options Controlling C++ Dialect 2073 2074@cindex compiler options, C++ 2075@cindex C++ options, command-line 2076@cindex options, C++ 2077This section describes the command-line options that are only meaningful 2078for C++ programs. You can also use most of the GNU compiler options 2079regardless of what language your program is in. For example, you 2080might compile a file @file{firstClass.C} like this: 2081 2082@smallexample 2083g++ -g -frepo -O -c firstClass.C 2084@end smallexample 2085 2086@noindent 2087In this example, only @option{-frepo} is an option meant 2088only for C++ programs; you can use the other options with any 2089language supported by GCC@. 2090 2091Here is a list of options that are @emph{only} for compiling C++ programs: 2092 2093@table @gcctabopt 2094 2095@item -fabi-version=@var{n} 2096@opindex fabi-version 2097Use version @var{n} of the C++ ABI@. The default is version 0. 2098 2099Version 0 refers to the version conforming most closely to 2100the C++ ABI specification. Therefore, the ABI obtained using version 0 2101will change in different versions of G++ as ABI bugs are fixed. 2102 2103Version 1 is the version of the C++ ABI that first appeared in G++ 3.2. 2104 2105Version 2 is the version of the C++ ABI that first appeared in G++ 21063.4, and was the default through G++ 4.9. 2107 2108Version 3 corrects an error in mangling a constant address as a 2109template argument. 2110 2111Version 4, which first appeared in G++ 4.5, implements a standard 2112mangling for vector types. 2113 2114Version 5, which first appeared in G++ 4.6, corrects the mangling of 2115attribute const/volatile on function pointer types, decltype of a 2116plain decl, and use of a function parameter in the declaration of 2117another parameter. 2118 2119Version 6, which first appeared in G++ 4.7, corrects the promotion 2120behavior of C++11 scoped enums and the mangling of template argument 2121packs, const/static_cast, prefix ++ and --, and a class scope function 2122used as a template argument. 2123 2124Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a 2125builtin type and corrects the mangling of lambdas in default argument 2126scope. 2127 2128Version 8, which first appeared in G++ 4.9, corrects the substitution 2129behavior of function types with function-cv-qualifiers. 2130 2131Version 9, which first appeared in G++ 5.2, corrects the alignment of 2132@code{nullptr_t}. 2133 2134See also @option{-Wabi}. 2135 2136@item -fabi-compat-version=@var{n} 2137@opindex fabi-compat-version 2138On targets that support strong aliases, G++ 2139works around mangling changes by creating an alias with the correct 2140mangled name when defining a symbol with an incorrect mangled name. 2141This switch specifies which ABI version to use for the alias. 2142 2143With @option{-fabi-version=0} (the default), this defaults to 2. If 2144another ABI version is explicitly selected, this defaults to 0. 2145 2146The compatibility version is also set by @option{-Wabi=@var{n}}. 2147 2148@item -fno-access-control 2149@opindex fno-access-control 2150Turn off all access checking. This switch is mainly useful for working 2151around bugs in the access control code. 2152 2153@item -fcheck-new 2154@opindex fcheck-new 2155Check that the pointer returned by @code{operator new} is non-null 2156before attempting to modify the storage allocated. This check is 2157normally unnecessary because the C++ standard specifies that 2158@code{operator new} only returns @code{0} if it is declared 2159@code{throw()}, in which case the compiler always checks the 2160return value even without this option. In all other cases, when 2161@code{operator new} has a non-empty exception specification, memory 2162exhaustion is signalled by throwing @code{std::bad_alloc}. See also 2163@samp{new (nothrow)}. 2164 2165@item -fconstexpr-depth=@var{n} 2166@opindex fconstexpr-depth 2167Set the maximum nested evaluation depth for C++11 constexpr functions 2168to @var{n}. A limit is needed to detect endless recursion during 2169constant expression evaluation. The minimum specified by the standard 2170is 512. 2171 2172@item -fdeduce-init-list 2173@opindex fdeduce-init-list 2174Enable deduction of a template type parameter as 2175@code{std::initializer_list} from a brace-enclosed initializer list, i.e.@: 2176 2177@smallexample 2178template <class T> auto forward(T t) -> decltype (realfn (t)) 2179@{ 2180 return realfn (t); 2181@} 2182 2183void f() 2184@{ 2185 forward(@{1,2@}); // call forward<std::initializer_list<int>> 2186@} 2187@end smallexample 2188 2189This deduction was implemented as a possible extension to the 2190originally proposed semantics for the C++11 standard, but was not part 2191of the final standard, so it is disabled by default. This option is 2192deprecated, and may be removed in a future version of G++. 2193 2194@item -ffriend-injection 2195@opindex ffriend-injection 2196Inject friend functions into the enclosing namespace, so that they are 2197visible outside the scope of the class in which they are declared. 2198Friend functions were documented to work this way in the old Annotated 2199C++ Reference Manual. 2200However, in ISO C++ a friend function that is not declared 2201in an enclosing scope can only be found using argument dependent 2202lookup. GCC defaults to the standard behavior. 2203 2204This option is for compatibility, and may be removed in a future 2205release of G++. 2206 2207@item -fno-elide-constructors 2208@opindex fno-elide-constructors 2209The C++ standard allows an implementation to omit creating a temporary 2210that is only used to initialize another object of the same type. 2211Specifying this option disables that optimization, and forces G++ to 2212call the copy constructor in all cases. 2213 2214@item -fno-enforce-eh-specs 2215@opindex fno-enforce-eh-specs 2216Don't generate code to check for violation of exception specifications 2217at run time. This option violates the C++ standard, but may be useful 2218for reducing code size in production builds, much like defining 2219@code{NDEBUG}. This does not give user code permission to throw 2220exceptions in violation of the exception specifications; the compiler 2221still optimizes based on the specifications, so throwing an 2222unexpected exception results in undefined behavior at run time. 2223 2224@item -fextern-tls-init 2225@itemx -fno-extern-tls-init 2226@opindex fextern-tls-init 2227@opindex fno-extern-tls-init 2228The C++11 and OpenMP standards allow @code{thread_local} and 2229@code{threadprivate} variables to have dynamic (runtime) 2230initialization. To support this, any use of such a variable goes 2231through a wrapper function that performs any necessary initialization. 2232When the use and definition of the variable are in the same 2233translation unit, this overhead can be optimized away, but when the 2234use is in a different translation unit there is significant overhead 2235even if the variable doesn't actually need dynamic initialization. If 2236the programmer can be sure that no use of the variable in a 2237non-defining TU needs to trigger dynamic initialization (either 2238because the variable is statically initialized, or a use of the 2239variable in the defining TU will be executed before any uses in 2240another TU), they can avoid this overhead with the 2241@option{-fno-extern-tls-init} option. 2242 2243On targets that support symbol aliases, the default is 2244@option{-fextern-tls-init}. On targets that do not support symbol 2245aliases, the default is @option{-fno-extern-tls-init}. 2246 2247@item -ffor-scope 2248@itemx -fno-for-scope 2249@opindex ffor-scope 2250@opindex fno-for-scope 2251If @option{-ffor-scope} is specified, the scope of variables declared in 2252a @i{for-init-statement} is limited to the @code{for} loop itself, 2253as specified by the C++ standard. 2254If @option{-fno-for-scope} is specified, the scope of variables declared in 2255a @i{for-init-statement} extends to the end of the enclosing scope, 2256as was the case in old versions of G++, and other (traditional) 2257implementations of C++. 2258 2259If neither flag is given, the default is to follow the standard, 2260but to allow and give a warning for old-style code that would 2261otherwise be invalid, or have different behavior. 2262 2263@item -fno-gnu-keywords 2264@opindex fno-gnu-keywords 2265Do not recognize @code{typeof} as a keyword, so that code can use this 2266word as an identifier. You can use the keyword @code{__typeof__} instead. 2267@option{-ansi} implies @option{-fno-gnu-keywords}. 2268 2269@item -fno-implicit-templates 2270@opindex fno-implicit-templates 2271Never emit code for non-inline templates that are instantiated 2272implicitly (i.e.@: by use); only emit code for explicit instantiations. 2273@xref{Template Instantiation}, for more information. 2274 2275@item -fno-implicit-inline-templates 2276@opindex fno-implicit-inline-templates 2277Don't emit code for implicit instantiations of inline templates, either. 2278The default is to handle inlines differently so that compiles with and 2279without optimization need the same set of explicit instantiations. 2280 2281@item -fno-implement-inlines 2282@opindex fno-implement-inlines 2283To save space, do not emit out-of-line copies of inline functions 2284controlled by @code{#pragma implementation}. This causes linker 2285errors if these functions are not inlined everywhere they are called. 2286 2287@item -fms-extensions 2288@opindex fms-extensions 2289Disable Wpedantic warnings about constructs used in MFC, such as implicit 2290int and getting a pointer to member function via non-standard syntax. 2291 2292@item -fno-nonansi-builtins 2293@opindex fno-nonansi-builtins 2294Disable built-in declarations of functions that are not mandated by 2295ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit}, 2296@code{index}, @code{bzero}, @code{conjf}, and other related functions. 2297 2298@item -fnothrow-opt 2299@opindex fnothrow-opt 2300Treat a @code{throw()} exception specification as if it were a 2301@code{noexcept} specification to reduce or eliminate the text size 2302overhead relative to a function with no exception specification. If 2303the function has local variables of types with non-trivial 2304destructors, the exception specification actually makes the 2305function smaller because the EH cleanups for those variables can be 2306optimized away. The semantic effect is that an exception thrown out of 2307a function with such an exception specification results in a call 2308to @code{terminate} rather than @code{unexpected}. 2309 2310@item -fno-operator-names 2311@opindex fno-operator-names 2312Do not treat the operator name keywords @code{and}, @code{bitand}, 2313@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as 2314synonyms as keywords. 2315 2316@item -fno-optional-diags 2317@opindex fno-optional-diags 2318Disable diagnostics that the standard says a compiler does not need to 2319issue. Currently, the only such diagnostic issued by G++ is the one for 2320a name having multiple meanings within a class. 2321 2322@item -fpermissive 2323@opindex fpermissive 2324Downgrade some diagnostics about nonconformant code from errors to 2325warnings. Thus, using @option{-fpermissive} allows some 2326nonconforming code to compile. 2327 2328@item -fno-pretty-templates 2329@opindex fno-pretty-templates 2330When an error message refers to a specialization of a function 2331template, the compiler normally prints the signature of the 2332template followed by the template arguments and any typedefs or 2333typenames in the signature (e.g. @code{void f(T) [with T = int]} 2334rather than @code{void f(int)}) so that it's clear which template is 2335involved. When an error message refers to a specialization of a class 2336template, the compiler omits any template arguments that match 2337the default template arguments for that template. If either of these 2338behaviors make it harder to understand the error message rather than 2339easier, you can use @option{-fno-pretty-templates} to disable them. 2340 2341@item -frepo 2342@opindex frepo 2343Enable automatic template instantiation at link time. This option also 2344implies @option{-fno-implicit-templates}. @xref{Template 2345Instantiation}, for more information. 2346 2347@item -fno-rtti 2348@opindex fno-rtti 2349Disable generation of information about every class with virtual 2350functions for use by the C++ run-time type identification features 2351(@code{dynamic_cast} and @code{typeid}). If you don't use those parts 2352of the language, you can save some space by using this flag. Note that 2353exception handling uses the same information, but G++ generates it as 2354needed. The @code{dynamic_cast} operator can still be used for casts that 2355do not require run-time type information, i.e.@: casts to @code{void *} or to 2356unambiguous base classes. 2357 2358@item -fsized-deallocation 2359@opindex fsized-deallocation 2360Enable the built-in global declarations 2361@smallexample 2362void operator delete (void *, std::size_t) noexcept; 2363void operator delete[] (void *, std::size_t) noexcept; 2364@end smallexample 2365as introduced in C++14. This is useful for user-defined replacement 2366deallocation functions that, for example, use the size of the object 2367to make deallocation faster. Enabled by default under 2368@option{-std=c++14} and above. The flag @option{-Wsized-deallocation} 2369warns about places that might want to add a definition. 2370 2371@item -fstats 2372@opindex fstats 2373Emit statistics about front-end processing at the end of the compilation. 2374This information is generally only useful to the G++ development team. 2375 2376@item -fstrict-enums 2377@opindex fstrict-enums 2378Allow the compiler to optimize using the assumption that a value of 2379enumerated type can only be one of the values of the enumeration (as 2380defined in the C++ standard; basically, a value that can be 2381represented in the minimum number of bits needed to represent all the 2382enumerators). This assumption may not be valid if the program uses a 2383cast to convert an arbitrary integer value to the enumerated type. 2384 2385@item -ftemplate-backtrace-limit=@var{n} 2386@opindex ftemplate-backtrace-limit 2387Set the maximum number of template instantiation notes for a single 2388warning or error to @var{n}. The default value is 10. 2389 2390@item -ftemplate-depth=@var{n} 2391@opindex ftemplate-depth 2392Set the maximum instantiation depth for template classes to @var{n}. 2393A limit on the template instantiation depth is needed to detect 2394endless recursions during template class instantiation. ANSI/ISO C++ 2395conforming programs must not rely on a maximum depth greater than 17 2396(changed to 1024 in C++11). The default value is 900, as the compiler 2397can run out of stack space before hitting 1024 in some situations. 2398 2399@item -fno-threadsafe-statics 2400@opindex fno-threadsafe-statics 2401Do not emit the extra code to use the routines specified in the C++ 2402ABI for thread-safe initialization of local statics. You can use this 2403option to reduce code size slightly in code that doesn't need to be 2404thread-safe. 2405 2406@item -fuse-cxa-atexit 2407@opindex fuse-cxa-atexit 2408Register destructors for objects with static storage duration with the 2409@code{__cxa_atexit} function rather than the @code{atexit} function. 2410This option is required for fully standards-compliant handling of static 2411destructors, but only works if your C library supports 2412@code{__cxa_atexit}. 2413 2414@item -fno-use-cxa-get-exception-ptr 2415@opindex fno-use-cxa-get-exception-ptr 2416Don't use the @code{__cxa_get_exception_ptr} runtime routine. This 2417causes @code{std::uncaught_exception} to be incorrect, but is necessary 2418if the runtime routine is not available. 2419 2420@item -fvisibility-inlines-hidden 2421@opindex fvisibility-inlines-hidden 2422This switch declares that the user does not attempt to compare 2423pointers to inline functions or methods where the addresses of the two functions 2424are taken in different shared objects. 2425 2426The effect of this is that GCC may, effectively, mark inline methods with 2427@code{__attribute__ ((visibility ("hidden")))} so that they do not 2428appear in the export table of a DSO and do not require a PLT indirection 2429when used within the DSO@. Enabling this option can have a dramatic effect 2430on load and link times of a DSO as it massively reduces the size of the 2431dynamic export table when the library makes heavy use of templates. 2432 2433The behavior of this switch is not quite the same as marking the 2434methods as hidden directly, because it does not affect static variables 2435local to the function or cause the compiler to deduce that 2436the function is defined in only one shared object. 2437 2438You may mark a method as having a visibility explicitly to negate the 2439effect of the switch for that method. For example, if you do want to 2440compare pointers to a particular inline method, you might mark it as 2441having default visibility. Marking the enclosing class with explicit 2442visibility has no effect. 2443 2444Explicitly instantiated inline methods are unaffected by this option 2445as their linkage might otherwise cross a shared library boundary. 2446@xref{Template Instantiation}. 2447 2448@item -fvisibility-ms-compat 2449@opindex fvisibility-ms-compat 2450This flag attempts to use visibility settings to make GCC's C++ 2451linkage model compatible with that of Microsoft Visual Studio. 2452 2453The flag makes these changes to GCC's linkage model: 2454 2455@enumerate 2456@item 2457It sets the default visibility to @code{hidden}, like 2458@option{-fvisibility=hidden}. 2459 2460@item 2461Types, but not their members, are not hidden by default. 2462 2463@item 2464The One Definition Rule is relaxed for types without explicit 2465visibility specifications that are defined in more than one 2466shared object: those declarations are permitted if they are 2467permitted when this option is not used. 2468@end enumerate 2469 2470In new code it is better to use @option{-fvisibility=hidden} and 2471export those classes that are intended to be externally visible. 2472Unfortunately it is possible for code to rely, perhaps accidentally, 2473on the Visual Studio behavior. 2474 2475Among the consequences of these changes are that static data members 2476of the same type with the same name but defined in different shared 2477objects are different, so changing one does not change the other; 2478and that pointers to function members defined in different shared 2479objects may not compare equal. When this flag is given, it is a 2480violation of the ODR to define types with the same name differently. 2481 2482@item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} 2483@opindex fvtable-verify 2484Turn on (or off, if using @option{-fvtable-verify=none}) the security 2485feature that verifies at run time, for every virtual call, that 2486the vtable pointer through which the call is made is valid for the type of 2487the object, and has not been corrupted or overwritten. If an invalid vtable 2488pointer is detected at run time, an error is reported and execution of the 2489program is immediately halted. 2490 2491This option causes run-time data structures to be built at program startup, 2492which are used for verifying the vtable pointers. 2493The options @samp{std} and @samp{preinit} 2494control the timing of when these data structures are built. In both cases the 2495data structures are built before execution reaches @code{main}. Using 2496@option{-fvtable-verify=std} causes the data structures to be built after 2497shared libraries have been loaded and initialized. 2498@option{-fvtable-verify=preinit} causes them to be built before shared 2499libraries have been loaded and initialized. 2500 2501If this option appears multiple times in the command line with different 2502values specified, @samp{none} takes highest priority over both @samp{std} and 2503@samp{preinit}; @samp{preinit} takes priority over @samp{std}. 2504 2505@item -fvtv-debug 2506@opindex fvtv-debug 2507When used in conjunction with @option{-fvtable-verify=std} or 2508@option{-fvtable-verify=preinit}, causes debug versions of the 2509runtime functions for the vtable verification feature to be called. 2510This flag also causes the compiler to log information about which 2511vtable pointers it finds for each class. 2512This information is written to a file named @file{vtv_set_ptr_data.log} 2513in the directory named by the environment variable @env{VTV_LOGS_DIR} 2514if that is defined or the current working directory otherwise. 2515 2516Note: This feature @emph{appends} data to the log file. If you want a fresh log 2517file, be sure to delete any existing one. 2518 2519@item -fvtv-counts 2520@opindex fvtv-counts 2521This is a debugging flag. When used in conjunction with 2522@option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this 2523causes the compiler to keep track of the total number of virtual calls 2524it encounters and the number of verifications it inserts. It also 2525counts the number of calls to certain run-time library functions 2526that it inserts and logs this information for each compilation unit. 2527The compiler writes this information to a file named 2528@file{vtv_count_data.log} in the directory named by the environment 2529variable @env{VTV_LOGS_DIR} if that is defined or the current working 2530directory otherwise. It also counts the size of the vtable pointer sets 2531for each class, and writes this information to @file{vtv_class_set_sizes.log} 2532in the same directory. 2533 2534Note: This feature @emph{appends} data to the log files. To get fresh log 2535files, be sure to delete any existing ones. 2536 2537@item -fno-weak 2538@opindex fno-weak 2539Do not use weak symbol support, even if it is provided by the linker. 2540By default, G++ uses weak symbols if they are available. This 2541option exists only for testing, and should not be used by end-users; 2542it results in inferior code and has no benefits. This option may 2543be removed in a future release of G++. 2544 2545@item -nostdinc++ 2546@opindex nostdinc++ 2547Do not search for header files in the standard directories specific to 2548C++, but do still search the other standard directories. (This option 2549is used when building the C++ library.) 2550@end table 2551 2552In addition, these optimization, warning, and code generation options 2553have meanings only for C++ programs: 2554 2555@table @gcctabopt 2556@item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)} 2557@opindex Wabi 2558@opindex Wno-abi 2559When an explicit @option{-fabi-version=@var{n}} option is used, causes 2560G++ to warn when it generates code that is probably not compatible with the 2561vendor-neutral C++ ABI@. Since G++ now defaults to 2562@option{-fabi-version=0}, @option{-Wabi} has no effect unless either 2563an older ABI version is selected (with @option{-fabi-version=@var{n}}) 2564or an older compatibility version is selected (with 2565@option{-Wabi=@var{n}} or @option{-fabi-compat-version=@var{n}}). 2566 2567Although an effort has been made to warn about 2568all such cases, there are probably some cases that are not warned about, 2569even though G++ is generating incompatible code. There may also be 2570cases where warnings are emitted even though the code that is generated 2571is compatible. 2572 2573You should rewrite your code to avoid these warnings if you are 2574concerned about the fact that code generated by G++ may not be binary 2575compatible with code generated by other compilers. 2576 2577@option{-Wabi} can also be used with an explicit version number to 2578warn about compatibility with a particular @option{-fabi-version} 2579level, e.g. @option{-Wabi=2} to warn about changes relative to 2580@option{-fabi-version=2}. Specifying a version number also sets 2581@option{-fabi-compat-version=@var{n}}. 2582 2583The known incompatibilities in @option{-fabi-version=2} (which was the 2584default from GCC 3.4 to 4.9) include: 2585 2586@itemize @bullet 2587 2588@item 2589A template with a non-type template parameter of reference type was 2590mangled incorrectly: 2591@smallexample 2592extern int N; 2593template <int &> struct S @{@}; 2594void n (S<N>) @{2@} 2595@end smallexample 2596 2597This was fixed in @option{-fabi-version=3}. 2598 2599@item 2600SIMD vector types declared using @code{__attribute ((vector_size))} were 2601mangled in a non-standard way that does not allow for overloading of 2602functions taking vectors of different sizes. 2603 2604The mangling was changed in @option{-fabi-version=4}. 2605 2606@item 2607@code{__attribute ((const))} and @code{noreturn} were mangled as type 2608qualifiers, and @code{decltype} of a plain declaration was folded away. 2609 2610These mangling issues were fixed in @option{-fabi-version=5}. 2611 2612@item 2613Scoped enumerators passed as arguments to a variadic function are 2614promoted like unscoped enumerators, causing @code{va_arg} to complain. 2615On most targets this does not actually affect the parameter passing 2616ABI, as there is no way to pass an argument smaller than @code{int}. 2617 2618Also, the ABI changed the mangling of template argument packs, 2619@code{const_cast}, @code{static_cast}, prefix increment/decrement, and 2620a class scope function used as a template argument. 2621 2622These issues were corrected in @option{-fabi-version=6}. 2623 2624@item 2625Lambdas in default argument scope were mangled incorrectly, and the 2626ABI changed the mangling of @code{nullptr_t}. 2627 2628These issues were corrected in @option{-fabi-version=7}. 2629 2630@item 2631When mangling a function type with function-cv-qualifiers, the 2632un-qualified function type was incorrectly treated as a substitution 2633candidate. 2634 2635This was fixed in @option{-fabi-version=8}, the default for GCC 5.1. 2636 2637@item 2638@code{decltype(nullptr)} incorrectly had an alignment of 1, leading to 2639unaligned accesses. Note that this did not affect the ABI of a 2640function with a @code{nullptr_t} parameter, as parameters have a 2641minimum alignment. 2642 2643This was fixed in @option{-fabi-version=9}, the default for GCC 5.2. 2644@end itemize 2645 2646It also warns about psABI-related changes. The known psABI changes at this 2647point include: 2648 2649@itemize @bullet 2650 2651@item 2652For SysV/x86-64, unions with @code{long double} members are 2653passed in memory as specified in psABI. For example: 2654 2655@smallexample 2656union U @{ 2657 long double ld; 2658 int i; 2659@}; 2660@end smallexample 2661 2662@noindent 2663@code{union U} is always passed in memory. 2664 2665@end itemize 2666 2667@item -Wabi-tag @r{(C++ and Objective-C++ only)} 2668@opindex Wabi-tag 2669@opindex -Wabi-tag 2670Warn when a type with an ABI tag is used in a context that does not 2671have that ABI tag. See @ref{C++ Attributes} for more information 2672about ABI tags. 2673 2674@item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)} 2675@opindex Wctor-dtor-privacy 2676@opindex Wno-ctor-dtor-privacy 2677Warn when a class seems unusable because all the constructors or 2678destructors in that class are private, and it has neither friends nor 2679public static member functions. Also warn if there are no non-private 2680methods, and there's at least one private member function that isn't 2681a constructor or destructor. 2682 2683@item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)} 2684@opindex Wdelete-non-virtual-dtor 2685@opindex Wno-delete-non-virtual-dtor 2686Warn when @code{delete} is used to destroy an instance of a class that 2687has virtual functions and non-virtual destructor. It is unsafe to delete 2688an instance of a derived class through a pointer to a base class if the 2689base class does not have a virtual destructor. This warning is enabled 2690by @option{-Wall}. 2691 2692@item -Wliteral-suffix @r{(C++ and Objective-C++ only)} 2693@opindex Wliteral-suffix 2694@opindex Wno-literal-suffix 2695Warn when a string or character literal is followed by a ud-suffix which does 2696not begin with an underscore. As a conforming extension, GCC treats such 2697suffixes as separate preprocessing tokens in order to maintain backwards 2698compatibility with code that uses formatting macros from @code{<inttypes.h>}. 2699For example: 2700 2701@smallexample 2702#define __STDC_FORMAT_MACROS 2703#include <inttypes.h> 2704#include <stdio.h> 2705 2706int main() @{ 2707 int64_t i64 = 123; 2708 printf("My int64: %"PRId64"\n", i64); 2709@} 2710@end smallexample 2711 2712In this case, @code{PRId64} is treated as a separate preprocessing token. 2713 2714This warning is enabled by default. 2715 2716@item -Wnarrowing @r{(C++ and Objective-C++ only)} 2717@opindex Wnarrowing 2718@opindex Wno-narrowing 2719Warn when a narrowing conversion prohibited by C++11 occurs within 2720@samp{@{ @}}, e.g. 2721 2722@smallexample 2723int i = @{ 2.2 @}; // error: narrowing from double to int 2724@end smallexample 2725 2726This flag is included in @option{-Wall} and @option{-Wc++11-compat}. 2727 2728With @option{-std=c++11}, @option{-Wno-narrowing} suppresses the diagnostic 2729required by the standard. Note that this does not affect the meaning 2730of well-formed code; narrowing conversions are still considered 2731ill-formed in SFINAE context. 2732 2733@item -Wnoexcept @r{(C++ and Objective-C++ only)} 2734@opindex Wnoexcept 2735@opindex Wno-noexcept 2736Warn when a noexcept-expression evaluates to false because of a call 2737to a function that does not have a non-throwing exception 2738specification (i.e. @code{throw()} or @code{noexcept}) but is known by 2739the compiler to never throw an exception. 2740 2741@item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)} 2742@opindex Wnon-virtual-dtor 2743@opindex Wno-non-virtual-dtor 2744Warn when a class has virtual functions and an accessible non-virtual 2745destructor itself or in an accessible polymorphic base class, in which 2746case it is possible but unsafe to delete an instance of a derived 2747class through a pointer to the class itself or base class. This 2748warning is automatically enabled if @option{-Weffc++} is specified. 2749 2750@item -Wreorder @r{(C++ and Objective-C++ only)} 2751@opindex Wreorder 2752@opindex Wno-reorder 2753@cindex reordering, warning 2754@cindex warning for reordering of member initializers 2755Warn when the order of member initializers given in the code does not 2756match the order in which they must be executed. For instance: 2757 2758@smallexample 2759struct A @{ 2760 int i; 2761 int j; 2762 A(): j (0), i (1) @{ @} 2763@}; 2764@end smallexample 2765 2766@noindent 2767The compiler rearranges the member initializers for @code{i} 2768and @code{j} to match the declaration order of the members, emitting 2769a warning to that effect. This warning is enabled by @option{-Wall}. 2770 2771@item -fext-numeric-literals @r{(C++ and Objective-C++ only)} 2772@opindex fext-numeric-literals 2773@opindex fno-ext-numeric-literals 2774Accept imaginary, fixed-point, or machine-defined 2775literal number suffixes as GNU extensions. 2776When this option is turned off these suffixes are treated 2777as C++11 user-defined literal numeric suffixes. 2778This is on by default for all pre-C++11 dialects and all GNU dialects: 2779@option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11}, 2780@option{-std=gnu++14}. 2781This option is off by default 2782for ISO C++11 onwards (@option{-std=c++11}, ...). 2783@end table 2784 2785The following @option{-W@dots{}} options are not affected by @option{-Wall}. 2786 2787@table @gcctabopt 2788@item -Weffc++ @r{(C++ and Objective-C++ only)} 2789@opindex Weffc++ 2790@opindex Wno-effc++ 2791Warn about violations of the following style guidelines from Scott Meyers' 2792@cite{Effective C++} series of books: 2793 2794@itemize @bullet 2795@item 2796Define a copy constructor and an assignment operator for classes 2797with dynamically-allocated memory. 2798 2799@item 2800Prefer initialization to assignment in constructors. 2801 2802@item 2803Have @code{operator=} return a reference to @code{*this}. 2804 2805@item 2806Don't try to return a reference when you must return an object. 2807 2808@item 2809Distinguish between prefix and postfix forms of increment and 2810decrement operators. 2811 2812@item 2813Never overload @code{&&}, @code{||}, or @code{,}. 2814 2815@end itemize 2816 2817This option also enables @option{-Wnon-virtual-dtor}, which is also 2818one of the effective C++ recommendations. However, the check is 2819extended to warn about the lack of virtual destructor in accessible 2820non-polymorphic bases classes too. 2821 2822When selecting this option, be aware that the standard library 2823headers do not obey all of these guidelines; use @samp{grep -v} 2824to filter out those warnings. 2825 2826@item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)} 2827@opindex Wstrict-null-sentinel 2828@opindex Wno-strict-null-sentinel 2829Warn about the use of an uncasted @code{NULL} as sentinel. When 2830compiling only with GCC this is a valid sentinel, as @code{NULL} is defined 2831to @code{__null}. Although it is a null pointer constant rather than a 2832null pointer, it is guaranteed to be of the same size as a pointer. 2833But this use is not portable across different compilers. 2834 2835@item -Wno-non-template-friend @r{(C++ and Objective-C++ only)} 2836@opindex Wno-non-template-friend 2837@opindex Wnon-template-friend 2838Disable warnings when non-templatized friend functions are declared 2839within a template. Since the advent of explicit template specification 2840support in G++, if the name of the friend is an unqualified-id (i.e., 2841@samp{friend foo(int)}), the C++ language specification demands that the 2842friend declare or define an ordinary, nontemplate function. (Section 284314.5.3). Before G++ implemented explicit specification, unqualified-ids 2844could be interpreted as a particular specialization of a templatized 2845function. Because this non-conforming behavior is no longer the default 2846behavior for G++, @option{-Wnon-template-friend} allows the compiler to 2847check existing code for potential trouble spots and is on by default. 2848This new compiler behavior can be turned off with 2849@option{-Wno-non-template-friend}, which keeps the conformant compiler code 2850but disables the helpful warning. 2851 2852@item -Wold-style-cast @r{(C++ and Objective-C++ only)} 2853@opindex Wold-style-cast 2854@opindex Wno-old-style-cast 2855Warn if an old-style (C-style) cast to a non-void type is used within 2856a C++ program. The new-style casts (@code{dynamic_cast}, 2857@code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are 2858less vulnerable to unintended effects and much easier to search for. 2859 2860@item -Woverloaded-virtual @r{(C++ and Objective-C++ only)} 2861@opindex Woverloaded-virtual 2862@opindex Wno-overloaded-virtual 2863@cindex overloaded virtual function, warning 2864@cindex warning for overloaded virtual function 2865Warn when a function declaration hides virtual functions from a 2866base class. For example, in: 2867 2868@smallexample 2869struct A @{ 2870 virtual void f(); 2871@}; 2872 2873struct B: public A @{ 2874 void f(int); 2875@}; 2876@end smallexample 2877 2878the @code{A} class version of @code{f} is hidden in @code{B}, and code 2879like: 2880 2881@smallexample 2882B* b; 2883b->f(); 2884@end smallexample 2885 2886@noindent 2887fails to compile. 2888 2889@item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)} 2890@opindex Wno-pmf-conversions 2891@opindex Wpmf-conversions 2892Disable the diagnostic for converting a bound pointer to member function 2893to a plain pointer. 2894 2895@item -Wsign-promo @r{(C++ and Objective-C++ only)} 2896@opindex Wsign-promo 2897@opindex Wno-sign-promo 2898Warn when overload resolution chooses a promotion from unsigned or 2899enumerated type to a signed type, over a conversion to an unsigned type of 2900the same size. Previous versions of G++ tried to preserve 2901unsignedness, but the standard mandates the current behavior. 2902@end table 2903 2904@node Objective-C and Objective-C++ Dialect Options 2905@section Options Controlling Objective-C and Objective-C++ Dialects 2906 2907@cindex compiler options, Objective-C and Objective-C++ 2908@cindex Objective-C and Objective-C++ options, command-line 2909@cindex options, Objective-C and Objective-C++ 2910(NOTE: This manual does not describe the Objective-C and Objective-C++ 2911languages themselves. @xref{Standards,,Language Standards 2912Supported by GCC}, for references.) 2913 2914This section describes the command-line options that are only meaningful 2915for Objective-C and Objective-C++ programs. You can also use most of 2916the language-independent GNU compiler options. 2917For example, you might compile a file @file{some_class.m} like this: 2918 2919@smallexample 2920gcc -g -fgnu-runtime -O -c some_class.m 2921@end smallexample 2922 2923@noindent 2924In this example, @option{-fgnu-runtime} is an option meant only for 2925Objective-C and Objective-C++ programs; you can use the other options with 2926any language supported by GCC@. 2927 2928Note that since Objective-C is an extension of the C language, Objective-C 2929compilations may also use options specific to the C front-end (e.g., 2930@option{-Wtraditional}). Similarly, Objective-C++ compilations may use 2931C++-specific options (e.g., @option{-Wabi}). 2932 2933Here is a list of options that are @emph{only} for compiling Objective-C 2934and Objective-C++ programs: 2935 2936@table @gcctabopt 2937@item -fconstant-string-class=@var{class-name} 2938@opindex fconstant-string-class 2939Use @var{class-name} as the name of the class to instantiate for each 2940literal string specified with the syntax @code{@@"@dots{}"}. The default 2941class name is @code{NXConstantString} if the GNU runtime is being used, and 2942@code{NSConstantString} if the NeXT runtime is being used (see below). The 2943@option{-fconstant-cfstrings} option, if also present, overrides the 2944@option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals 2945to be laid out as constant CoreFoundation strings. 2946 2947@item -fgnu-runtime 2948@opindex fgnu-runtime 2949Generate object code compatible with the standard GNU Objective-C 2950runtime. This is the default for most types of systems. 2951 2952@item -fnext-runtime 2953@opindex fnext-runtime 2954Generate output compatible with the NeXT runtime. This is the default 2955for NeXT-based systems, including Darwin and Mac OS X@. The macro 2956@code{__NEXT_RUNTIME__} is predefined if (and only if) this option is 2957used. 2958 2959@item -fno-nil-receivers 2960@opindex fno-nil-receivers 2961Assume that all Objective-C message dispatches (@code{[receiver 2962message:arg]}) in this translation unit ensure that the receiver is 2963not @code{nil}. This allows for more efficient entry points in the 2964runtime to be used. This option is only available in conjunction with 2965the NeXT runtime and ABI version 0 or 1. 2966 2967@item -fobjc-abi-version=@var{n} 2968@opindex fobjc-abi-version 2969Use version @var{n} of the Objective-C ABI for the selected runtime. 2970This option is currently supported only for the NeXT runtime. In that 2971case, Version 0 is the traditional (32-bit) ABI without support for 2972properties and other Objective-C 2.0 additions. Version 1 is the 2973traditional (32-bit) ABI with support for properties and other 2974Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If 2975nothing is specified, the default is Version 0 on 32-bit target 2976machines, and Version 2 on 64-bit target machines. 2977 2978@item -fobjc-call-cxx-cdtors 2979@opindex fobjc-call-cxx-cdtors 2980For each Objective-C class, check if any of its instance variables is a 2981C++ object with a non-trivial default constructor. If so, synthesize a 2982special @code{- (id) .cxx_construct} instance method which runs 2983non-trivial default constructors on any such instance variables, in order, 2984and then return @code{self}. Similarly, check if any instance variable 2985is a C++ object with a non-trivial destructor, and if so, synthesize a 2986special @code{- (void) .cxx_destruct} method which runs 2987all such default destructors, in reverse order. 2988 2989The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct} 2990methods thusly generated only operate on instance variables 2991declared in the current Objective-C class, and not those inherited 2992from superclasses. It is the responsibility of the Objective-C 2993runtime to invoke all such methods in an object's inheritance 2994hierarchy. The @code{- (id) .cxx_construct} methods are invoked 2995by the runtime immediately after a new object instance is allocated; 2996the @code{- (void) .cxx_destruct} methods are invoked immediately 2997before the runtime deallocates an object instance. 2998 2999As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has 3000support for invoking the @code{- (id) .cxx_construct} and 3001@code{- (void) .cxx_destruct} methods. 3002 3003@item -fobjc-direct-dispatch 3004@opindex fobjc-direct-dispatch 3005Allow fast jumps to the message dispatcher. On Darwin this is 3006accomplished via the comm page. 3007 3008@item -fobjc-exceptions 3009@opindex fobjc-exceptions 3010Enable syntactic support for structured exception handling in 3011Objective-C, similar to what is offered by C++ and Java. This option 3012is required to use the Objective-C keywords @code{@@try}, 3013@code{@@throw}, @code{@@catch}, @code{@@finally} and 3014@code{@@synchronized}. This option is available with both the GNU 3015runtime and the NeXT runtime (but not available in conjunction with 3016the NeXT runtime on Mac OS X 10.2 and earlier). 3017 3018@item -fobjc-gc 3019@opindex fobjc-gc 3020Enable garbage collection (GC) in Objective-C and Objective-C++ 3021programs. This option is only available with the NeXT runtime; the 3022GNU runtime has a different garbage collection implementation that 3023does not require special compiler flags. 3024 3025@item -fobjc-nilcheck 3026@opindex fobjc-nilcheck 3027For the NeXT runtime with version 2 of the ABI, check for a nil 3028receiver in method invocations before doing the actual method call. 3029This is the default and can be disabled using 3030@option{-fno-objc-nilcheck}. Class methods and super calls are never 3031checked for nil in this way no matter what this flag is set to. 3032Currently this flag does nothing when the GNU runtime, or an older 3033version of the NeXT runtime ABI, is used. 3034 3035@item -fobjc-std=objc1 3036@opindex fobjc-std 3037Conform to the language syntax of Objective-C 1.0, the language 3038recognized by GCC 4.0. This only affects the Objective-C additions to 3039the C/C++ language; it does not affect conformance to C/C++ standards, 3040which is controlled by the separate C/C++ dialect option flags. When 3041this option is used with the Objective-C or Objective-C++ compiler, 3042any Objective-C syntax that is not recognized by GCC 4.0 is rejected. 3043This is useful if you need to make sure that your Objective-C code can 3044be compiled with older versions of GCC@. 3045 3046@item -freplace-objc-classes 3047@opindex freplace-objc-classes 3048Emit a special marker instructing @command{ld(1)} not to statically link in 3049the resulting object file, and allow @command{dyld(1)} to load it in at 3050run time instead. This is used in conjunction with the Fix-and-Continue 3051debugging mode, where the object file in question may be recompiled and 3052dynamically reloaded in the course of program execution, without the need 3053to restart the program itself. Currently, Fix-and-Continue functionality 3054is only available in conjunction with the NeXT runtime on Mac OS X 10.3 3055and later. 3056 3057@item -fzero-link 3058@opindex fzero-link 3059When compiling for the NeXT runtime, the compiler ordinarily replaces calls 3060to @code{objc_getClass("@dots{}")} (when the name of the class is known at 3061compile time) with static class references that get initialized at load time, 3062which improves run-time performance. Specifying the @option{-fzero-link} flag 3063suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")} 3064to be retained. This is useful in Zero-Link debugging mode, since it allows 3065for individual class implementations to be modified during program execution. 3066The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")} 3067regardless of command-line options. 3068 3069@item -fno-local-ivars 3070@opindex fno-local-ivars 3071@opindex flocal-ivars 3072By default instance variables in Objective-C can be accessed as if 3073they were local variables from within the methods of the class they're 3074declared in. This can lead to shadowing between instance variables 3075and other variables declared either locally inside a class method or 3076globally with the same name. Specifying the @option{-fno-local-ivars} 3077flag disables this behavior thus avoiding variable shadowing issues. 3078 3079@item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} 3080@opindex fivar-visibility 3081Set the default instance variable visibility to the specified option 3082so that instance variables declared outside the scope of any access 3083modifier directives default to the specified visibility. 3084 3085@item -gen-decls 3086@opindex gen-decls 3087Dump interface declarations for all classes seen in the source file to a 3088file named @file{@var{sourcename}.decl}. 3089 3090@item -Wassign-intercept @r{(Objective-C and Objective-C++ only)} 3091@opindex Wassign-intercept 3092@opindex Wno-assign-intercept 3093Warn whenever an Objective-C assignment is being intercepted by the 3094garbage collector. 3095 3096@item -Wno-protocol @r{(Objective-C and Objective-C++ only)} 3097@opindex Wno-protocol 3098@opindex Wprotocol 3099If a class is declared to implement a protocol, a warning is issued for 3100every method in the protocol that is not implemented by the class. The 3101default behavior is to issue a warning for every method not explicitly 3102implemented in the class, even if a method implementation is inherited 3103from the superclass. If you use the @option{-Wno-protocol} option, then 3104methods inherited from the superclass are considered to be implemented, 3105and no warning is issued for them. 3106 3107@item -Wselector @r{(Objective-C and Objective-C++ only)} 3108@opindex Wselector 3109@opindex Wno-selector 3110Warn if multiple methods of different types for the same selector are 3111found during compilation. The check is performed on the list of methods 3112in the final stage of compilation. Additionally, a check is performed 3113for each selector appearing in a @code{@@selector(@dots{})} 3114expression, and a corresponding method for that selector has been found 3115during compilation. Because these checks scan the method table only at 3116the end of compilation, these warnings are not produced if the final 3117stage of compilation is not reached, for example because an error is 3118found during compilation, or because the @option{-fsyntax-only} option is 3119being used. 3120 3121@item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)} 3122@opindex Wstrict-selector-match 3123@opindex Wno-strict-selector-match 3124Warn if multiple methods with differing argument and/or return types are 3125found for a given selector when attempting to send a message using this 3126selector to a receiver of type @code{id} or @code{Class}. When this flag 3127is off (which is the default behavior), the compiler omits such warnings 3128if any differences found are confined to types that share the same size 3129and alignment. 3130 3131@item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)} 3132@opindex Wundeclared-selector 3133@opindex Wno-undeclared-selector 3134Warn if a @code{@@selector(@dots{})} expression referring to an 3135undeclared selector is found. A selector is considered undeclared if no 3136method with that name has been declared before the 3137@code{@@selector(@dots{})} expression, either explicitly in an 3138@code{@@interface} or @code{@@protocol} declaration, or implicitly in 3139an @code{@@implementation} section. This option always performs its 3140checks as soon as a @code{@@selector(@dots{})} expression is found, 3141while @option{-Wselector} only performs its checks in the final stage of 3142compilation. This also enforces the coding style convention 3143that methods and selectors must be declared before being used. 3144 3145@item -print-objc-runtime-info 3146@opindex print-objc-runtime-info 3147Generate C header describing the largest structure that is passed by 3148value, if any. 3149 3150@end table 3151 3152@node Language Independent Options 3153@section Options to Control Diagnostic Messages Formatting 3154@cindex options to control diagnostics formatting 3155@cindex diagnostic messages 3156@cindex message formatting 3157 3158Traditionally, diagnostic messages have been formatted irrespective of 3159the output device's aspect (e.g.@: its width, @dots{}). You can use the 3160options described below 3161to control the formatting algorithm for diagnostic messages, 3162e.g.@: how many characters per line, how often source location 3163information should be reported. Note that some language front ends may not 3164honor these options. 3165 3166@table @gcctabopt 3167@item -fmessage-length=@var{n} 3168@opindex fmessage-length 3169Try to format error messages so that they fit on lines of about 3170@var{n} characters. If @var{n} is zero, then no line-wrapping is 3171done; each error message appears on a single line. This is the 3172default for all front ends. 3173 3174@item -fdiagnostics-show-location=once 3175@opindex fdiagnostics-show-location 3176Only meaningful in line-wrapping mode. Instructs the diagnostic messages 3177reporter to emit source location information @emph{once}; that is, in 3178case the message is too long to fit on a single physical line and has to 3179be wrapped, the source location won't be emitted (as prefix) again, 3180over and over, in subsequent continuation lines. This is the default 3181behavior. 3182 3183@item -fdiagnostics-show-location=every-line 3184Only meaningful in line-wrapping mode. Instructs the diagnostic 3185messages reporter to emit the same source location information (as 3186prefix) for physical lines that result from the process of breaking 3187a message which is too long to fit on a single line. 3188 3189@item -fdiagnostics-color[=@var{WHEN}] 3190@itemx -fno-diagnostics-color 3191@opindex fdiagnostics-color 3192@cindex highlight, color, colour 3193@vindex GCC_COLORS @r{environment variable} 3194Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always}, 3195or @samp{auto}. The default depends on how the compiler has been configured, 3196it can be any of the above @var{WHEN} options or also @samp{never} 3197if @env{GCC_COLORS} environment variable isn't present in the environment, 3198and @samp{auto} otherwise. 3199@samp{auto} means to use color only when the standard error is a terminal. 3200The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are 3201aliases for @option{-fdiagnostics-color=always} and 3202@option{-fdiagnostics-color=never}, respectively. 3203 3204The colors are defined by the environment variable @env{GCC_COLORS}. 3205Its value is a colon-separated list of capabilities and Select Graphic 3206Rendition (SGR) substrings. SGR commands are interpreted by the 3207terminal or terminal emulator. (See the section in the documentation 3208of your text terminal for permitted values and their meanings as 3209character attributes.) These substring values are integers in decimal 3210representation and can be concatenated with semicolons. 3211Common values to concatenate include 3212@samp{1} for bold, 3213@samp{4} for underline, 3214@samp{5} for blink, 3215@samp{7} for inverse, 3216@samp{39} for default foreground color, 3217@samp{30} to @samp{37} for foreground colors, 3218@samp{90} to @samp{97} for 16-color mode foreground colors, 3219@samp{38;5;0} to @samp{38;5;255} 3220for 88-color and 256-color modes foreground colors, 3221@samp{49} for default background color, 3222@samp{40} to @samp{47} for background colors, 3223@samp{100} to @samp{107} for 16-color mode background colors, 3224and @samp{48;5;0} to @samp{48;5;255} 3225for 88-color and 256-color modes background colors. 3226 3227The default @env{GCC_COLORS} is 3228@smallexample 3229error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01 3230@end smallexample 3231@noindent 3232where @samp{01;31} is bold red, @samp{01;35} is bold magenta, 3233@samp{01;36} is bold cyan, @samp{01;32} is bold green and 3234@samp{01} is bold. Setting @env{GCC_COLORS} to the empty 3235string disables colors. 3236Supported capabilities are as follows. 3237 3238@table @code 3239@item error= 3240@vindex error GCC_COLORS @r{capability} 3241SGR substring for error: markers. 3242 3243@item warning= 3244@vindex warning GCC_COLORS @r{capability} 3245SGR substring for warning: markers. 3246 3247@item note= 3248@vindex note GCC_COLORS @r{capability} 3249SGR substring for note: markers. 3250 3251@item caret= 3252@vindex caret GCC_COLORS @r{capability} 3253SGR substring for caret line. 3254 3255@item locus= 3256@vindex locus GCC_COLORS @r{capability} 3257SGR substring for location information, @samp{file:line} or 3258@samp{file:line:column} etc. 3259 3260@item quote= 3261@vindex quote GCC_COLORS @r{capability} 3262SGR substring for information printed within quotes. 3263@end table 3264 3265@item -fno-diagnostics-show-option 3266@opindex fno-diagnostics-show-option 3267@opindex fdiagnostics-show-option 3268By default, each diagnostic emitted includes text indicating the 3269command-line option that directly controls the diagnostic (if such an 3270option is known to the diagnostic machinery). Specifying the 3271@option{-fno-diagnostics-show-option} flag suppresses that behavior. 3272 3273@item -fno-diagnostics-show-caret 3274@opindex fno-diagnostics-show-caret 3275@opindex fdiagnostics-show-caret 3276By default, each diagnostic emitted includes the original source line 3277and a caret '^' indicating the column. This option suppresses this 3278information. The source line is truncated to @var{n} characters, if 3279the @option{-fmessage-length=n} option is given. When the output is done 3280to the terminal, the width is limited to the width given by the 3281@env{COLUMNS} environment variable or, if not set, to the terminal width. 3282 3283@end table 3284 3285@node Warning Options 3286@section Options to Request or Suppress Warnings 3287@cindex options to control warnings 3288@cindex warning messages 3289@cindex messages, warning 3290@cindex suppressing warnings 3291 3292Warnings are diagnostic messages that report constructions that 3293are not inherently erroneous but that are risky or suggest there 3294may have been an error. 3295 3296The following language-independent options do not enable specific 3297warnings but control the kinds of diagnostics produced by GCC@. 3298 3299@table @gcctabopt 3300@cindex syntax checking 3301@item -fsyntax-only 3302@opindex fsyntax-only 3303Check the code for syntax errors, but don't do anything beyond that. 3304 3305@item -fmax-errors=@var{n} 3306@opindex fmax-errors 3307Limits the maximum number of error messages to @var{n}, at which point 3308GCC bails out rather than attempting to continue processing the source 3309code. If @var{n} is 0 (the default), there is no limit on the number 3310of error messages produced. If @option{-Wfatal-errors} is also 3311specified, then @option{-Wfatal-errors} takes precedence over this 3312option. 3313 3314@item -w 3315@opindex w 3316Inhibit all warning messages. 3317 3318@item -Werror 3319@opindex Werror 3320@opindex Wno-error 3321Make all warnings into errors. 3322 3323@item -Werror= 3324@opindex Werror= 3325@opindex Wno-error= 3326Make the specified warning into an error. The specifier for a warning 3327is appended; for example @option{-Werror=switch} turns the warnings 3328controlled by @option{-Wswitch} into errors. This switch takes a 3329negative form, to be used to negate @option{-Werror} for specific 3330warnings; for example @option{-Wno-error=switch} makes 3331@option{-Wswitch} warnings not be errors, even when @option{-Werror} 3332is in effect. 3333 3334The warning message for each controllable warning includes the 3335option that controls the warning. That option can then be used with 3336@option{-Werror=} and @option{-Wno-error=} as described above. 3337(Printing of the option in the warning message can be disabled using the 3338@option{-fno-diagnostics-show-option} flag.) 3339 3340Note that specifying @option{-Werror=}@var{foo} automatically implies 3341@option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not 3342imply anything. 3343 3344@item -Wfatal-errors 3345@opindex Wfatal-errors 3346@opindex Wno-fatal-errors 3347This option causes the compiler to abort compilation on the first error 3348occurred rather than trying to keep going and printing further error 3349messages. 3350 3351@end table 3352 3353You can request many specific warnings with options beginning with 3354@samp{-W}, for example @option{-Wimplicit} to request warnings on 3355implicit declarations. Each of these specific warning options also 3356has a negative form beginning @samp{-Wno-} to turn off warnings; for 3357example, @option{-Wno-implicit}. This manual lists only one of the 3358two forms, whichever is not the default. For further 3359language-specific options also refer to @ref{C++ Dialect Options} and 3360@ref{Objective-C and Objective-C++ Dialect Options}. 3361 3362Some options, such as @option{-Wall} and @option{-Wextra}, turn on other 3363options, such as @option{-Wunused}, which may turn on further options, 3364such as @option{-Wunused-value}. The combined effect of positive and 3365negative forms is that more specific options have priority over less 3366specific ones, independently of their position in the command-line. For 3367options of the same specificity, the last one takes effect. Options 3368enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect 3369as if they appeared at the end of the command-line. 3370 3371When an unrecognized warning option is requested (e.g., 3372@option{-Wunknown-warning}), GCC emits a diagnostic stating 3373that the option is not recognized. However, if the @option{-Wno-} form 3374is used, the behavior is slightly different: no diagnostic is 3375produced for @option{-Wno-unknown-warning} unless other diagnostics 3376are being produced. This allows the use of new @option{-Wno-} options 3377with old compilers, but if something goes wrong, the compiler 3378warns that an unrecognized option is present. 3379 3380@table @gcctabopt 3381@item -Wpedantic 3382@itemx -pedantic 3383@opindex pedantic 3384@opindex Wpedantic 3385Issue all the warnings demanded by strict ISO C and ISO C++; 3386reject all programs that use forbidden extensions, and some other 3387programs that do not follow ISO C and ISO C++. For ISO C, follows the 3388version of the ISO C standard specified by any @option{-std} option used. 3389 3390Valid ISO C and ISO C++ programs should compile properly with or without 3391this option (though a rare few require @option{-ansi} or a 3392@option{-std} option specifying the required version of ISO C)@. However, 3393without this option, certain GNU extensions and traditional C and C++ 3394features are supported as well. With this option, they are rejected. 3395 3396@option{-Wpedantic} does not cause warning messages for use of the 3397alternate keywords whose names begin and end with @samp{__}. Pedantic 3398warnings are also disabled in the expression that follows 3399@code{__extension__}. However, only system header files should use 3400these escape routes; application programs should avoid them. 3401@xref{Alternate Keywords}. 3402 3403Some users try to use @option{-Wpedantic} to check programs for strict ISO 3404C conformance. They soon find that it does not do quite what they want: 3405it finds some non-ISO practices, but not all---only those for which 3406ISO C @emph{requires} a diagnostic, and some others for which 3407diagnostics have been added. 3408 3409A feature to report any failure to conform to ISO C might be useful in 3410some instances, but would require considerable additional work and would 3411be quite different from @option{-Wpedantic}. We don't have plans to 3412support such a feature in the near future. 3413 3414Where the standard specified with @option{-std} represents a GNU 3415extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a 3416corresponding @dfn{base standard}, the version of ISO C on which the GNU 3417extended dialect is based. Warnings from @option{-Wpedantic} are given 3418where they are required by the base standard. (It does not make sense 3419for such warnings to be given only for features not in the specified GNU 3420C dialect, since by definition the GNU dialects of C include all 3421features the compiler supports with the given option, and there would be 3422nothing to warn about.) 3423 3424@item -pedantic-errors 3425@opindex pedantic-errors 3426Give an error whenever the @dfn{base standard} (see @option{-Wpedantic}) 3427requires a diagnostic, in some cases where there is undefined behavior 3428at compile-time and in some other cases that do not prevent compilation 3429of programs that are valid according to the standard. This is not 3430equivalent to @option{-Werror=pedantic}, since there are errors enabled 3431by this option and not enabled by the latter and vice versa. 3432 3433@item -Wall 3434@opindex Wall 3435@opindex Wno-all 3436This enables all the warnings about constructions that some users 3437consider questionable, and that are easy to avoid (or modify to 3438prevent the warning), even in conjunction with macros. This also 3439enables some language-specific warnings described in @ref{C++ Dialect 3440Options} and @ref{Objective-C and Objective-C++ Dialect Options}. 3441 3442@option{-Wall} turns on the following warning flags: 3443 3444@gccoptlist{-Waddress @gol 3445-Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol 3446-Wc++11-compat -Wc++14-compat@gol 3447-Wchar-subscripts @gol 3448-Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol 3449-Wimplicit-int @r{(C and Objective-C only)} @gol 3450-Wimplicit-function-declaration @r{(C and Objective-C only)} @gol 3451-Wcomment @gol 3452-Wformat @gol 3453-Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol 3454-Wmaybe-uninitialized @gol 3455-Wmissing-braces @r{(only for C/ObjC)} @gol 3456-Wnonnull @gol 3457-Wopenmp-simd @gol 3458-Wparentheses @gol 3459-Wpointer-sign @gol 3460-Wreorder @gol 3461-Wreturn-type @gol 3462-Wsequence-point @gol 3463-Wsign-compare @r{(only in C++)} @gol 3464-Wstrict-aliasing @gol 3465-Wstrict-overflow=1 @gol 3466-Wswitch @gol 3467-Wtrigraphs @gol 3468-Wuninitialized @gol 3469-Wunknown-pragmas @gol 3470-Wunused-function @gol 3471-Wunused-label @gol 3472-Wunused-value @gol 3473-Wunused-variable @gol 3474-Wvolatile-register-var @gol 3475} 3476 3477Note that some warning flags are not implied by @option{-Wall}. Some of 3478them warn about constructions that users generally do not consider 3479questionable, but which occasionally you might wish to check for; 3480others warn about constructions that are necessary or hard to avoid in 3481some cases, and there is no simple way to modify the code to suppress 3482the warning. Some of them are enabled by @option{-Wextra} but many of 3483them must be enabled individually. 3484 3485@item -Wextra 3486@opindex W 3487@opindex Wextra 3488@opindex Wno-extra 3489This enables some extra warning flags that are not enabled by 3490@option{-Wall}. (This option used to be called @option{-W}. The older 3491name is still supported, but the newer name is more descriptive.) 3492 3493@gccoptlist{-Wclobbered @gol 3494-Wempty-body @gol 3495-Wignored-qualifiers @gol 3496-Wmissing-field-initializers @gol 3497-Wmissing-parameter-type @r{(C only)} @gol 3498-Wold-style-declaration @r{(C only)} @gol 3499-Woverride-init @gol 3500-Wsign-compare @gol 3501-Wtype-limits @gol 3502-Wuninitialized @gol 3503-Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol 3504-Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol 3505} 3506 3507The option @option{-Wextra} also prints warning messages for the 3508following cases: 3509 3510@itemize @bullet 3511 3512@item 3513A pointer is compared against integer zero with @code{<}, @code{<=}, 3514@code{>}, or @code{>=}. 3515 3516@item 3517(C++ only) An enumerator and a non-enumerator both appear in a 3518conditional expression. 3519 3520@item 3521(C++ only) Ambiguous virtual bases. 3522 3523@item 3524(C++ only) Subscripting an array that has been declared @code{register}. 3525 3526@item 3527(C++ only) Taking the address of a variable that has been declared 3528@code{register}. 3529 3530@item 3531(C++ only) A base class is not initialized in a derived class's copy 3532constructor. 3533 3534@end itemize 3535 3536@item -Wchar-subscripts 3537@opindex Wchar-subscripts 3538@opindex Wno-char-subscripts 3539Warn if an array subscript has type @code{char}. This is a common cause 3540of error, as programmers often forget that this type is signed on some 3541machines. 3542This warning is enabled by @option{-Wall}. 3543 3544@item -Wcomment 3545@opindex Wcomment 3546@opindex Wno-comment 3547Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*} 3548comment, or whenever a Backslash-Newline appears in a @samp{//} comment. 3549This warning is enabled by @option{-Wall}. 3550 3551@item -Wchkp 3552@opindex Wchkp 3553Warn about an invalid memory access that is found by Pointer Bounds Checker 3554(@option{-fcheck-pointer-bounds}). 3555 3556@item -Wno-coverage-mismatch 3557@opindex Wno-coverage-mismatch 3558Warn if feedback profiles do not match when using the 3559@option{-fprofile-use} option. 3560If a source file is changed between compiling with @option{-fprofile-gen} and 3561with @option{-fprofile-use}, the files with the profile feedback can fail 3562to match the source file and GCC cannot use the profile feedback 3563information. By default, this warning is enabled and is treated as an 3564error. @option{-Wno-coverage-mismatch} can be used to disable the 3565warning or @option{-Wno-error=coverage-mismatch} can be used to 3566disable the error. Disabling the error for this warning can result in 3567poorly optimized code and is useful only in the 3568case of very minor changes such as bug fixes to an existing code-base. 3569Completely disabling the warning is not recommended. 3570 3571@item -Wno-cpp 3572@r{(C, Objective-C, C++, Objective-C++ and Fortran only)} 3573 3574Suppress warning messages emitted by @code{#warning} directives. 3575 3576@item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)} 3577@opindex Wdouble-promotion 3578@opindex Wno-double-promotion 3579Give a warning when a value of type @code{float} is implicitly 3580promoted to @code{double}. CPUs with a 32-bit ``single-precision'' 3581floating-point unit implement @code{float} in hardware, but emulate 3582@code{double} in software. On such a machine, doing computations 3583using @code{double} values is much more expensive because of the 3584overhead required for software emulation. 3585 3586It is easy to accidentally do computations with @code{double} because 3587floating-point literals are implicitly of type @code{double}. For 3588example, in: 3589@smallexample 3590@group 3591float area(float radius) 3592@{ 3593 return 3.14159 * radius * radius; 3594@} 3595@end group 3596@end smallexample 3597the compiler performs the entire computation with @code{double} 3598because the floating-point literal is a @code{double}. 3599 3600@item -Wformat 3601@itemx -Wformat=@var{n} 3602@opindex Wformat 3603@opindex Wno-format 3604@opindex ffreestanding 3605@opindex fno-builtin 3606@opindex Wformat= 3607Check calls to @code{printf} and @code{scanf}, etc., to make sure that 3608the arguments supplied have types appropriate to the format string 3609specified, and that the conversions specified in the format string make 3610sense. This includes standard functions, and others specified by format 3611attributes (@pxref{Function Attributes}), in the @code{printf}, 3612@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension, 3613not in the C standard) families (or other target-specific families). 3614Which functions are checked without format attributes having been 3615specified depends on the standard version selected, and such checks of 3616functions without the attribute specified are disabled by 3617@option{-ffreestanding} or @option{-fno-builtin}. 3618 3619The formats are checked against the format features supported by GNU 3620libc version 2.2. These include all ISO C90 and C99 features, as well 3621as features from the Single Unix Specification and some BSD and GNU 3622extensions. Other library implementations may not support all these 3623features; GCC does not support warning about features that go beyond a 3624particular library's limitations. However, if @option{-Wpedantic} is used 3625with @option{-Wformat}, warnings are given about format features not 3626in the selected standard version (but not for @code{strfmon} formats, 3627since those are not in any version of the C standard). @xref{C Dialect 3628Options,,Options Controlling C Dialect}. 3629 3630@table @gcctabopt 3631@item -Wformat=1 3632@itemx -Wformat 3633@opindex Wformat 3634@opindex Wformat=1 3635Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and 3636@option{-Wno-format} is equivalent to @option{-Wformat=0}. Since 3637@option{-Wformat} also checks for null format arguments for several 3638functions, @option{-Wformat} also implies @option{-Wnonnull}. Some 3639aspects of this level of format checking can be disabled by the 3640options: @option{-Wno-format-contains-nul}, 3641@option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}. 3642@option{-Wformat} is enabled by @option{-Wall}. 3643 3644@item -Wno-format-contains-nul 3645@opindex Wno-format-contains-nul 3646@opindex Wformat-contains-nul 3647If @option{-Wformat} is specified, do not warn about format strings that 3648contain NUL bytes. 3649 3650@item -Wno-format-extra-args 3651@opindex Wno-format-extra-args 3652@opindex Wformat-extra-args 3653If @option{-Wformat} is specified, do not warn about excess arguments to a 3654@code{printf} or @code{scanf} format function. The C standard specifies 3655that such arguments are ignored. 3656 3657Where the unused arguments lie between used arguments that are 3658specified with @samp{$} operand number specifications, normally 3659warnings are still given, since the implementation could not know what 3660type to pass to @code{va_arg} to skip the unused arguments. However, 3661in the case of @code{scanf} formats, this option suppresses the 3662warning if the unused arguments are all pointers, since the Single 3663Unix Specification says that such unused arguments are allowed. 3664 3665@item -Wno-format-zero-length 3666@opindex Wno-format-zero-length 3667@opindex Wformat-zero-length 3668If @option{-Wformat} is specified, do not warn about zero-length formats. 3669The C standard specifies that zero-length formats are allowed. 3670 3671 3672@item -Wformat=2 3673@opindex Wformat=2 3674Enable @option{-Wformat} plus additional format checks. Currently 3675equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security 3676-Wformat-y2k}. 3677 3678@item -Wformat-nonliteral 3679@opindex Wformat-nonliteral 3680@opindex Wno-format-nonliteral 3681If @option{-Wformat} is specified, also warn if the format string is not a 3682string literal and so cannot be checked, unless the format function 3683takes its format arguments as a @code{va_list}. 3684 3685@item -Wformat-security 3686@opindex Wformat-security 3687@opindex Wno-format-security 3688If @option{-Wformat} is specified, also warn about uses of format 3689functions that represent possible security problems. At present, this 3690warns about calls to @code{printf} and @code{scanf} functions where the 3691format string is not a string literal and there are no format arguments, 3692as in @code{printf (foo);}. This may be a security hole if the format 3693string came from untrusted input and contains @samp{%n}. (This is 3694currently a subset of what @option{-Wformat-nonliteral} warns about, but 3695in future warnings may be added to @option{-Wformat-security} that are not 3696included in @option{-Wformat-nonliteral}.) 3697 3698@item -Wformat-signedness 3699@opindex Wformat-signedness 3700@opindex Wno-format-signedness 3701If @option{-Wformat} is specified, also warn if the format string 3702requires an unsigned argument and the argument is signed and vice versa. 3703 3704@item -Wformat-y2k 3705@opindex Wformat-y2k 3706@opindex Wno-format-y2k 3707If @option{-Wformat} is specified, also warn about @code{strftime} 3708formats that may yield only a two-digit year. 3709@end table 3710 3711@item -Wnonnull 3712@opindex Wnonnull 3713@opindex Wno-nonnull 3714Warn about passing a null pointer for arguments marked as 3715requiring a non-null value by the @code{nonnull} function attribute. 3716 3717@option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It 3718can be disabled with the @option{-Wno-nonnull} option. 3719 3720@item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)} 3721@opindex Winit-self 3722@opindex Wno-init-self 3723Warn about uninitialized variables that are initialized with themselves. 3724Note this option can only be used with the @option{-Wuninitialized} option. 3725 3726For example, GCC warns about @code{i} being uninitialized in the 3727following snippet only when @option{-Winit-self} has been specified: 3728@smallexample 3729@group 3730int f() 3731@{ 3732 int i = i; 3733 return i; 3734@} 3735@end group 3736@end smallexample 3737 3738This warning is enabled by @option{-Wall} in C++. 3739 3740@item -Wimplicit-int @r{(C and Objective-C only)} 3741@opindex Wimplicit-int 3742@opindex Wno-implicit-int 3743Warn when a declaration does not specify a type. 3744This warning is enabled by @option{-Wall}. 3745 3746@item -Wimplicit-function-declaration @r{(C and Objective-C only)} 3747@opindex Wimplicit-function-declaration 3748@opindex Wno-implicit-function-declaration 3749Give a warning whenever a function is used before being declared. In 3750C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is 3751enabled by default and it is made into an error by 3752@option{-pedantic-errors}. This warning is also enabled by 3753@option{-Wall}. 3754 3755@item -Wimplicit @r{(C and Objective-C only)} 3756@opindex Wimplicit 3757@opindex Wno-implicit 3758Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}. 3759This warning is enabled by @option{-Wall}. 3760 3761@item -Wignored-qualifiers @r{(C and C++ only)} 3762@opindex Wignored-qualifiers 3763@opindex Wno-ignored-qualifiers 3764Warn if the return type of a function has a type qualifier 3765such as @code{const}. For ISO C such a type qualifier has no effect, 3766since the value returned by a function is not an lvalue. 3767For C++, the warning is only emitted for scalar types or @code{void}. 3768ISO C prohibits qualified @code{void} return types on function 3769definitions, so such return types always receive a warning 3770even without this option. 3771 3772This warning is also enabled by @option{-Wextra}. 3773 3774@item -Wmain 3775@opindex Wmain 3776@opindex Wno-main 3777Warn if the type of @code{main} is suspicious. @code{main} should be 3778a function with external linkage, returning int, taking either zero 3779arguments, two, or three arguments of appropriate types. This warning 3780is enabled by default in C++ and is enabled by either @option{-Wall} 3781or @option{-Wpedantic}. 3782 3783@item -Wmissing-braces 3784@opindex Wmissing-braces 3785@opindex Wno-missing-braces 3786Warn if an aggregate or union initializer is not fully bracketed. In 3787the following example, the initializer for @code{a} is not fully 3788bracketed, but that for @code{b} is fully bracketed. This warning is 3789enabled by @option{-Wall} in C. 3790 3791@smallexample 3792int a[2][2] = @{ 0, 1, 2, 3 @}; 3793int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @}; 3794@end smallexample 3795 3796This warning is enabled by @option{-Wall}. 3797 3798@item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)} 3799@opindex Wmissing-include-dirs 3800@opindex Wno-missing-include-dirs 3801Warn if a user-supplied include directory does not exist. 3802 3803@item -Wparentheses 3804@opindex Wparentheses 3805@opindex Wno-parentheses 3806Warn if parentheses are omitted in certain contexts, such 3807as when there is an assignment in a context where a truth value 3808is expected, or when operators are nested whose precedence people 3809often get confused about. 3810 3811Also warn if a comparison like @code{x<=y<=z} appears; this is 3812equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different 3813interpretation from that of ordinary mathematical notation. 3814 3815Also warn about constructions where there may be confusion to which 3816@code{if} statement an @code{else} branch belongs. Here is an example of 3817such a case: 3818 3819@smallexample 3820@group 3821@{ 3822 if (a) 3823 if (b) 3824 foo (); 3825 else 3826 bar (); 3827@} 3828@end group 3829@end smallexample 3830 3831In C/C++, every @code{else} branch belongs to the innermost possible 3832@code{if} statement, which in this example is @code{if (b)}. This is 3833often not what the programmer expected, as illustrated in the above 3834example by indentation the programmer chose. When there is the 3835potential for this confusion, GCC issues a warning when this flag 3836is specified. To eliminate the warning, add explicit braces around 3837the innermost @code{if} statement so there is no way the @code{else} 3838can belong to the enclosing @code{if}. The resulting code 3839looks like this: 3840 3841@smallexample 3842@group 3843@{ 3844 if (a) 3845 @{ 3846 if (b) 3847 foo (); 3848 else 3849 bar (); 3850 @} 3851@} 3852@end group 3853@end smallexample 3854 3855Also warn for dangerous uses of the GNU extension to 3856@code{?:} with omitted middle operand. When the condition 3857in the @code{?}: operator is a boolean expression, the omitted value is 3858always 1. Often programmers expect it to be a value computed 3859inside the conditional expression instead. 3860 3861This warning is enabled by @option{-Wall}. 3862 3863@item -Wsequence-point 3864@opindex Wsequence-point 3865@opindex Wno-sequence-point 3866Warn about code that may have undefined semantics because of violations 3867of sequence point rules in the C and C++ standards. 3868 3869The C and C++ standards define the order in which expressions in a C/C++ 3870program are evaluated in terms of @dfn{sequence points}, which represent 3871a partial ordering between the execution of parts of the program: those 3872executed before the sequence point, and those executed after it. These 3873occur after the evaluation of a full expression (one which is not part 3874of a larger expression), after the evaluation of the first operand of a 3875@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a 3876function is called (but after the evaluation of its arguments and the 3877expression denoting the called function), and in certain other places. 3878Other than as expressed by the sequence point rules, the order of 3879evaluation of subexpressions of an expression is not specified. All 3880these rules describe only a partial order rather than a total order, 3881since, for example, if two functions are called within one expression 3882with no sequence point between them, the order in which the functions 3883are called is not specified. However, the standards committee have 3884ruled that function calls do not overlap. 3885 3886It is not specified when between sequence points modifications to the 3887values of objects take effect. Programs whose behavior depends on this 3888have undefined behavior; the C and C++ standards specify that ``Between 3889the previous and next sequence point an object shall have its stored 3890value modified at most once by the evaluation of an expression. 3891Furthermore, the prior value shall be read only to determine the value 3892to be stored.''. If a program breaks these rules, the results on any 3893particular implementation are entirely unpredictable. 3894 3895Examples of code with undefined behavior are @code{a = a++;}, 3896@code{a[n] = b[n++]} and @code{a[i++] = i;}. Some more complicated cases 3897are not diagnosed by this option, and it may give an occasional false 3898positive result, but in general it has been found fairly effective at 3899detecting this sort of problem in programs. 3900 3901The standard is worded confusingly, therefore there is some debate 3902over the precise meaning of the sequence point rules in subtle cases. 3903Links to discussions of the problem, including proposed formal 3904definitions, may be found on the GCC readings page, at 3905@uref{http://gcc.gnu.org/@/readings.html}. 3906 3907This warning is enabled by @option{-Wall} for C and C++. 3908 3909@item -Wno-return-local-addr 3910@opindex Wno-return-local-addr 3911@opindex Wreturn-local-addr 3912Do not warn about returning a pointer (or in C++, a reference) to a 3913variable that goes out of scope after the function returns. 3914 3915@item -Wreturn-type 3916@opindex Wreturn-type 3917@opindex Wno-return-type 3918Warn whenever a function is defined with a return type that defaults 3919to @code{int}. Also warn about any @code{return} statement with no 3920return value in a function whose return type is not @code{void} 3921(falling off the end of the function body is considered returning 3922without a value), and about a @code{return} statement with an 3923expression in a function whose return type is @code{void}. 3924 3925For C++, a function without return type always produces a diagnostic 3926message, even when @option{-Wno-return-type} is specified. The only 3927exceptions are @code{main} and functions defined in system headers. 3928 3929This warning is enabled by @option{-Wall}. 3930 3931@item -Wshift-count-negative 3932@opindex Wshift-count-negative 3933@opindex Wno-shift-count-negative 3934Warn if shift count is negative. This warning is enabled by default. 3935 3936@item -Wshift-count-overflow 3937@opindex Wshift-count-overflow 3938@opindex Wno-shift-count-overflow 3939Warn if shift count >= width of type. This warning is enabled by default. 3940 3941@item -Wswitch 3942@opindex Wswitch 3943@opindex Wno-switch 3944Warn whenever a @code{switch} statement has an index of enumerated type 3945and lacks a @code{case} for one or more of the named codes of that 3946enumeration. (The presence of a @code{default} label prevents this 3947warning.) @code{case} labels outside the enumeration range also 3948provoke warnings when this option is used (even if there is a 3949@code{default} label). 3950This warning is enabled by @option{-Wall}. 3951 3952@item -Wswitch-default 3953@opindex Wswitch-default 3954@opindex Wno-switch-default 3955Warn whenever a @code{switch} statement does not have a @code{default} 3956case. 3957 3958@item -Wswitch-enum 3959@opindex Wswitch-enum 3960@opindex Wno-switch-enum 3961Warn whenever a @code{switch} statement has an index of enumerated type 3962and lacks a @code{case} for one or more of the named codes of that 3963enumeration. @code{case} labels outside the enumeration range also 3964provoke warnings when this option is used. The only difference 3965between @option{-Wswitch} and this option is that this option gives a 3966warning about an omitted enumeration code even if there is a 3967@code{default} label. 3968 3969@item -Wswitch-bool 3970@opindex Wswitch-bool 3971@opindex Wno-switch-bool 3972Warn whenever a @code{switch} statement has an index of boolean type. 3973It is possible to suppress this warning by casting the controlling 3974expression to a type other than @code{bool}. For example: 3975@smallexample 3976@group 3977switch ((int) (a == 4)) 3978 @{ 3979 @dots{} 3980 @} 3981@end group 3982@end smallexample 3983This warning is enabled by default for C and C++ programs. 3984 3985@item -Wsync-nand @r{(C and C++ only)} 3986@opindex Wsync-nand 3987@opindex Wno-sync-nand 3988Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch} 3989built-in functions are used. These functions changed semantics in GCC 4.4. 3990 3991@item -Wtrigraphs 3992@opindex Wtrigraphs 3993@opindex Wno-trigraphs 3994Warn if any trigraphs are encountered that might change the meaning of 3995the program (trigraphs within comments are not warned about). 3996This warning is enabled by @option{-Wall}. 3997 3998@item -Wunused-but-set-parameter 3999@opindex Wunused-but-set-parameter 4000@opindex Wno-unused-but-set-parameter 4001Warn whenever a function parameter is assigned to, but otherwise unused 4002(aside from its declaration). 4003 4004To suppress this warning use the @code{unused} attribute 4005(@pxref{Variable Attributes}). 4006 4007This warning is also enabled by @option{-Wunused} together with 4008@option{-Wextra}. 4009 4010@item -Wunused-but-set-variable 4011@opindex Wunused-but-set-variable 4012@opindex Wno-unused-but-set-variable 4013Warn whenever a local variable is assigned to, but otherwise unused 4014(aside from its declaration). 4015This warning is enabled by @option{-Wall}. 4016 4017To suppress this warning use the @code{unused} attribute 4018(@pxref{Variable Attributes}). 4019 4020This warning is also enabled by @option{-Wunused}, which is enabled 4021by @option{-Wall}. 4022 4023@item -Wunused-function 4024@opindex Wunused-function 4025@opindex Wno-unused-function 4026Warn whenever a static function is declared but not defined or a 4027non-inline static function is unused. 4028This warning is enabled by @option{-Wall}. 4029 4030@item -Wunused-label 4031@opindex Wunused-label 4032@opindex Wno-unused-label 4033Warn whenever a label is declared but not used. 4034This warning is enabled by @option{-Wall}. 4035 4036To suppress this warning use the @code{unused} attribute 4037(@pxref{Variable Attributes}). 4038 4039@item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)} 4040@opindex Wunused-local-typedefs 4041Warn when a typedef locally defined in a function is not used. 4042This warning is enabled by @option{-Wall}. 4043 4044@item -Wunused-parameter 4045@opindex Wunused-parameter 4046@opindex Wno-unused-parameter 4047Warn whenever a function parameter is unused aside from its declaration. 4048 4049To suppress this warning use the @code{unused} attribute 4050(@pxref{Variable Attributes}). 4051 4052@item -Wno-unused-result 4053@opindex Wunused-result 4054@opindex Wno-unused-result 4055Do not warn if a caller of a function marked with attribute 4056@code{warn_unused_result} (@pxref{Function Attributes}) does not use 4057its return value. The default is @option{-Wunused-result}. 4058 4059@item -Wunused-variable 4060@opindex Wunused-variable 4061@opindex Wno-unused-variable 4062Warn whenever a local variable or non-constant static variable is unused 4063aside from its declaration. 4064This warning is enabled by @option{-Wall}. 4065 4066To suppress this warning use the @code{unused} attribute 4067(@pxref{Variable Attributes}). 4068 4069@item -Wunused-value 4070@opindex Wunused-value 4071@opindex Wno-unused-value 4072Warn whenever a statement computes a result that is explicitly not 4073used. To suppress this warning cast the unused expression to 4074@code{void}. This includes an expression-statement or the left-hand 4075side of a comma expression that contains no side effects. For example, 4076an expression such as @code{x[i,j]} causes a warning, while 4077@code{x[(void)i,j]} does not. 4078 4079This warning is enabled by @option{-Wall}. 4080 4081@item -Wunused 4082@opindex Wunused 4083@opindex Wno-unused 4084All the above @option{-Wunused} options combined. 4085 4086In order to get a warning about an unused function parameter, you must 4087either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies 4088@option{-Wunused}), or separately specify @option{-Wunused-parameter}. 4089 4090@item -Wuninitialized 4091@opindex Wuninitialized 4092@opindex Wno-uninitialized 4093Warn if an automatic variable is used without first being initialized 4094or if a variable may be clobbered by a @code{setjmp} call. In C++, 4095warn if a non-static reference or non-static @code{const} member 4096appears in a class without constructors. 4097 4098If you want to warn about code that uses the uninitialized value of the 4099variable in its own initializer, use the @option{-Winit-self} option. 4100 4101These warnings occur for individual uninitialized or clobbered 4102elements of structure, union or array variables as well as for 4103variables that are uninitialized or clobbered as a whole. They do 4104not occur for variables or elements declared @code{volatile}. Because 4105these warnings depend on optimization, the exact variables or elements 4106for which there are warnings depends on the precise optimization 4107options and version of GCC used. 4108 4109Note that there may be no warning about a variable that is used only 4110to compute a value that itself is never used, because such 4111computations may be deleted by data flow analysis before the warnings 4112are printed. 4113 4114@item -Wmaybe-uninitialized 4115@opindex Wmaybe-uninitialized 4116@opindex Wno-maybe-uninitialized 4117For an automatic variable, if there exists a path from the function 4118entry to a use of the variable that is initialized, but there exist 4119some other paths for which the variable is not initialized, the compiler 4120emits a warning if it cannot prove the uninitialized paths are not 4121executed at run time. These warnings are made optional because GCC is 4122not smart enough to see all the reasons why the code might be correct 4123in spite of appearing to have an error. Here is one example of how 4124this can happen: 4125 4126@smallexample 4127@group 4128@{ 4129 int x; 4130 switch (y) 4131 @{ 4132 case 1: x = 1; 4133 break; 4134 case 2: x = 4; 4135 break; 4136 case 3: x = 5; 4137 @} 4138 foo (x); 4139@} 4140@end group 4141@end smallexample 4142 4143@noindent 4144If the value of @code{y} is always 1, 2 or 3, then @code{x} is 4145always initialized, but GCC doesn't know this. To suppress the 4146warning, you need to provide a default case with assert(0) or 4147similar code. 4148 4149@cindex @code{longjmp} warnings 4150This option also warns when a non-volatile automatic variable might be 4151changed by a call to @code{longjmp}. These warnings as well are possible 4152only in optimizing compilation. 4153 4154The compiler sees only the calls to @code{setjmp}. It cannot know 4155where @code{longjmp} will be called; in fact, a signal handler could 4156call it at any point in the code. As a result, you may get a warning 4157even when there is in fact no problem because @code{longjmp} cannot 4158in fact be called at the place that would cause a problem. 4159 4160Some spurious warnings can be avoided if you declare all the functions 4161you use that never return as @code{noreturn}. @xref{Function 4162Attributes}. 4163 4164This warning is enabled by @option{-Wall} or @option{-Wextra}. 4165 4166@item -Wunknown-pragmas 4167@opindex Wunknown-pragmas 4168@opindex Wno-unknown-pragmas 4169@cindex warning for unknown pragmas 4170@cindex unknown pragmas, warning 4171@cindex pragmas, warning of unknown 4172Warn when a @code{#pragma} directive is encountered that is not understood by 4173GCC@. If this command-line option is used, warnings are even issued 4174for unknown pragmas in system header files. This is not the case if 4175the warnings are only enabled by the @option{-Wall} command-line option. 4176 4177@item -Wno-pragmas 4178@opindex Wno-pragmas 4179@opindex Wpragmas 4180Do not warn about misuses of pragmas, such as incorrect parameters, 4181invalid syntax, or conflicts between pragmas. See also 4182@option{-Wunknown-pragmas}. 4183 4184@item -Wstrict-aliasing 4185@opindex Wstrict-aliasing 4186@opindex Wno-strict-aliasing 4187This option is only active when @option{-fstrict-aliasing} is active. 4188It warns about code that might break the strict aliasing rules that the 4189compiler is using for optimization. The warning does not catch all 4190cases, but does attempt to catch the more common pitfalls. It is 4191included in @option{-Wall}. 4192It is equivalent to @option{-Wstrict-aliasing=3} 4193 4194@item -Wstrict-aliasing=n 4195@opindex Wstrict-aliasing=n 4196This option is only active when @option{-fstrict-aliasing} is active. 4197It warns about code that might break the strict aliasing rules that the 4198compiler is using for optimization. 4199Higher levels correspond to higher accuracy (fewer false positives). 4200Higher levels also correspond to more effort, similar to the way @option{-O} 4201works. 4202@option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}. 4203 4204Level 1: Most aggressive, quick, least accurate. 4205Possibly useful when higher levels 4206do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few 4207false negatives. However, it has many false positives. 4208Warns for all pointer conversions between possibly incompatible types, 4209even if never dereferenced. Runs in the front end only. 4210 4211Level 2: Aggressive, quick, not too precise. 4212May still have many false positives (not as many as level 1 though), 4213and few false negatives (but possibly more than level 1). 4214Unlike level 1, it only warns when an address is taken. Warns about 4215incomplete types. Runs in the front end only. 4216 4217Level 3 (default for @option{-Wstrict-aliasing}): 4218Should have very few false positives and few false 4219negatives. Slightly slower than levels 1 or 2 when optimization is enabled. 4220Takes care of the common pun+dereference pattern in the front end: 4221@code{*(int*)&some_float}. 4222If optimization is enabled, it also runs in the back end, where it deals 4223with multiple statement cases using flow-sensitive points-to information. 4224Only warns when the converted pointer is dereferenced. 4225Does not warn about incomplete types. 4226 4227@item -Wstrict-overflow 4228@itemx -Wstrict-overflow=@var{n} 4229@opindex Wstrict-overflow 4230@opindex Wno-strict-overflow 4231This option is only active when @option{-fstrict-overflow} is active. 4232It warns about cases where the compiler optimizes based on the 4233assumption that signed overflow does not occur. Note that it does not 4234warn about all cases where the code might overflow: it only warns 4235about cases where the compiler implements some optimization. Thus 4236this warning depends on the optimization level. 4237 4238An optimization that assumes that signed overflow does not occur is 4239perfectly safe if the values of the variables involved are such that 4240overflow never does, in fact, occur. Therefore this warning can 4241easily give a false positive: a warning about code that is not 4242actually a problem. To help focus on important issues, several 4243warning levels are defined. No warnings are issued for the use of 4244undefined signed overflow when estimating how many iterations a loop 4245requires, in particular when determining whether a loop will be 4246executed at all. 4247 4248@table @gcctabopt 4249@item -Wstrict-overflow=1 4250Warn about cases that are both questionable and easy to avoid. For 4251example, with @option{-fstrict-overflow}, the compiler simplifies 4252@code{x + 1 > x} to @code{1}. This level of 4253@option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels 4254are not, and must be explicitly requested. 4255 4256@item -Wstrict-overflow=2 4257Also warn about other cases where a comparison is simplified to a 4258constant. For example: @code{abs (x) >= 0}. This can only be 4259simplified when @option{-fstrict-overflow} is in effect, because 4260@code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than 4261zero. @option{-Wstrict-overflow} (with no level) is the same as 4262@option{-Wstrict-overflow=2}. 4263 4264@item -Wstrict-overflow=3 4265Also warn about other cases where a comparison is simplified. For 4266example: @code{x + 1 > 1} is simplified to @code{x > 0}. 4267 4268@item -Wstrict-overflow=4 4269Also warn about other simplifications not covered by the above cases. 4270For example: @code{(x * 10) / 5} is simplified to @code{x * 2}. 4271 4272@item -Wstrict-overflow=5 4273Also warn about cases where the compiler reduces the magnitude of a 4274constant involved in a comparison. For example: @code{x + 2 > y} is 4275simplified to @code{x + 1 >= y}. This is reported only at the 4276highest warning level because this simplification applies to many 4277comparisons, so this warning level gives a very large number of 4278false positives. 4279@end table 4280 4281@item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]} 4282@opindex Wsuggest-attribute= 4283@opindex Wno-suggest-attribute= 4284Warn for cases where adding an attribute may be beneficial. The 4285attributes currently supported are listed below. 4286 4287@table @gcctabopt 4288@item -Wsuggest-attribute=pure 4289@itemx -Wsuggest-attribute=const 4290@itemx -Wsuggest-attribute=noreturn 4291@opindex Wsuggest-attribute=pure 4292@opindex Wno-suggest-attribute=pure 4293@opindex Wsuggest-attribute=const 4294@opindex Wno-suggest-attribute=const 4295@opindex Wsuggest-attribute=noreturn 4296@opindex Wno-suggest-attribute=noreturn 4297 4298Warn about functions that might be candidates for attributes 4299@code{pure}, @code{const} or @code{noreturn}. The compiler only warns for 4300functions visible in other compilation units or (in the case of @code{pure} and 4301@code{const}) if it cannot prove that the function returns normally. A function 4302returns normally if it doesn't contain an infinite loop or return abnormally 4303by throwing, calling @code{abort} or trapping. This analysis requires option 4304@option{-fipa-pure-const}, which is enabled by default at @option{-O} and 4305higher. Higher optimization levels improve the accuracy of the analysis. 4306 4307@item -Wsuggest-attribute=format 4308@itemx -Wmissing-format-attribute 4309@opindex Wsuggest-attribute=format 4310@opindex Wmissing-format-attribute 4311@opindex Wno-suggest-attribute=format 4312@opindex Wno-missing-format-attribute 4313@opindex Wformat 4314@opindex Wno-format 4315 4316Warn about function pointers that might be candidates for @code{format} 4317attributes. Note these are only possible candidates, not absolute ones. 4318GCC guesses that function pointers with @code{format} attributes that 4319are used in assignment, initialization, parameter passing or return 4320statements should have a corresponding @code{format} attribute in the 4321resulting type. I.e.@: the left-hand side of the assignment or 4322initialization, the type of the parameter variable, or the return type 4323of the containing function respectively should also have a @code{format} 4324attribute to avoid the warning. 4325 4326GCC also warns about function definitions that might be 4327candidates for @code{format} attributes. Again, these are only 4328possible candidates. GCC guesses that @code{format} attributes 4329might be appropriate for any function that calls a function like 4330@code{vprintf} or @code{vscanf}, but this might not always be the 4331case, and some functions for which @code{format} attributes are 4332appropriate may not be detected. 4333@end table 4334 4335@item -Wsuggest-final-types 4336@opindex Wno-suggest-final-types 4337@opindex Wsuggest-final-types 4338Warn about types with virtual methods where code quality would be improved 4339if the type were declared with the C++11 @code{final} specifier, 4340or, if possible, 4341declared in an anonymous namespace. This allows GCC to more aggressively 4342devirtualize the polymorphic calls. This warning is more effective with link 4343time optimization, where the information about the class hierarchy graph is 4344more complete. 4345 4346@item -Wsuggest-final-methods 4347@opindex Wno-suggest-final-methods 4348@opindex Wsuggest-final-methods 4349Warn about virtual methods where code quality would be improved if the method 4350were declared with the C++11 @code{final} specifier, 4351or, if possible, its type were 4352declared in an anonymous namespace or with the @code{final} specifier. 4353This warning is 4354more effective with link time optimization, where the information about the 4355class hierarchy graph is more complete. It is recommended to first consider 4356suggestions of @option{-Wsuggest-final-types} and then rebuild with new 4357annotations. 4358 4359@item -Wsuggest-override 4360Warn about overriding virtual functions that are not marked with the override 4361keyword. 4362 4363@item -Warray-bounds 4364@itemx -Warray-bounds=@var{n} 4365@opindex Wno-array-bounds 4366@opindex Warray-bounds 4367This option is only active when @option{-ftree-vrp} is active 4368(default for @option{-O2} and above). It warns about subscripts to arrays 4369that are always out of bounds. This warning is enabled by @option{-Wall}. 4370 4371@table @gcctabopt 4372@item -Warray-bounds=1 4373This is the warning level of @option{-Warray-bounds} and is enabled 4374by @option{-Wall}; higher levels are not, and must be explicitly requested. 4375 4376@item -Warray-bounds=2 4377This warning level also warns about out of bounds access for 4378arrays at the end of a struct and for arrays accessed through 4379pointers. This warning level may give a larger number of 4380false positives and is deactivated by default. 4381@end table 4382 4383 4384@item -Wbool-compare 4385@opindex Wno-bool-compare 4386@opindex Wbool-compare 4387Warn about boolean expression compared with an integer value different from 4388@code{true}/@code{false}. For instance, the following comparison is 4389always false: 4390@smallexample 4391int n = 5; 4392@dots{} 4393if ((n > 1) == 2) @{ @dots{} @} 4394@end smallexample 4395This warning is enabled by @option{-Wall}. 4396 4397@item -Wno-discarded-qualifiers @r{(C and Objective-C only)} 4398@opindex Wno-discarded-qualifiers 4399@opindex Wdiscarded-qualifiers 4400Do not warn if type qualifiers on pointers are being discarded. 4401Typically, the compiler warns if a @code{const char *} variable is 4402passed to a function that takes a @code{char *} parameter. This option 4403can be used to suppress such a warning. 4404 4405@item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)} 4406@opindex Wno-discarded-array-qualifiers 4407@opindex Wdiscarded-array-qualifiers 4408Do not warn if type qualifiers on arrays which are pointer targets 4409are being discarded. Typically, the compiler warns if a 4410@code{const int (*)[]} variable is passed to a function that 4411takes a @code{int (*)[]} parameter. This option can be used to 4412suppress such a warning. 4413 4414@item -Wno-incompatible-pointer-types @r{(C and Objective-C only)} 4415@opindex Wno-incompatible-pointer-types 4416@opindex Wincompatible-pointer-types 4417Do not warn when there is a conversion between pointers that have incompatible 4418types. This warning is for cases not covered by @option{-Wno-pointer-sign}, 4419which warns for pointer argument passing or assignment with different 4420signedness. 4421 4422@item -Wno-int-conversion @r{(C and Objective-C only)} 4423@opindex Wno-int-conversion 4424@opindex Wint-conversion 4425Do not warn about incompatible integer to pointer and pointer to integer 4426conversions. This warning is about implicit conversions; for explicit 4427conversions the warnings @option{-Wno-int-to-pointer-cast} and 4428@option{-Wno-pointer-to-int-cast} may be used. 4429 4430@item -Wno-div-by-zero 4431@opindex Wno-div-by-zero 4432@opindex Wdiv-by-zero 4433Do not warn about compile-time integer division by zero. Floating-point 4434division by zero is not warned about, as it can be a legitimate way of 4435obtaining infinities and NaNs. 4436 4437@item -Wsystem-headers 4438@opindex Wsystem-headers 4439@opindex Wno-system-headers 4440@cindex warnings from system headers 4441@cindex system headers, warnings from 4442Print warning messages for constructs found in system header files. 4443Warnings from system headers are normally suppressed, on the assumption 4444that they usually do not indicate real problems and would only make the 4445compiler output harder to read. Using this command-line option tells 4446GCC to emit warnings from system headers as if they occurred in user 4447code. However, note that using @option{-Wall} in conjunction with this 4448option does @emph{not} warn about unknown pragmas in system 4449headers---for that, @option{-Wunknown-pragmas} must also be used. 4450 4451@item -Wtrampolines 4452@opindex Wtrampolines 4453@opindex Wno-trampolines 4454Warn about trampolines generated for pointers to nested functions. 4455A trampoline is a small piece of data or code that is created at run 4456time on the stack when the address of a nested function is taken, and is 4457used to call the nested function indirectly. For some targets, it is 4458made up of data only and thus requires no special treatment. But, for 4459most targets, it is made up of code and thus requires the stack to be 4460made executable in order for the program to work properly. 4461 4462@item -Wfloat-equal 4463@opindex Wfloat-equal 4464@opindex Wno-float-equal 4465Warn if floating-point values are used in equality comparisons. 4466 4467The idea behind this is that sometimes it is convenient (for the 4468programmer) to consider floating-point values as approximations to 4469infinitely precise real numbers. If you are doing this, then you need 4470to compute (by analyzing the code, or in some other way) the maximum or 4471likely maximum error that the computation introduces, and allow for it 4472when performing comparisons (and when producing output, but that's a 4473different problem). In particular, instead of testing for equality, you 4474should check to see whether the two values have ranges that overlap; and 4475this is done with the relational operators, so equality comparisons are 4476probably mistaken. 4477 4478@item -Wtraditional @r{(C and Objective-C only)} 4479@opindex Wtraditional 4480@opindex Wno-traditional 4481Warn about certain constructs that behave differently in traditional and 4482ISO C@. Also warn about ISO C constructs that have no traditional C 4483equivalent, and/or problematic constructs that should be avoided. 4484 4485@itemize @bullet 4486@item 4487Macro parameters that appear within string literals in the macro body. 4488In traditional C macro replacement takes place within string literals, 4489but in ISO C it does not. 4490 4491@item 4492In traditional C, some preprocessor directives did not exist. 4493Traditional preprocessors only considered a line to be a directive 4494if the @samp{#} appeared in column 1 on the line. Therefore 4495@option{-Wtraditional} warns about directives that traditional C 4496understands but ignores because the @samp{#} does not appear as the 4497first character on the line. It also suggests you hide directives like 4498@code{#pragma} not understood by traditional C by indenting them. Some 4499traditional implementations do not recognize @code{#elif}, so this option 4500suggests avoiding it altogether. 4501 4502@item 4503A function-like macro that appears without arguments. 4504 4505@item 4506The unary plus operator. 4507 4508@item 4509The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point 4510constant suffixes. (Traditional C does support the @samp{L} suffix on integer 4511constants.) Note, these suffixes appear in macros defined in the system 4512headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}. 4513Use of these macros in user code might normally lead to spurious 4514warnings, however GCC's integrated preprocessor has enough context to 4515avoid warning in these cases. 4516 4517@item 4518A function declared external in one block and then used after the end of 4519the block. 4520 4521@item 4522A @code{switch} statement has an operand of type @code{long}. 4523 4524@item 4525A non-@code{static} function declaration follows a @code{static} one. 4526This construct is not accepted by some traditional C compilers. 4527 4528@item 4529The ISO type of an integer constant has a different width or 4530signedness from its traditional type. This warning is only issued if 4531the base of the constant is ten. I.e.@: hexadecimal or octal values, which 4532typically represent bit patterns, are not warned about. 4533 4534@item 4535Usage of ISO string concatenation is detected. 4536 4537@item 4538Initialization of automatic aggregates. 4539 4540@item 4541Identifier conflicts with labels. Traditional C lacks a separate 4542namespace for labels. 4543 4544@item 4545Initialization of unions. If the initializer is zero, the warning is 4546omitted. This is done under the assumption that the zero initializer in 4547user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing 4548initializer warnings and relies on default initialization to zero in the 4549traditional C case. 4550 4551@item 4552Conversions by prototypes between fixed/floating-point values and vice 4553versa. The absence of these prototypes when compiling with traditional 4554C causes serious problems. This is a subset of the possible 4555conversion warnings; for the full set use @option{-Wtraditional-conversion}. 4556 4557@item 4558Use of ISO C style function definitions. This warning intentionally is 4559@emph{not} issued for prototype declarations or variadic functions 4560because these ISO C features appear in your code when using 4561libiberty's traditional C compatibility macros, @code{PARAMS} and 4562@code{VPARAMS}. This warning is also bypassed for nested functions 4563because that feature is already a GCC extension and thus not relevant to 4564traditional C compatibility. 4565@end itemize 4566 4567@item -Wtraditional-conversion @r{(C and Objective-C only)} 4568@opindex Wtraditional-conversion 4569@opindex Wno-traditional-conversion 4570Warn if a prototype causes a type conversion that is different from what 4571would happen to the same argument in the absence of a prototype. This 4572includes conversions of fixed point to floating and vice versa, and 4573conversions changing the width or signedness of a fixed-point argument 4574except when the same as the default promotion. 4575 4576@item -Wdeclaration-after-statement @r{(C and Objective-C only)} 4577@opindex Wdeclaration-after-statement 4578@opindex Wno-declaration-after-statement 4579Warn when a declaration is found after a statement in a block. This 4580construct, known from C++, was introduced with ISO C99 and is by default 4581allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}. 4582 4583@item -Wundef 4584@opindex Wundef 4585@opindex Wno-undef 4586Warn if an undefined identifier is evaluated in an @code{#if} directive. 4587 4588@item -Wno-endif-labels 4589@opindex Wno-endif-labels 4590@opindex Wendif-labels 4591Do not warn whenever an @code{#else} or an @code{#endif} are followed by text. 4592 4593@item -Wshadow 4594@opindex Wshadow 4595@opindex Wno-shadow 4596Warn whenever a local variable or type declaration shadows another 4597variable, parameter, type, class member (in C++), or instance variable 4598(in Objective-C) or whenever a built-in function is shadowed. Note 4599that in C++, the compiler warns if a local variable shadows an 4600explicit typedef, but not if it shadows a struct/class/enum. 4601 4602@item -Wno-shadow-ivar @r{(Objective-C only)} 4603@opindex Wno-shadow-ivar 4604@opindex Wshadow-ivar 4605Do not warn whenever a local variable shadows an instance variable in an 4606Objective-C method. 4607 4608@item -Wlarger-than=@var{len} 4609@opindex Wlarger-than=@var{len} 4610@opindex Wlarger-than-@var{len} 4611Warn whenever an object of larger than @var{len} bytes is defined. 4612 4613@item -Wframe-larger-than=@var{len} 4614@opindex Wframe-larger-than 4615Warn if the size of a function frame is larger than @var{len} bytes. 4616The computation done to determine the stack frame size is approximate 4617and not conservative. 4618The actual requirements may be somewhat greater than @var{len} 4619even if you do not get a warning. In addition, any space allocated 4620via @code{alloca}, variable-length arrays, or related constructs 4621is not included by the compiler when determining 4622whether or not to issue a warning. 4623 4624@item -Wno-free-nonheap-object 4625@opindex Wno-free-nonheap-object 4626@opindex Wfree-nonheap-object 4627Do not warn when attempting to free an object that was not allocated 4628on the heap. 4629 4630@item -Wstack-usage=@var{len} 4631@opindex Wstack-usage 4632Warn if the stack usage of a function might be larger than @var{len} bytes. 4633The computation done to determine the stack usage is conservative. 4634Any space allocated via @code{alloca}, variable-length arrays, or related 4635constructs is included by the compiler when determining whether or not to 4636issue a warning. 4637 4638The message is in keeping with the output of @option{-fstack-usage}. 4639 4640@itemize 4641@item 4642If the stack usage is fully static but exceeds the specified amount, it's: 4643 4644@smallexample 4645 warning: stack usage is 1120 bytes 4646@end smallexample 4647@item 4648If the stack usage is (partly) dynamic but bounded, it's: 4649 4650@smallexample 4651 warning: stack usage might be 1648 bytes 4652@end smallexample 4653@item 4654If the stack usage is (partly) dynamic and not bounded, it's: 4655 4656@smallexample 4657 warning: stack usage might be unbounded 4658@end smallexample 4659@end itemize 4660 4661@item -Wunsafe-loop-optimizations 4662@opindex Wunsafe-loop-optimizations 4663@opindex Wno-unsafe-loop-optimizations 4664Warn if the loop cannot be optimized because the compiler cannot 4665assume anything on the bounds of the loop indices. With 4666@option{-funsafe-loop-optimizations} warn if the compiler makes 4667such assumptions. 4668 4669@item -Wno-pedantic-ms-format @r{(MinGW targets only)} 4670@opindex Wno-pedantic-ms-format 4671@opindex Wpedantic-ms-format 4672When used in combination with @option{-Wformat} 4673and @option{-pedantic} without GNU extensions, this option 4674disables the warnings about non-ISO @code{printf} / @code{scanf} format 4675width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets, 4676which depend on the MS runtime. 4677 4678@item -Wpointer-arith 4679@opindex Wpointer-arith 4680@opindex Wno-pointer-arith 4681Warn about anything that depends on the ``size of'' a function type or 4682of @code{void}. GNU C assigns these types a size of 1, for 4683convenience in calculations with @code{void *} pointers and pointers 4684to functions. In C++, warn also when an arithmetic operation involves 4685@code{NULL}. This warning is also enabled by @option{-Wpedantic}. 4686 4687@item -Wtype-limits 4688@opindex Wtype-limits 4689@opindex Wno-type-limits 4690Warn if a comparison is always true or always false due to the limited 4691range of the data type, but do not warn for constant expressions. For 4692example, warn if an unsigned variable is compared against zero with 4693@code{<} or @code{>=}. This warning is also enabled by 4694@option{-Wextra}. 4695 4696@item -Wbad-function-cast @r{(C and Objective-C only)} 4697@opindex Wbad-function-cast 4698@opindex Wno-bad-function-cast 4699Warn when a function call is cast to a non-matching type. 4700For example, warn if a call to a function returning an integer type 4701is cast to a pointer type. 4702 4703@item -Wc90-c99-compat @r{(C and Objective-C only)} 4704@opindex Wc90-c99-compat 4705@opindex Wno-c90-c99-compat 4706Warn about features not present in ISO C90, but present in ISO C99. 4707For instance, warn about use of variable length arrays, @code{long long} 4708type, @code{bool} type, compound literals, designated initializers, and so 4709on. This option is independent of the standards mode. Warnings are disabled 4710in the expression that follows @code{__extension__}. 4711 4712@item -Wc99-c11-compat @r{(C and Objective-C only)} 4713@opindex Wc99-c11-compat 4714@opindex Wno-c99-c11-compat 4715Warn about features not present in ISO C99, but present in ISO C11. 4716For instance, warn about use of anonymous structures and unions, 4717@code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier, 4718@code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword, 4719and so on. This option is independent of the standards mode. Warnings are 4720disabled in the expression that follows @code{__extension__}. 4721 4722@item -Wc++-compat @r{(C and Objective-C only)} 4723@opindex Wc++-compat 4724Warn about ISO C constructs that are outside of the common subset of 4725ISO C and ISO C++, e.g.@: request for implicit conversion from 4726@code{void *} to a pointer to non-@code{void} type. 4727 4728@item -Wc++11-compat @r{(C++ and Objective-C++ only)} 4729@opindex Wc++11-compat 4730Warn about C++ constructs whose meaning differs between ISO C++ 1998 4731and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords 4732in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is 4733enabled by @option{-Wall}. 4734 4735@item -Wc++14-compat @r{(C++ and Objective-C++ only)} 4736@opindex Wc++14-compat 4737Warn about C++ constructs whose meaning differs between ISO C++ 2011 4738and ISO C++ 2014. This warning is enabled by @option{-Wall}. 4739 4740@item -Wcast-qual 4741@opindex Wcast-qual 4742@opindex Wno-cast-qual 4743Warn whenever a pointer is cast so as to remove a type qualifier from 4744the target type. For example, warn if a @code{const char *} is cast 4745to an ordinary @code{char *}. 4746 4747Also warn when making a cast that introduces a type qualifier in an 4748unsafe way. For example, casting @code{char **} to @code{const char **} 4749is unsafe, as in this example: 4750 4751@smallexample 4752 /* p is char ** value. */ 4753 const char **q = (const char **) p; 4754 /* Assignment of readonly string to const char * is OK. */ 4755 *q = "string"; 4756 /* Now char** pointer points to read-only memory. */ 4757 **p = 'b'; 4758@end smallexample 4759 4760@item -Wcast-align 4761@opindex Wcast-align 4762@opindex Wno-cast-align 4763Warn whenever a pointer is cast such that the required alignment of the 4764target is increased. For example, warn if a @code{char *} is cast to 4765an @code{int *} on machines where integers can only be accessed at 4766two- or four-byte boundaries. 4767 4768@item -Wwrite-strings 4769@opindex Wwrite-strings 4770@opindex Wno-write-strings 4771When compiling C, give string constants the type @code{const 4772char[@var{length}]} so that copying the address of one into a 4773non-@code{const} @code{char *} pointer produces a warning. These 4774warnings help you find at compile time code that can try to write 4775into a string constant, but only if you have been very careful about 4776using @code{const} in declarations and prototypes. Otherwise, it is 4777just a nuisance. This is why we did not make @option{-Wall} request 4778these warnings. 4779 4780When compiling C++, warn about the deprecated conversion from string 4781literals to @code{char *}. This warning is enabled by default for C++ 4782programs. 4783 4784@item -Wclobbered 4785@opindex Wclobbered 4786@opindex Wno-clobbered 4787Warn for variables that might be changed by @code{longjmp} or 4788@code{vfork}. This warning is also enabled by @option{-Wextra}. 4789 4790@item -Wconditionally-supported @r{(C++ and Objective-C++ only)} 4791@opindex Wconditionally-supported 4792@opindex Wno-conditionally-supported 4793Warn for conditionally-supported (C++11 [intro.defs]) constructs. 4794 4795@item -Wconversion 4796@opindex Wconversion 4797@opindex Wno-conversion 4798Warn for implicit conversions that may alter a value. This includes 4799conversions between real and integer, like @code{abs (x)} when 4800@code{x} is @code{double}; conversions between signed and unsigned, 4801like @code{unsigned ui = -1}; and conversions to smaller types, like 4802@code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs 4803((int) x)} and @code{ui = (unsigned) -1}, or if the value is not 4804changed by the conversion like in @code{abs (2.0)}. Warnings about 4805conversions between signed and unsigned integers can be disabled by 4806using @option{-Wno-sign-conversion}. 4807 4808For C++, also warn for confusing overload resolution for user-defined 4809conversions; and conversions that never use a type conversion 4810operator: conversions to @code{void}, the same type, a base class or a 4811reference to them. Warnings about conversions between signed and 4812unsigned integers are disabled by default in C++ unless 4813@option{-Wsign-conversion} is explicitly enabled. 4814 4815@item -Wno-conversion-null @r{(C++ and Objective-C++ only)} 4816@opindex Wconversion-null 4817@opindex Wno-conversion-null 4818Do not warn for conversions between @code{NULL} and non-pointer 4819types. @option{-Wconversion-null} is enabled by default. 4820 4821@item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)} 4822@opindex Wzero-as-null-pointer-constant 4823@opindex Wno-zero-as-null-pointer-constant 4824Warn when a literal '0' is used as null pointer constant. This can 4825be useful to facilitate the conversion to @code{nullptr} in C++11. 4826 4827@item -Wdate-time 4828@opindex Wdate-time 4829@opindex Wno-date-time 4830Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__} 4831are encountered as they might prevent bit-wise-identical reproducible 4832compilations. 4833 4834@item -Wdelete-incomplete @r{(C++ and Objective-C++ only)} 4835@opindex Wdelete-incomplete 4836@opindex Wno-delete-incomplete 4837Warn when deleting a pointer to incomplete type, which may cause 4838undefined behavior at runtime. This warning is enabled by default. 4839 4840@item -Wuseless-cast @r{(C++ and Objective-C++ only)} 4841@opindex Wuseless-cast 4842@opindex Wno-useless-cast 4843Warn when an expression is casted to its own type. 4844 4845@item -Wempty-body 4846@opindex Wempty-body 4847@opindex Wno-empty-body 4848Warn if an empty body occurs in an @code{if}, @code{else} or @code{do 4849while} statement. This warning is also enabled by @option{-Wextra}. 4850 4851@item -Wenum-compare 4852@opindex Wenum-compare 4853@opindex Wno-enum-compare 4854Warn about a comparison between values of different enumerated types. 4855In C++ enumeral mismatches in conditional expressions are also 4856diagnosed and the warning is enabled by default. In C this warning is 4857enabled by @option{-Wall}. 4858 4859@item -Wjump-misses-init @r{(C, Objective-C only)} 4860@opindex Wjump-misses-init 4861@opindex Wno-jump-misses-init 4862Warn if a @code{goto} statement or a @code{switch} statement jumps 4863forward across the initialization of a variable, or jumps backward to a 4864label after the variable has been initialized. This only warns about 4865variables that are initialized when they are declared. This warning is 4866only supported for C and Objective-C; in C++ this sort of branch is an 4867error in any case. 4868 4869@option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It 4870can be disabled with the @option{-Wno-jump-misses-init} option. 4871 4872@item -Wsign-compare 4873@opindex Wsign-compare 4874@opindex Wno-sign-compare 4875@cindex warning for comparison of signed and unsigned values 4876@cindex comparison of signed and unsigned values, warning 4877@cindex signed and unsigned values, comparison warning 4878Warn when a comparison between signed and unsigned values could produce 4879an incorrect result when the signed value is converted to unsigned. 4880This warning is also enabled by @option{-Wextra}; to get the other warnings 4881of @option{-Wextra} without this warning, use @option{-Wextra -Wno-sign-compare}. 4882 4883@item -Wsign-conversion 4884@opindex Wsign-conversion 4885@opindex Wno-sign-conversion 4886Warn for implicit conversions that may change the sign of an integer 4887value, like assigning a signed integer expression to an unsigned 4888integer variable. An explicit cast silences the warning. In C, this 4889option is enabled also by @option{-Wconversion}. 4890 4891@item -Wfloat-conversion 4892@opindex Wfloat-conversion 4893@opindex Wno-float-conversion 4894Warn for implicit conversions that reduce the precision of a real value. 4895This includes conversions from real to integer, and from higher precision 4896real to lower precision real values. This option is also enabled by 4897@option{-Wconversion}. 4898 4899@item -Wsized-deallocation @r{(C++ and Objective-C++ only)} 4900@opindex Wsized-deallocation 4901@opindex Wno-sized-deallocation 4902Warn about a definition of an unsized deallocation function 4903@smallexample 4904void operator delete (void *) noexcept; 4905void operator delete[] (void *) noexcept; 4906@end smallexample 4907without a definition of the corresponding sized deallocation function 4908@smallexample 4909void operator delete (void *, std::size_t) noexcept; 4910void operator delete[] (void *, std::size_t) noexcept; 4911@end smallexample 4912or vice versa. Enabled by @option{-Wextra} along with 4913@option{-fsized-deallocation}. 4914 4915@item -Wsizeof-pointer-memaccess 4916@opindex Wsizeof-pointer-memaccess 4917@opindex Wno-sizeof-pointer-memaccess 4918Warn for suspicious length parameters to certain string and memory built-in 4919functions if the argument uses @code{sizeof}. This warning warns e.g.@: 4920about @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not an array, 4921but a pointer, and suggests a possible fix, or about 4922@code{memcpy (&foo, ptr, sizeof (&foo));}. This warning is enabled by 4923@option{-Wall}. 4924 4925@item -Wsizeof-array-argument 4926@opindex Wsizeof-array-argument 4927@opindex Wno-sizeof-array-argument 4928Warn when the @code{sizeof} operator is applied to a parameter that is 4929declared as an array in a function definition. This warning is enabled by 4930default for C and C++ programs. 4931 4932@item -Wmemset-transposed-args 4933@opindex Wmemset-transposed-args 4934@opindex Wno-memset-transposed-args 4935Warn for suspicious calls to the @code{memset} built-in function, if the 4936second argument is not zero and the third argument is zero. This warns e.g.@ 4937about @code{memset (buf, sizeof buf, 0)} where most probably 4938@code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics 4939is only emitted if the third argument is literal zero. If it is some 4940expression that is folded to zero, a cast of zero to some type, etc., 4941it is far less likely that the user has mistakenly exchanged the arguments 4942and no warning is emitted. This warning is enabled by @option{-Wall}. 4943 4944@item -Waddress 4945@opindex Waddress 4946@opindex Wno-address 4947Warn about suspicious uses of memory addresses. These include using 4948the address of a function in a conditional expression, such as 4949@code{void func(void); if (func)}, and comparisons against the memory 4950address of a string literal, such as @code{if (x == "abc")}. Such 4951uses typically indicate a programmer error: the address of a function 4952always evaluates to true, so their use in a conditional usually 4953indicate that the programmer forgot the parentheses in a function 4954call; and comparisons against string literals result in unspecified 4955behavior and are not portable in C, so they usually indicate that the 4956programmer intended to use @code{strcmp}. This warning is enabled by 4957@option{-Wall}. 4958 4959@item -Wlogical-op 4960@opindex Wlogical-op 4961@opindex Wno-logical-op 4962Warn about suspicious uses of logical operators in expressions. 4963This includes using logical operators in contexts where a 4964bit-wise operator is likely to be expected. 4965 4966@item -Wlogical-not-parentheses 4967@opindex Wlogical-not-parentheses 4968@opindex Wno-logical-not-parentheses 4969Warn about logical not used on the left hand side operand of a comparison. 4970This option does not warn if the RHS operand is of a boolean type. Its 4971purpose is to detect suspicious code like the following: 4972@smallexample 4973int a; 4974@dots{} 4975if (!a > 1) @{ @dots{} @} 4976@end smallexample 4977 4978It is possible to suppress the warning by wrapping the LHS into 4979parentheses: 4980@smallexample 4981if ((!a) > 1) @{ @dots{} @} 4982@end smallexample 4983 4984This warning is enabled by @option{-Wall}. 4985 4986@item -Waggregate-return 4987@opindex Waggregate-return 4988@opindex Wno-aggregate-return 4989Warn if any functions that return structures or unions are defined or 4990called. (In languages where you can return an array, this also elicits 4991a warning.) 4992 4993@item -Wno-aggressive-loop-optimizations 4994@opindex Wno-aggressive-loop-optimizations 4995@opindex Waggressive-loop-optimizations 4996Warn if in a loop with constant number of iterations the compiler detects 4997undefined behavior in some statement during one or more of the iterations. 4998 4999@item -Wno-attributes 5000@opindex Wno-attributes 5001@opindex Wattributes 5002Do not warn if an unexpected @code{__attribute__} is used, such as 5003unrecognized attributes, function attributes applied to variables, 5004etc. This does not stop errors for incorrect use of supported 5005attributes. 5006 5007@item -Wno-builtin-macro-redefined 5008@opindex Wno-builtin-macro-redefined 5009@opindex Wbuiltin-macro-redefined 5010Do not warn if certain built-in macros are redefined. This suppresses 5011warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__}, 5012@code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}. 5013 5014@item -Wstrict-prototypes @r{(C and Objective-C only)} 5015@opindex Wstrict-prototypes 5016@opindex Wno-strict-prototypes 5017Warn if a function is declared or defined without specifying the 5018argument types. (An old-style function definition is permitted without 5019a warning if preceded by a declaration that specifies the argument 5020types.) 5021 5022@item -Wold-style-declaration @r{(C and Objective-C only)} 5023@opindex Wold-style-declaration 5024@opindex Wno-old-style-declaration 5025Warn for obsolescent usages, according to the C Standard, in a 5026declaration. For example, warn if storage-class specifiers like 5027@code{static} are not the first things in a declaration. This warning 5028is also enabled by @option{-Wextra}. 5029 5030@item -Wold-style-definition @r{(C and Objective-C only)} 5031@opindex Wold-style-definition 5032@opindex Wno-old-style-definition 5033Warn if an old-style function definition is used. A warning is given 5034even if there is a previous prototype. 5035 5036@item -Wmissing-parameter-type @r{(C and Objective-C only)} 5037@opindex Wmissing-parameter-type 5038@opindex Wno-missing-parameter-type 5039A function parameter is declared without a type specifier in K&R-style 5040functions: 5041 5042@smallexample 5043void foo(bar) @{ @} 5044@end smallexample 5045 5046This warning is also enabled by @option{-Wextra}. 5047 5048@item -Wmissing-prototypes @r{(C and Objective-C only)} 5049@opindex Wmissing-prototypes 5050@opindex Wno-missing-prototypes 5051Warn if a global function is defined without a previous prototype 5052declaration. This warning is issued even if the definition itself 5053provides a prototype. Use this option to detect global functions 5054that do not have a matching prototype declaration in a header file. 5055This option is not valid for C++ because all function declarations 5056provide prototypes and a non-matching declaration declares an 5057overload rather than conflict with an earlier declaration. 5058Use @option{-Wmissing-declarations} to detect missing declarations in C++. 5059 5060@item -Wmissing-declarations 5061@opindex Wmissing-declarations 5062@opindex Wno-missing-declarations 5063Warn if a global function is defined without a previous declaration. 5064Do so even if the definition itself provides a prototype. 5065Use this option to detect global functions that are not declared in 5066header files. In C, no warnings are issued for functions with previous 5067non-prototype declarations; use @option{-Wmissing-prototypes} to detect 5068missing prototypes. In C++, no warnings are issued for function templates, 5069or for inline functions, or for functions in anonymous namespaces. 5070 5071@item -Wmissing-field-initializers 5072@opindex Wmissing-field-initializers 5073@opindex Wno-missing-field-initializers 5074@opindex W 5075@opindex Wextra 5076@opindex Wno-extra 5077Warn if a structure's initializer has some fields missing. For 5078example, the following code causes such a warning, because 5079@code{x.h} is implicitly zero: 5080 5081@smallexample 5082struct s @{ int f, g, h; @}; 5083struct s x = @{ 3, 4 @}; 5084@end smallexample 5085 5086This option does not warn about designated initializers, so the following 5087modification does not trigger a warning: 5088 5089@smallexample 5090struct s @{ int f, g, h; @}; 5091struct s x = @{ .f = 3, .g = 4 @}; 5092@end smallexample 5093 5094In C++ this option does not warn either about the empty @{ @} 5095initializer, for example: 5096 5097@smallexample 5098struct s @{ int f, g, h; @}; 5099s x = @{ @}; 5100@end smallexample 5101 5102This warning is included in @option{-Wextra}. To get other @option{-Wextra} 5103warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}. 5104 5105@item -Wno-multichar 5106@opindex Wno-multichar 5107@opindex Wmultichar 5108Do not warn if a multicharacter constant (@samp{'FOOF'}) is used. 5109Usually they indicate a typo in the user's code, as they have 5110implementation-defined values, and should not be used in portable code. 5111 5112@item -Wnormalized@r{[}=@r{<}none@r{|}id@r{|}nfc@r{|}nfkc@r{>]} 5113@opindex Wnormalized= 5114@opindex Wnormalized 5115@opindex Wno-normalized 5116@cindex NFC 5117@cindex NFKC 5118@cindex character set, input normalization 5119In ISO C and ISO C++, two identifiers are different if they are 5120different sequences of characters. However, sometimes when characters 5121outside the basic ASCII character set are used, you can have two 5122different character sequences that look the same. To avoid confusion, 5123the ISO 10646 standard sets out some @dfn{normalization rules} which 5124when applied ensure that two sequences that look the same are turned into 5125the same sequence. GCC can warn you if you are using identifiers that 5126have not been normalized; this option controls that warning. 5127 5128There are four levels of warning supported by GCC@. The default is 5129@option{-Wnormalized=nfc}, which warns about any identifier that is 5130not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the 5131recommended form for most uses. It is equivalent to 5132@option{-Wnormalized}. 5133 5134Unfortunately, there are some characters allowed in identifiers by 5135ISO C and ISO C++ that, when turned into NFC, are not allowed in 5136identifiers. That is, there's no way to use these symbols in portable 5137ISO C or C++ and have all your identifiers in NFC@. 5138@option{-Wnormalized=id} suppresses the warning for these characters. 5139It is hoped that future versions of the standards involved will correct 5140this, which is why this option is not the default. 5141 5142You can switch the warning off for all characters by writing 5143@option{-Wnormalized=none} or @option{-Wno-normalized}. You should 5144only do this if you are using some other normalization scheme (like 5145``D''), because otherwise you can easily create bugs that are 5146literally impossible to see. 5147 5148Some characters in ISO 10646 have distinct meanings but look identical 5149in some fonts or display methodologies, especially once formatting has 5150been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL 5151LETTER N'', displays just like a regular @code{n} that has been 5152placed in a superscript. ISO 10646 defines the @dfn{NFKC} 5153normalization scheme to convert all these into a standard form as 5154well, and GCC warns if your code is not in NFKC if you use 5155@option{-Wnormalized=nfkc}. This warning is comparable to warning 5156about every identifier that contains the letter O because it might be 5157confused with the digit 0, and so is not the default, but may be 5158useful as a local coding convention if the programming environment 5159cannot be fixed to display these characters distinctly. 5160 5161@item -Wno-deprecated 5162@opindex Wno-deprecated 5163@opindex Wdeprecated 5164Do not warn about usage of deprecated features. @xref{Deprecated Features}. 5165 5166@item -Wno-deprecated-declarations 5167@opindex Wno-deprecated-declarations 5168@opindex Wdeprecated-declarations 5169Do not warn about uses of functions (@pxref{Function Attributes}), 5170variables (@pxref{Variable Attributes}), and types (@pxref{Type 5171Attributes}) marked as deprecated by using the @code{deprecated} 5172attribute. 5173 5174@item -Wno-overflow 5175@opindex Wno-overflow 5176@opindex Woverflow 5177Do not warn about compile-time overflow in constant expressions. 5178 5179@item -Wno-odr 5180@opindex Wno-odr 5181@opindex Wodr 5182Warn about One Definition Rule violations during link-time optimization. 5183Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default. 5184 5185@item -Wopenmp-simd 5186@opindex Wopenm-simd 5187Warn if the vectorizer cost model overrides the OpenMP or the Cilk Plus 5188simd directive set by user. The @option{-fsimd-cost-model=unlimited} 5189option can be used to relax the cost model. 5190 5191@item -Woverride-init @r{(C and Objective-C only)} 5192@opindex Woverride-init 5193@opindex Wno-override-init 5194@opindex W 5195@opindex Wextra 5196@opindex Wno-extra 5197Warn if an initialized field without side effects is overridden when 5198using designated initializers (@pxref{Designated Inits, , Designated 5199Initializers}). 5200 5201This warning is included in @option{-Wextra}. To get other 5202@option{-Wextra} warnings without this one, use @option{-Wextra 5203-Wno-override-init}. 5204 5205@item -Wpacked 5206@opindex Wpacked 5207@opindex Wno-packed 5208Warn if a structure is given the packed attribute, but the packed 5209attribute has no effect on the layout or size of the structure. 5210Such structures may be mis-aligned for little benefit. For 5211instance, in this code, the variable @code{f.x} in @code{struct bar} 5212is misaligned even though @code{struct bar} does not itself 5213have the packed attribute: 5214 5215@smallexample 5216@group 5217struct foo @{ 5218 int x; 5219 char a, b, c, d; 5220@} __attribute__((packed)); 5221struct bar @{ 5222 char z; 5223 struct foo f; 5224@}; 5225@end group 5226@end smallexample 5227 5228@item -Wpacked-bitfield-compat 5229@opindex Wpacked-bitfield-compat 5230@opindex Wno-packed-bitfield-compat 5231The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute 5232on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but 5233the change can lead to differences in the structure layout. GCC 5234informs you when the offset of such a field has changed in GCC 4.4. 5235For example there is no longer a 4-bit padding between field @code{a} 5236and @code{b} in this structure: 5237 5238@smallexample 5239struct foo 5240@{ 5241 char a:4; 5242 char b:8; 5243@} __attribute__ ((packed)); 5244@end smallexample 5245 5246This warning is enabled by default. Use 5247@option{-Wno-packed-bitfield-compat} to disable this warning. 5248 5249@item -Wpadded 5250@opindex Wpadded 5251@opindex Wno-padded 5252Warn if padding is included in a structure, either to align an element 5253of the structure or to align the whole structure. Sometimes when this 5254happens it is possible to rearrange the fields of the structure to 5255reduce the padding and so make the structure smaller. 5256 5257@item -Wredundant-decls 5258@opindex Wredundant-decls 5259@opindex Wno-redundant-decls 5260Warn if anything is declared more than once in the same scope, even in 5261cases where multiple declaration is valid and changes nothing. 5262 5263@item -Wnested-externs @r{(C and Objective-C only)} 5264@opindex Wnested-externs 5265@opindex Wno-nested-externs 5266Warn if an @code{extern} declaration is encountered within a function. 5267 5268@item -Wno-inherited-variadic-ctor 5269@opindex Winherited-variadic-ctor 5270@opindex Wno-inherited-variadic-ctor 5271Suppress warnings about use of C++11 inheriting constructors when the 5272base class inherited from has a C variadic constructor; the warning is 5273on by default because the ellipsis is not inherited. 5274 5275@item -Winline 5276@opindex Winline 5277@opindex Wno-inline 5278Warn if a function that is declared as inline cannot be inlined. 5279Even with this option, the compiler does not warn about failures to 5280inline functions declared in system headers. 5281 5282The compiler uses a variety of heuristics to determine whether or not 5283to inline a function. For example, the compiler takes into account 5284the size of the function being inlined and the amount of inlining 5285that has already been done in the current function. Therefore, 5286seemingly insignificant changes in the source program can cause the 5287warnings produced by @option{-Winline} to appear or disappear. 5288 5289@item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)} 5290@opindex Wno-invalid-offsetof 5291@opindex Winvalid-offsetof 5292Suppress warnings from applying the @code{offsetof} macro to a non-POD 5293type. According to the 2014 ISO C++ standard, applying @code{offsetof} 5294to a non-standard-layout type is undefined. In existing C++ implementations, 5295however, @code{offsetof} typically gives meaningful results. 5296This flag is for users who are aware that they are 5297writing nonportable code and who have deliberately chosen to ignore the 5298warning about it. 5299 5300The restrictions on @code{offsetof} may be relaxed in a future version 5301of the C++ standard. 5302 5303@item -Wno-int-to-pointer-cast 5304@opindex Wno-int-to-pointer-cast 5305@opindex Wint-to-pointer-cast 5306Suppress warnings from casts to pointer type of an integer of a 5307different size. In C++, casting to a pointer type of smaller size is 5308an error. @option{Wint-to-pointer-cast} is enabled by default. 5309 5310 5311@item -Wno-pointer-to-int-cast @r{(C and Objective-C only)} 5312@opindex Wno-pointer-to-int-cast 5313@opindex Wpointer-to-int-cast 5314Suppress warnings from casts from a pointer to an integer type of a 5315different size. 5316 5317@item -Winvalid-pch 5318@opindex Winvalid-pch 5319@opindex Wno-invalid-pch 5320Warn if a precompiled header (@pxref{Precompiled Headers}) is found in 5321the search path but can't be used. 5322 5323@item -Wlong-long 5324@opindex Wlong-long 5325@opindex Wno-long-long 5326Warn if @code{long long} type is used. This is enabled by either 5327@option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98 5328modes. To inhibit the warning messages, use @option{-Wno-long-long}. 5329 5330@item -Wvariadic-macros 5331@opindex Wvariadic-macros 5332@opindex Wno-variadic-macros 5333Warn if variadic macros are used in ISO C90 mode, or if the GNU 5334alternate syntax is used in ISO C99 mode. This is enabled by either 5335@option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning 5336messages, use @option{-Wno-variadic-macros}. 5337 5338@item -Wvarargs 5339@opindex Wvarargs 5340@opindex Wno-varargs 5341Warn upon questionable usage of the macros used to handle variable 5342arguments like @code{va_start}. This is default. To inhibit the 5343warning messages, use @option{-Wno-varargs}. 5344 5345@item -Wvector-operation-performance 5346@opindex Wvector-operation-performance 5347@opindex Wno-vector-operation-performance 5348Warn if vector operation is not implemented via SIMD capabilities of the 5349architecture. Mainly useful for the performance tuning. 5350Vector operation can be implemented @code{piecewise}, which means that the 5351scalar operation is performed on every vector element; 5352@code{in parallel}, which means that the vector operation is implemented 5353using scalars of wider type, which normally is more performance efficient; 5354and @code{as a single scalar}, which means that vector fits into a 5355scalar type. 5356 5357@item -Wno-virtual-move-assign 5358@opindex Wvirtual-move-assign 5359@opindex Wno-virtual-move-assign 5360Suppress warnings about inheriting from a virtual base with a 5361non-trivial C++11 move assignment operator. This is dangerous because 5362if the virtual base is reachable along more than one path, it is 5363moved multiple times, which can mean both objects end up in the 5364moved-from state. If the move assignment operator is written to avoid 5365moving from a moved-from object, this warning can be disabled. 5366 5367@item -Wvla 5368@opindex Wvla 5369@opindex Wno-vla 5370Warn if variable length array is used in the code. 5371@option{-Wno-vla} prevents the @option{-Wpedantic} warning of 5372the variable length array. 5373 5374@item -Wvolatile-register-var 5375@opindex Wvolatile-register-var 5376@opindex Wno-volatile-register-var 5377Warn if a register variable is declared volatile. The volatile 5378modifier does not inhibit all optimizations that may eliminate reads 5379and/or writes to register variables. This warning is enabled by 5380@option{-Wall}. 5381 5382@item -Wdisabled-optimization 5383@opindex Wdisabled-optimization 5384@opindex Wno-disabled-optimization 5385Warn if a requested optimization pass is disabled. This warning does 5386not generally indicate that there is anything wrong with your code; it 5387merely indicates that GCC's optimizers are unable to handle the code 5388effectively. Often, the problem is that your code is too big or too 5389complex; GCC refuses to optimize programs when the optimization 5390itself is likely to take inordinate amounts of time. 5391 5392@item -Wpointer-sign @r{(C and Objective-C only)} 5393@opindex Wpointer-sign 5394@opindex Wno-pointer-sign 5395Warn for pointer argument passing or assignment with different signedness. 5396This option is only supported for C and Objective-C@. It is implied by 5397@option{-Wall} and by @option{-Wpedantic}, which can be disabled with 5398@option{-Wno-pointer-sign}. 5399 5400@item -Wstack-protector 5401@opindex Wstack-protector 5402@opindex Wno-stack-protector 5403This option is only active when @option{-fstack-protector} is active. It 5404warns about functions that are not protected against stack smashing. 5405 5406@item -Woverlength-strings 5407@opindex Woverlength-strings 5408@opindex Wno-overlength-strings 5409Warn about string constants that are longer than the ``minimum 5410maximum'' length specified in the C standard. Modern compilers 5411generally allow string constants that are much longer than the 5412standard's minimum limit, but very portable programs should avoid 5413using longer strings. 5414 5415The limit applies @emph{after} string constant concatenation, and does 5416not count the trailing NUL@. In C90, the limit was 509 characters; in 5417C99, it was raised to 4095. C++98 does not specify a normative 5418minimum maximum, so we do not diagnose overlength strings in C++@. 5419 5420This option is implied by @option{-Wpedantic}, and can be disabled with 5421@option{-Wno-overlength-strings}. 5422 5423@item -Wunsuffixed-float-constants @r{(C and Objective-C only)} 5424@opindex Wunsuffixed-float-constants 5425 5426Issue a warning for any floating constant that does not have 5427a suffix. When used together with @option{-Wsystem-headers} it 5428warns about such constants in system header files. This can be useful 5429when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma 5430from the decimal floating-point extension to C99. 5431 5432@item -Wno-designated-init @r{(C and Objective-C only)} 5433Suppress warnings when a positional initializer is used to initialize 5434a structure that has been marked with the @code{designated_init} 5435attribute. 5436 5437@end table 5438 5439@node Debugging Options 5440@section Options for Debugging Your Program or GCC 5441@cindex options, debugging 5442@cindex debugging information options 5443 5444GCC has various special options that are used for debugging 5445either your program or GCC: 5446 5447@table @gcctabopt 5448@item -g 5449@opindex g 5450Produce debugging information in the operating system's native format 5451(stabs, COFF, XCOFF, or DWARF 2)@. GDB can work with this debugging 5452information. 5453 5454On most systems that use stabs format, @option{-g} enables use of extra 5455debugging information that only GDB can use; this extra information 5456makes debugging work better in GDB but probably makes other debuggers 5457crash or 5458refuse to read the program. If you want to control for certain whether 5459to generate the extra information, use @option{-gstabs+}, @option{-gstabs}, 5460@option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below). 5461 5462GCC allows you to use @option{-g} with 5463@option{-O}. The shortcuts taken by optimized code may occasionally 5464produce surprising results: some variables you declared may not exist 5465at all; flow of control may briefly move where you did not expect it; 5466some statements may not be executed because they compute constant 5467results or their values are already at hand; some statements may 5468execute in different places because they have been moved out of loops. 5469 5470Nevertheless it proves possible to debug optimized output. This makes 5471it reasonable to use the optimizer for programs that might have bugs. 5472 5473The following options are useful when GCC is generated with the 5474capability for more than one debugging format. 5475 5476@item -gsplit-dwarf 5477@opindex gsplit-dwarf 5478Separate as much dwarf debugging information as possible into a 5479separate output file with the extension .dwo. This option allows 5480the build system to avoid linking files with debug information. To 5481be useful, this option requires a debugger capable of reading .dwo 5482files. 5483 5484@item -ggdb 5485@opindex ggdb 5486Produce debugging information for use by GDB@. This means to use the 5487most expressive format available (DWARF 2, stabs, or the native format 5488if neither of those are supported), including GDB extensions if at all 5489possible. 5490 5491@item -gpubnames 5492@opindex gpubnames 5493Generate dwarf .debug_pubnames and .debug_pubtypes sections. 5494 5495@item -ggnu-pubnames 5496@opindex ggnu-pubnames 5497Generate .debug_pubnames and .debug_pubtypes sections in a format 5498suitable for conversion into a GDB@ index. This option is only useful 5499with a linker that can produce GDB@ index version 7. 5500 5501@item -gstabs 5502@opindex gstabs 5503Produce debugging information in stabs format (if that is supported), 5504without GDB extensions. This is the format used by DBX on most BSD 5505systems. On MIPS, Alpha and System V Release 4 systems this option 5506produces stabs debugging output that is not understood by DBX or SDB@. 5507On System V Release 4 systems this option requires the GNU assembler. 5508 5509@item -feliminate-unused-debug-symbols 5510@opindex feliminate-unused-debug-symbols 5511Produce debugging information in stabs format (if that is supported), 5512for only symbols that are actually used. 5513 5514@item -femit-class-debug-always 5515@opindex femit-class-debug-always 5516Instead of emitting debugging information for a C++ class in only one 5517object file, emit it in all object files using the class. This option 5518should be used only with debuggers that are unable to handle the way GCC 5519normally emits debugging information for classes because using this 5520option increases the size of debugging information by as much as a 5521factor of two. 5522 5523@item -fdebug-types-section 5524@opindex fdebug-types-section 5525@opindex fno-debug-types-section 5526When using DWARF Version 4 or higher, type DIEs can be put into 5527their own @code{.debug_types} section instead of making them part of the 5528@code{.debug_info} section. It is more efficient to put them in a separate 5529comdat sections since the linker can then remove duplicates. 5530But not all DWARF consumers support @code{.debug_types} sections yet 5531and on some objects @code{.debug_types} produces larger instead of smaller 5532debugging information. 5533 5534@item -gstabs+ 5535@opindex gstabs+ 5536Produce debugging information in stabs format (if that is supported), 5537using GNU extensions understood only by the GNU debugger (GDB)@. The 5538use of these extensions is likely to make other debuggers crash or 5539refuse to read the program. 5540 5541@item -gcoff 5542@opindex gcoff 5543Produce debugging information in COFF format (if that is supported). 5544This is the format used by SDB on most System V systems prior to 5545System V Release 4. 5546 5547@item -gxcoff 5548@opindex gxcoff 5549Produce debugging information in XCOFF format (if that is supported). 5550This is the format used by the DBX debugger on IBM RS/6000 systems. 5551 5552@item -gxcoff+ 5553@opindex gxcoff+ 5554Produce debugging information in XCOFF format (if that is supported), 5555using GNU extensions understood only by the GNU debugger (GDB)@. The 5556use of these extensions is likely to make other debuggers crash or 5557refuse to read the program, and may cause assemblers other than the GNU 5558assembler (GAS) to fail with an error. 5559 5560@item -gdwarf-@var{version} 5561@opindex gdwarf-@var{version} 5562Produce debugging information in DWARF format (if that is supported). 5563The value of @var{version} may be either 2, 3, 4 or 5; the default version 5564for most targets is 4. DWARF Version 5 is only experimental. 5565 5566Note that with DWARF Version 2, some ports require and always 5567use some non-conflicting DWARF 3 extensions in the unwind tables. 5568 5569Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments} 5570for maximum benefit. 5571 5572@item -grecord-gcc-switches 5573@opindex grecord-gcc-switches 5574This switch causes the command-line options used to invoke the 5575compiler that may affect code generation to be appended to the 5576DW_AT_producer attribute in DWARF debugging information. The options 5577are concatenated with spaces separating them from each other and from 5578the compiler version. See also @option{-frecord-gcc-switches} for another 5579way of storing compiler options into the object file. This is the default. 5580 5581@item -gno-record-gcc-switches 5582@opindex gno-record-gcc-switches 5583Disallow appending command-line options to the DW_AT_producer attribute 5584in DWARF debugging information. 5585 5586@item -gstrict-dwarf 5587@opindex gstrict-dwarf 5588Disallow using extensions of later DWARF standard version than selected 5589with @option{-gdwarf-@var{version}}. On most targets using non-conflicting 5590DWARF extensions from later standard versions is allowed. 5591 5592@item -gno-strict-dwarf 5593@opindex gno-strict-dwarf 5594Allow using extensions of later DWARF standard version than selected with 5595@option{-gdwarf-@var{version}}. 5596 5597@item -gz@r{[}=@var{type}@r{]} 5598@opindex gz 5599Produce compressed debug sections in DWARF format, if that is supported. 5600If @var{type} is not given, the default type depends on the capabilities 5601of the assembler and linker used. @var{type} may be one of 5602@samp{none} (don't compress debug sections), @samp{zlib} (use zlib 5603compression in ELF gABI format), or @samp{zlib-gnu} (use zlib 5604compression in traditional GNU format). If the linker doesn't support 5605writing compressed debug sections, the option is rejected. Otherwise, 5606if the assembler does not support them, @option{-gz} is silently ignored 5607when producing object files. 5608 5609@item -gvms 5610@opindex gvms 5611Produce debugging information in Alpha/VMS debug format (if that is 5612supported). This is the format used by DEBUG on Alpha/VMS systems. 5613 5614@item -g@var{level} 5615@itemx -ggdb@var{level} 5616@itemx -gstabs@var{level} 5617@itemx -gcoff@var{level} 5618@itemx -gxcoff@var{level} 5619@itemx -gvms@var{level} 5620Request debugging information and also use @var{level} to specify how 5621much information. The default level is 2. 5622 5623Level 0 produces no debug information at all. Thus, @option{-g0} negates 5624@option{-g}. 5625 5626Level 1 produces minimal information, enough for making backtraces in 5627parts of the program that you don't plan to debug. This includes 5628descriptions of functions and external variables, and line number 5629tables, but no information about local variables. 5630 5631Level 3 includes extra information, such as all the macro definitions 5632present in the program. Some debuggers support macro expansion when 5633you use @option{-g3}. 5634 5635@option{-gdwarf-2} does not accept a concatenated debug level, because 5636GCC used to support an option @option{-gdwarf} that meant to generate 5637debug information in version 1 of the DWARF format (which is very 5638different from version 2), and it would have been too confusing. That 5639debug format is long obsolete, but the option cannot be changed now. 5640Instead use an additional @option{-g@var{level}} option to change the 5641debug level for DWARF. 5642 5643@item -gtoggle 5644@opindex gtoggle 5645Turn off generation of debug info, if leaving out this option 5646generates it, or turn it on at level 2 otherwise. The position of this 5647argument in the command line does not matter; it takes effect after all 5648other options are processed, and it does so only once, no matter how 5649many times it is given. This is mainly intended to be used with 5650@option{-fcompare-debug}. 5651 5652@item -fsanitize=address 5653@opindex fsanitize=address 5654Enable AddressSanitizer, a fast memory error detector. 5655Memory access instructions are instrumented to detect 5656out-of-bounds and use-after-free bugs. 5657See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for 5658more details. The run-time behavior can be influenced using the 5659@env{ASAN_OPTIONS} environment variable. When set to @code{help=1}, 5660the available options are shown at startup of the instrumended program. See 5661@url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags} 5662for a list of supported options. 5663 5664@item -fsanitize=kernel-address 5665@opindex fsanitize=kernel-address 5666Enable AddressSanitizer for Linux kernel. 5667See @uref{https://github.com/google/kasan/wiki} for more details. 5668 5669@item -fsanitize=thread 5670@opindex fsanitize=thread 5671Enable ThreadSanitizer, a fast data race detector. 5672Memory access instructions are instrumented to detect 5673data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more 5674details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS} 5675environment variable; see 5676@url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of 5677supported options. 5678 5679@item -fsanitize=leak 5680@opindex fsanitize=leak 5681Enable LeakSanitizer, a memory leak detector. 5682This option only matters for linking of executables and if neither 5683@option{-fsanitize=address} nor @option{-fsanitize=thread} is used. In that 5684case the executable is linked against a library that overrides @code{malloc} 5685and other allocator functions. See 5686@uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more 5687details. The run-time behavior can be influenced using the 5688@env{LSAN_OPTIONS} environment variable. 5689 5690@item -fsanitize=undefined 5691@opindex fsanitize=undefined 5692Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector. 5693Various computations are instrumented to detect undefined behavior 5694at runtime. Current suboptions are: 5695 5696@table @gcctabopt 5697 5698@item -fsanitize=shift 5699@opindex fsanitize=shift 5700This option enables checking that the result of a shift operation is 5701not undefined. Note that what exactly is considered undefined differs 5702slightly between C and C++, as well as between ISO C90 and C99, etc. 5703 5704@item -fsanitize=integer-divide-by-zero 5705@opindex fsanitize=integer-divide-by-zero 5706Detect integer division by zero as well as @code{INT_MIN / -1} division. 5707 5708@item -fsanitize=unreachable 5709@opindex fsanitize=unreachable 5710With this option, the compiler turns the @code{__builtin_unreachable} 5711call into a diagnostics message call instead. When reaching the 5712@code{__builtin_unreachable} call, the behavior is undefined. 5713 5714@item -fsanitize=vla-bound 5715@opindex fsanitize=vla-bound 5716This option instructs the compiler to check that the size of a variable 5717length array is positive. 5718 5719@item -fsanitize=null 5720@opindex fsanitize=null 5721This option enables pointer checking. Particularly, the application 5722built with this option turned on will issue an error message when it 5723tries to dereference a NULL pointer, or if a reference (possibly an 5724rvalue reference) is bound to a NULL pointer, or if a method is invoked 5725on an object pointed by a NULL pointer. 5726 5727@item -fsanitize=return 5728@opindex fsanitize=return 5729This option enables return statement checking. Programs 5730built with this option turned on will issue an error message 5731when the end of a non-void function is reached without actually 5732returning a value. This option works in C++ only. 5733 5734@item -fsanitize=signed-integer-overflow 5735@opindex fsanitize=signed-integer-overflow 5736This option enables signed integer overflow checking. We check that 5737the result of @code{+}, @code{*}, and both unary and binary @code{-} 5738does not overflow in the signed arithmetics. Note, integer promotion 5739rules must be taken into account. That is, the following is not an 5740overflow: 5741@smallexample 5742signed char a = SCHAR_MAX; 5743a++; 5744@end smallexample 5745 5746@item -fsanitize=bounds 5747@opindex fsanitize=bounds 5748This option enables instrumentation of array bounds. Various out of bounds 5749accesses are detected. Flexible array members, flexible array member-like 5750arrays, and initializers of variables with static storage are not instrumented. 5751 5752@item -fsanitize=alignment 5753@opindex fsanitize=alignment 5754 5755This option enables checking of alignment of pointers when they are 5756dereferenced, or when a reference is bound to insufficiently aligned target, 5757or when a method or constructor is invoked on insufficiently aligned object. 5758 5759@item -fsanitize=object-size 5760@opindex fsanitize=object-size 5761This option enables instrumentation of memory references using the 5762@code{__builtin_object_size} function. Various out of bounds pointer 5763accesses are detected. 5764 5765@item -fsanitize=float-divide-by-zero 5766@opindex fsanitize=float-divide-by-zero 5767Detect floating-point division by zero. Unlike other similar options, 5768@option{-fsanitize=float-divide-by-zero} is not enabled by 5769@option{-fsanitize=undefined}, since floating-point division by zero can 5770be a legitimate way of obtaining infinities and NaNs. 5771 5772@item -fsanitize=float-cast-overflow 5773@opindex fsanitize=float-cast-overflow 5774This option enables floating-point type to integer conversion checking. 5775We check that the result of the conversion does not overflow. 5776Unlike other similar options, @option{-fsanitize=float-cast-overflow} is 5777not enabled by @option{-fsanitize=undefined}. 5778This option does not work well with @code{FE_INVALID} exceptions enabled. 5779 5780@item -fsanitize=nonnull-attribute 5781@opindex fsanitize=nonnull-attribute 5782 5783This option enables instrumentation of calls, checking whether null values 5784are not passed to arguments marked as requiring a non-null value by the 5785@code{nonnull} function attribute. 5786 5787@item -fsanitize=returns-nonnull-attribute 5788@opindex fsanitize=returns-nonnull-attribute 5789 5790This option enables instrumentation of return statements in functions 5791marked with @code{returns_nonnull} function attribute, to detect returning 5792of null values from such functions. 5793 5794@item -fsanitize=bool 5795@opindex fsanitize=bool 5796 5797This option enables instrumentation of loads from bool. If a value other 5798than 0/1 is loaded, a run-time error is issued. 5799 5800@item -fsanitize=enum 5801@opindex fsanitize=enum 5802 5803This option enables instrumentation of loads from an enum type. If 5804a value outside the range of values for the enum type is loaded, 5805a run-time error is issued. 5806 5807@item -fsanitize=vptr 5808@opindex fsanitize=vptr 5809 5810This option enables instrumentation of C++ member function calls, member 5811accesses and some conversions between pointers to base and derived classes, 5812to verify the referenced object has the correct dynamic type. 5813 5814@end table 5815 5816While @option{-ftrapv} causes traps for signed overflows to be emitted, 5817@option{-fsanitize=undefined} gives a diagnostic message. 5818This currently works only for the C family of languages. 5819 5820@item -fno-sanitize=all 5821@opindex fno-sanitize=all 5822 5823This option disables all previously enabled sanitizers. 5824@option{-fsanitize=all} is not allowed, as some sanitizers cannot be used 5825together. 5826 5827@item -fasan-shadow-offset=@var{number} 5828@opindex fasan-shadow-offset 5829This option forces GCC to use custom shadow offset in AddressSanitizer checks. 5830It is useful for experimenting with different shadow memory layouts in 5831Kernel AddressSanitizer. 5832 5833@item -fsanitize-recover@r{[}=@var{opts}@r{]} 5834@opindex fsanitize-recover 5835@opindex fno-sanitize-recover 5836@option{-fsanitize-recover=} controls error recovery mode for sanitizers 5837mentioned in comma-separated list of @var{opts}. Enabling this option 5838for a sanitizer component causes it to attempt to continue 5839running the program as if no error happened. This means multiple 5840runtime errors can be reported in a single program run, and the exit 5841code of the program may indicate success even when errors 5842have been reported. The @option{-fno-sanitize-recover=} option 5843can be used to alter 5844this behavior: only the first detected error is reported 5845and program then exits with a non-zero exit code. 5846 5847Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions 5848except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}), 5849@option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero} and 5850@option{-fsanitize=kernel-address}. For these sanitizers error recovery is turned on by default. 5851@option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also 5852accepted, the former enables recovery for all sanitizers that support it, 5853the latter disables recovery for all sanitizers that support it. 5854 5855Syntax without explicit @var{opts} parameter is deprecated. It is equivalent to 5856@smallexample 5857-fsanitize-recover=undefined,float-cast-overflow,float-divide-by-zero 5858@end smallexample 5859@noindent 5860Similarly @option{-fno-sanitize-recover} is equivalent to 5861@smallexample 5862-fno-sanitize-recover=undefined,float-cast-overflow,float-divide-by-zero 5863@end smallexample 5864 5865@item -fsanitize-undefined-trap-on-error 5866@opindex fsanitize-undefined-trap-on-error 5867The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to 5868report undefined behavior using @code{__builtin_trap} rather than 5869a @code{libubsan} library routine. The advantage of this is that the 5870@code{libubsan} library is not needed and is not linked in, so this 5871is usable even in freestanding environments. 5872 5873@item -fcheck-pointer-bounds 5874@opindex fcheck-pointer-bounds 5875@opindex fno-check-pointer-bounds 5876@cindex Pointer Bounds Checker options 5877Enable Pointer Bounds Checker instrumentation. Each memory reference 5878is instrumented with checks of the pointer used for memory access against 5879bounds associated with that pointer. 5880 5881Currently there 5882is only an implementation for Intel MPX available, thus x86 target 5883and @option{-mmpx} are required to enable this feature. 5884MPX-based instrumentation requires 5885a runtime library to enable MPX in hardware and handle bounds 5886violation signals. By default when @option{-fcheck-pointer-bounds} 5887and @option{-mmpx} options are used to link a program, the GCC driver 5888links against the @file{libmpx} runtime library and @file{libmpxwrappers} 5889library. It also passes '-z bndplt' to a linker in case it supports this 5890option (which is checked on libmpx configuration). Note that old versions 5891of linker may ignore option. Gold linker doesn't support '-z bndplt' 5892option. With no '-z bndplt' support in linker all calls to dynamic libraries 5893lose passed bounds reducing overall protection level. It's highly 5894recommended to use linker with '-z bndplt' support. In case such linker 5895is not available it is adviced to always use @option{-static-libmpxwrappers} 5896for better protection level or use @option{-static} to completely avoid 5897external calls to dynamic libraries. MPX-based instrumentation 5898may be used for debugging and also may be included in production code 5899to increase program security. Depending on usage, you may 5900have different requirements for the runtime library. The current version 5901of the MPX runtime library is more oriented for use as a debugging 5902tool. MPX runtime library usage implies @option{-lpthread}. See 5903also @option{-static-libmpx}. The runtime library behavior can be 5904influenced using various @env{CHKP_RT_*} environment variables. See 5905@uref{https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler} 5906for more details. 5907 5908Generated instrumentation may be controlled by various 5909@option{-fchkp-*} options and by the @code{bnd_variable_size} 5910structure field attribute (@pxref{Type Attributes}) and 5911@code{bnd_legacy}, and @code{bnd_instrument} function attributes 5912(@pxref{Function Attributes}). GCC also provides a number of built-in 5913functions for controlling the Pointer Bounds Checker. @xref{Pointer 5914Bounds Checker builtins}, for more information. 5915 5916@item -fchkp-check-incomplete-type 5917@opindex fchkp-check-incomplete-type 5918@opindex fno-chkp-check-incomplete-type 5919Generate pointer bounds checks for variables with incomplete type. 5920Enabled by default. 5921 5922@item -fchkp-narrow-bounds 5923@opindex fchkp-narrow-bounds 5924@opindex fno-chkp-narrow-bounds 5925Controls bounds used by Pointer Bounds Checker for pointers to object 5926fields. If narrowing is enabled then field bounds are used. Otherwise 5927object bounds are used. See also @option{-fchkp-narrow-to-innermost-array} 5928and @option{-fchkp-first-field-has-own-bounds}. Enabled by default. 5929 5930@item -fchkp-first-field-has-own-bounds 5931@opindex fchkp-first-field-has-own-bounds 5932@opindex fno-chkp-first-field-has-own-bounds 5933Forces Pointer Bounds Checker to use narrowed bounds for the address of the 5934first field in the structure. By default a pointer to the first field has 5935the same bounds as a pointer to the whole structure. 5936 5937@item -fchkp-narrow-to-innermost-array 5938@opindex fchkp-narrow-to-innermost-array 5939@opindex fno-chkp-narrow-to-innermost-array 5940Forces Pointer Bounds Checker to use bounds of the innermost arrays in 5941case of nested static array access. By default this option is disabled and 5942bounds of the outermost array are used. 5943 5944@item -fchkp-optimize 5945@opindex fchkp-optimize 5946@opindex fno-chkp-optimize 5947Enables Pointer Bounds Checker optimizations. Enabled by default at 5948optimization levels @option{-O}, @option{-O2}, @option{-O3}. 5949 5950@item -fchkp-use-fast-string-functions 5951@opindex fchkp-use-fast-string-functions 5952@opindex fno-chkp-use-fast-string-functions 5953Enables use of @code{*_nobnd} versions of string functions (not copying bounds) 5954by Pointer Bounds Checker. Disabled by default. 5955 5956@item -fchkp-use-nochk-string-functions 5957@opindex fchkp-use-nochk-string-functions 5958@opindex fno-chkp-use-nochk-string-functions 5959Enables use of @code{*_nochk} versions of string functions (not checking bounds) 5960by Pointer Bounds Checker. Disabled by default. 5961 5962@item -fchkp-use-static-bounds 5963@opindex fchkp-use-static-bounds 5964@opindex fno-chkp-use-static-bounds 5965Allow Pointer Bounds Checker to generate static bounds holding 5966bounds of static variables. Enabled by default. 5967 5968@item -fchkp-use-static-const-bounds 5969@opindex fchkp-use-static-const-bounds 5970@opindex fno-chkp-use-static-const-bounds 5971Use statically-initialized bounds for constant bounds instead of 5972generating them each time they are required. By default enabled when 5973@option{-fchkp-use-static-bounds} is enabled. 5974 5975@item -fchkp-treat-zero-dynamic-size-as-infinite 5976@opindex fchkp-treat-zero-dynamic-size-as-infinite 5977@opindex fno-chkp-treat-zero-dynamic-size-as-infinite 5978With this option, objects with incomplete type whose 5979dynamically-obtained size is zero are treated as having infinite size 5980instead by Pointer Bounds 5981Checker. This option may be helpful if a program is linked with a library 5982missing size information for some symbols. Disabled by default. 5983 5984@item -fchkp-check-read 5985@opindex fchkp-check-read 5986@opindex fno-chkp-check-read 5987Instructs Pointer Bounds Checker to generate checks for all read 5988accesses to memory. Enabled by default. 5989 5990@item -fchkp-check-write 5991@opindex fchkp-check-write 5992@opindex fno-chkp-check-write 5993Instructs Pointer Bounds Checker to generate checks for all write 5994accesses to memory. Enabled by default. 5995 5996@item -fchkp-store-bounds 5997@opindex fchkp-store-bounds 5998@opindex fno-chkp-store-bounds 5999Instructs Pointer Bounds Checker to generate bounds stores for 6000pointer writes. Enabled by default. 6001 6002@item -fchkp-instrument-calls 6003@opindex fchkp-instrument-calls 6004@opindex fno-chkp-instrument-calls 6005Instructs Pointer Bounds Checker to pass pointer bounds to calls. 6006Enabled by default. 6007 6008@item -fchkp-instrument-marked-only 6009@opindex fchkp-instrument-marked-only 6010@opindex fno-chkp-instrument-marked-only 6011Instructs Pointer Bounds Checker to instrument only functions 6012marked with the @code{bnd_instrument} attribute 6013(@pxref{Function Attributes}). Disabled by default. 6014 6015@item -fchkp-use-wrappers 6016@opindex fchkp-use-wrappers 6017@opindex fno-chkp-use-wrappers 6018Allows Pointer Bounds Checker to replace calls to built-in functions 6019with calls to wrapper functions. When @option{-fchkp-use-wrappers} 6020is used to link a program, the GCC driver automatically links 6021against @file{libmpxwrappers}. See also @option{-static-libmpxwrappers}. 6022Enabled by default. 6023 6024@item -fdump-final-insns@r{[}=@var{file}@r{]} 6025@opindex fdump-final-insns 6026Dump the final internal representation (RTL) to @var{file}. If the 6027optional argument is omitted (or if @var{file} is @code{.}), the name 6028of the dump file is determined by appending @code{.gkd} to the 6029compilation output file name. 6030 6031@item -fcompare-debug@r{[}=@var{opts}@r{]} 6032@opindex fcompare-debug 6033@opindex fno-compare-debug 6034If no error occurs during compilation, run the compiler a second time, 6035adding @var{opts} and @option{-fcompare-debug-second} to the arguments 6036passed to the second compilation. Dump the final internal 6037representation in both compilations, and print an error if they differ. 6038 6039If the equal sign is omitted, the default @option{-gtoggle} is used. 6040 6041The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty 6042and nonzero, implicitly enables @option{-fcompare-debug}. If 6043@env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash, 6044then it is used for @var{opts}, otherwise the default @option{-gtoggle} 6045is used. 6046 6047@option{-fcompare-debug=}, with the equal sign but without @var{opts}, 6048is equivalent to @option{-fno-compare-debug}, which disables the dumping 6049of the final representation and the second compilation, preventing even 6050@env{GCC_COMPARE_DEBUG} from taking effect. 6051 6052To verify full coverage during @option{-fcompare-debug} testing, set 6053@env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden}, 6054which GCC rejects as an invalid option in any actual compilation 6055(rather than preprocessing, assembly or linking). To get just a 6056warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug 6057not overridden} will do. 6058 6059@item -fcompare-debug-second 6060@opindex fcompare-debug-second 6061This option is implicitly passed to the compiler for the second 6062compilation requested by @option{-fcompare-debug}, along with options to 6063silence warnings, and omitting other options that would cause 6064side-effect compiler outputs to files or to the standard output. Dump 6065files and preserved temporary files are renamed so as to contain the 6066@code{.gk} additional extension during the second compilation, to avoid 6067overwriting those generated by the first. 6068 6069When this option is passed to the compiler driver, it causes the 6070@emph{first} compilation to be skipped, which makes it useful for little 6071other than debugging the compiler proper. 6072 6073@item -feliminate-dwarf2-dups 6074@opindex feliminate-dwarf2-dups 6075Compress DWARF 2 debugging information by eliminating duplicated 6076information about each symbol. This option only makes sense when 6077generating DWARF 2 debugging information with @option{-gdwarf-2}. 6078 6079@item -femit-struct-debug-baseonly 6080@opindex femit-struct-debug-baseonly 6081Emit debug information for struct-like types 6082only when the base name of the compilation source file 6083matches the base name of file in which the struct is defined. 6084 6085This option substantially reduces the size of debugging information, 6086but at significant potential loss in type information to the debugger. 6087See @option{-femit-struct-debug-reduced} for a less aggressive option. 6088See @option{-femit-struct-debug-detailed} for more detailed control. 6089 6090This option works only with DWARF 2. 6091 6092@item -femit-struct-debug-reduced 6093@opindex femit-struct-debug-reduced 6094Emit debug information for struct-like types 6095only when the base name of the compilation source file 6096matches the base name of file in which the type is defined, 6097unless the struct is a template or defined in a system header. 6098 6099This option significantly reduces the size of debugging information, 6100with some potential loss in type information to the debugger. 6101See @option{-femit-struct-debug-baseonly} for a more aggressive option. 6102See @option{-femit-struct-debug-detailed} for more detailed control. 6103 6104This option works only with DWARF 2. 6105 6106@item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} 6107@opindex femit-struct-debug-detailed 6108Specify the struct-like types 6109for which the compiler generates debug information. 6110The intent is to reduce duplicate struct debug information 6111between different object files within the same program. 6112 6113This option is a detailed version of 6114@option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly}, 6115which serves for most needs. 6116 6117A specification has the syntax@* 6118[@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none}) 6119 6120The optional first word limits the specification to 6121structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}). 6122A struct type is used directly when it is the type of a variable, member. 6123Indirect uses arise through pointers to structs. 6124That is, when use of an incomplete struct is valid, the use is indirect. 6125An example is 6126@samp{struct one direct; struct two * indirect;}. 6127 6128The optional second word limits the specification to 6129ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}). 6130Generic structs are a bit complicated to explain. 6131For C++, these are non-explicit specializations of template classes, 6132or non-template classes within the above. 6133Other programming languages have generics, 6134but @option{-femit-struct-debug-detailed} does not yet implement them. 6135 6136The third word specifies the source files for those 6137structs for which the compiler should emit debug information. 6138The values @samp{none} and @samp{any} have the normal meaning. 6139The value @samp{base} means that 6140the base of name of the file in which the type declaration appears 6141must match the base of the name of the main compilation file. 6142In practice, this means that when compiling @file{foo.c}, debug information 6143is generated for types declared in that file and @file{foo.h}, 6144but not other header files. 6145The value @samp{sys} means those types satisfying @samp{base} 6146or declared in system or compiler headers. 6147 6148You may need to experiment to determine the best settings for your application. 6149 6150The default is @option{-femit-struct-debug-detailed=all}. 6151 6152This option works only with DWARF 2. 6153 6154@item -fno-merge-debug-strings 6155@opindex fmerge-debug-strings 6156@opindex fno-merge-debug-strings 6157Direct the linker to not merge together strings in the debugging 6158information that are identical in different object files. Merging is 6159not supported by all assemblers or linkers. Merging decreases the size 6160of the debug information in the output file at the cost of increasing 6161link processing time. Merging is enabled by default. 6162 6163@item -fdebug-prefix-map=@var{old}=@var{new} 6164@opindex fdebug-prefix-map 6165When compiling files in directory @file{@var{old}}, record debugging 6166information describing them as in @file{@var{new}} instead. 6167 6168@item -fno-dwarf2-cfi-asm 6169@opindex fdwarf2-cfi-asm 6170@opindex fno-dwarf2-cfi-asm 6171Emit DWARF 2 unwind info as compiler generated @code{.eh_frame} section 6172instead of using GAS @code{.cfi_*} directives. 6173 6174@cindex @command{prof} 6175@item -p 6176@opindex p 6177Generate extra code to write profile information suitable for the 6178analysis program @command{prof}. You must use this option when compiling 6179the source files you want data about, and you must also use it when 6180linking. 6181 6182@cindex @command{gprof} 6183@item -pg 6184@opindex pg 6185Generate extra code to write profile information suitable for the 6186analysis program @command{gprof}. You must use this option when compiling 6187the source files you want data about, and you must also use it when 6188linking. 6189 6190@item -Q 6191@opindex Q 6192Makes the compiler print out each function name as it is compiled, and 6193print some statistics about each pass when it finishes. 6194 6195@item -ftime-report 6196@opindex ftime-report 6197Makes the compiler print some statistics about the time consumed by each 6198pass when it finishes. 6199 6200@item -fmem-report 6201@opindex fmem-report 6202Makes the compiler print some statistics about permanent memory 6203allocation when it finishes. 6204 6205@item -fmem-report-wpa 6206@opindex fmem-report-wpa 6207Makes the compiler print some statistics about permanent memory 6208allocation for the WPA phase only. 6209 6210@item -fpre-ipa-mem-report 6211@opindex fpre-ipa-mem-report 6212@item -fpost-ipa-mem-report 6213@opindex fpost-ipa-mem-report 6214Makes the compiler print some statistics about permanent memory 6215allocation before or after interprocedural optimization. 6216 6217@item -fprofile-report 6218@opindex fprofile-report 6219Makes the compiler print some statistics about consistency of the 6220(estimated) profile and effect of individual passes. 6221 6222@item -fstack-usage 6223@opindex fstack-usage 6224Makes the compiler output stack usage information for the program, on a 6225per-function basis. The filename for the dump is made by appending 6226@file{.su} to the @var{auxname}. @var{auxname} is generated from the name of 6227the output file, if explicitly specified and it is not an executable, 6228otherwise it is the basename of the source file. An entry is made up 6229of three fields: 6230 6231@itemize 6232@item 6233The name of the function. 6234@item 6235A number of bytes. 6236@item 6237One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}. 6238@end itemize 6239 6240The qualifier @code{static} means that the function manipulates the stack 6241statically: a fixed number of bytes are allocated for the frame on function 6242entry and released on function exit; no stack adjustments are otherwise made 6243in the function. The second field is this fixed number of bytes. 6244 6245The qualifier @code{dynamic} means that the function manipulates the stack 6246dynamically: in addition to the static allocation described above, stack 6247adjustments are made in the body of the function, for example to push/pop 6248arguments around function calls. If the qualifier @code{bounded} is also 6249present, the amount of these adjustments is bounded at compile time and 6250the second field is an upper bound of the total amount of stack used by 6251the function. If it is not present, the amount of these adjustments is 6252not bounded at compile time and the second field only represents the 6253bounded part. 6254 6255@item -fprofile-arcs 6256@opindex fprofile-arcs 6257Add code so that program flow @dfn{arcs} are instrumented. During 6258execution the program records how many times each branch and call is 6259executed and how many times it is taken or returns. When the compiled 6260program exits it saves this data to a file called 6261@file{@var{auxname}.gcda} for each source file. The data may be used for 6262profile-directed optimizations (@option{-fbranch-probabilities}), or for 6263test coverage analysis (@option{-ftest-coverage}). Each object file's 6264@var{auxname} is generated from the name of the output file, if 6265explicitly specified and it is not the final executable, otherwise it is 6266the basename of the source file. In both cases any suffix is removed 6267(e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or 6268@file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}). 6269@xref{Cross-profiling}. 6270 6271@cindex @command{gcov} 6272@item --coverage 6273@opindex coverage 6274 6275This option is used to compile and link code instrumented for coverage 6276analysis. The option is a synonym for @option{-fprofile-arcs} 6277@option{-ftest-coverage} (when compiling) and @option{-lgcov} (when 6278linking). See the documentation for those options for more details. 6279 6280@itemize 6281 6282@item 6283Compile the source files with @option{-fprofile-arcs} plus optimization 6284and code generation options. For test coverage analysis, use the 6285additional @option{-ftest-coverage} option. You do not need to profile 6286every source file in a program. 6287 6288@item 6289Link your object files with @option{-lgcov} or @option{-fprofile-arcs} 6290(the latter implies the former). 6291 6292@item 6293Run the program on a representative workload to generate the arc profile 6294information. This may be repeated any number of times. You can run 6295concurrent instances of your program, and provided that the file system 6296supports locking, the data files will be correctly updated. Also 6297@code{fork} calls are detected and correctly handled (double counting 6298will not happen). 6299 6300@item 6301For profile-directed optimizations, compile the source files again with 6302the same optimization and code generation options plus 6303@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that 6304Control Optimization}). 6305 6306@item 6307For test coverage analysis, use @command{gcov} to produce human readable 6308information from the @file{.gcno} and @file{.gcda} files. Refer to the 6309@command{gcov} documentation for further information. 6310 6311@end itemize 6312 6313With @option{-fprofile-arcs}, for each function of your program GCC 6314creates a program flow graph, then finds a spanning tree for the graph. 6315Only arcs that are not on the spanning tree have to be instrumented: the 6316compiler adds code to count the number of times that these arcs are 6317executed. When an arc is the only exit or only entrance to a block, the 6318instrumentation code can be added to the block; otherwise, a new basic 6319block must be created to hold the instrumentation code. 6320 6321@need 2000 6322@item -ftest-coverage 6323@opindex ftest-coverage 6324Produce a notes file that the @command{gcov} code-coverage utility 6325(@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to 6326show program coverage. Each source file's note file is called 6327@file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option 6328above for a description of @var{auxname} and instructions on how to 6329generate test coverage data. Coverage data matches the source files 6330more closely if you do not optimize. 6331 6332@item -fdbg-cnt-list 6333@opindex fdbg-cnt-list 6334Print the name and the counter upper bound for all debug counters. 6335 6336 6337@item -fdbg-cnt=@var{counter-value-list} 6338@opindex fdbg-cnt 6339Set the internal debug counter upper bound. @var{counter-value-list} 6340is a comma-separated list of @var{name}:@var{value} pairs 6341which sets the upper bound of each debug counter @var{name} to @var{value}. 6342All debug counters have the initial upper bound of @code{UINT_MAX}; 6343thus @code{dbg_cnt} returns true always unless the upper bound 6344is set by this option. 6345For example, with @option{-fdbg-cnt=dce:10,tail_call:0}, 6346@code{dbg_cnt(dce)} returns true only for first 10 invocations. 6347 6348@item -fenable-@var{kind}-@var{pass} 6349@itemx -fdisable-@var{kind}-@var{pass}=@var{range-list} 6350@opindex fdisable- 6351@opindex fenable- 6352 6353This is a set of options that are used to explicitly disable/enable 6354optimization passes. These options are intended for use for debugging GCC. 6355Compiler users should use regular options for enabling/disabling 6356passes instead. 6357 6358@table @gcctabopt 6359 6360@item -fdisable-ipa-@var{pass} 6361Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is 6362statically invoked in the compiler multiple times, the pass name should be 6363appended with a sequential number starting from 1. 6364 6365@item -fdisable-rtl-@var{pass} 6366@itemx -fdisable-rtl-@var{pass}=@var{range-list} 6367Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is 6368statically invoked in the compiler multiple times, the pass name should be 6369appended with a sequential number starting from 1. @var{range-list} is a 6370comma-separated list of function ranges or assembler names. Each range is a number 6371pair separated by a colon. The range is inclusive in both ends. If the range 6372is trivial, the number pair can be simplified as a single number. If the 6373function's call graph node's @var{uid} falls within one of the specified ranges, 6374the @var{pass} is disabled for that function. The @var{uid} is shown in the 6375function header of a dump file, and the pass names can be dumped by using 6376option @option{-fdump-passes}. 6377 6378@item -fdisable-tree-@var{pass} 6379@itemx -fdisable-tree-@var{pass}=@var{range-list} 6380Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of 6381option arguments. 6382 6383@item -fenable-ipa-@var{pass} 6384Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is 6385statically invoked in the compiler multiple times, the pass name should be 6386appended with a sequential number starting from 1. 6387 6388@item -fenable-rtl-@var{pass} 6389@itemx -fenable-rtl-@var{pass}=@var{range-list} 6390Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument 6391description and examples. 6392 6393@item -fenable-tree-@var{pass} 6394@itemx -fenable-tree-@var{pass}=@var{range-list} 6395Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description 6396of option arguments. 6397 6398@end table 6399 6400Here are some examples showing uses of these options. 6401 6402@smallexample 6403 6404# disable ccp1 for all functions 6405 -fdisable-tree-ccp1 6406# disable complete unroll for function whose cgraph node uid is 1 6407 -fenable-tree-cunroll=1 6408# disable gcse2 for functions at the following ranges [1,1], 6409# [300,400], and [400,1000] 6410# disable gcse2 for functions foo and foo2 6411 -fdisable-rtl-gcse2=foo,foo2 6412# disable early inlining 6413 -fdisable-tree-einline 6414# disable ipa inlining 6415 -fdisable-ipa-inline 6416# enable tree full unroll 6417 -fenable-tree-unroll 6418 6419@end smallexample 6420 6421@item -d@var{letters} 6422@itemx -fdump-rtl-@var{pass} 6423@itemx -fdump-rtl-@var{pass}=@var{filename} 6424@opindex d 6425@opindex fdump-rtl-@var{pass} 6426Says to make debugging dumps during compilation at times specified by 6427@var{letters}. This is used for debugging the RTL-based passes of the 6428compiler. The file names for most of the dumps are made by appending 6429a pass number and a word to the @var{dumpname}, and the files are 6430created in the directory of the output file. In case of 6431@option{=@var{filename}} option, the dump is output on the given file 6432instead of the pass numbered dump files. Note that the pass number is 6433computed statically as passes get registered into the pass manager. 6434Thus the numbering is not related to the dynamic order of execution of 6435passes. In particular, a pass installed by a plugin could have a 6436number over 200 even if it executed quite early. @var{dumpname} is 6437generated from the name of the output file, if explicitly specified 6438and it is not an executable, otherwise it is the basename of the 6439source file. These switches may have different effects when 6440@option{-E} is used for preprocessing. 6441 6442Debug dumps can be enabled with a @option{-fdump-rtl} switch or some 6443@option{-d} option @var{letters}. Here are the possible 6444letters for use in @var{pass} and @var{letters}, and their meanings: 6445 6446@table @gcctabopt 6447 6448@item -fdump-rtl-alignments 6449@opindex fdump-rtl-alignments 6450Dump after branch alignments have been computed. 6451 6452@item -fdump-rtl-asmcons 6453@opindex fdump-rtl-asmcons 6454Dump after fixing rtl statements that have unsatisfied in/out constraints. 6455 6456@item -fdump-rtl-auto_inc_dec 6457@opindex fdump-rtl-auto_inc_dec 6458Dump after auto-inc-dec discovery. This pass is only run on 6459architectures that have auto inc or auto dec instructions. 6460 6461@item -fdump-rtl-barriers 6462@opindex fdump-rtl-barriers 6463Dump after cleaning up the barrier instructions. 6464 6465@item -fdump-rtl-bbpart 6466@opindex fdump-rtl-bbpart 6467Dump after partitioning hot and cold basic blocks. 6468 6469@item -fdump-rtl-bbro 6470@opindex fdump-rtl-bbro 6471Dump after block reordering. 6472 6473@item -fdump-rtl-btl1 6474@itemx -fdump-rtl-btl2 6475@opindex fdump-rtl-btl2 6476@opindex fdump-rtl-btl2 6477@option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping 6478after the two branch 6479target load optimization passes. 6480 6481@item -fdump-rtl-bypass 6482@opindex fdump-rtl-bypass 6483Dump after jump bypassing and control flow optimizations. 6484 6485@item -fdump-rtl-combine 6486@opindex fdump-rtl-combine 6487Dump after the RTL instruction combination pass. 6488 6489@item -fdump-rtl-compgotos 6490@opindex fdump-rtl-compgotos 6491Dump after duplicating the computed gotos. 6492 6493@item -fdump-rtl-ce1 6494@itemx -fdump-rtl-ce2 6495@itemx -fdump-rtl-ce3 6496@opindex fdump-rtl-ce1 6497@opindex fdump-rtl-ce2 6498@opindex fdump-rtl-ce3 6499@option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and 6500@option{-fdump-rtl-ce3} enable dumping after the three 6501if conversion passes. 6502 6503@item -fdump-rtl-cprop_hardreg 6504@opindex fdump-rtl-cprop_hardreg 6505Dump after hard register copy propagation. 6506 6507@item -fdump-rtl-csa 6508@opindex fdump-rtl-csa 6509Dump after combining stack adjustments. 6510 6511@item -fdump-rtl-cse1 6512@itemx -fdump-rtl-cse2 6513@opindex fdump-rtl-cse1 6514@opindex fdump-rtl-cse2 6515@option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after 6516the two common subexpression elimination passes. 6517 6518@item -fdump-rtl-dce 6519@opindex fdump-rtl-dce 6520Dump after the standalone dead code elimination passes. 6521 6522@item -fdump-rtl-dbr 6523@opindex fdump-rtl-dbr 6524Dump after delayed branch scheduling. 6525 6526@item -fdump-rtl-dce1 6527@itemx -fdump-rtl-dce2 6528@opindex fdump-rtl-dce1 6529@opindex fdump-rtl-dce2 6530@option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after 6531the two dead store elimination passes. 6532 6533@item -fdump-rtl-eh 6534@opindex fdump-rtl-eh 6535Dump after finalization of EH handling code. 6536 6537@item -fdump-rtl-eh_ranges 6538@opindex fdump-rtl-eh_ranges 6539Dump after conversion of EH handling range regions. 6540 6541@item -fdump-rtl-expand 6542@opindex fdump-rtl-expand 6543Dump after RTL generation. 6544 6545@item -fdump-rtl-fwprop1 6546@itemx -fdump-rtl-fwprop2 6547@opindex fdump-rtl-fwprop1 6548@opindex fdump-rtl-fwprop2 6549@option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable 6550dumping after the two forward propagation passes. 6551 6552@item -fdump-rtl-gcse1 6553@itemx -fdump-rtl-gcse2 6554@opindex fdump-rtl-gcse1 6555@opindex fdump-rtl-gcse2 6556@option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping 6557after global common subexpression elimination. 6558 6559@item -fdump-rtl-init-regs 6560@opindex fdump-rtl-init-regs 6561Dump after the initialization of the registers. 6562 6563@item -fdump-rtl-initvals 6564@opindex fdump-rtl-initvals 6565Dump after the computation of the initial value sets. 6566 6567@item -fdump-rtl-into_cfglayout 6568@opindex fdump-rtl-into_cfglayout 6569Dump after converting to cfglayout mode. 6570 6571@item -fdump-rtl-ira 6572@opindex fdump-rtl-ira 6573Dump after iterated register allocation. 6574 6575@item -fdump-rtl-jump 6576@opindex fdump-rtl-jump 6577Dump after the second jump optimization. 6578 6579@item -fdump-rtl-loop2 6580@opindex fdump-rtl-loop2 6581@option{-fdump-rtl-loop2} enables dumping after the rtl 6582loop optimization passes. 6583 6584@item -fdump-rtl-mach 6585@opindex fdump-rtl-mach 6586Dump after performing the machine dependent reorganization pass, if that 6587pass exists. 6588 6589@item -fdump-rtl-mode_sw 6590@opindex fdump-rtl-mode_sw 6591Dump after removing redundant mode switches. 6592 6593@item -fdump-rtl-rnreg 6594@opindex fdump-rtl-rnreg 6595Dump after register renumbering. 6596 6597@item -fdump-rtl-outof_cfglayout 6598@opindex fdump-rtl-outof_cfglayout 6599Dump after converting from cfglayout mode. 6600 6601@item -fdump-rtl-peephole2 6602@opindex fdump-rtl-peephole2 6603Dump after the peephole pass. 6604 6605@item -fdump-rtl-postreload 6606@opindex fdump-rtl-postreload 6607Dump after post-reload optimizations. 6608 6609@item -fdump-rtl-pro_and_epilogue 6610@opindex fdump-rtl-pro_and_epilogue 6611Dump after generating the function prologues and epilogues. 6612 6613@item -fdump-rtl-sched1 6614@itemx -fdump-rtl-sched2 6615@opindex fdump-rtl-sched1 6616@opindex fdump-rtl-sched2 6617@option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping 6618after the basic block scheduling passes. 6619 6620@item -fdump-rtl-ree 6621@opindex fdump-rtl-ree 6622Dump after sign/zero extension elimination. 6623 6624@item -fdump-rtl-seqabstr 6625@opindex fdump-rtl-seqabstr 6626Dump after common sequence discovery. 6627 6628@item -fdump-rtl-shorten 6629@opindex fdump-rtl-shorten 6630Dump after shortening branches. 6631 6632@item -fdump-rtl-sibling 6633@opindex fdump-rtl-sibling 6634Dump after sibling call optimizations. 6635 6636@item -fdump-rtl-split1 6637@itemx -fdump-rtl-split2 6638@itemx -fdump-rtl-split3 6639@itemx -fdump-rtl-split4 6640@itemx -fdump-rtl-split5 6641@opindex fdump-rtl-split1 6642@opindex fdump-rtl-split2 6643@opindex fdump-rtl-split3 6644@opindex fdump-rtl-split4 6645@opindex fdump-rtl-split5 6646These options enable dumping after five rounds of 6647instruction splitting. 6648 6649@item -fdump-rtl-sms 6650@opindex fdump-rtl-sms 6651Dump after modulo scheduling. This pass is only run on some 6652architectures. 6653 6654@item -fdump-rtl-stack 6655@opindex fdump-rtl-stack 6656Dump after conversion from GCC's ``flat register file'' registers to the 6657x87's stack-like registers. This pass is only run on x86 variants. 6658 6659@item -fdump-rtl-subreg1 6660@itemx -fdump-rtl-subreg2 6661@opindex fdump-rtl-subreg1 6662@opindex fdump-rtl-subreg2 6663@option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after 6664the two subreg expansion passes. 6665 6666@item -fdump-rtl-unshare 6667@opindex fdump-rtl-unshare 6668Dump after all rtl has been unshared. 6669 6670@item -fdump-rtl-vartrack 6671@opindex fdump-rtl-vartrack 6672Dump after variable tracking. 6673 6674@item -fdump-rtl-vregs 6675@opindex fdump-rtl-vregs 6676Dump after converting virtual registers to hard registers. 6677 6678@item -fdump-rtl-web 6679@opindex fdump-rtl-web 6680Dump after live range splitting. 6681 6682@item -fdump-rtl-regclass 6683@itemx -fdump-rtl-subregs_of_mode_init 6684@itemx -fdump-rtl-subregs_of_mode_finish 6685@itemx -fdump-rtl-dfinit 6686@itemx -fdump-rtl-dfinish 6687@opindex fdump-rtl-regclass 6688@opindex fdump-rtl-subregs_of_mode_init 6689@opindex fdump-rtl-subregs_of_mode_finish 6690@opindex fdump-rtl-dfinit 6691@opindex fdump-rtl-dfinish 6692These dumps are defined but always produce empty files. 6693 6694@item -da 6695@itemx -fdump-rtl-all 6696@opindex da 6697@opindex fdump-rtl-all 6698Produce all the dumps listed above. 6699 6700@item -dA 6701@opindex dA 6702Annotate the assembler output with miscellaneous debugging information. 6703 6704@item -dD 6705@opindex dD 6706Dump all macro definitions, at the end of preprocessing, in addition to 6707normal output. 6708 6709@item -dH 6710@opindex dH 6711Produce a core dump whenever an error occurs. 6712 6713@item -dp 6714@opindex dp 6715Annotate the assembler output with a comment indicating which 6716pattern and alternative is used. The length of each instruction is 6717also printed. 6718 6719@item -dP 6720@opindex dP 6721Dump the RTL in the assembler output as a comment before each instruction. 6722Also turns on @option{-dp} annotation. 6723 6724@item -dx 6725@opindex dx 6726Just generate RTL for a function instead of compiling it. Usually used 6727with @option{-fdump-rtl-expand}. 6728@end table 6729 6730@item -fdump-noaddr 6731@opindex fdump-noaddr 6732When doing debugging dumps, suppress address output. This makes it more 6733feasible to use diff on debugging dumps for compiler invocations with 6734different compiler binaries and/or different 6735text / bss / data / heap / stack / dso start locations. 6736 6737@item -freport-bug 6738@opindex freport-bug 6739Collect and dump debug information into temporary file if ICE in C/C++ 6740compiler occured. 6741 6742@item -fdump-unnumbered 6743@opindex fdump-unnumbered 6744When doing debugging dumps, suppress instruction numbers and address output. 6745This makes it more feasible to use diff on debugging dumps for compiler 6746invocations with different options, in particular with and without 6747@option{-g}. 6748 6749@item -fdump-unnumbered-links 6750@opindex fdump-unnumbered-links 6751When doing debugging dumps (see @option{-d} option above), suppress 6752instruction numbers for the links to the previous and next instructions 6753in a sequence. 6754 6755@item -fdump-translation-unit @r{(C++ only)} 6756@itemx -fdump-translation-unit-@var{options} @r{(C++ only)} 6757@opindex fdump-translation-unit 6758Dump a representation of the tree structure for the entire translation 6759unit to a file. The file name is made by appending @file{.tu} to the 6760source file name, and the file is created in the same directory as the 6761output file. If the @samp{-@var{options}} form is used, @var{options} 6762controls the details of the dump as described for the 6763@option{-fdump-tree} options. 6764 6765@item -fdump-class-hierarchy @r{(C++ only)} 6766@itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)} 6767@opindex fdump-class-hierarchy 6768Dump a representation of each class's hierarchy and virtual function 6769table layout to a file. The file name is made by appending 6770@file{.class} to the source file name, and the file is created in the 6771same directory as the output file. If the @samp{-@var{options}} form 6772is used, @var{options} controls the details of the dump as described 6773for the @option{-fdump-tree} options. 6774 6775@item -fdump-ipa-@var{switch} 6776@opindex fdump-ipa 6777Control the dumping at various stages of inter-procedural analysis 6778language tree to a file. The file name is generated by appending a 6779switch specific suffix to the source file name, and the file is created 6780in the same directory as the output file. The following dumps are 6781possible: 6782 6783@table @samp 6784@item all 6785Enables all inter-procedural analysis dumps. 6786 6787@item cgraph 6788Dumps information about call-graph optimization, unused function removal, 6789and inlining decisions. 6790 6791@item inline 6792Dump after function inlining. 6793 6794@end table 6795 6796@item -fdump-passes 6797@opindex fdump-passes 6798Dump the list of optimization passes that are turned on and off by 6799the current command-line options. 6800 6801@item -fdump-statistics-@var{option} 6802@opindex fdump-statistics 6803Enable and control dumping of pass statistics in a separate file. The 6804file name is generated by appending a suffix ending in 6805@samp{.statistics} to the source file name, and the file is created in 6806the same directory as the output file. If the @samp{-@var{option}} 6807form is used, @samp{-stats} causes counters to be summed over the 6808whole compilation unit while @samp{-details} dumps every event as 6809the passes generate them. The default with no option is to sum 6810counters for each function compiled. 6811 6812@item -fdump-tree-@var{switch} 6813@itemx -fdump-tree-@var{switch}-@var{options} 6814@itemx -fdump-tree-@var{switch}-@var{options}=@var{filename} 6815@opindex fdump-tree 6816Control the dumping at various stages of processing the intermediate 6817language tree to a file. The file name is generated by appending a 6818switch-specific suffix to the source file name, and the file is 6819created in the same directory as the output file. In case of 6820@option{=@var{filename}} option, the dump is output on the given file 6821instead of the auto named dump files. If the @samp{-@var{options}} 6822form is used, @var{options} is a list of @samp{-} separated options 6823which control the details of the dump. Not all options are applicable 6824to all dumps; those that are not meaningful are ignored. The 6825following options are available 6826 6827@table @samp 6828@item address 6829Print the address of each node. Usually this is not meaningful as it 6830changes according to the environment and source file. Its primary use 6831is for tying up a dump file with a debug environment. 6832@item asmname 6833If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that 6834in the dump instead of @code{DECL_NAME}. Its primary use is ease of 6835use working backward from mangled names in the assembly file. 6836@item slim 6837When dumping front-end intermediate representations, inhibit dumping 6838of members of a scope or body of a function merely because that scope 6839has been reached. Only dump such items when they are directly reachable 6840by some other path. 6841 6842When dumping pretty-printed trees, this option inhibits dumping the 6843bodies of control structures. 6844 6845When dumping RTL, print the RTL in slim (condensed) form instead of 6846the default LISP-like representation. 6847@item raw 6848Print a raw representation of the tree. By default, trees are 6849pretty-printed into a C-like representation. 6850@item details 6851Enable more detailed dumps (not honored by every dump option). Also 6852include information from the optimization passes. 6853@item stats 6854Enable dumping various statistics about the pass (not honored by every dump 6855option). 6856@item blocks 6857Enable showing basic block boundaries (disabled in raw dumps). 6858@item graph 6859For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}), 6860dump a representation of the control flow graph suitable for viewing with 6861GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in 6862the file is pretty-printed as a subgraph, so that GraphViz can render them 6863all in a single plot. 6864 6865This option currently only works for RTL dumps, and the RTL is always 6866dumped in slim form. 6867@item vops 6868Enable showing virtual operands for every statement. 6869@item lineno 6870Enable showing line numbers for statements. 6871@item uid 6872Enable showing the unique ID (@code{DECL_UID}) for each variable. 6873@item verbose 6874Enable showing the tree dump for each statement. 6875@item eh 6876Enable showing the EH region number holding each statement. 6877@item scev 6878Enable showing scalar evolution analysis details. 6879@item optimized 6880Enable showing optimization information (only available in certain 6881passes). 6882@item missed 6883Enable showing missed optimization information (only available in certain 6884passes). 6885@item note 6886Enable other detailed optimization information (only available in 6887certain passes). 6888@item =@var{filename} 6889Instead of an auto named dump file, output into the given file 6890name. The file names @file{stdout} and @file{stderr} are treated 6891specially and are considered already open standard streams. For 6892example, 6893 6894@smallexample 6895gcc -O2 -ftree-vectorize -fdump-tree-vect-blocks=foo.dump 6896 -fdump-tree-pre=stderr file.c 6897@end smallexample 6898 6899outputs vectorizer dump into @file{foo.dump}, while the PRE dump is 6900output on to @file{stderr}. If two conflicting dump filenames are 6901given for the same pass, then the latter option overrides the earlier 6902one. 6903 6904@item all 6905Turn on all options, except @option{raw}, @option{slim}, @option{verbose} 6906and @option{lineno}. 6907 6908@item optall 6909Turn on all optimization options, i.e., @option{optimized}, 6910@option{missed}, and @option{note}. 6911@end table 6912 6913The following tree dumps are possible: 6914@table @samp 6915 6916@item original 6917@opindex fdump-tree-original 6918Dump before any tree based optimization, to @file{@var{file}.original}. 6919 6920@item optimized 6921@opindex fdump-tree-optimized 6922Dump after all tree based optimization, to @file{@var{file}.optimized}. 6923 6924@item gimple 6925@opindex fdump-tree-gimple 6926Dump each function before and after the gimplification pass to a file. The 6927file name is made by appending @file{.gimple} to the source file name. 6928 6929@item cfg 6930@opindex fdump-tree-cfg 6931Dump the control flow graph of each function to a file. The file name is 6932made by appending @file{.cfg} to the source file name. 6933 6934@item ch 6935@opindex fdump-tree-ch 6936Dump each function after copying loop headers. The file name is made by 6937appending @file{.ch} to the source file name. 6938 6939@item ssa 6940@opindex fdump-tree-ssa 6941Dump SSA related information to a file. The file name is made by appending 6942@file{.ssa} to the source file name. 6943 6944@item alias 6945@opindex fdump-tree-alias 6946Dump aliasing information for each function. The file name is made by 6947appending @file{.alias} to the source file name. 6948 6949@item ccp 6950@opindex fdump-tree-ccp 6951Dump each function after CCP@. The file name is made by appending 6952@file{.ccp} to the source file name. 6953 6954@item storeccp 6955@opindex fdump-tree-storeccp 6956Dump each function after STORE-CCP@. The file name is made by appending 6957@file{.storeccp} to the source file name. 6958 6959@item pre 6960@opindex fdump-tree-pre 6961Dump trees after partial redundancy elimination. The file name is made 6962by appending @file{.pre} to the source file name. 6963 6964@item fre 6965@opindex fdump-tree-fre 6966Dump trees after full redundancy elimination. The file name is made 6967by appending @file{.fre} to the source file name. 6968 6969@item copyprop 6970@opindex fdump-tree-copyprop 6971Dump trees after copy propagation. The file name is made 6972by appending @file{.copyprop} to the source file name. 6973 6974@item store_copyprop 6975@opindex fdump-tree-store_copyprop 6976Dump trees after store copy-propagation. The file name is made 6977by appending @file{.store_copyprop} to the source file name. 6978 6979@item dce 6980@opindex fdump-tree-dce 6981Dump each function after dead code elimination. The file name is made by 6982appending @file{.dce} to the source file name. 6983 6984@item sra 6985@opindex fdump-tree-sra 6986Dump each function after performing scalar replacement of aggregates. The 6987file name is made by appending @file{.sra} to the source file name. 6988 6989@item sink 6990@opindex fdump-tree-sink 6991Dump each function after performing code sinking. The file name is made 6992by appending @file{.sink} to the source file name. 6993 6994@item dom 6995@opindex fdump-tree-dom 6996Dump each function after applying dominator tree optimizations. The file 6997name is made by appending @file{.dom} to the source file name. 6998 6999@item dse 7000@opindex fdump-tree-dse 7001Dump each function after applying dead store elimination. The file 7002name is made by appending @file{.dse} to the source file name. 7003 7004@item phiopt 7005@opindex fdump-tree-phiopt 7006Dump each function after optimizing PHI nodes into straightline code. The file 7007name is made by appending @file{.phiopt} to the source file name. 7008 7009@item forwprop 7010@opindex fdump-tree-forwprop 7011Dump each function after forward propagating single use variables. The file 7012name is made by appending @file{.forwprop} to the source file name. 7013 7014@item copyrename 7015@opindex fdump-tree-copyrename 7016Dump each function after applying the copy rename optimization. The file 7017name is made by appending @file{.copyrename} to the source file name. 7018 7019@item nrv 7020@opindex fdump-tree-nrv 7021Dump each function after applying the named return value optimization on 7022generic trees. The file name is made by appending @file{.nrv} to the source 7023file name. 7024 7025@item vect 7026@opindex fdump-tree-vect 7027Dump each function after applying vectorization of loops. The file name is 7028made by appending @file{.vect} to the source file name. 7029 7030@item slp 7031@opindex fdump-tree-slp 7032Dump each function after applying vectorization of basic blocks. The file name 7033is made by appending @file{.slp} to the source file name. 7034 7035@item vrp 7036@opindex fdump-tree-vrp 7037Dump each function after Value Range Propagation (VRP). The file name 7038is made by appending @file{.vrp} to the source file name. 7039 7040@item all 7041@opindex fdump-tree-all 7042Enable all the available tree dumps with the flags provided in this option. 7043@end table 7044 7045@item -fopt-info 7046@itemx -fopt-info-@var{options} 7047@itemx -fopt-info-@var{options}=@var{filename} 7048@opindex fopt-info 7049Controls optimization dumps from various optimization passes. If the 7050@samp{-@var{options}} form is used, @var{options} is a list of 7051@samp{-} separated option keywords to select the dump details and 7052optimizations. 7053 7054The @var{options} can be divided into two groups: options describing the 7055verbosity of the dump, and options describing which optimizations 7056should be included. The options from both the groups can be freely 7057mixed as they are non-overlapping. However, in case of any conflicts, 7058the later options override the earlier options on the command 7059line. 7060 7061The following options control the dump verbosity: 7062 7063@table @samp 7064@item optimized 7065Print information when an optimization is successfully applied. It is 7066up to a pass to decide which information is relevant. For example, the 7067vectorizer passes print the source location of loops which are 7068successfully vectorized. 7069@item missed 7070Print information about missed optimizations. Individual passes 7071control which information to include in the output. 7072@item note 7073Print verbose information about optimizations, such as certain 7074transformations, more detailed messages about decisions etc. 7075@item all 7076Print detailed optimization information. This includes 7077@samp{optimized}, @samp{missed}, and @samp{note}. 7078@end table 7079 7080One or more of the following option keywords can be used to describe a 7081group of optimizations: 7082 7083@table @samp 7084@item ipa 7085Enable dumps from all interprocedural optimizations. 7086@item loop 7087Enable dumps from all loop optimizations. 7088@item inline 7089Enable dumps from all inlining optimizations. 7090@item vec 7091Enable dumps from all vectorization optimizations. 7092@item optall 7093Enable dumps from all optimizations. This is a superset of 7094the optimization groups listed above. 7095@end table 7096 7097If @var{options} is 7098omitted, it defaults to @samp{optimized-optall}, which means to dump all 7099info about successful optimizations from all the passes. 7100 7101If the @var{filename} is provided, then the dumps from all the 7102applicable optimizations are concatenated into the @var{filename}. 7103Otherwise the dump is output onto @file{stderr}. Though multiple 7104@option{-fopt-info} options are accepted, only one of them can include 7105a @var{filename}. If other filenames are provided then all but the 7106first such option are ignored. 7107 7108Note that the output @var{filename} is overwritten 7109in case of multiple translation units. If a combined output from 7110multiple translation units is desired, @file{stderr} should be used 7111instead. 7112 7113In the following example, the optimization info is output to 7114@file{stderr}: 7115 7116@smallexample 7117gcc -O3 -fopt-info 7118@end smallexample 7119 7120This example: 7121@smallexample 7122gcc -O3 -fopt-info-missed=missed.all 7123@end smallexample 7124 7125@noindent 7126outputs missed optimization report from all the passes into 7127@file{missed.all}, and this one: 7128 7129@smallexample 7130gcc -O2 -ftree-vectorize -fopt-info-vec-missed 7131@end smallexample 7132 7133@noindent 7134prints information about missed optimization opportunities from 7135vectorization passes on @file{stderr}. 7136Note that @option{-fopt-info-vec-missed} is equivalent to 7137@option{-fopt-info-missed-vec}. 7138 7139As another example, 7140@smallexample 7141gcc -O3 -fopt-info-inline-optimized-missed=inline.txt 7142@end smallexample 7143 7144@noindent 7145outputs information about missed optimizations as well as 7146optimized locations from all the inlining passes into 7147@file{inline.txt}. 7148 7149Finally, consider: 7150 7151@smallexample 7152gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt 7153@end smallexample 7154 7155@noindent 7156Here the two output filenames @file{vec.miss} and @file{loop.opt} are 7157in conflict since only one output file is allowed. In this case, only 7158the first option takes effect and the subsequent options are 7159ignored. Thus only @file{vec.miss} is produced which contains 7160dumps from the vectorizer about missed opportunities. 7161 7162@item -frandom-seed=@var{string} 7163@opindex frandom-seed 7164This option provides a seed that GCC uses in place of 7165random numbers in generating certain symbol names 7166that have to be different in every compiled file. It is also used to 7167place unique stamps in coverage data files and the object files that 7168produce them. You can use the @option{-frandom-seed} option to produce 7169reproducibly identical object files. 7170 7171The @var{string} can either be a number (decimal, octal or hex) or an 7172arbitrary string (in which case it's converted to a number by 7173computing CRC32). 7174 7175The @var{string} should be different for every file you compile. 7176 7177@item -fsched-verbose=@var{n} 7178@opindex fsched-verbose 7179On targets that use instruction scheduling, this option controls the 7180amount of debugging output the scheduler prints. This information is 7181written to standard error, unless @option{-fdump-rtl-sched1} or 7182@option{-fdump-rtl-sched2} is specified, in which case it is output 7183to the usual dump listing file, @file{.sched1} or @file{.sched2} 7184respectively. However for @var{n} greater than nine, the output is 7185always printed to standard error. 7186 7187For @var{n} greater than zero, @option{-fsched-verbose} outputs the 7188same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}. 7189For @var{n} greater than one, it also output basic block probabilities, 7190detailed ready list information and unit/insn info. For @var{n} greater 7191than two, it includes RTL at abort point, control-flow and regions info. 7192And for @var{n} over four, @option{-fsched-verbose} also includes 7193dependence info. 7194 7195@item -save-temps 7196@itemx -save-temps=cwd 7197@opindex save-temps 7198Store the usual ``temporary'' intermediate files permanently; place them 7199in the current directory and name them based on the source file. Thus, 7200compiling @file{foo.c} with @option{-c -save-temps} produces files 7201@file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a 7202preprocessed @file{foo.i} output file even though the compiler now 7203normally uses an integrated preprocessor. 7204 7205When used in combination with the @option{-x} command-line option, 7206@option{-save-temps} is sensible enough to avoid over writing an 7207input source file with the same extension as an intermediate file. 7208The corresponding intermediate file may be obtained by renaming the 7209source file before using @option{-save-temps}. 7210 7211If you invoke GCC in parallel, compiling several different source 7212files that share a common base name in different subdirectories or the 7213same source file compiled for multiple output destinations, it is 7214likely that the different parallel compilers will interfere with each 7215other, and overwrite the temporary files. For instance: 7216 7217@smallexample 7218gcc -save-temps -o outdir1/foo.o indir1/foo.c& 7219gcc -save-temps -o outdir2/foo.o indir2/foo.c& 7220@end smallexample 7221 7222may result in @file{foo.i} and @file{foo.o} being written to 7223simultaneously by both compilers. 7224 7225@item -save-temps=obj 7226@opindex save-temps=obj 7227Store the usual ``temporary'' intermediate files permanently. If the 7228@option{-o} option is used, the temporary files are based on the 7229object file. If the @option{-o} option is not used, the 7230@option{-save-temps=obj} switch behaves like @option{-save-temps}. 7231 7232For example: 7233 7234@smallexample 7235gcc -save-temps=obj -c foo.c 7236gcc -save-temps=obj -c bar.c -o dir/xbar.o 7237gcc -save-temps=obj foobar.c -o dir2/yfoobar 7238@end smallexample 7239 7240@noindent 7241creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i}, 7242@file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and 7243@file{dir2/yfoobar.o}. 7244 7245@item -time@r{[}=@var{file}@r{]} 7246@opindex time 7247Report the CPU time taken by each subprocess in the compilation 7248sequence. For C source files, this is the compiler proper and assembler 7249(plus the linker if linking is done). 7250 7251Without the specification of an output file, the output looks like this: 7252 7253@smallexample 7254# cc1 0.12 0.01 7255# as 0.00 0.01 7256@end smallexample 7257 7258The first number on each line is the ``user time'', that is time spent 7259executing the program itself. The second number is ``system time'', 7260time spent executing operating system routines on behalf of the program. 7261Both numbers are in seconds. 7262 7263With the specification of an output file, the output is appended to the 7264named file, and it looks like this: 7265 7266@smallexample 72670.12 0.01 cc1 @var{options} 72680.00 0.01 as @var{options} 7269@end smallexample 7270 7271The ``user time'' and the ``system time'' are moved before the program 7272name, and the options passed to the program are displayed, so that one 7273can later tell what file was being compiled, and with which options. 7274 7275@item -fvar-tracking 7276@opindex fvar-tracking 7277Run variable tracking pass. It computes where variables are stored at each 7278position in code. Better debugging information is then generated 7279(if the debugging information format supports this information). 7280 7281It is enabled by default when compiling with optimization (@option{-Os}, 7282@option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and 7283the debug info format supports it. 7284 7285@item -fvar-tracking-assignments 7286@opindex fvar-tracking-assignments 7287@opindex fno-var-tracking-assignments 7288Annotate assignments to user variables early in the compilation and 7289attempt to carry the annotations over throughout the compilation all the 7290way to the end, in an attempt to improve debug information while 7291optimizing. Use of @option{-gdwarf-4} is recommended along with it. 7292 7293It can be enabled even if var-tracking is disabled, in which case 7294annotations are created and maintained, but discarded at the end. 7295By default, this flag is enabled together with @option{-fvar-tracking}, 7296except when selective scheduling is enabled. 7297 7298@item -fvar-tracking-assignments-toggle 7299@opindex fvar-tracking-assignments-toggle 7300@opindex fno-var-tracking-assignments-toggle 7301Toggle @option{-fvar-tracking-assignments}, in the same way that 7302@option{-gtoggle} toggles @option{-g}. 7303 7304@item -print-file-name=@var{library} 7305@opindex print-file-name 7306Print the full absolute name of the library file @var{library} that 7307would be used when linking---and don't do anything else. With this 7308option, GCC does not compile or link anything; it just prints the 7309file name. 7310 7311@item -print-multi-directory 7312@opindex print-multi-directory 7313Print the directory name corresponding to the multilib selected by any 7314other switches present in the command line. This directory is supposed 7315to exist in @env{GCC_EXEC_PREFIX}. 7316 7317@item -print-multi-lib 7318@opindex print-multi-lib 7319Print the mapping from multilib directory names to compiler switches 7320that enable them. The directory name is separated from the switches by 7321@samp{;}, and each switch starts with an @samp{@@} instead of the 7322@samp{-}, without spaces between multiple switches. This is supposed to 7323ease shell processing. 7324 7325@item -print-multi-os-directory 7326@opindex print-multi-os-directory 7327Print the path to OS libraries for the selected 7328multilib, relative to some @file{lib} subdirectory. If OS libraries are 7329present in the @file{lib} subdirectory and no multilibs are used, this is 7330usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}} 7331sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or 7332@file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}} 7333subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}. 7334 7335@item -print-multiarch 7336@opindex print-multiarch 7337Print the path to OS libraries for the selected multiarch, 7338relative to some @file{lib} subdirectory. 7339 7340@item -print-prog-name=@var{program} 7341@opindex print-prog-name 7342Like @option{-print-file-name}, but searches for a program such as @command{cpp}. 7343 7344@item -print-libgcc-file-name 7345@opindex print-libgcc-file-name 7346Same as @option{-print-file-name=libgcc.a}. 7347 7348This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs} 7349but you do want to link with @file{libgcc.a}. You can do: 7350 7351@smallexample 7352gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name` 7353@end smallexample 7354 7355@item -print-search-dirs 7356@opindex print-search-dirs 7357Print the name of the configured installation directory and a list of 7358program and library directories @command{gcc} searches---and don't do anything else. 7359 7360This is useful when @command{gcc} prints the error message 7361@samp{installation problem, cannot exec cpp0: No such file or directory}. 7362To resolve this you either need to put @file{cpp0} and the other compiler 7363components where @command{gcc} expects to find them, or you can set the environment 7364variable @env{GCC_EXEC_PREFIX} to the directory where you installed them. 7365Don't forget the trailing @samp{/}. 7366@xref{Environment Variables}. 7367 7368@item -print-sysroot 7369@opindex print-sysroot 7370Print the target sysroot directory that is used during 7371compilation. This is the target sysroot specified either at configure 7372time or using the @option{--sysroot} option, possibly with an extra 7373suffix that depends on compilation options. If no target sysroot is 7374specified, the option prints nothing. 7375 7376@item -print-sysroot-headers-suffix 7377@opindex print-sysroot-headers-suffix 7378Print the suffix added to the target sysroot when searching for 7379headers, or give an error if the compiler is not configured with such 7380a suffix---and don't do anything else. 7381 7382@item -dumpmachine 7383@opindex dumpmachine 7384Print the compiler's target machine (for example, 7385@samp{i686-pc-linux-gnu})---and don't do anything else. 7386 7387@item -dumpversion 7388@opindex dumpversion 7389Print the compiler version (for example, @code{3.0})---and don't do 7390anything else. 7391 7392@item -dumpspecs 7393@opindex dumpspecs 7394Print the compiler's built-in specs---and don't do anything else. (This 7395is used when GCC itself is being built.) @xref{Spec Files}. 7396 7397@item -fno-eliminate-unused-debug-types 7398@opindex feliminate-unused-debug-types 7399@opindex fno-eliminate-unused-debug-types 7400Normally, when producing DWARF 2 output, GCC avoids producing debug symbol 7401output for types that are nowhere used in the source file being compiled. 7402Sometimes it is useful to have GCC emit debugging 7403information for all types declared in a compilation 7404unit, regardless of whether or not they are actually used 7405in that compilation unit, for example 7406if, in the debugger, you want to cast a value to a type that is 7407not actually used in your program (but is declared). More often, 7408however, this results in a significant amount of wasted space. 7409@end table 7410 7411@node Optimize Options 7412@section Options That Control Optimization 7413@cindex optimize options 7414@cindex options, optimization 7415 7416These options control various sorts of optimizations. 7417 7418Without any optimization option, the compiler's goal is to reduce the 7419cost of compilation and to make debugging produce the expected 7420results. Statements are independent: if you stop the program with a 7421breakpoint between statements, you can then assign a new value to any 7422variable or change the program counter to any other statement in the 7423function and get exactly the results you expect from the source 7424code. 7425 7426Turning on optimization flags makes the compiler attempt to improve 7427the performance and/or code size at the expense of compilation time 7428and possibly the ability to debug the program. 7429 7430The compiler performs optimization based on the knowledge it has of the 7431program. Compiling multiple files at once to a single output file mode allows 7432the compiler to use information gained from all of the files when compiling 7433each of them. 7434 7435Not all optimizations are controlled directly by a flag. Only 7436optimizations that have a flag are listed in this section. 7437 7438Most optimizations are only enabled if an @option{-O} level is set on 7439the command line. Otherwise they are disabled, even if individual 7440optimization flags are specified. 7441 7442Depending on the target and how GCC was configured, a slightly different 7443set of optimizations may be enabled at each @option{-O} level than 7444those listed here. You can invoke GCC with @option{-Q --help=optimizers} 7445to find out the exact set of optimizations that are enabled at each level. 7446@xref{Overall Options}, for examples. 7447 7448@table @gcctabopt 7449@item -O 7450@itemx -O1 7451@opindex O 7452@opindex O1 7453Optimize. Optimizing compilation takes somewhat more time, and a lot 7454more memory for a large function. 7455 7456With @option{-O}, the compiler tries to reduce code size and execution 7457time, without performing any optimizations that take a great deal of 7458compilation time. 7459 7460@option{-O} turns on the following optimization flags: 7461@gccoptlist{ 7462-fauto-inc-dec @gol 7463-fbranch-count-reg @gol 7464-fcombine-stack-adjustments @gol 7465-fcompare-elim @gol 7466-fcprop-registers @gol 7467-fdce @gol 7468-fdefer-pop @gol 7469-fdelayed-branch @gol 7470-fdse @gol 7471-fforward-propagate @gol 7472-fguess-branch-probability @gol 7473-fif-conversion2 @gol 7474-fif-conversion @gol 7475-finline-functions-called-once @gol 7476-fipa-pure-const @gol 7477-fipa-profile @gol 7478-fipa-reference @gol 7479-fmerge-constants @gol 7480-fmove-loop-invariants @gol 7481-fshrink-wrap @gol 7482-fsplit-wide-types @gol 7483-ftree-bit-ccp @gol 7484-ftree-ccp @gol 7485-fssa-phiopt @gol 7486-ftree-ch @gol 7487-ftree-copy-prop @gol 7488-ftree-copyrename @gol 7489-ftree-dce @gol 7490-ftree-dominator-opts @gol 7491-ftree-dse @gol 7492-ftree-forwprop @gol 7493-ftree-fre @gol 7494-ftree-phiprop @gol 7495-ftree-sink @gol 7496-ftree-slsr @gol 7497-ftree-sra @gol 7498-ftree-pta @gol 7499-ftree-ter @gol 7500-funit-at-a-time} 7501 7502@option{-O} also turns on @option{-fomit-frame-pointer} on machines 7503where doing so does not interfere with debugging. 7504 7505@item -O2 7506@opindex O2 7507Optimize even more. GCC performs nearly all supported optimizations 7508that do not involve a space-speed tradeoff. 7509As compared to @option{-O}, this option increases both compilation time 7510and the performance of the generated code. 7511 7512@option{-O2} turns on all optimization flags specified by @option{-O}. It 7513also turns on the following optimization flags: 7514@gccoptlist{-fthread-jumps @gol 7515-falign-functions -falign-jumps @gol 7516-falign-loops -falign-labels @gol 7517-fcaller-saves @gol 7518-fcrossjumping @gol 7519-fcse-follow-jumps -fcse-skip-blocks @gol 7520-fdelete-null-pointer-checks @gol 7521-fdevirtualize -fdevirtualize-speculatively @gol 7522-fexpensive-optimizations @gol 7523-fgcse -fgcse-lm @gol 7524-fhoist-adjacent-loads @gol 7525-finline-small-functions @gol 7526-findirect-inlining @gol 7527-fipa-cp @gol 7528-fipa-cp-alignment @gol 7529-fipa-sra @gol 7530-fipa-icf @gol 7531-fisolate-erroneous-paths-dereference @gol 7532-flra-remat @gol 7533-foptimize-sibling-calls @gol 7534-foptimize-strlen @gol 7535-fpartial-inlining @gol 7536-fpeephole2 @gol 7537-freorder-blocks -freorder-blocks-and-partition -freorder-functions @gol 7538-frerun-cse-after-loop @gol 7539-fsched-interblock -fsched-spec @gol 7540-fschedule-insns -fschedule-insns2 @gol 7541-fstrict-aliasing -fstrict-overflow @gol 7542-ftree-builtin-call-dce @gol 7543-ftree-switch-conversion -ftree-tail-merge @gol 7544-ftree-pre @gol 7545-ftree-vrp @gol 7546-fipa-ra} 7547 7548Please note the warning under @option{-fgcse} about 7549invoking @option{-O2} on programs that use computed gotos. 7550 7551@item -O3 7552@opindex O3 7553Optimize yet more. @option{-O3} turns on all optimizations specified 7554by @option{-O2} and also turns on the @option{-finline-functions}, 7555@option{-funswitch-loops}, @option{-fpredictive-commoning}, 7556@option{-fgcse-after-reload}, @option{-ftree-loop-vectorize}, 7557@option{-ftree-loop-distribute-patterns}, 7558@option{-ftree-slp-vectorize}, @option{-fvect-cost-model}, 7559@option{-ftree-partial-pre} and @option{-fipa-cp-clone} options. 7560 7561@item -O0 7562@opindex O0 7563Reduce compilation time and make debugging produce the expected 7564results. This is the default. 7565 7566@item -Os 7567@opindex Os 7568Optimize for size. @option{-Os} enables all @option{-O2} optimizations that 7569do not typically increase code size. It also performs further 7570optimizations designed to reduce code size. 7571 7572@option{-Os} disables the following optimization flags: 7573@gccoptlist{-falign-functions -falign-jumps -falign-loops @gol 7574-falign-labels -freorder-blocks -freorder-blocks-and-partition @gol 7575-fprefetch-loop-arrays} 7576 7577@item -Ofast 7578@opindex Ofast 7579Disregard strict standards compliance. @option{-Ofast} enables all 7580@option{-O3} optimizations. It also enables optimizations that are not 7581valid for all standard-compliant programs. 7582It turns on @option{-ffast-math} and the Fortran-specific 7583@option{-fno-protect-parens} and @option{-fstack-arrays}. 7584 7585@item -Og 7586@opindex Og 7587Optimize debugging experience. @option{-Og} enables optimizations 7588that do not interfere with debugging. It should be the optimization 7589level of choice for the standard edit-compile-debug cycle, offering 7590a reasonable level of optimization while maintaining fast compilation 7591and a good debugging experience. 7592 7593If you use multiple @option{-O} options, with or without level numbers, 7594the last such option is the one that is effective. 7595@end table 7596 7597Options of the form @option{-f@var{flag}} specify machine-independent 7598flags. Most flags have both positive and negative forms; the negative 7599form of @option{-ffoo} is @option{-fno-foo}. In the table 7600below, only one of the forms is listed---the one you typically 7601use. You can figure out the other form by either removing @samp{no-} 7602or adding it. 7603 7604The following options control specific optimizations. They are either 7605activated by @option{-O} options or are related to ones that are. You 7606can use the following flags in the rare cases when ``fine-tuning'' of 7607optimizations to be performed is desired. 7608 7609@table @gcctabopt 7610@item -fno-defer-pop 7611@opindex fno-defer-pop 7612Always pop the arguments to each function call as soon as that function 7613returns. For machines that must pop arguments after a function call, 7614the compiler normally lets arguments accumulate on the stack for several 7615function calls and pops them all at once. 7616 7617Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 7618 7619@item -fforward-propagate 7620@opindex fforward-propagate 7621Perform a forward propagation pass on RTL@. The pass tries to combine two 7622instructions and checks if the result can be simplified. If loop unrolling 7623is active, two passes are performed and the second is scheduled after 7624loop unrolling. 7625 7626This option is enabled by default at optimization levels @option{-O}, 7627@option{-O2}, @option{-O3}, @option{-Os}. 7628 7629@item -ffp-contract=@var{style} 7630@opindex ffp-contract 7631@option{-ffp-contract=off} disables floating-point expression contraction. 7632@option{-ffp-contract=fast} enables floating-point expression contraction 7633such as forming of fused multiply-add operations if the target has 7634native support for them. 7635@option{-ffp-contract=on} enables floating-point expression contraction 7636if allowed by the language standard. This is currently not implemented 7637and treated equal to @option{-ffp-contract=off}. 7638 7639The default is @option{-ffp-contract=fast}. 7640 7641@item -fomit-frame-pointer 7642@opindex fomit-frame-pointer 7643Don't keep the frame pointer in a register for functions that 7644don't need one. This avoids the instructions to save, set up and 7645restore frame pointers; it also makes an extra register available 7646in many functions. @strong{It also makes debugging impossible on 7647some machines.} 7648 7649On some machines, such as the VAX, this flag has no effect, because 7650the standard calling sequence automatically handles the frame pointer 7651and nothing is saved by pretending it doesn't exist. The 7652machine-description macro @code{FRAME_POINTER_REQUIRED} controls 7653whether a target machine supports this flag. @xref{Registers,,Register 7654Usage, gccint, GNU Compiler Collection (GCC) Internals}. 7655 7656The default setting (when not optimizing for 7657size) for 32-bit GNU/Linux x86 and 32-bit Darwin x86 targets is 7658@option{-fomit-frame-pointer}. You can configure GCC with the 7659@option{--enable-frame-pointer} configure option to change the default. 7660 7661Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 7662 7663@item -foptimize-sibling-calls 7664@opindex foptimize-sibling-calls 7665Optimize sibling and tail recursive calls. 7666 7667Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 7668 7669@item -foptimize-strlen 7670@opindex foptimize-strlen 7671Optimize various standard C string functions (e.g. @code{strlen}, 7672@code{strchr} or @code{strcpy}) and 7673their @code{_FORTIFY_SOURCE} counterparts into faster alternatives. 7674 7675Enabled at levels @option{-O2}, @option{-O3}. 7676 7677@item -fno-inline 7678@opindex fno-inline 7679Do not expand any functions inline apart from those marked with 7680the @code{always_inline} attribute. This is the default when not 7681optimizing. 7682 7683Single functions can be exempted from inlining by marking them 7684with the @code{noinline} attribute. 7685 7686@item -finline-small-functions 7687@opindex finline-small-functions 7688Integrate functions into their callers when their body is smaller than expected 7689function call code (so overall size of program gets smaller). The compiler 7690heuristically decides which functions are simple enough to be worth integrating 7691in this way. This inlining applies to all functions, even those not declared 7692inline. 7693 7694Enabled at level @option{-O2}. 7695 7696@item -findirect-inlining 7697@opindex findirect-inlining 7698Inline also indirect calls that are discovered to be known at compile 7699time thanks to previous inlining. This option has any effect only 7700when inlining itself is turned on by the @option{-finline-functions} 7701or @option{-finline-small-functions} options. 7702 7703Enabled at level @option{-O2}. 7704 7705@item -finline-functions 7706@opindex finline-functions 7707Consider all functions for inlining, even if they are not declared inline. 7708The compiler heuristically decides which functions are worth integrating 7709in this way. 7710 7711If all calls to a given function are integrated, and the function is 7712declared @code{static}, then the function is normally not output as 7713assembler code in its own right. 7714 7715Enabled at level @option{-O3}. 7716 7717@item -finline-functions-called-once 7718@opindex finline-functions-called-once 7719Consider all @code{static} functions called once for inlining into their 7720caller even if they are not marked @code{inline}. If a call to a given 7721function is integrated, then the function is not output as assembler code 7722in its own right. 7723 7724Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}. 7725 7726@item -fearly-inlining 7727@opindex fearly-inlining 7728Inline functions marked by @code{always_inline} and functions whose body seems 7729smaller than the function call overhead early before doing 7730@option{-fprofile-generate} instrumentation and real inlining pass. Doing so 7731makes profiling significantly cheaper and usually inlining faster on programs 7732having large chains of nested wrapper functions. 7733 7734Enabled by default. 7735 7736@item -fipa-sra 7737@opindex fipa-sra 7738Perform interprocedural scalar replacement of aggregates, removal of 7739unused parameters and replacement of parameters passed by reference 7740by parameters passed by value. 7741 7742Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}. 7743 7744@item -finline-limit=@var{n} 7745@opindex finline-limit 7746By default, GCC limits the size of functions that can be inlined. This flag 7747allows coarse control of this limit. @var{n} is the size of functions that 7748can be inlined in number of pseudo instructions. 7749 7750Inlining is actually controlled by a number of parameters, which may be 7751specified individually by using @option{--param @var{name}=@var{value}}. 7752The @option{-finline-limit=@var{n}} option sets some of these parameters 7753as follows: 7754 7755@table @gcctabopt 7756@item max-inline-insns-single 7757is set to @var{n}/2. 7758@item max-inline-insns-auto 7759is set to @var{n}/2. 7760@end table 7761 7762See below for a documentation of the individual 7763parameters controlling inlining and for the defaults of these parameters. 7764 7765@emph{Note:} there may be no value to @option{-finline-limit} that results 7766in default behavior. 7767 7768@emph{Note:} pseudo instruction represents, in this particular context, an 7769abstract measurement of function's size. In no way does it represent a count 7770of assembly instructions and as such its exact meaning might change from one 7771release to an another. 7772 7773@item -fno-keep-inline-dllexport 7774@opindex fno-keep-inline-dllexport 7775This is a more fine-grained version of @option{-fkeep-inline-functions}, 7776which applies only to functions that are declared using the @code{dllexport} 7777attribute or declspec (@xref{Function Attributes,,Declaring Attributes of 7778Functions}.) 7779 7780@item -fkeep-inline-functions 7781@opindex fkeep-inline-functions 7782In C, emit @code{static} functions that are declared @code{inline} 7783into the object file, even if the function has been inlined into all 7784of its callers. This switch does not affect functions using the 7785@code{extern inline} extension in GNU C90@. In C++, emit any and all 7786inline functions into the object file. 7787 7788@item -fkeep-static-consts 7789@opindex fkeep-static-consts 7790Emit variables declared @code{static const} when optimization isn't turned 7791on, even if the variables aren't referenced. 7792 7793GCC enables this option by default. If you want to force the compiler to 7794check if a variable is referenced, regardless of whether or not 7795optimization is turned on, use the @option{-fno-keep-static-consts} option. 7796 7797@item -fmerge-constants 7798@opindex fmerge-constants 7799Attempt to merge identical constants (string constants and floating-point 7800constants) across compilation units. 7801 7802This option is the default for optimized compilation if the assembler and 7803linker support it. Use @option{-fno-merge-constants} to inhibit this 7804behavior. 7805 7806Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 7807 7808@item -fmerge-all-constants 7809@opindex fmerge-all-constants 7810Attempt to merge identical constants and identical variables. 7811 7812This option implies @option{-fmerge-constants}. In addition to 7813@option{-fmerge-constants} this considers e.g.@: even constant initialized 7814arrays or initialized constant variables with integral or floating-point 7815types. Languages like C or C++ require each variable, including multiple 7816instances of the same variable in recursive calls, to have distinct locations, 7817so using this option results in non-conforming 7818behavior. 7819 7820@item -fmodulo-sched 7821@opindex fmodulo-sched 7822Perform swing modulo scheduling immediately before the first scheduling 7823pass. This pass looks at innermost loops and reorders their 7824instructions by overlapping different iterations. 7825 7826@item -fmodulo-sched-allow-regmoves 7827@opindex fmodulo-sched-allow-regmoves 7828Perform more aggressive SMS-based modulo scheduling with register moves 7829allowed. By setting this flag certain anti-dependences edges are 7830deleted, which triggers the generation of reg-moves based on the 7831life-range analysis. This option is effective only with 7832@option{-fmodulo-sched} enabled. 7833 7834@item -fno-branch-count-reg 7835@opindex fno-branch-count-reg 7836Do not use ``decrement and branch'' instructions on a count register, 7837but instead generate a sequence of instructions that decrement a 7838register, compare it against zero, then branch based upon the result. 7839This option is only meaningful on architectures that support such 7840instructions, which include x86, PowerPC, IA-64 and S/390. 7841 7842Enabled by default at @option{-O1} and higher. 7843 7844The default is @option{-fbranch-count-reg}. 7845 7846@item -fno-function-cse 7847@opindex fno-function-cse 7848Do not put function addresses in registers; make each instruction that 7849calls a constant function contain the function's address explicitly. 7850 7851This option results in less efficient code, but some strange hacks 7852that alter the assembler output may be confused by the optimizations 7853performed when this option is not used. 7854 7855The default is @option{-ffunction-cse} 7856 7857@item -fno-zero-initialized-in-bss 7858@opindex fno-zero-initialized-in-bss 7859If the target supports a BSS section, GCC by default puts variables that 7860are initialized to zero into BSS@. This can save space in the resulting 7861code. 7862 7863This option turns off this behavior because some programs explicitly 7864rely on variables going to the data section---e.g., so that the 7865resulting executable can find the beginning of that section and/or make 7866assumptions based on that. 7867 7868The default is @option{-fzero-initialized-in-bss}. 7869 7870@item -fthread-jumps 7871@opindex fthread-jumps 7872Perform optimizations that check to see if a jump branches to a 7873location where another comparison subsumed by the first is found. If 7874so, the first branch is redirected to either the destination of the 7875second branch or a point immediately following it, depending on whether 7876the condition is known to be true or false. 7877 7878Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 7879 7880@item -fsplit-wide-types 7881@opindex fsplit-wide-types 7882When using a type that occupies multiple registers, such as @code{long 7883long} on a 32-bit system, split the registers apart and allocate them 7884independently. This normally generates better code for those types, 7885but may make debugging more difficult. 7886 7887Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, 7888@option{-Os}. 7889 7890@item -fcse-follow-jumps 7891@opindex fcse-follow-jumps 7892In common subexpression elimination (CSE), scan through jump instructions 7893when the target of the jump is not reached by any other path. For 7894example, when CSE encounters an @code{if} statement with an 7895@code{else} clause, CSE follows the jump when the condition 7896tested is false. 7897 7898Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 7899 7900@item -fcse-skip-blocks 7901@opindex fcse-skip-blocks 7902This is similar to @option{-fcse-follow-jumps}, but causes CSE to 7903follow jumps that conditionally skip over blocks. When CSE 7904encounters a simple @code{if} statement with no else clause, 7905@option{-fcse-skip-blocks} causes CSE to follow the jump around the 7906body of the @code{if}. 7907 7908Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 7909 7910@item -frerun-cse-after-loop 7911@opindex frerun-cse-after-loop 7912Re-run common subexpression elimination after loop optimizations are 7913performed. 7914 7915Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 7916 7917@item -fgcse 7918@opindex fgcse 7919Perform a global common subexpression elimination pass. 7920This pass also performs global constant and copy propagation. 7921 7922@emph{Note:} When compiling a program using computed gotos, a GCC 7923extension, you may get better run-time performance if you disable 7924the global common subexpression elimination pass by adding 7925@option{-fno-gcse} to the command line. 7926 7927Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 7928 7929@item -fgcse-lm 7930@opindex fgcse-lm 7931When @option{-fgcse-lm} is enabled, global common subexpression elimination 7932attempts to move loads that are only killed by stores into themselves. This 7933allows a loop containing a load/store sequence to be changed to a load outside 7934the loop, and a copy/store within the loop. 7935 7936Enabled by default when @option{-fgcse} is enabled. 7937 7938@item -fgcse-sm 7939@opindex fgcse-sm 7940When @option{-fgcse-sm} is enabled, a store motion pass is run after 7941global common subexpression elimination. This pass attempts to move 7942stores out of loops. When used in conjunction with @option{-fgcse-lm}, 7943loops containing a load/store sequence can be changed to a load before 7944the loop and a store after the loop. 7945 7946Not enabled at any optimization level. 7947 7948@item -fgcse-las 7949@opindex fgcse-las 7950When @option{-fgcse-las} is enabled, the global common subexpression 7951elimination pass eliminates redundant loads that come after stores to the 7952same memory location (both partial and full redundancies). 7953 7954Not enabled at any optimization level. 7955 7956@item -fgcse-after-reload 7957@opindex fgcse-after-reload 7958When @option{-fgcse-after-reload} is enabled, a redundant load elimination 7959pass is performed after reload. The purpose of this pass is to clean up 7960redundant spilling. 7961 7962@item -faggressive-loop-optimizations 7963@opindex faggressive-loop-optimizations 7964This option tells the loop optimizer to use language constraints to 7965derive bounds for the number of iterations of a loop. This assumes that 7966loop code does not invoke undefined behavior by for example causing signed 7967integer overflows or out-of-bound array accesses. The bounds for the 7968number of iterations of a loop are used to guide loop unrolling and peeling 7969and loop exit test optimizations. 7970This option is enabled by default. 7971 7972@item -funsafe-loop-optimizations 7973@opindex funsafe-loop-optimizations 7974This option tells the loop optimizer to assume that loop indices do not 7975overflow, and that loops with nontrivial exit condition are not 7976infinite. This enables a wider range of loop optimizations even if 7977the loop optimizer itself cannot prove that these assumptions are valid. 7978If you use @option{-Wunsafe-loop-optimizations}, the compiler warns you 7979if it finds this kind of loop. 7980 7981@item -fcrossjumping 7982@opindex fcrossjumping 7983Perform cross-jumping transformation. 7984This transformation unifies equivalent code and saves code size. The 7985resulting code may or may not perform better than without cross-jumping. 7986 7987Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 7988 7989@item -fauto-inc-dec 7990@opindex fauto-inc-dec 7991Combine increments or decrements of addresses with memory accesses. 7992This pass is always skipped on architectures that do not have 7993instructions to support this. Enabled by default at @option{-O} and 7994higher on architectures that support this. 7995 7996@item -fdce 7997@opindex fdce 7998Perform dead code elimination (DCE) on RTL@. 7999Enabled by default at @option{-O} and higher. 8000 8001@item -fdse 8002@opindex fdse 8003Perform dead store elimination (DSE) on RTL@. 8004Enabled by default at @option{-O} and higher. 8005 8006@item -fif-conversion 8007@opindex fif-conversion 8008Attempt to transform conditional jumps into branch-less equivalents. This 8009includes use of conditional moves, min, max, set flags and abs instructions, and 8010some tricks doable by standard arithmetics. The use of conditional execution 8011on chips where it is available is controlled by @option{-fif-conversion2}. 8012 8013Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 8014 8015@item -fif-conversion2 8016@opindex fif-conversion2 8017Use conditional execution (where available) to transform conditional jumps into 8018branch-less equivalents. 8019 8020Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 8021 8022@item -fdeclone-ctor-dtor 8023@opindex fdeclone-ctor-dtor 8024The C++ ABI requires multiple entry points for constructors and 8025destructors: one for a base subobject, one for a complete object, and 8026one for a virtual destructor that calls operator delete afterwards. 8027For a hierarchy with virtual bases, the base and complete variants are 8028clones, which means two copies of the function. With this option, the 8029base and complete variants are changed to be thunks that call a common 8030implementation. 8031 8032Enabled by @option{-Os}. 8033 8034@item -fdelete-null-pointer-checks 8035@opindex fdelete-null-pointer-checks 8036Assume that programs cannot safely dereference null pointers, and that 8037no code or data element resides there. This enables simple constant 8038folding optimizations at all optimization levels. In addition, other 8039optimization passes in GCC use this flag to control global dataflow 8040analyses that eliminate useless checks for null pointers; these assume 8041that if a pointer is checked after it has already been dereferenced, 8042it cannot be null. 8043 8044Note however that in some environments this assumption is not true. 8045Use @option{-fno-delete-null-pointer-checks} to disable this optimization 8046for programs that depend on that behavior. 8047 8048Some targets, especially embedded ones, disable this option at all levels. 8049Otherwise it is enabled at all levels: @option{-O0}, @option{-O1}, 8050@option{-O2}, @option{-O3}, @option{-Os}. Passes that use the information 8051are enabled independently at different optimization levels. 8052 8053@item -fdevirtualize 8054@opindex fdevirtualize 8055Attempt to convert calls to virtual functions to direct calls. This 8056is done both within a procedure and interprocedurally as part of 8057indirect inlining (@option{-findirect-inlining}) and interprocedural constant 8058propagation (@option{-fipa-cp}). 8059Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8060 8061@item -fdevirtualize-speculatively 8062@opindex fdevirtualize-speculatively 8063Attempt to convert calls to virtual functions to speculative direct calls. 8064Based on the analysis of the type inheritance graph, determine for a given call 8065the set of likely targets. If the set is small, preferably of size 1, change 8066the call into a conditional deciding between direct and indirect calls. The 8067speculative calls enable more optimizations, such as inlining. When they seem 8068useless after further optimization, they are converted back into original form. 8069 8070@item -fdevirtualize-at-ltrans 8071@opindex fdevirtualize-at-ltrans 8072Stream extra information needed for aggressive devirtualization when running 8073the link-time optimizer in local transformation mode. 8074This option enables more devirtualization but 8075significantly increases the size of streamed data. For this reason it is 8076disabled by default. 8077 8078@item -fexpensive-optimizations 8079@opindex fexpensive-optimizations 8080Perform a number of minor optimizations that are relatively expensive. 8081 8082Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8083 8084@item -free 8085@opindex free 8086Attempt to remove redundant extension instructions. This is especially 8087helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit 8088registers after writing to their lower 32-bit half. 8089 8090Enabled for Alpha, AArch64 and x86 at levels @option{-O2}, 8091@option{-O3}, @option{-Os}. 8092 8093@item -fno-lifetime-dse 8094@opindex fno-lifetime-dse 8095In C++ the value of an object is only affected by changes within its 8096lifetime: when the constructor begins, the object has an indeterminate 8097value, and any changes during the lifetime of the object are dead when 8098the object is destroyed. Normally dead store elimination will take 8099advantage of this; if your code relies on the value of the object 8100storage persisting beyond the lifetime of the object, you can use this 8101flag to disable this optimization. 8102 8103@item -flive-range-shrinkage 8104@opindex flive-range-shrinkage 8105Attempt to decrease register pressure through register live range 8106shrinkage. This is helpful for fast processors with small or moderate 8107size register sets. 8108 8109@item -fira-algorithm=@var{algorithm} 8110@opindex fira-algorithm 8111Use the specified coloring algorithm for the integrated register 8112allocator. The @var{algorithm} argument can be @samp{priority}, which 8113specifies Chow's priority coloring, or @samp{CB}, which specifies 8114Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented 8115for all architectures, but for those targets that do support it, it is 8116the default because it generates better code. 8117 8118@item -fira-region=@var{region} 8119@opindex fira-region 8120Use specified regions for the integrated register allocator. The 8121@var{region} argument should be one of the following: 8122 8123@table @samp 8124 8125@item all 8126Use all loops as register allocation regions. 8127This can give the best results for machines with a small and/or 8128irregular register set. 8129 8130@item mixed 8131Use all loops except for loops with small register pressure 8132as the regions. This value usually gives 8133the best results in most cases and for most architectures, 8134and is enabled by default when compiling with optimization for speed 8135(@option{-O}, @option{-O2}, @dots{}). 8136 8137@item one 8138Use all functions as a single region. 8139This typically results in the smallest code size, and is enabled by default for 8140@option{-Os} or @option{-O0}. 8141 8142@end table 8143 8144@item -fira-hoist-pressure 8145@opindex fira-hoist-pressure 8146Use IRA to evaluate register pressure in the code hoisting pass for 8147decisions to hoist expressions. This option usually results in smaller 8148code, but it can slow the compiler down. 8149 8150This option is enabled at level @option{-Os} for all targets. 8151 8152@item -fira-loop-pressure 8153@opindex fira-loop-pressure 8154Use IRA to evaluate register pressure in loops for decisions to move 8155loop invariants. This option usually results in generation 8156of faster and smaller code on machines with large register files (>= 32 8157registers), but it can slow the compiler down. 8158 8159This option is enabled at level @option{-O3} for some targets. 8160 8161@item -fno-ira-share-save-slots 8162@opindex fno-ira-share-save-slots 8163Disable sharing of stack slots used for saving call-used hard 8164registers living through a call. Each hard register gets a 8165separate stack slot, and as a result function stack frames are 8166larger. 8167 8168@item -fno-ira-share-spill-slots 8169@opindex fno-ira-share-spill-slots 8170Disable sharing of stack slots allocated for pseudo-registers. Each 8171pseudo-register that does not get a hard register gets a separate 8172stack slot, and as a result function stack frames are larger. 8173 8174@item -fira-verbose=@var{n} 8175@opindex fira-verbose 8176Control the verbosity of the dump file for the integrated register allocator. 8177The default value is 5. If the value @var{n} is greater or equal to 10, 8178the dump output is sent to stderr using the same format as @var{n} minus 10. 8179 8180@item -flra-remat 8181@opindex flra-remat 8182Enable CFG-sensitive rematerialization in LRA. Instead of loading 8183values of spilled pseudos, LRA tries to rematerialize (recalculate) 8184values if it is profitable. 8185 8186Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8187 8188@item -fdelayed-branch 8189@opindex fdelayed-branch 8190If supported for the target machine, attempt to reorder instructions 8191to exploit instruction slots available after delayed branch 8192instructions. 8193 8194Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 8195 8196@item -fschedule-insns 8197@opindex fschedule-insns 8198If supported for the target machine, attempt to reorder instructions to 8199eliminate execution stalls due to required data being unavailable. This 8200helps machines that have slow floating point or memory load instructions 8201by allowing other instructions to be issued until the result of the load 8202or floating-point instruction is required. 8203 8204Enabled at levels @option{-O2}, @option{-O3}. 8205 8206@item -fschedule-insns2 8207@opindex fschedule-insns2 8208Similar to @option{-fschedule-insns}, but requests an additional pass of 8209instruction scheduling after register allocation has been done. This is 8210especially useful on machines with a relatively small number of 8211registers and where memory load instructions take more than one cycle. 8212 8213Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8214 8215@item -fno-sched-interblock 8216@opindex fno-sched-interblock 8217Don't schedule instructions across basic blocks. This is normally 8218enabled by default when scheduling before register allocation, i.e.@: 8219with @option{-fschedule-insns} or at @option{-O2} or higher. 8220 8221@item -fno-sched-spec 8222@opindex fno-sched-spec 8223Don't allow speculative motion of non-load instructions. This is normally 8224enabled by default when scheduling before register allocation, i.e.@: 8225with @option{-fschedule-insns} or at @option{-O2} or higher. 8226 8227@item -fsched-pressure 8228@opindex fsched-pressure 8229Enable register pressure sensitive insn scheduling before register 8230allocation. This only makes sense when scheduling before register 8231allocation is enabled, i.e.@: with @option{-fschedule-insns} or at 8232@option{-O2} or higher. Usage of this option can improve the 8233generated code and decrease its size by preventing register pressure 8234increase above the number of available hard registers and subsequent 8235spills in register allocation. 8236 8237@item -fsched-spec-load 8238@opindex fsched-spec-load 8239Allow speculative motion of some load instructions. This only makes 8240sense when scheduling before register allocation, i.e.@: with 8241@option{-fschedule-insns} or at @option{-O2} or higher. 8242 8243@item -fsched-spec-load-dangerous 8244@opindex fsched-spec-load-dangerous 8245Allow speculative motion of more load instructions. This only makes 8246sense when scheduling before register allocation, i.e.@: with 8247@option{-fschedule-insns} or at @option{-O2} or higher. 8248 8249@item -fsched-stalled-insns 8250@itemx -fsched-stalled-insns=@var{n} 8251@opindex fsched-stalled-insns 8252Define how many insns (if any) can be moved prematurely from the queue 8253of stalled insns into the ready list during the second scheduling pass. 8254@option{-fno-sched-stalled-insns} means that no insns are moved 8255prematurely, @option{-fsched-stalled-insns=0} means there is no limit 8256on how many queued insns can be moved prematurely. 8257@option{-fsched-stalled-insns} without a value is equivalent to 8258@option{-fsched-stalled-insns=1}. 8259 8260@item -fsched-stalled-insns-dep 8261@itemx -fsched-stalled-insns-dep=@var{n} 8262@opindex fsched-stalled-insns-dep 8263Define how many insn groups (cycles) are examined for a dependency 8264on a stalled insn that is a candidate for premature removal from the queue 8265of stalled insns. This has an effect only during the second scheduling pass, 8266and only if @option{-fsched-stalled-insns} is used. 8267@option{-fno-sched-stalled-insns-dep} is equivalent to 8268@option{-fsched-stalled-insns-dep=0}. 8269@option{-fsched-stalled-insns-dep} without a value is equivalent to 8270@option{-fsched-stalled-insns-dep=1}. 8271 8272@item -fsched2-use-superblocks 8273@opindex fsched2-use-superblocks 8274When scheduling after register allocation, use superblock scheduling. 8275This allows motion across basic block boundaries, 8276resulting in faster schedules. This option is experimental, as not all machine 8277descriptions used by GCC model the CPU closely enough to avoid unreliable 8278results from the algorithm. 8279 8280This only makes sense when scheduling after register allocation, i.e.@: with 8281@option{-fschedule-insns2} or at @option{-O2} or higher. 8282 8283@item -fsched-group-heuristic 8284@opindex fsched-group-heuristic 8285Enable the group heuristic in the scheduler. This heuristic favors 8286the instruction that belongs to a schedule group. This is enabled 8287by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns} 8288or @option{-fschedule-insns2} or at @option{-O2} or higher. 8289 8290@item -fsched-critical-path-heuristic 8291@opindex fsched-critical-path-heuristic 8292Enable the critical-path heuristic in the scheduler. This heuristic favors 8293instructions on the critical path. This is enabled by default when 8294scheduling is enabled, i.e.@: with @option{-fschedule-insns} 8295or @option{-fschedule-insns2} or at @option{-O2} or higher. 8296 8297@item -fsched-spec-insn-heuristic 8298@opindex fsched-spec-insn-heuristic 8299Enable the speculative instruction heuristic in the scheduler. This 8300heuristic favors speculative instructions with greater dependency weakness. 8301This is enabled by default when scheduling is enabled, i.e.@: 8302with @option{-fschedule-insns} or @option{-fschedule-insns2} 8303or at @option{-O2} or higher. 8304 8305@item -fsched-rank-heuristic 8306@opindex fsched-rank-heuristic 8307Enable the rank heuristic in the scheduler. This heuristic favors 8308the instruction belonging to a basic block with greater size or frequency. 8309This is enabled by default when scheduling is enabled, i.e.@: 8310with @option{-fschedule-insns} or @option{-fschedule-insns2} or 8311at @option{-O2} or higher. 8312 8313@item -fsched-last-insn-heuristic 8314@opindex fsched-last-insn-heuristic 8315Enable the last-instruction heuristic in the scheduler. This heuristic 8316favors the instruction that is less dependent on the last instruction 8317scheduled. This is enabled by default when scheduling is enabled, 8318i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or 8319at @option{-O2} or higher. 8320 8321@item -fsched-dep-count-heuristic 8322@opindex fsched-dep-count-heuristic 8323Enable the dependent-count heuristic in the scheduler. This heuristic 8324favors the instruction that has more instructions depending on it. 8325This is enabled by default when scheduling is enabled, i.e.@: 8326with @option{-fschedule-insns} or @option{-fschedule-insns2} or 8327at @option{-O2} or higher. 8328 8329@item -freschedule-modulo-scheduled-loops 8330@opindex freschedule-modulo-scheduled-loops 8331Modulo scheduling is performed before traditional scheduling. If a loop 8332is modulo scheduled, later scheduling passes may change its schedule. 8333Use this option to control that behavior. 8334 8335@item -fselective-scheduling 8336@opindex fselective-scheduling 8337Schedule instructions using selective scheduling algorithm. Selective 8338scheduling runs instead of the first scheduler pass. 8339 8340@item -fselective-scheduling2 8341@opindex fselective-scheduling2 8342Schedule instructions using selective scheduling algorithm. Selective 8343scheduling runs instead of the second scheduler pass. 8344 8345@item -fsel-sched-pipelining 8346@opindex fsel-sched-pipelining 8347Enable software pipelining of innermost loops during selective scheduling. 8348This option has no effect unless one of @option{-fselective-scheduling} or 8349@option{-fselective-scheduling2} is turned on. 8350 8351@item -fsel-sched-pipelining-outer-loops 8352@opindex fsel-sched-pipelining-outer-loops 8353When pipelining loops during selective scheduling, also pipeline outer loops. 8354This option has no effect unless @option{-fsel-sched-pipelining} is turned on. 8355 8356@item -fsemantic-interposition 8357@opindex fsemantic-interposition 8358Some object formats, like ELF, allow interposing of symbols by the 8359dynamic linker. 8360This means that for symbols exported from the DSO, the compiler cannot perform 8361interprocedural propagation, inlining and other optimizations in anticipation 8362that the function or variable in question may change. While this feature is 8363useful, for example, to rewrite memory allocation functions by a debugging 8364implementation, it is expensive in the terms of code quality. 8365With @option{-fno-semantic-interposition} the compiler assumes that 8366if interposition happens for functions the overwriting function will have 8367precisely the same semantics (and side effects). 8368Similarly if interposition happens 8369for variables, the constructor of the variable will be the same. The flag 8370has no effect for functions explicitly declared inline 8371(where it is never allowed for interposition to change semantics) 8372and for symbols explicitly declared weak. 8373 8374@item -fshrink-wrap 8375@opindex fshrink-wrap 8376Emit function prologues only before parts of the function that need it, 8377rather than at the top of the function. This flag is enabled by default at 8378@option{-O} and higher. 8379 8380@item -fcaller-saves 8381@opindex fcaller-saves 8382Enable allocation of values to registers that are clobbered by 8383function calls, by emitting extra instructions to save and restore the 8384registers around such calls. Such allocation is done only when it 8385seems to result in better code. 8386 8387This option is always enabled by default on certain machines, usually 8388those which have no call-preserved registers to use instead. 8389 8390Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8391 8392@item -fcombine-stack-adjustments 8393@opindex fcombine-stack-adjustments 8394Tracks stack adjustments (pushes and pops) and stack memory references 8395and then tries to find ways to combine them. 8396 8397Enabled by default at @option{-O1} and higher. 8398 8399@item -fipa-ra 8400@opindex fipa-ra 8401Use caller save registers for allocation if those registers are not used by 8402any called function. In that case it is not necessary to save and restore 8403them around calls. This is only possible if called functions are part of 8404same compilation unit as current function and they are compiled before it. 8405 8406Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 8407 8408@item -fconserve-stack 8409@opindex fconserve-stack 8410Attempt to minimize stack usage. The compiler attempts to use less 8411stack space, even if that makes the program slower. This option 8412implies setting the @option{large-stack-frame} parameter to 100 8413and the @option{large-stack-frame-growth} parameter to 400. 8414 8415@item -ftree-reassoc 8416@opindex ftree-reassoc 8417Perform reassociation on trees. This flag is enabled by default 8418at @option{-O} and higher. 8419 8420@item -ftree-pre 8421@opindex ftree-pre 8422Perform partial redundancy elimination (PRE) on trees. This flag is 8423enabled by default at @option{-O2} and @option{-O3}. 8424 8425@item -ftree-partial-pre 8426@opindex ftree-partial-pre 8427Make partial redundancy elimination (PRE) more aggressive. This flag is 8428enabled by default at @option{-O3}. 8429 8430@item -ftree-forwprop 8431@opindex ftree-forwprop 8432Perform forward propagation on trees. This flag is enabled by default 8433at @option{-O} and higher. 8434 8435@item -ftree-fre 8436@opindex ftree-fre 8437Perform full redundancy elimination (FRE) on trees. The difference 8438between FRE and PRE is that FRE only considers expressions 8439that are computed on all paths leading to the redundant computation. 8440This analysis is faster than PRE, though it exposes fewer redundancies. 8441This flag is enabled by default at @option{-O} and higher. 8442 8443@item -ftree-phiprop 8444@opindex ftree-phiprop 8445Perform hoisting of loads from conditional pointers on trees. This 8446pass is enabled by default at @option{-O} and higher. 8447 8448@item -fhoist-adjacent-loads 8449@opindex fhoist-adjacent-loads 8450Speculatively hoist loads from both branches of an if-then-else if the 8451loads are from adjacent locations in the same structure and the target 8452architecture has a conditional move instruction. This flag is enabled 8453by default at @option{-O2} and higher. 8454 8455@item -ftree-copy-prop 8456@opindex ftree-copy-prop 8457Perform copy propagation on trees. This pass eliminates unnecessary 8458copy operations. This flag is enabled by default at @option{-O} and 8459higher. 8460 8461@item -fipa-pure-const 8462@opindex fipa-pure-const 8463Discover which functions are pure or constant. 8464Enabled by default at @option{-O} and higher. 8465 8466@item -fipa-reference 8467@opindex fipa-reference 8468Discover which static variables do not escape the 8469compilation unit. 8470Enabled by default at @option{-O} and higher. 8471 8472@item -fipa-pta 8473@opindex fipa-pta 8474Perform interprocedural pointer analysis and interprocedural modification 8475and reference analysis. This option can cause excessive memory and 8476compile-time usage on large compilation units. It is not enabled by 8477default at any optimization level. 8478 8479@item -fipa-profile 8480@opindex fipa-profile 8481Perform interprocedural profile propagation. The functions called only from 8482cold functions are marked as cold. Also functions executed once (such as 8483@code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold 8484functions and loop less parts of functions executed once are then optimized for 8485size. 8486Enabled by default at @option{-O} and higher. 8487 8488@item -fipa-cp 8489@opindex fipa-cp 8490Perform interprocedural constant propagation. 8491This optimization analyzes the program to determine when values passed 8492to functions are constants and then optimizes accordingly. 8493This optimization can substantially increase performance 8494if the application has constants passed to functions. 8495This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}. 8496 8497@item -fipa-cp-clone 8498@opindex fipa-cp-clone 8499Perform function cloning to make interprocedural constant propagation stronger. 8500When enabled, interprocedural constant propagation performs function cloning 8501when externally visible function can be called with constant arguments. 8502Because this optimization can create multiple copies of functions, 8503it may significantly increase code size 8504(see @option{--param ipcp-unit-growth=@var{value}}). 8505This flag is enabled by default at @option{-O3}. 8506 8507@item -fipa-cp-alignment 8508@opindex -fipa-cp-alignment 8509When enabled, this optimization propagates alignment of function 8510parameters to support better vectorization and string operations. 8511 8512This flag is enabled by default at @option{-O2} and @option{-Os}. It 8513requires that @option{-fipa-cp} is enabled. 8514 8515@item -fipa-icf 8516@opindex fipa-icf 8517Perform Identical Code Folding for functions and read-only variables. 8518The optimization reduces code size and may disturb unwind stacks by replacing 8519a function by equivalent one with a different name. The optimization works 8520more effectively with link time optimization enabled. 8521 8522Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF 8523works on different levels and thus the optimizations are not same - there are 8524equivalences that are found only by GCC and equivalences found only by Gold. 8525 8526This flag is enabled by default at @option{-O2} and @option{-Os}. 8527 8528@item -fisolate-erroneous-paths-dereference 8529@opindex fisolate-erroneous-paths-dereference 8530Detect paths that trigger erroneous or undefined behavior due to 8531dereferencing a null pointer. Isolate those paths from the main control 8532flow and turn the statement with erroneous or undefined behavior into a trap. 8533This flag is enabled by default at @option{-O2} and higher. 8534 8535@item -fisolate-erroneous-paths-attribute 8536@opindex fisolate-erroneous-paths-attribute 8537Detect paths that trigger erroneous or undefined behavior due a null value 8538being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull} 8539attribute. Isolate those paths from the main control flow and turn the 8540statement with erroneous or undefined behavior into a trap. This is not 8541currently enabled, but may be enabled by @option{-O2} in the future. 8542 8543@item -ftree-sink 8544@opindex ftree-sink 8545Perform forward store motion on trees. This flag is 8546enabled by default at @option{-O} and higher. 8547 8548@item -ftree-bit-ccp 8549@opindex ftree-bit-ccp 8550Perform sparse conditional bit constant propagation on trees and propagate 8551pointer alignment information. 8552This pass only operates on local scalar variables and is enabled by default 8553at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled. 8554 8555@item -ftree-ccp 8556@opindex ftree-ccp 8557Perform sparse conditional constant propagation (CCP) on trees. This 8558pass only operates on local scalar variables and is enabled by default 8559at @option{-O} and higher. 8560 8561@item -fssa-phiopt 8562@opindex fssa-phiopt 8563Perform pattern matching on SSA PHI nodes to optimize conditional 8564code. This pass is enabled by default at @option{-O} and higher. 8565 8566@item -ftree-switch-conversion 8567@opindex ftree-switch-conversion 8568Perform conversion of simple initializations in a switch to 8569initializations from a scalar array. This flag is enabled by default 8570at @option{-O2} and higher. 8571 8572@item -ftree-tail-merge 8573@opindex ftree-tail-merge 8574Look for identical code sequences. When found, replace one with a jump to the 8575other. This optimization is known as tail merging or cross jumping. This flag 8576is enabled by default at @option{-O2} and higher. The compilation time 8577in this pass can 8578be limited using @option{max-tail-merge-comparisons} parameter and 8579@option{max-tail-merge-iterations} parameter. 8580 8581@item -ftree-dce 8582@opindex ftree-dce 8583Perform dead code elimination (DCE) on trees. This flag is enabled by 8584default at @option{-O} and higher. 8585 8586@item -ftree-builtin-call-dce 8587@opindex ftree-builtin-call-dce 8588Perform conditional dead code elimination (DCE) for calls to built-in functions 8589that may set @code{errno} but are otherwise side-effect free. This flag is 8590enabled by default at @option{-O2} and higher if @option{-Os} is not also 8591specified. 8592 8593@item -ftree-dominator-opts 8594@opindex ftree-dominator-opts 8595Perform a variety of simple scalar cleanups (constant/copy 8596propagation, redundancy elimination, range propagation and expression 8597simplification) based on a dominator tree traversal. This also 8598performs jump threading (to reduce jumps to jumps). This flag is 8599enabled by default at @option{-O} and higher. 8600 8601@item -ftree-dse 8602@opindex ftree-dse 8603Perform dead store elimination (DSE) on trees. A dead store is a store into 8604a memory location that is later overwritten by another store without 8605any intervening loads. In this case the earlier store can be deleted. This 8606flag is enabled by default at @option{-O} and higher. 8607 8608@item -ftree-ch 8609@opindex ftree-ch 8610Perform loop header copying on trees. This is beneficial since it increases 8611effectiveness of code motion optimizations. It also saves one jump. This flag 8612is enabled by default at @option{-O} and higher. It is not enabled 8613for @option{-Os}, since it usually increases code size. 8614 8615@item -ftree-loop-optimize 8616@opindex ftree-loop-optimize 8617Perform loop optimizations on trees. This flag is enabled by default 8618at @option{-O} and higher. 8619 8620@item -ftree-loop-linear 8621@opindex ftree-loop-linear 8622Perform loop interchange transformations on tree. Same as 8623@option{-floop-interchange}. To use this code transformation, GCC has 8624to be configured with @option{--with-isl} to enable the Graphite loop 8625transformation infrastructure. 8626 8627@item -floop-interchange 8628@opindex floop-interchange 8629Perform loop interchange transformations on loops. Interchanging two 8630nested loops switches the inner and outer loops. For example, given a 8631loop like: 8632@smallexample 8633DO J = 1, M 8634 DO I = 1, N 8635 A(J, I) = A(J, I) * C 8636 ENDDO 8637ENDDO 8638@end smallexample 8639@noindent 8640loop interchange transforms the loop as if it were written: 8641@smallexample 8642DO I = 1, N 8643 DO J = 1, M 8644 A(J, I) = A(J, I) * C 8645 ENDDO 8646ENDDO 8647@end smallexample 8648which can be beneficial when @code{N} is larger than the caches, 8649because in Fortran, the elements of an array are stored in memory 8650contiguously by column, and the original loop iterates over rows, 8651potentially creating at each access a cache miss. This optimization 8652applies to all the languages supported by GCC and is not limited to 8653Fortran. To use this code transformation, GCC has to be configured 8654with @option{--with-isl} to enable the Graphite loop transformation 8655infrastructure. 8656 8657@item -floop-strip-mine 8658@opindex floop-strip-mine 8659Perform loop strip mining transformations on loops. Strip mining 8660splits a loop into two nested loops. The outer loop has strides 8661equal to the strip size and the inner loop has strides of the 8662original loop within a strip. The strip length can be changed 8663using the @option{loop-block-tile-size} parameter. For example, 8664given a loop like: 8665@smallexample 8666DO I = 1, N 8667 A(I) = A(I) + C 8668ENDDO 8669@end smallexample 8670@noindent 8671loop strip mining transforms the loop as if it were written: 8672@smallexample 8673DO II = 1, N, 51 8674 DO I = II, min (II + 50, N) 8675 A(I) = A(I) + C 8676 ENDDO 8677ENDDO 8678@end smallexample 8679This optimization applies to all the languages supported by GCC and is 8680not limited to Fortran. To use this code transformation, GCC has to 8681be configured with @option{--with-isl} to enable the Graphite loop 8682transformation infrastructure. 8683 8684@item -floop-block 8685@opindex floop-block 8686Perform loop blocking transformations on loops. Blocking strip mines 8687each loop in the loop nest such that the memory accesses of the 8688element loops fit inside caches. The strip length can be changed 8689using the @option{loop-block-tile-size} parameter. For example, given 8690a loop like: 8691@smallexample 8692DO I = 1, N 8693 DO J = 1, M 8694 A(J, I) = B(I) + C(J) 8695 ENDDO 8696ENDDO 8697@end smallexample 8698@noindent 8699loop blocking transforms the loop as if it were written: 8700@smallexample 8701DO II = 1, N, 51 8702 DO JJ = 1, M, 51 8703 DO I = II, min (II + 50, N) 8704 DO J = JJ, min (JJ + 50, M) 8705 A(J, I) = B(I) + C(J) 8706 ENDDO 8707 ENDDO 8708 ENDDO 8709ENDDO 8710@end smallexample 8711which can be beneficial when @code{M} is larger than the caches, 8712because the innermost loop iterates over a smaller amount of data 8713which can be kept in the caches. This optimization applies to all the 8714languages supported by GCC and is not limited to Fortran. To use this 8715code transformation, GCC has to be configured with @option{--with-isl} 8716to enable the Graphite loop transformation infrastructure. 8717 8718@item -fgraphite-identity 8719@opindex fgraphite-identity 8720Enable the identity transformation for graphite. For every SCoP we generate 8721the polyhedral representation and transform it back to gimple. Using 8722@option{-fgraphite-identity} we can check the costs or benefits of the 8723GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations 8724are also performed by the code generator ISL, like index splitting and 8725dead code elimination in loops. 8726 8727@item -floop-nest-optimize 8728@opindex floop-nest-optimize 8729Enable the ISL based loop nest optimizer. This is a generic loop nest 8730optimizer based on the Pluto optimization algorithms. It calculates a loop 8731structure optimized for data-locality and parallelism. This option 8732is experimental. 8733 8734@item -floop-unroll-and-jam 8735@opindex floop-unroll-and-jam 8736Enable unroll and jam for the ISL based loop nest optimizer. The unroll 8737factor can be changed using the @option{loop-unroll-jam-size} parameter. 8738The unrolled dimension (counting from the most inner one) can be changed 8739using the @option{loop-unroll-jam-depth} parameter. . 8740 8741@item -floop-parallelize-all 8742@opindex floop-parallelize-all 8743Use the Graphite data dependence analysis to identify loops that can 8744be parallelized. Parallelize all the loops that can be analyzed to 8745not contain loop carried dependences without checking that it is 8746profitable to parallelize the loops. 8747 8748@item -fcheck-data-deps 8749@opindex fcheck-data-deps 8750Compare the results of several data dependence analyzers. This option 8751is used for debugging the data dependence analyzers. 8752 8753@item -ftree-loop-if-convert 8754@opindex ftree-loop-if-convert 8755Attempt to transform conditional jumps in the innermost loops to 8756branch-less equivalents. The intent is to remove control-flow from 8757the innermost loops in order to improve the ability of the 8758vectorization pass to handle these loops. This is enabled by default 8759if vectorization is enabled. 8760 8761@item -ftree-loop-if-convert-stores 8762@opindex ftree-loop-if-convert-stores 8763Attempt to also if-convert conditional jumps containing memory writes. 8764This transformation can be unsafe for multi-threaded programs as it 8765transforms conditional memory writes into unconditional memory writes. 8766For example, 8767@smallexample 8768for (i = 0; i < N; i++) 8769 if (cond) 8770 A[i] = expr; 8771@end smallexample 8772is transformed to 8773@smallexample 8774for (i = 0; i < N; i++) 8775 A[i] = cond ? expr : A[i]; 8776@end smallexample 8777potentially producing data races. 8778 8779@item -ftree-loop-distribution 8780@opindex ftree-loop-distribution 8781Perform loop distribution. This flag can improve cache performance on 8782big loop bodies and allow further loop optimizations, like 8783parallelization or vectorization, to take place. For example, the loop 8784@smallexample 8785DO I = 1, N 8786 A(I) = B(I) + C 8787 D(I) = E(I) * F 8788ENDDO 8789@end smallexample 8790is transformed to 8791@smallexample 8792DO I = 1, N 8793 A(I) = B(I) + C 8794ENDDO 8795DO I = 1, N 8796 D(I) = E(I) * F 8797ENDDO 8798@end smallexample 8799 8800@item -ftree-loop-distribute-patterns 8801@opindex ftree-loop-distribute-patterns 8802Perform loop distribution of patterns that can be code generated with 8803calls to a library. This flag is enabled by default at @option{-O3}. 8804 8805This pass distributes the initialization loops and generates a call to 8806memset zero. For example, the loop 8807@smallexample 8808DO I = 1, N 8809 A(I) = 0 8810 B(I) = A(I) + I 8811ENDDO 8812@end smallexample 8813is transformed to 8814@smallexample 8815DO I = 1, N 8816 A(I) = 0 8817ENDDO 8818DO I = 1, N 8819 B(I) = A(I) + I 8820ENDDO 8821@end smallexample 8822and the initialization loop is transformed into a call to memset zero. 8823 8824@item -ftree-loop-im 8825@opindex ftree-loop-im 8826Perform loop invariant motion on trees. This pass moves only invariants that 8827are hard to handle at RTL level (function calls, operations that expand to 8828nontrivial sequences of insns). With @option{-funswitch-loops} it also moves 8829operands of conditions that are invariant out of the loop, so that we can use 8830just trivial invariantness analysis in loop unswitching. The pass also includes 8831store motion. 8832 8833@item -ftree-loop-ivcanon 8834@opindex ftree-loop-ivcanon 8835Create a canonical counter for number of iterations in loops for which 8836determining number of iterations requires complicated analysis. Later 8837optimizations then may determine the number easily. Useful especially 8838in connection with unrolling. 8839 8840@item -fivopts 8841@opindex fivopts 8842Perform induction variable optimizations (strength reduction, induction 8843variable merging and induction variable elimination) on trees. 8844 8845@item -ftree-parallelize-loops=n 8846@opindex ftree-parallelize-loops 8847Parallelize loops, i.e., split their iteration space to run in n threads. 8848This is only possible for loops whose iterations are independent 8849and can be arbitrarily reordered. The optimization is only 8850profitable on multiprocessor machines, for loops that are CPU-intensive, 8851rather than constrained e.g.@: by memory bandwidth. This option 8852implies @option{-pthread}, and thus is only supported on targets 8853that have support for @option{-pthread}. 8854 8855@item -ftree-pta 8856@opindex ftree-pta 8857Perform function-local points-to analysis on trees. This flag is 8858enabled by default at @option{-O} and higher. 8859 8860@item -ftree-sra 8861@opindex ftree-sra 8862Perform scalar replacement of aggregates. This pass replaces structure 8863references with scalars to prevent committing structures to memory too 8864early. This flag is enabled by default at @option{-O} and higher. 8865 8866@item -ftree-copyrename 8867@opindex ftree-copyrename 8868Perform copy renaming on trees. This pass attempts to rename compiler 8869temporaries to other variables at copy locations, usually resulting in 8870variable names which more closely resemble the original variables. This flag 8871is enabled by default at @option{-O} and higher. 8872 8873@item -ftree-coalesce-inlined-vars 8874@opindex ftree-coalesce-inlined-vars 8875Tell the copyrename pass (see @option{-ftree-copyrename}) to attempt to 8876combine small user-defined variables too, but only if they are inlined 8877from other functions. It is a more limited form of 8878@option{-ftree-coalesce-vars}. This may harm debug information of such 8879inlined variables, but it keeps variables of the inlined-into 8880function apart from each other, such that they are more likely to 8881contain the expected values in a debugging session. 8882 8883@item -ftree-coalesce-vars 8884@opindex ftree-coalesce-vars 8885Tell the copyrename pass (see @option{-ftree-copyrename}) to attempt to 8886combine small user-defined variables too, instead of just compiler 8887temporaries. This may severely limit the ability to debug an optimized 8888program compiled with @option{-fno-var-tracking-assignments}. In the 8889negated form, this flag prevents SSA coalescing of user variables, 8890including inlined ones. This option is enabled by default. 8891 8892@item -ftree-ter 8893@opindex ftree-ter 8894Perform temporary expression replacement during the SSA->normal phase. Single 8895use/single def temporaries are replaced at their use location with their 8896defining expression. This results in non-GIMPLE code, but gives the expanders 8897much more complex trees to work on resulting in better RTL generation. This is 8898enabled by default at @option{-O} and higher. 8899 8900@item -ftree-slsr 8901@opindex ftree-slsr 8902Perform straight-line strength reduction on trees. This recognizes related 8903expressions involving multiplications and replaces them by less expensive 8904calculations when possible. This is enabled by default at @option{-O} and 8905higher. 8906 8907@item -ftree-vectorize 8908@opindex ftree-vectorize 8909Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize} 8910and @option{-ftree-slp-vectorize} if not explicitly specified. 8911 8912@item -ftree-loop-vectorize 8913@opindex ftree-loop-vectorize 8914Perform loop vectorization on trees. This flag is enabled by default at 8915@option{-O3} and when @option{-ftree-vectorize} is enabled. 8916 8917@item -ftree-slp-vectorize 8918@opindex ftree-slp-vectorize 8919Perform basic block vectorization on trees. This flag is enabled by default at 8920@option{-O3} and when @option{-ftree-vectorize} is enabled. 8921 8922@item -fvect-cost-model=@var{model} 8923@opindex fvect-cost-model 8924Alter the cost model used for vectorization. The @var{model} argument 8925should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}. 8926With the @samp{unlimited} model the vectorized code-path is assumed 8927to be profitable while with the @samp{dynamic} model a runtime check 8928guards the vectorized code-path to enable it only for iteration 8929counts that will likely execute faster than when executing the original 8930scalar loop. The @samp{cheap} model disables vectorization of 8931loops where doing so would be cost prohibitive for example due to 8932required runtime checks for data dependence or alignment but otherwise 8933is equal to the @samp{dynamic} model. 8934The default cost model depends on other optimization flags and is 8935either @samp{dynamic} or @samp{cheap}. 8936 8937@item -fsimd-cost-model=@var{model} 8938@opindex fsimd-cost-model 8939Alter the cost model used for vectorization of loops marked with the OpenMP 8940or Cilk Plus simd directive. The @var{model} argument should be one of 8941@samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model} 8942have the same meaning as described in @option{-fvect-cost-model} and by 8943default a cost model defined with @option{-fvect-cost-model} is used. 8944 8945@item -ftree-vrp 8946@opindex ftree-vrp 8947Perform Value Range Propagation on trees. This is similar to the 8948constant propagation pass, but instead of values, ranges of values are 8949propagated. This allows the optimizers to remove unnecessary range 8950checks like array bound checks and null pointer checks. This is 8951enabled by default at @option{-O2} and higher. Null pointer check 8952elimination is only done if @option{-fdelete-null-pointer-checks} is 8953enabled. 8954 8955@item -fsplit-ivs-in-unroller 8956@opindex fsplit-ivs-in-unroller 8957Enables expression of values of induction variables in later iterations 8958of the unrolled loop using the value in the first iteration. This breaks 8959long dependency chains, thus improving efficiency of the scheduling passes. 8960 8961A combination of @option{-fweb} and CSE is often sufficient to obtain the 8962same effect. However, that is not reliable in cases where the loop body 8963is more complicated than a single basic block. It also does not work at all 8964on some architectures due to restrictions in the CSE pass. 8965 8966This optimization is enabled by default. 8967 8968@item -fvariable-expansion-in-unroller 8969@opindex fvariable-expansion-in-unroller 8970With this option, the compiler creates multiple copies of some 8971local variables when unrolling a loop, which can result in superior code. 8972 8973@item -fpartial-inlining 8974@opindex fpartial-inlining 8975Inline parts of functions. This option has any effect only 8976when inlining itself is turned on by the @option{-finline-functions} 8977or @option{-finline-small-functions} options. 8978 8979Enabled at level @option{-O2}. 8980 8981@item -fpredictive-commoning 8982@opindex fpredictive-commoning 8983Perform predictive commoning optimization, i.e., reusing computations 8984(especially memory loads and stores) performed in previous 8985iterations of loops. 8986 8987This option is enabled at level @option{-O3}. 8988 8989@item -fprefetch-loop-arrays 8990@opindex fprefetch-loop-arrays 8991If supported by the target machine, generate instructions to prefetch 8992memory to improve the performance of loops that access large arrays. 8993 8994This option may generate better or worse code; results are highly 8995dependent on the structure of loops within the source code. 8996 8997Disabled at level @option{-Os}. 8998 8999@item -fno-peephole 9000@itemx -fno-peephole2 9001@opindex fno-peephole 9002@opindex fno-peephole2 9003Disable any machine-specific peephole optimizations. The difference 9004between @option{-fno-peephole} and @option{-fno-peephole2} is in how they 9005are implemented in the compiler; some targets use one, some use the 9006other, a few use both. 9007 9008@option{-fpeephole} is enabled by default. 9009@option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 9010 9011@item -fno-guess-branch-probability 9012@opindex fno-guess-branch-probability 9013Do not guess branch probabilities using heuristics. 9014 9015GCC uses heuristics to guess branch probabilities if they are 9016not provided by profiling feedback (@option{-fprofile-arcs}). These 9017heuristics are based on the control flow graph. If some branch probabilities 9018are specified by @code{__builtin_expect}, then the heuristics are 9019used to guess branch probabilities for the rest of the control flow graph, 9020taking the @code{__builtin_expect} info into account. The interactions 9021between the heuristics and @code{__builtin_expect} can be complex, and in 9022some cases, it may be useful to disable the heuristics so that the effects 9023of @code{__builtin_expect} are easier to understand. 9024 9025The default is @option{-fguess-branch-probability} at levels 9026@option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 9027 9028@item -freorder-blocks 9029@opindex freorder-blocks 9030Reorder basic blocks in the compiled function in order to reduce number of 9031taken branches and improve code locality. 9032 9033Enabled at levels @option{-O2}, @option{-O3}. 9034 9035@item -freorder-blocks-and-partition 9036@opindex freorder-blocks-and-partition 9037In addition to reordering basic blocks in the compiled function, in order 9038to reduce number of taken branches, partitions hot and cold basic blocks 9039into separate sections of the assembly and .o files, to improve 9040paging and cache locality performance. 9041 9042This optimization is automatically turned off in the presence of 9043exception handling, for linkonce sections, for functions with a user-defined 9044section attribute and on any architecture that does not support named 9045sections. 9046 9047Enabled for x86 at levels @option{-O2}, @option{-O3}. 9048 9049@item -freorder-functions 9050@opindex freorder-functions 9051Reorder functions in the object file in order to 9052improve code locality. This is implemented by using special 9053subsections @code{.text.hot} for most frequently executed functions and 9054@code{.text.unlikely} for unlikely executed functions. Reordering is done by 9055the linker so object file format must support named sections and linker must 9056place them in a reasonable way. 9057 9058Also profile feedback must be available to make this option effective. See 9059@option{-fprofile-arcs} for details. 9060 9061Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 9062 9063@item -fstrict-aliasing 9064@opindex fstrict-aliasing 9065Allow the compiler to assume the strictest aliasing rules applicable to 9066the language being compiled. For C (and C++), this activates 9067optimizations based on the type of expressions. In particular, an 9068object of one type is assumed never to reside at the same address as an 9069object of a different type, unless the types are almost the same. For 9070example, an @code{unsigned int} can alias an @code{int}, but not a 9071@code{void*} or a @code{double}. A character type may alias any other 9072type. 9073 9074@anchor{Type-punning}Pay special attention to code like this: 9075@smallexample 9076union a_union @{ 9077 int i; 9078 double d; 9079@}; 9080 9081int f() @{ 9082 union a_union t; 9083 t.d = 3.0; 9084 return t.i; 9085@} 9086@end smallexample 9087The practice of reading from a different union member than the one most 9088recently written to (called ``type-punning'') is common. Even with 9089@option{-fstrict-aliasing}, type-punning is allowed, provided the memory 9090is accessed through the union type. So, the code above works as 9091expected. @xref{Structures unions enumerations and bit-fields 9092implementation}. However, this code might not: 9093@smallexample 9094int f() @{ 9095 union a_union t; 9096 int* ip; 9097 t.d = 3.0; 9098 ip = &t.i; 9099 return *ip; 9100@} 9101@end smallexample 9102 9103Similarly, access by taking the address, casting the resulting pointer 9104and dereferencing the result has undefined behavior, even if the cast 9105uses a union type, e.g.: 9106@smallexample 9107int f() @{ 9108 double d = 3.0; 9109 return ((union a_union *) &d)->i; 9110@} 9111@end smallexample 9112 9113The @option{-fstrict-aliasing} option is enabled at levels 9114@option{-O2}, @option{-O3}, @option{-Os}. 9115 9116@item -fstrict-overflow 9117@opindex fstrict-overflow 9118Allow the compiler to assume strict signed overflow rules, depending 9119on the language being compiled. For C (and C++) this means that 9120overflow when doing arithmetic with signed numbers is undefined, which 9121means that the compiler may assume that it does not happen. This 9122permits various optimizations. For example, the compiler assumes 9123that an expression like @code{i + 10 > i} is always true for 9124signed @code{i}. This assumption is only valid if signed overflow is 9125undefined, as the expression is false if @code{i + 10} overflows when 9126using twos complement arithmetic. When this option is in effect any 9127attempt to determine whether an operation on signed numbers 9128overflows must be written carefully to not actually involve overflow. 9129 9130This option also allows the compiler to assume strict pointer 9131semantics: given a pointer to an object, if adding an offset to that 9132pointer does not produce a pointer to the same object, the addition is 9133undefined. This permits the compiler to conclude that @code{p + u > 9134p} is always true for a pointer @code{p} and unsigned integer 9135@code{u}. This assumption is only valid because pointer wraparound is 9136undefined, as the expression is false if @code{p + u} overflows using 9137twos complement arithmetic. 9138 9139See also the @option{-fwrapv} option. Using @option{-fwrapv} means 9140that integer signed overflow is fully defined: it wraps. When 9141@option{-fwrapv} is used, there is no difference between 9142@option{-fstrict-overflow} and @option{-fno-strict-overflow} for 9143integers. With @option{-fwrapv} certain types of overflow are 9144permitted. For example, if the compiler gets an overflow when doing 9145arithmetic on constants, the overflowed value can still be used with 9146@option{-fwrapv}, but not otherwise. 9147 9148The @option{-fstrict-overflow} option is enabled at levels 9149@option{-O2}, @option{-O3}, @option{-Os}. 9150 9151@item -falign-functions 9152@itemx -falign-functions=@var{n} 9153@opindex falign-functions 9154Align the start of functions to the next power-of-two greater than 9155@var{n}, skipping up to @var{n} bytes. For instance, 9156@option{-falign-functions=32} aligns functions to the next 32-byte 9157boundary, but @option{-falign-functions=24} aligns to the next 915832-byte boundary only if this can be done by skipping 23 bytes or less. 9159 9160@option{-fno-align-functions} and @option{-falign-functions=1} are 9161equivalent and mean that functions are not aligned. 9162 9163Some assemblers only support this flag when @var{n} is a power of two; 9164in that case, it is rounded up. 9165 9166If @var{n} is not specified or is zero, use a machine-dependent default. 9167 9168Enabled at levels @option{-O2}, @option{-O3}. 9169 9170@item -falign-labels 9171@itemx -falign-labels=@var{n} 9172@opindex falign-labels 9173Align all branch targets to a power-of-two boundary, skipping up to 9174@var{n} bytes like @option{-falign-functions}. This option can easily 9175make code slower, because it must insert dummy operations for when the 9176branch target is reached in the usual flow of the code. 9177 9178@option{-fno-align-labels} and @option{-falign-labels=1} are 9179equivalent and mean that labels are not aligned. 9180 9181If @option{-falign-loops} or @option{-falign-jumps} are applicable and 9182are greater than this value, then their values are used instead. 9183 9184If @var{n} is not specified or is zero, use a machine-dependent default 9185which is very likely to be @samp{1}, meaning no alignment. 9186 9187Enabled at levels @option{-O2}, @option{-O3}. 9188 9189@item -falign-loops 9190@itemx -falign-loops=@var{n} 9191@opindex falign-loops 9192Align loops to a power-of-two boundary, skipping up to @var{n} bytes 9193like @option{-falign-functions}. If the loops are 9194executed many times, this makes up for any execution of the dummy 9195operations. 9196 9197@option{-fno-align-loops} and @option{-falign-loops=1} are 9198equivalent and mean that loops are not aligned. 9199 9200If @var{n} is not specified or is zero, use a machine-dependent default. 9201 9202Enabled at levels @option{-O2}, @option{-O3}. 9203 9204@item -falign-jumps 9205@itemx -falign-jumps=@var{n} 9206@opindex falign-jumps 9207Align branch targets to a power-of-two boundary, for branch targets 9208where the targets can only be reached by jumping, skipping up to @var{n} 9209bytes like @option{-falign-functions}. In this case, no dummy operations 9210need be executed. 9211 9212@option{-fno-align-jumps} and @option{-falign-jumps=1} are 9213equivalent and mean that loops are not aligned. 9214 9215If @var{n} is not specified or is zero, use a machine-dependent default. 9216 9217Enabled at levels @option{-O2}, @option{-O3}. 9218 9219@item -funit-at-a-time 9220@opindex funit-at-a-time 9221This option is left for compatibility reasons. @option{-funit-at-a-time} 9222has no effect, while @option{-fno-unit-at-a-time} implies 9223@option{-fno-toplevel-reorder} and @option{-fno-section-anchors}. 9224 9225Enabled by default. 9226 9227@item -fno-toplevel-reorder 9228@opindex fno-toplevel-reorder 9229Do not reorder top-level functions, variables, and @code{asm} 9230statements. Output them in the same order that they appear in the 9231input file. When this option is used, unreferenced static variables 9232are not removed. This option is intended to support existing code 9233that relies on a particular ordering. For new code, it is better to 9234use attributes when possible. 9235 9236Enabled at level @option{-O0}. When disabled explicitly, it also implies 9237@option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some 9238targets. 9239 9240@item -fweb 9241@opindex fweb 9242Constructs webs as commonly used for register allocation purposes and assign 9243each web individual pseudo register. This allows the register allocation pass 9244to operate on pseudos directly, but also strengthens several other optimization 9245passes, such as CSE, loop optimizer and trivial dead code remover. It can, 9246however, make debugging impossible, since variables no longer stay in a 9247``home register''. 9248 9249Enabled by default with @option{-funroll-loops}. 9250 9251@item -fwhole-program 9252@opindex fwhole-program 9253Assume that the current compilation unit represents the whole program being 9254compiled. All public functions and variables with the exception of @code{main} 9255and those merged by attribute @code{externally_visible} become static functions 9256and in effect are optimized more aggressively by interprocedural optimizers. 9257 9258This option should not be used in combination with @option{-flto}. 9259Instead relying on a linker plugin should provide safer and more precise 9260information. 9261 9262@item -flto[=@var{n}] 9263@opindex flto 9264This option runs the standard link-time optimizer. When invoked 9265with source code, it generates GIMPLE (one of GCC's internal 9266representations) and writes it to special ELF sections in the object 9267file. When the object files are linked together, all the function 9268bodies are read from these ELF sections and instantiated as if they 9269had been part of the same translation unit. 9270 9271To use the link-time optimizer, @option{-flto} and optimization 9272options should be specified at compile time and during the final link. 9273For example: 9274 9275@smallexample 9276gcc -c -O2 -flto foo.c 9277gcc -c -O2 -flto bar.c 9278gcc -o myprog -flto -O2 foo.o bar.o 9279@end smallexample 9280 9281The first two invocations to GCC save a bytecode representation 9282of GIMPLE into special ELF sections inside @file{foo.o} and 9283@file{bar.o}. The final invocation reads the GIMPLE bytecode from 9284@file{foo.o} and @file{bar.o}, merges the two files into a single 9285internal image, and compiles the result as usual. Since both 9286@file{foo.o} and @file{bar.o} are merged into a single image, this 9287causes all the interprocedural analyses and optimizations in GCC to 9288work across the two files as if they were a single one. This means, 9289for example, that the inliner is able to inline functions in 9290@file{bar.o} into functions in @file{foo.o} and vice-versa. 9291 9292Another (simpler) way to enable link-time optimization is: 9293 9294@smallexample 9295gcc -o myprog -flto -O2 foo.c bar.c 9296@end smallexample 9297 9298The above generates bytecode for @file{foo.c} and @file{bar.c}, 9299merges them together into a single GIMPLE representation and optimizes 9300them as usual to produce @file{myprog}. 9301 9302The only important thing to keep in mind is that to enable link-time 9303optimizations you need to use the GCC driver to perform the link-step. 9304GCC then automatically performs link-time optimization if any of the 9305objects involved were compiled with the @option{-flto} command-line option. 9306You generally 9307should specify the optimization options to be used for link-time 9308optimization though GCC tries to be clever at guessing an 9309optimization level to use from the options used at compile-time 9310if you fail to specify one at link-time. You can always override 9311the automatic decision to do link-time optimization at link-time 9312by passing @option{-fno-lto} to the link command. 9313 9314To make whole program optimization effective, it is necessary to make 9315certain whole program assumptions. The compiler needs to know 9316what functions and variables can be accessed by libraries and runtime 9317outside of the link-time optimized unit. When supported by the linker, 9318the linker plugin (see @option{-fuse-linker-plugin}) passes information 9319to the compiler about used and externally visible symbols. When 9320the linker plugin is not available, @option{-fwhole-program} should be 9321used to allow the compiler to make these assumptions, which leads 9322to more aggressive optimization decisions. 9323 9324When @option{-fuse-linker-plugin} is not enabled then, when a file is 9325compiled with @option{-flto}, the generated object file is larger than 9326a regular object file because it contains GIMPLE bytecodes and the usual 9327final code (see @option{-ffat-lto-objects}. This means that 9328object files with LTO information can be linked as normal object 9329files; if @option{-fno-lto} is passed to the linker, no 9330interprocedural optimizations are applied. Note that when 9331@option{-fno-fat-lto-objects} is enabled the compile-stage is faster 9332but you cannot perform a regular, non-LTO link on them. 9333 9334Additionally, the optimization flags used to compile individual files 9335are not necessarily related to those used at link time. For instance, 9336 9337@smallexample 9338gcc -c -O0 -ffat-lto-objects -flto foo.c 9339gcc -c -O0 -ffat-lto-objects -flto bar.c 9340gcc -o myprog -O3 foo.o bar.o 9341@end smallexample 9342 9343This produces individual object files with unoptimized assembler 9344code, but the resulting binary @file{myprog} is optimized at 9345@option{-O3}. If, instead, the final binary is generated with 9346@option{-fno-lto}, then @file{myprog} is not optimized. 9347 9348When producing the final binary, GCC only 9349applies link-time optimizations to those files that contain bytecode. 9350Therefore, you can mix and match object files and libraries with 9351GIMPLE bytecodes and final object code. GCC automatically selects 9352which files to optimize in LTO mode and which files to link without 9353further processing. 9354 9355There are some code generation flags preserved by GCC when 9356generating bytecodes, as they need to be used during the final link 9357stage. Generally options specified at link-time override those 9358specified at compile-time. 9359 9360If you do not specify an optimization level option @option{-O} at 9361link-time then GCC computes one based on the optimization levels 9362used when compiling the object files. The highest optimization 9363level wins here. 9364 9365Currently, the following options and their setting are take from 9366the first object file that explicitely specified it: 9367@option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon}, 9368@option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm} 9369and all the @option{-m} target flags. 9370 9371Certain ABI changing flags are required to match in all compilation-units 9372and trying to override this at link-time with a conflicting value 9373is ignored. This includes options such as @option{-freg-struct-return} 9374and @option{-fpcc-struct-return}. 9375 9376Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow}, 9377@option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing} 9378are passed through to the link stage and merged conservatively for 9379conflicting translation units. Specifically 9380@option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take 9381precedence and for example @option{-ffp-contract=off} takes precedence 9382over @option{-ffp-contract=fast}. You can override them at linke-time. 9383 9384It is recommended that you compile all the files participating in the 9385same link with the same options and also specify those options at 9386link time. 9387 9388If LTO encounters objects with C linkage declared with incompatible 9389types in separate translation units to be linked together (undefined 9390behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be 9391issued. The behavior is still undefined at run time. Similar 9392diagnostics may be raised for other languages. 9393 9394Another feature of LTO is that it is possible to apply interprocedural 9395optimizations on files written in different languages: 9396 9397@smallexample 9398gcc -c -flto foo.c 9399g++ -c -flto bar.cc 9400gfortran -c -flto baz.f90 9401g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran 9402@end smallexample 9403 9404Notice that the final link is done with @command{g++} to get the C++ 9405runtime libraries and @option{-lgfortran} is added to get the Fortran 9406runtime libraries. In general, when mixing languages in LTO mode, you 9407should use the same link command options as when mixing languages in a 9408regular (non-LTO) compilation. 9409 9410If object files containing GIMPLE bytecode are stored in a library archive, say 9411@file{libfoo.a}, it is possible to extract and use them in an LTO link if you 9412are using a linker with plugin support. To create static libraries suitable 9413for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar} 9414and @command{ranlib}; 9415to show the symbols of object files with GIMPLE bytecode, use 9416@command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib} 9417and @command{nm} have been compiled with plugin support. At link time, use the the 9418flag @option{-fuse-linker-plugin} to ensure that the library participates in 9419the LTO optimization process: 9420 9421@smallexample 9422gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo 9423@end smallexample 9424 9425With the linker plugin enabled, the linker extracts the needed 9426GIMPLE files from @file{libfoo.a} and passes them on to the running GCC 9427to make them part of the aggregated GIMPLE image to be optimized. 9428 9429If you are not using a linker with plugin support and/or do not 9430enable the linker plugin, then the objects inside @file{libfoo.a} 9431are extracted and linked as usual, but they do not participate 9432in the LTO optimization process. In order to make a static library suitable 9433for both LTO optimization and usual linkage, compile its object files with 9434@option{-flto} @option{-ffat-lto-objects}. 9435 9436Link-time optimizations do not require the presence of the whole program to 9437operate. If the program does not require any symbols to be exported, it is 9438possible to combine @option{-flto} and @option{-fwhole-program} to allow 9439the interprocedural optimizers to use more aggressive assumptions which may 9440lead to improved optimization opportunities. 9441Use of @option{-fwhole-program} is not needed when linker plugin is 9442active (see @option{-fuse-linker-plugin}). 9443 9444The current implementation of LTO makes no 9445attempt to generate bytecode that is portable between different 9446types of hosts. The bytecode files are versioned and there is a 9447strict version check, so bytecode files generated in one version of 9448GCC do not work with an older or newer version of GCC. 9449 9450Link-time optimization does not work well with generation of debugging 9451information. Combining @option{-flto} with 9452@option{-g} is currently experimental and expected to produce unexpected 9453results. 9454 9455If you specify the optional @var{n}, the optimization and code 9456generation done at link time is executed in parallel using @var{n} 9457parallel jobs by utilizing an installed @command{make} program. The 9458environment variable @env{MAKE} may be used to override the program 9459used. The default value for @var{n} is 1. 9460 9461You can also specify @option{-flto=jobserver} to use GNU make's 9462job server mode to determine the number of parallel jobs. This 9463is useful when the Makefile calling GCC is already executing in parallel. 9464You must prepend a @samp{+} to the command recipe in the parent Makefile 9465for this to work. This option likely only works if @env{MAKE} is 9466GNU make. 9467 9468@item -flto-partition=@var{alg} 9469@opindex flto-partition 9470Specify the partitioning algorithm used by the link-time optimizer. 9471The value is either @samp{1to1} to specify a partitioning mirroring 9472the original source files or @samp{balanced} to specify partitioning 9473into equally sized chunks (whenever possible) or @samp{max} to create 9474new partition for every symbol where possible. Specifying @samp{none} 9475as an algorithm disables partitioning and streaming completely. 9476The default value is @samp{balanced}. While @samp{1to1} can be used 9477as an workaround for various code ordering issues, the @samp{max} 9478partitioning is intended for internal testing only. 9479The value @samp{one} specifies that exactly one partition should be 9480used while the value @samp{none} bypasses partitioning and executes 9481the link-time optimization step directly from the WPA phase. 9482 9483@item -flto-odr-type-merging 9484@opindex flto-odr-type-merging 9485Enable streaming of mangled types names of C++ types and their unification 9486at linktime. This increases size of LTO object files, but enable 9487diagnostics about One Definition Rule violations. 9488 9489@item -flto-compression-level=@var{n} 9490@opindex flto-compression-level 9491This option specifies the level of compression used for intermediate 9492language written to LTO object files, and is only meaningful in 9493conjunction with LTO mode (@option{-flto}). Valid 9494values are 0 (no compression) to 9 (maximum compression). Values 9495outside this range are clamped to either 0 or 9. If the option is not 9496given, a default balanced compression setting is used. 9497 9498@item -flto-report 9499@opindex flto-report 9500Prints a report with internal details on the workings of the link-time 9501optimizer. The contents of this report vary from version to version. 9502It is meant to be useful to GCC developers when processing object 9503files in LTO mode (via @option{-flto}). 9504 9505Disabled by default. 9506 9507@item -flto-report-wpa 9508@opindex flto-report-wpa 9509Like @option{-flto-report}, but only print for the WPA phase of Link 9510Time Optimization. 9511 9512@item -fuse-linker-plugin 9513@opindex fuse-linker-plugin 9514Enables the use of a linker plugin during link-time optimization. This 9515option relies on plugin support in the linker, which is available in gold 9516or in GNU ld 2.21 or newer. 9517 9518This option enables the extraction of object files with GIMPLE bytecode out 9519of library archives. This improves the quality of optimization by exposing 9520more code to the link-time optimizer. This information specifies what 9521symbols can be accessed externally (by non-LTO object or during dynamic 9522linking). Resulting code quality improvements on binaries (and shared 9523libraries that use hidden visibility) are similar to @option{-fwhole-program}. 9524See @option{-flto} for a description of the effect of this flag and how to 9525use it. 9526 9527This option is enabled by default when LTO support in GCC is enabled 9528and GCC was configured for use with 9529a linker supporting plugins (GNU ld 2.21 or newer or gold). 9530 9531@item -ffat-lto-objects 9532@opindex ffat-lto-objects 9533Fat LTO objects are object files that contain both the intermediate language 9534and the object code. This makes them usable for both LTO linking and normal 9535linking. This option is effective only when compiling with @option{-flto} 9536and is ignored at link time. 9537 9538@option{-fno-fat-lto-objects} improves compilation time over plain LTO, but 9539requires the complete toolchain to be aware of LTO. It requires a linker with 9540linker plugin support for basic functionality. Additionally, 9541@command{nm}, @command{ar} and @command{ranlib} 9542need to support linker plugins to allow a full-featured build environment 9543(capable of building static libraries etc). GCC provides the @command{gcc-ar}, 9544@command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options 9545to these tools. With non fat LTO makefiles need to be modified to use them. 9546 9547The default is @option{-fno-fat-lto-objects} on targets with linker plugin 9548support. 9549 9550@item -fcompare-elim 9551@opindex fcompare-elim 9552After register allocation and post-register allocation instruction splitting, 9553identify arithmetic instructions that compute processor flags similar to a 9554comparison operation based on that arithmetic. If possible, eliminate the 9555explicit comparison operation. 9556 9557This pass only applies to certain targets that cannot explicitly represent 9558the comparison operation before register allocation is complete. 9559 9560Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 9561 9562@item -fcprop-registers 9563@opindex fcprop-registers 9564After register allocation and post-register allocation instruction splitting, 9565perform a copy-propagation pass to try to reduce scheduling dependencies 9566and occasionally eliminate the copy. 9567 9568Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}. 9569 9570@item -fprofile-correction 9571@opindex fprofile-correction 9572Profiles collected using an instrumented binary for multi-threaded programs may 9573be inconsistent due to missed counter updates. When this option is specified, 9574GCC uses heuristics to correct or smooth out such inconsistencies. By 9575default, GCC emits an error message when an inconsistent profile is detected. 9576 9577@item -fprofile-dir=@var{path} 9578@opindex fprofile-dir 9579 9580Set the directory to search for the profile data files in to @var{path}. 9581This option affects only the profile data generated by 9582@option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs} 9583and used by @option{-fprofile-use} and @option{-fbranch-probabilities} 9584and its related options. Both absolute and relative paths can be used. 9585By default, GCC uses the current directory as @var{path}, thus the 9586profile data file appears in the same directory as the object file. 9587 9588@item -fprofile-generate 9589@itemx -fprofile-generate=@var{path} 9590@opindex fprofile-generate 9591 9592Enable options usually used for instrumenting application to produce 9593profile useful for later recompilation with profile feedback based 9594optimization. You must use @option{-fprofile-generate} both when 9595compiling and when linking your program. 9596 9597The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}. 9598 9599If @var{path} is specified, GCC looks at the @var{path} to find 9600the profile feedback data files. See @option{-fprofile-dir}. 9601 9602@item -fprofile-use 9603@itemx -fprofile-use=@var{path} 9604@opindex fprofile-use 9605Enable profile feedback-directed optimizations, 9606and the following optimizations 9607which are generally profitable only with profile feedback available: 9608@option{-fbranch-probabilities}, @option{-fvpt}, 9609@option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer}, 9610@option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}. 9611 9612By default, GCC emits an error message if the feedback profiles do not 9613match the source code. This error can be turned into a warning by using 9614@option{-Wcoverage-mismatch}. Note this may result in poorly optimized 9615code. 9616 9617If @var{path} is specified, GCC looks at the @var{path} to find 9618the profile feedback data files. See @option{-fprofile-dir}. 9619 9620@item -fauto-profile 9621@itemx -fauto-profile=@var{path} 9622@opindex fauto-profile 9623Enable sampling-based feedback-directed optimizations, 9624and the following optimizations 9625which are generally profitable only with profile feedback available: 9626@option{-fbranch-probabilities}, @option{-fvpt}, 9627@option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer}, 9628@option{-ftree-vectorize}, 9629@option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone}, 9630@option{-fpredictive-commoning}, @option{-funswitch-loops}, 9631@option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}. 9632 9633@var{path} is the name of a file containing AutoFDO profile information. 9634If omitted, it defaults to @file{fbdata.afdo} in the current directory. 9635 9636Producing an AutoFDO profile data file requires running your program 9637with the @command{perf} utility on a supported GNU/Linux target system. 9638For more information, see @uref{https://perf.wiki.kernel.org/}. 9639 9640E.g. 9641@smallexample 9642perf record -e br_inst_retired:near_taken -b -o perf.data \ 9643 -- your_program 9644@end smallexample 9645 9646Then use the @command{create_gcov} tool to convert the raw profile data 9647to a format that can be used by GCC.@ You must also supply the 9648unstripped binary for your program to this tool. 9649See @uref{https://github.com/google/autofdo}. 9650 9651E.g. 9652@smallexample 9653create_gcov --binary=your_program.unstripped --profile=perf.data \ 9654 --gcov=profile.afdo 9655@end smallexample 9656@end table 9657 9658The following options control compiler behavior regarding floating-point 9659arithmetic. These options trade off between speed and 9660correctness. All must be specifically enabled. 9661 9662@table @gcctabopt 9663@item -ffloat-store 9664@opindex ffloat-store 9665Do not store floating-point variables in registers, and inhibit other 9666options that might change whether a floating-point value is taken from a 9667register or memory. 9668 9669@cindex floating-point precision 9670This option prevents undesirable excess precision on machines such as 9671the 68000 where the floating registers (of the 68881) keep more 9672precision than a @code{double} is supposed to have. Similarly for the 9673x86 architecture. For most programs, the excess precision does only 9674good, but a few programs rely on the precise definition of IEEE floating 9675point. Use @option{-ffloat-store} for such programs, after modifying 9676them to store all pertinent intermediate computations into variables. 9677 9678@item -fexcess-precision=@var{style} 9679@opindex fexcess-precision 9680This option allows further control over excess precision on machines 9681where floating-point registers have more precision than the IEEE 9682@code{float} and @code{double} types and the processor does not 9683support operations rounding to those types. By default, 9684@option{-fexcess-precision=fast} is in effect; this means that 9685operations are carried out in the precision of the registers and that 9686it is unpredictable when rounding to the types specified in the source 9687code takes place. When compiling C, if 9688@option{-fexcess-precision=standard} is specified then excess 9689precision follows the rules specified in ISO C99; in particular, 9690both casts and assignments cause values to be rounded to their 9691semantic types (whereas @option{-ffloat-store} only affects 9692assignments). This option is enabled by default for C if a strict 9693conformance option such as @option{-std=c99} is used. 9694 9695@opindex mfpmath 9696@option{-fexcess-precision=standard} is not implemented for languages 9697other than C, and has no effect if 9698@option{-funsafe-math-optimizations} or @option{-ffast-math} is 9699specified. On the x86, it also has no effect if @option{-mfpmath=sse} 9700or @option{-mfpmath=sse+387} is specified; in the former case, IEEE 9701semantics apply without excess precision, and in the latter, rounding 9702is unpredictable. 9703 9704@item -ffast-math 9705@opindex ffast-math 9706Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, 9707@option{-ffinite-math-only}, @option{-fno-rounding-math}, 9708@option{-fno-signaling-nans} and @option{-fcx-limited-range}. 9709 9710This option causes the preprocessor macro @code{__FAST_MATH__} to be defined. 9711 9712This option is not turned on by any @option{-O} option besides 9713@option{-Ofast} since it can result in incorrect output for programs 9714that depend on an exact implementation of IEEE or ISO rules/specifications 9715for math functions. It may, however, yield faster code for programs 9716that do not require the guarantees of these specifications. 9717 9718@item -fno-math-errno 9719@opindex fno-math-errno 9720Do not set @code{errno} after calling math functions that are executed 9721with a single instruction, e.g., @code{sqrt}. A program that relies on 9722IEEE exceptions for math error handling may want to use this flag 9723for speed while maintaining IEEE arithmetic compatibility. 9724 9725This option is not turned on by any @option{-O} option since 9726it can result in incorrect output for programs that depend on 9727an exact implementation of IEEE or ISO rules/specifications for 9728math functions. It may, however, yield faster code for programs 9729that do not require the guarantees of these specifications. 9730 9731The default is @option{-fmath-errno}. 9732 9733On Darwin systems, the math library never sets @code{errno}. There is 9734therefore no reason for the compiler to consider the possibility that 9735it might, and @option{-fno-math-errno} is the default. 9736 9737@item -funsafe-math-optimizations 9738@opindex funsafe-math-optimizations 9739 9740Allow optimizations for floating-point arithmetic that (a) assume 9741that arguments and results are valid and (b) may violate IEEE or 9742ANSI standards. When used at link-time, it may include libraries 9743or startup files that change the default FPU control word or other 9744similar optimizations. 9745 9746This option is not turned on by any @option{-O} option since 9747it can result in incorrect output for programs that depend on 9748an exact implementation of IEEE or ISO rules/specifications for 9749math functions. It may, however, yield faster code for programs 9750that do not require the guarantees of these specifications. 9751Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math}, 9752@option{-fassociative-math} and @option{-freciprocal-math}. 9753 9754The default is @option{-fno-unsafe-math-optimizations}. 9755 9756@item -fassociative-math 9757@opindex fassociative-math 9758 9759Allow re-association of operands in series of floating-point operations. 9760This violates the ISO C and C++ language standard by possibly changing 9761computation result. NOTE: re-ordering may change the sign of zero as 9762well as ignore NaNs and inhibit or create underflow or overflow (and 9763thus cannot be used on code that relies on rounding behavior like 9764@code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons 9765and thus may not be used when ordered comparisons are required. 9766This option requires that both @option{-fno-signed-zeros} and 9767@option{-fno-trapping-math} be in effect. Moreover, it doesn't make 9768much sense with @option{-frounding-math}. For Fortran the option 9769is automatically enabled when both @option{-fno-signed-zeros} and 9770@option{-fno-trapping-math} are in effect. 9771 9772The default is @option{-fno-associative-math}. 9773 9774@item -freciprocal-math 9775@opindex freciprocal-math 9776 9777Allow the reciprocal of a value to be used instead of dividing by 9778the value if this enables optimizations. For example @code{x / y} 9779can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)} 9780is subject to common subexpression elimination. Note that this loses 9781precision and increases the number of flops operating on the value. 9782 9783The default is @option{-fno-reciprocal-math}. 9784 9785@item -ffinite-math-only 9786@opindex ffinite-math-only 9787Allow optimizations for floating-point arithmetic that assume 9788that arguments and results are not NaNs or +-Infs. 9789 9790This option is not turned on by any @option{-O} option since 9791it can result in incorrect output for programs that depend on 9792an exact implementation of IEEE or ISO rules/specifications for 9793math functions. It may, however, yield faster code for programs 9794that do not require the guarantees of these specifications. 9795 9796The default is @option{-fno-finite-math-only}. 9797 9798@item -fno-signed-zeros 9799@opindex fno-signed-zeros 9800Allow optimizations for floating-point arithmetic that ignore the 9801signedness of zero. IEEE arithmetic specifies the behavior of 9802distinct +0.0 and @minus{}0.0 values, which then prohibits simplification 9803of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}). 9804This option implies that the sign of a zero result isn't significant. 9805 9806The default is @option{-fsigned-zeros}. 9807 9808@item -fno-trapping-math 9809@opindex fno-trapping-math 9810Compile code assuming that floating-point operations cannot generate 9811user-visible traps. These traps include division by zero, overflow, 9812underflow, inexact result and invalid operation. This option requires 9813that @option{-fno-signaling-nans} be in effect. Setting this option may 9814allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example. 9815 9816This option should never be turned on by any @option{-O} option since 9817it can result in incorrect output for programs that depend on 9818an exact implementation of IEEE or ISO rules/specifications for 9819math functions. 9820 9821The default is @option{-ftrapping-math}. 9822 9823@item -frounding-math 9824@opindex frounding-math 9825Disable transformations and optimizations that assume default floating-point 9826rounding behavior. This is round-to-zero for all floating point 9827to integer conversions, and round-to-nearest for all other arithmetic 9828truncations. This option should be specified for programs that change 9829the FP rounding mode dynamically, or that may be executed with a 9830non-default rounding mode. This option disables constant folding of 9831floating-point expressions at compile time (which may be affected by 9832rounding mode) and arithmetic transformations that are unsafe in the 9833presence of sign-dependent rounding modes. 9834 9835The default is @option{-fno-rounding-math}. 9836 9837This option is experimental and does not currently guarantee to 9838disable all GCC optimizations that are affected by rounding mode. 9839Future versions of GCC may provide finer control of this setting 9840using C99's @code{FENV_ACCESS} pragma. This command-line option 9841will be used to specify the default state for @code{FENV_ACCESS}. 9842 9843@item -fsignaling-nans 9844@opindex fsignaling-nans 9845Compile code assuming that IEEE signaling NaNs may generate user-visible 9846traps during floating-point operations. Setting this option disables 9847optimizations that may change the number of exceptions visible with 9848signaling NaNs. This option implies @option{-ftrapping-math}. 9849 9850This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to 9851be defined. 9852 9853The default is @option{-fno-signaling-nans}. 9854 9855This option is experimental and does not currently guarantee to 9856disable all GCC optimizations that affect signaling NaN behavior. 9857 9858@item -fsingle-precision-constant 9859@opindex fsingle-precision-constant 9860Treat floating-point constants as single precision instead of 9861implicitly converting them to double-precision constants. 9862 9863@item -fcx-limited-range 9864@opindex fcx-limited-range 9865When enabled, this option states that a range reduction step is not 9866needed when performing complex division. Also, there is no checking 9867whether the result of a complex multiplication or division is @code{NaN 9868+ I*NaN}, with an attempt to rescue the situation in that case. The 9869default is @option{-fno-cx-limited-range}, but is enabled by 9870@option{-ffast-math}. 9871 9872This option controls the default setting of the ISO C99 9873@code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to 9874all languages. 9875 9876@item -fcx-fortran-rules 9877@opindex fcx-fortran-rules 9878Complex multiplication and division follow Fortran rules. Range 9879reduction is done as part of complex division, but there is no checking 9880whether the result of a complex multiplication or division is @code{NaN 9881+ I*NaN}, with an attempt to rescue the situation in that case. 9882 9883The default is @option{-fno-cx-fortran-rules}. 9884 9885@end table 9886 9887The following options control optimizations that may improve 9888performance, but are not enabled by any @option{-O} options. This 9889section includes experimental options that may produce broken code. 9890 9891@table @gcctabopt 9892@item -fbranch-probabilities 9893@opindex fbranch-probabilities 9894After running a program compiled with @option{-fprofile-arcs} 9895(@pxref{Debugging Options,, Options for Debugging Your Program or 9896@command{gcc}}), you can compile it a second time using 9897@option{-fbranch-probabilities}, to improve optimizations based on 9898the number of times each branch was taken. When a program 9899compiled with @option{-fprofile-arcs} exits, it saves arc execution 9900counts to a file called @file{@var{sourcename}.gcda} for each source 9901file. The information in this data file is very dependent on the 9902structure of the generated code, so you must use the same source code 9903and the same optimization options for both compilations. 9904 9905With @option{-fbranch-probabilities}, GCC puts a 9906@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}. 9907These can be used to improve optimization. Currently, they are only 9908used in one place: in @file{reorg.c}, instead of guessing which path a 9909branch is most likely to take, the @samp{REG_BR_PROB} values are used to 9910exactly determine which path is taken more often. 9911 9912@item -fprofile-values 9913@opindex fprofile-values 9914If combined with @option{-fprofile-arcs}, it adds code so that some 9915data about values of expressions in the program is gathered. 9916 9917With @option{-fbranch-probabilities}, it reads back the data gathered 9918from profiling values of expressions for usage in optimizations. 9919 9920Enabled with @option{-fprofile-generate} and @option{-fprofile-use}. 9921 9922@item -fprofile-reorder-functions 9923@opindex fprofile-reorder-functions 9924Function reordering based on profile instrumentation collects 9925first time of execution of a function and orders these functions 9926in ascending order. 9927 9928Enabled with @option{-fprofile-use}. 9929 9930@item -fvpt 9931@opindex fvpt 9932If combined with @option{-fprofile-arcs}, this option instructs the compiler 9933to add code to gather information about values of expressions. 9934 9935With @option{-fbranch-probabilities}, it reads back the data gathered 9936and actually performs the optimizations based on them. 9937Currently the optimizations include specialization of division operations 9938using the knowledge about the value of the denominator. 9939 9940@item -frename-registers 9941@opindex frename-registers 9942Attempt to avoid false dependencies in scheduled code by making use 9943of registers left over after register allocation. This optimization 9944most benefits processors with lots of registers. Depending on the 9945debug information format adopted by the target, however, it can 9946make debugging impossible, since variables no longer stay in 9947a ``home register''. 9948 9949Enabled by default with @option{-funroll-loops} and @option{-fpeel-loops}. 9950 9951@item -fschedule-fusion 9952@opindex fschedule-fusion 9953Performs a target dependent pass over the instruction stream to schedule 9954instructions of same type together because target machine can execute them 9955more efficiently if they are adjacent to each other in the instruction flow. 9956 9957Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 9958 9959@item -ftracer 9960@opindex ftracer 9961Perform tail duplication to enlarge superblock size. This transformation 9962simplifies the control flow of the function allowing other optimizations to do 9963a better job. 9964 9965Enabled with @option{-fprofile-use}. 9966 9967@item -funroll-loops 9968@opindex funroll-loops 9969Unroll loops whose number of iterations can be determined at compile time or 9970upon entry to the loop. @option{-funroll-loops} implies 9971@option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}. 9972It also turns on complete loop peeling (i.e.@: complete removal of loops with 9973a small constant number of iterations). This option makes code larger, and may 9974or may not make it run faster. 9975 9976Enabled with @option{-fprofile-use}. 9977 9978@item -funroll-all-loops 9979@opindex funroll-all-loops 9980Unroll all loops, even if their number of iterations is uncertain when 9981the loop is entered. This usually makes programs run more slowly. 9982@option{-funroll-all-loops} implies the same options as 9983@option{-funroll-loops}. 9984 9985@item -fpeel-loops 9986@opindex fpeel-loops 9987Peels loops for which there is enough information that they do not 9988roll much (from profile feedback). It also turns on complete loop peeling 9989(i.e.@: complete removal of loops with small constant number of iterations). 9990 9991Enabled with @option{-fprofile-use}. 9992 9993@item -fmove-loop-invariants 9994@opindex fmove-loop-invariants 9995Enables the loop invariant motion pass in the RTL loop optimizer. Enabled 9996at level @option{-O1} 9997 9998@item -funswitch-loops 9999@opindex funswitch-loops 10000Move branches with loop invariant conditions out of the loop, with duplicates 10001of the loop on both branches (modified according to result of the condition). 10002 10003@item -ffunction-sections 10004@itemx -fdata-sections 10005@opindex ffunction-sections 10006@opindex fdata-sections 10007Place each function or data item into its own section in the output 10008file if the target supports arbitrary sections. The name of the 10009function or the name of the data item determines the section's name 10010in the output file. 10011 10012Use these options on systems where the linker can perform optimizations 10013to improve locality of reference in the instruction space. Most systems 10014using the ELF object format and SPARC processors running Solaris 2 have 10015linkers with such optimizations. AIX may have these optimizations in 10016the future. 10017 10018Only use these options when there are significant benefits from doing 10019so. When you specify these options, the assembler and linker 10020create larger object and executable files and are also slower. 10021You cannot use @command{gprof} on all systems if you 10022specify this option, and you may have problems with debugging if 10023you specify both this option and @option{-g}. 10024 10025@item -fbranch-target-load-optimize 10026@opindex fbranch-target-load-optimize 10027Perform branch target register load optimization before prologue / epilogue 10028threading. 10029The use of target registers can typically be exposed only during reload, 10030thus hoisting loads out of loops and doing inter-block scheduling needs 10031a separate optimization pass. 10032 10033@item -fbranch-target-load-optimize2 10034@opindex fbranch-target-load-optimize2 10035Perform branch target register load optimization after prologue / epilogue 10036threading. 10037 10038@item -fbtr-bb-exclusive 10039@opindex fbtr-bb-exclusive 10040When performing branch target register load optimization, don't reuse 10041branch target registers within any basic block. 10042 10043@item -fstack-protector 10044@opindex fstack-protector 10045Emit extra code to check for buffer overflows, such as stack smashing 10046attacks. This is done by adding a guard variable to functions with 10047vulnerable objects. This includes functions that call @code{alloca}, and 10048functions with buffers larger than 8 bytes. The guards are initialized 10049when a function is entered and then checked when the function exits. 10050If a guard check fails, an error message is printed and the program exits. 10051 10052@item -fstack-protector-all 10053@opindex fstack-protector-all 10054Like @option{-fstack-protector} except that all functions are protected. 10055 10056@item -fstack-protector-strong 10057@opindex fstack-protector-strong 10058Like @option{-fstack-protector} but includes additional functions to 10059be protected --- those that have local array definitions, or have 10060references to local frame addresses. 10061 10062@item -fstack-protector-explicit 10063@opindex fstack-protector-explicit 10064Like @option{-fstack-protector} but only protects those functions which 10065have the @code{stack_protect} attribute 10066 10067@item -fstdarg-opt 10068@opindex fstdarg-opt 10069Optimize the prologue of variadic argument functions with respect to usage of 10070those arguments. 10071 10072@item -fsection-anchors 10073@opindex fsection-anchors 10074Try to reduce the number of symbolic address calculations by using 10075shared ``anchor'' symbols to address nearby objects. This transformation 10076can help to reduce the number of GOT entries and GOT accesses on some 10077targets. 10078 10079For example, the implementation of the following function @code{foo}: 10080 10081@smallexample 10082static int a, b, c; 10083int foo (void) @{ return a + b + c; @} 10084@end smallexample 10085 10086@noindent 10087usually calculates the addresses of all three variables, but if you 10088compile it with @option{-fsection-anchors}, it accesses the variables 10089from a common anchor point instead. The effect is similar to the 10090following pseudocode (which isn't valid C): 10091 10092@smallexample 10093int foo (void) 10094@{ 10095 register int *xr = &x; 10096 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x]; 10097@} 10098@end smallexample 10099 10100Not all targets support this option. 10101 10102@item --param @var{name}=@var{value} 10103@opindex param 10104In some places, GCC uses various constants to control the amount of 10105optimization that is done. For example, GCC does not inline functions 10106that contain more than a certain number of instructions. You can 10107control some of these constants on the command line using the 10108@option{--param} option. 10109 10110The names of specific parameters, and the meaning of the values, are 10111tied to the internals of the compiler, and are subject to change 10112without notice in future releases. 10113 10114In each case, the @var{value} is an integer. The allowable choices for 10115@var{name} are: 10116 10117@table @gcctabopt 10118@item predictable-branch-outcome 10119When branch is predicted to be taken with probability lower than this threshold 10120(in percent), then it is considered well predictable. The default is 10. 10121 10122@item max-crossjump-edges 10123The maximum number of incoming edges to consider for cross-jumping. 10124The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in 10125the number of edges incoming to each block. Increasing values mean 10126more aggressive optimization, making the compilation time increase with 10127probably small improvement in executable size. 10128 10129@item min-crossjump-insns 10130The minimum number of instructions that must be matched at the end 10131of two blocks before cross-jumping is performed on them. This 10132value is ignored in the case where all instructions in the block being 10133cross-jumped from are matched. The default value is 5. 10134 10135@item max-grow-copy-bb-insns 10136The maximum code size expansion factor when copying basic blocks 10137instead of jumping. The expansion is relative to a jump instruction. 10138The default value is 8. 10139 10140@item max-goto-duplication-insns 10141The maximum number of instructions to duplicate to a block that jumps 10142to a computed goto. To avoid @math{O(N^2)} behavior in a number of 10143passes, GCC factors computed gotos early in the compilation process, 10144and unfactors them as late as possible. Only computed jumps at the 10145end of a basic blocks with no more than max-goto-duplication-insns are 10146unfactored. The default value is 8. 10147 10148@item max-delay-slot-insn-search 10149The maximum number of instructions to consider when looking for an 10150instruction to fill a delay slot. If more than this arbitrary number of 10151instructions are searched, the time savings from filling the delay slot 10152are minimal, so stop searching. Increasing values mean more 10153aggressive optimization, making the compilation time increase with probably 10154small improvement in execution time. 10155 10156@item max-delay-slot-live-search 10157When trying to fill delay slots, the maximum number of instructions to 10158consider when searching for a block with valid live register 10159information. Increasing this arbitrarily chosen value means more 10160aggressive optimization, increasing the compilation time. This parameter 10161should be removed when the delay slot code is rewritten to maintain the 10162control-flow graph. 10163 10164@item max-gcse-memory 10165The approximate maximum amount of memory that can be allocated in 10166order to perform the global common subexpression elimination 10167optimization. If more memory than specified is required, the 10168optimization is not done. 10169 10170@item max-gcse-insertion-ratio 10171If the ratio of expression insertions to deletions is larger than this value 10172for any expression, then RTL PRE inserts or removes the expression and thus 10173leaves partially redundant computations in the instruction stream. The default value is 20. 10174 10175@item max-pending-list-length 10176The maximum number of pending dependencies scheduling allows 10177before flushing the current state and starting over. Large functions 10178with few branches or calls can create excessively large lists which 10179needlessly consume memory and resources. 10180 10181@item max-modulo-backtrack-attempts 10182The maximum number of backtrack attempts the scheduler should make 10183when modulo scheduling a loop. Larger values can exponentially increase 10184compilation time. 10185 10186@item max-inline-insns-single 10187Several parameters control the tree inliner used in GCC@. 10188This number sets the maximum number of instructions (counted in GCC's 10189internal representation) in a single function that the tree inliner 10190considers for inlining. This only affects functions declared 10191inline and methods implemented in a class declaration (C++). 10192The default value is 400. 10193 10194@item max-inline-insns-auto 10195When you use @option{-finline-functions} (included in @option{-O3}), 10196a lot of functions that would otherwise not be considered for inlining 10197by the compiler are investigated. To those functions, a different 10198(more restrictive) limit compared to functions declared inline can 10199be applied. 10200The default value is 40. 10201 10202@item inline-min-speedup 10203When estimated performance improvement of caller + callee runtime exceeds this 10204threshold (in precent), the function can be inlined regardless the limit on 10205@option{--param max-inline-insns-single} and @option{--param 10206max-inline-insns-auto}. 10207 10208@item large-function-insns 10209The limit specifying really large functions. For functions larger than this 10210limit after inlining, inlining is constrained by 10211@option{--param large-function-growth}. This parameter is useful primarily 10212to avoid extreme compilation time caused by non-linear algorithms used by the 10213back end. 10214The default value is 2700. 10215 10216@item large-function-growth 10217Specifies maximal growth of large function caused by inlining in percents. 10218The default value is 100 which limits large function growth to 2.0 times 10219the original size. 10220 10221@item large-unit-insns 10222The limit specifying large translation unit. Growth caused by inlining of 10223units larger than this limit is limited by @option{--param inline-unit-growth}. 10224For small units this might be too tight. 10225For example, consider a unit consisting of function A 10226that is inline and B that just calls A three times. If B is small relative to 10227A, the growth of unit is 300\% and yet such inlining is very sane. For very 10228large units consisting of small inlineable functions, however, the overall unit 10229growth limit is needed to avoid exponential explosion of code size. Thus for 10230smaller units, the size is increased to @option{--param large-unit-insns} 10231before applying @option{--param inline-unit-growth}. The default is 10000. 10232 10233@item inline-unit-growth 10234Specifies maximal overall growth of the compilation unit caused by inlining. 10235The default value is 20 which limits unit growth to 1.2 times the original 10236size. Cold functions (either marked cold via an attribute or by profile 10237feedback) are not accounted into the unit size. 10238 10239@item ipcp-unit-growth 10240Specifies maximal overall growth of the compilation unit caused by 10241interprocedural constant propagation. The default value is 10 which limits 10242unit growth to 1.1 times the original size. 10243 10244@item large-stack-frame 10245The limit specifying large stack frames. While inlining the algorithm is trying 10246to not grow past this limit too much. The default value is 256 bytes. 10247 10248@item large-stack-frame-growth 10249Specifies maximal growth of large stack frames caused by inlining in percents. 10250The default value is 1000 which limits large stack frame growth to 11 times 10251the original size. 10252 10253@item max-inline-insns-recursive 10254@itemx max-inline-insns-recursive-auto 10255Specifies the maximum number of instructions an out-of-line copy of a 10256self-recursive inline 10257function can grow into by performing recursive inlining. 10258 10259@option{--param max-inline-insns-recursive} applies to functions 10260declared inline. 10261For functions not declared inline, recursive inlining 10262happens only when @option{-finline-functions} (included in @option{-O3}) is 10263enabled; @option{--param max-inline-insns-recursive-auto} applies instead. The 10264default value is 450. 10265 10266@item max-inline-recursive-depth 10267@itemx max-inline-recursive-depth-auto 10268Specifies the maximum recursion depth used for recursive inlining. 10269 10270@option{--param max-inline-recursive-depth} applies to functions 10271declared inline. For functions not declared inline, recursive inlining 10272happens only when @option{-finline-functions} (included in @option{-O3}) is 10273enabled; @option{--param max-inline-recursive-depth-auto} applies instead. The 10274default value is 8. 10275 10276@item min-inline-recursive-probability 10277Recursive inlining is profitable only for function having deep recursion 10278in average and can hurt for function having little recursion depth by 10279increasing the prologue size or complexity of function body to other 10280optimizers. 10281 10282When profile feedback is available (see @option{-fprofile-generate}) the actual 10283recursion depth can be guessed from probability that function recurses via a 10284given call expression. This parameter limits inlining only to call expressions 10285whose probability exceeds the given threshold (in percents). 10286The default value is 10. 10287 10288@item early-inlining-insns 10289Specify growth that the early inliner can make. In effect it increases 10290the amount of inlining for code having a large abstraction penalty. 10291The default value is 14. 10292 10293@item max-early-inliner-iterations 10294Limit of iterations of the early inliner. This basically bounds 10295the number of nested indirect calls the early inliner can resolve. 10296Deeper chains are still handled by late inlining. 10297 10298@item comdat-sharing-probability 10299Probability (in percent) that C++ inline function with comdat visibility 10300are shared across multiple compilation units. The default value is 20. 10301 10302@item profile-func-internal-id 10303A parameter to control whether to use function internal id in profile 10304database lookup. If the value is 0, the compiler uses an id that 10305is based on function assembler name and filename, which makes old profile 10306data more tolerant to source changes such as function reordering etc. 10307The default value is 0. 10308 10309@item min-vect-loop-bound 10310The minimum number of iterations under which loops are not vectorized 10311when @option{-ftree-vectorize} is used. The number of iterations after 10312vectorization needs to be greater than the value specified by this option 10313to allow vectorization. The default value is 0. 10314 10315@item gcse-cost-distance-ratio 10316Scaling factor in calculation of maximum distance an expression 10317can be moved by GCSE optimizations. This is currently supported only in the 10318code hoisting pass. The bigger the ratio, the more aggressive code hoisting 10319is with simple expressions, i.e., the expressions that have cost 10320less than @option{gcse-unrestricted-cost}. Specifying 0 disables 10321hoisting of simple expressions. The default value is 10. 10322 10323@item gcse-unrestricted-cost 10324Cost, roughly measured as the cost of a single typical machine 10325instruction, at which GCSE optimizations do not constrain 10326the distance an expression can travel. This is currently 10327supported only in the code hoisting pass. The lesser the cost, 10328the more aggressive code hoisting is. Specifying 0 10329allows all expressions to travel unrestricted distances. 10330The default value is 3. 10331 10332@item max-hoist-depth 10333The depth of search in the dominator tree for expressions to hoist. 10334This is used to avoid quadratic behavior in hoisting algorithm. 10335The value of 0 does not limit on the search, but may slow down compilation 10336of huge functions. The default value is 30. 10337 10338@item max-tail-merge-comparisons 10339The maximum amount of similar bbs to compare a bb with. This is used to 10340avoid quadratic behavior in tree tail merging. The default value is 10. 10341 10342@item max-tail-merge-iterations 10343The maximum amount of iterations of the pass over the function. This is used to 10344limit compilation time in tree tail merging. The default value is 2. 10345 10346@item max-unrolled-insns 10347The maximum number of instructions that a loop may have to be unrolled. 10348If a loop is unrolled, this parameter also determines how many times 10349the loop code is unrolled. 10350 10351@item max-average-unrolled-insns 10352The maximum number of instructions biased by probabilities of their execution 10353that a loop may have to be unrolled. If a loop is unrolled, 10354this parameter also determines how many times the loop code is unrolled. 10355 10356@item max-unroll-times 10357The maximum number of unrollings of a single loop. 10358 10359@item max-peeled-insns 10360The maximum number of instructions that a loop may have to be peeled. 10361If a loop is peeled, this parameter also determines how many times 10362the loop code is peeled. 10363 10364@item max-peel-times 10365The maximum number of peelings of a single loop. 10366 10367@item max-peel-branches 10368The maximum number of branches on the hot path through the peeled sequence. 10369 10370@item max-completely-peeled-insns 10371The maximum number of insns of a completely peeled loop. 10372 10373@item max-completely-peel-times 10374The maximum number of iterations of a loop to be suitable for complete peeling. 10375 10376@item max-completely-peel-loop-nest-depth 10377The maximum depth of a loop nest suitable for complete peeling. 10378 10379@item max-unswitch-insns 10380The maximum number of insns of an unswitched loop. 10381 10382@item max-unswitch-level 10383The maximum number of branches unswitched in a single loop. 10384 10385@item lim-expensive 10386The minimum cost of an expensive expression in the loop invariant motion. 10387 10388@item iv-consider-all-candidates-bound 10389Bound on number of candidates for induction variables, below which 10390all candidates are considered for each use in induction variable 10391optimizations. If there are more candidates than this, 10392only the most relevant ones are considered to avoid quadratic time complexity. 10393 10394@item iv-max-considered-uses 10395The induction variable optimizations give up on loops that contain more 10396induction variable uses. 10397 10398@item iv-always-prune-cand-set-bound 10399If the number of candidates in the set is smaller than this value, 10400always try to remove unnecessary ivs from the set 10401when adding a new one. 10402 10403@item scev-max-expr-size 10404Bound on size of expressions used in the scalar evolutions analyzer. 10405Large expressions slow the analyzer. 10406 10407@item scev-max-expr-complexity 10408Bound on the complexity of the expressions in the scalar evolutions analyzer. 10409Complex expressions slow the analyzer. 10410 10411@item omega-max-vars 10412The maximum number of variables in an Omega constraint system. 10413The default value is 128. 10414 10415@item omega-max-geqs 10416The maximum number of inequalities in an Omega constraint system. 10417The default value is 256. 10418 10419@item omega-max-eqs 10420The maximum number of equalities in an Omega constraint system. 10421The default value is 128. 10422 10423@item omega-max-wild-cards 10424The maximum number of wildcard variables that the Omega solver is 10425able to insert. The default value is 18. 10426 10427@item omega-hash-table-size 10428The size of the hash table in the Omega solver. The default value is 10429550. 10430 10431@item omega-max-keys 10432The maximal number of keys used by the Omega solver. The default 10433value is 500. 10434 10435@item omega-eliminate-redundant-constraints 10436When set to 1, use expensive methods to eliminate all redundant 10437constraints. The default value is 0. 10438 10439@item vect-max-version-for-alignment-checks 10440The maximum number of run-time checks that can be performed when 10441doing loop versioning for alignment in the vectorizer. 10442 10443@item vect-max-version-for-alias-checks 10444The maximum number of run-time checks that can be performed when 10445doing loop versioning for alias in the vectorizer. 10446 10447@item vect-max-peeling-for-alignment 10448The maximum number of loop peels to enhance access alignment 10449for vectorizer. Value -1 means 'no limit'. 10450 10451@item max-iterations-to-track 10452The maximum number of iterations of a loop the brute-force algorithm 10453for analysis of the number of iterations of the loop tries to evaluate. 10454 10455@item hot-bb-count-ws-permille 10456A basic block profile count is considered hot if it contributes to 10457the given permillage (i.e. 0...1000) of the entire profiled execution. 10458 10459@item hot-bb-frequency-fraction 10460Select fraction of the entry block frequency of executions of basic block in 10461function given basic block needs to have to be considered hot. 10462 10463@item max-predicted-iterations 10464The maximum number of loop iterations we predict statically. This is useful 10465in cases where a function contains a single loop with known bound and 10466another loop with unknown bound. 10467The known number of iterations is predicted correctly, while 10468the unknown number of iterations average to roughly 10. This means that the 10469loop without bounds appears artificially cold relative to the other one. 10470 10471@item builtin-expect-probability 10472Control the probability of the expression having the specified value. This 10473parameter takes a percentage (i.e. 0 ... 100) as input. 10474The default probability of 90 is obtained empirically. 10475 10476@item align-threshold 10477 10478Select fraction of the maximal frequency of executions of a basic block in 10479a function to align the basic block. 10480 10481@item align-loop-iterations 10482 10483A loop expected to iterate at least the selected number of iterations is 10484aligned. 10485 10486@item tracer-dynamic-coverage 10487@itemx tracer-dynamic-coverage-feedback 10488 10489This value is used to limit superblock formation once the given percentage of 10490executed instructions is covered. This limits unnecessary code size 10491expansion. 10492 10493The @option{tracer-dynamic-coverage-feedback} parameter 10494is used only when profile 10495feedback is available. The real profiles (as opposed to statically estimated 10496ones) are much less balanced allowing the threshold to be larger value. 10497 10498@item tracer-max-code-growth 10499Stop tail duplication once code growth has reached given percentage. This is 10500a rather artificial limit, as most of the duplicates are eliminated later in 10501cross jumping, so it may be set to much higher values than is the desired code 10502growth. 10503 10504@item tracer-min-branch-ratio 10505 10506Stop reverse growth when the reverse probability of best edge is less than this 10507threshold (in percent). 10508 10509@item tracer-min-branch-ratio 10510@itemx tracer-min-branch-ratio-feedback 10511 10512Stop forward growth if the best edge has probability lower than this 10513threshold. 10514 10515Similarly to @option{tracer-dynamic-coverage} two values are present, one for 10516compilation for profile feedback and one for compilation without. The value 10517for compilation with profile feedback needs to be more conservative (higher) in 10518order to make tracer effective. 10519 10520@item max-cse-path-length 10521 10522The maximum number of basic blocks on path that CSE considers. 10523The default is 10. 10524 10525@item max-cse-insns 10526The maximum number of instructions CSE processes before flushing. 10527The default is 1000. 10528 10529@item ggc-min-expand 10530 10531GCC uses a garbage collector to manage its own memory allocation. This 10532parameter specifies the minimum percentage by which the garbage 10533collector's heap should be allowed to expand between collections. 10534Tuning this may improve compilation speed; it has no effect on code 10535generation. 10536 10537The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when 10538RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is 10539the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If 10540GCC is not able to calculate RAM on a particular platform, the lower 10541bound of 30% is used. Setting this parameter and 10542@option{ggc-min-heapsize} to zero causes a full collection to occur at 10543every opportunity. This is extremely slow, but can be useful for 10544debugging. 10545 10546@item ggc-min-heapsize 10547 10548Minimum size of the garbage collector's heap before it begins bothering 10549to collect garbage. The first collection occurs after the heap expands 10550by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again, 10551tuning this may improve compilation speed, and has no effect on code 10552generation. 10553 10554The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that 10555tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but 10556with a lower bound of 4096 (four megabytes) and an upper bound of 10557131072 (128 megabytes). If GCC is not able to calculate RAM on a 10558particular platform, the lower bound is used. Setting this parameter 10559very large effectively disables garbage collection. Setting this 10560parameter and @option{ggc-min-expand} to zero causes a full collection 10561to occur at every opportunity. 10562 10563@item max-reload-search-insns 10564The maximum number of instruction reload should look backward for equivalent 10565register. Increasing values mean more aggressive optimization, making the 10566compilation time increase with probably slightly better performance. 10567The default value is 100. 10568 10569@item max-cselib-memory-locations 10570The maximum number of memory locations cselib should take into account. 10571Increasing values mean more aggressive optimization, making the compilation time 10572increase with probably slightly better performance. The default value is 500. 10573 10574@item reorder-blocks-duplicate 10575@itemx reorder-blocks-duplicate-feedback 10576 10577Used by the basic block reordering pass to decide whether to use unconditional 10578branch or duplicate the code on its destination. Code is duplicated when its 10579estimated size is smaller than this value multiplied by the estimated size of 10580unconditional jump in the hot spots of the program. 10581 10582The @option{reorder-block-duplicate-feedback} parameter 10583is used only when profile 10584feedback is available. It may be set to higher values than 10585@option{reorder-block-duplicate} since information about the hot spots is more 10586accurate. 10587 10588@item max-sched-ready-insns 10589The maximum number of instructions ready to be issued the scheduler should 10590consider at any given time during the first scheduling pass. Increasing 10591values mean more thorough searches, making the compilation time increase 10592with probably little benefit. The default value is 100. 10593 10594@item max-sched-region-blocks 10595The maximum number of blocks in a region to be considered for 10596interblock scheduling. The default value is 10. 10597 10598@item max-pipeline-region-blocks 10599The maximum number of blocks in a region to be considered for 10600pipelining in the selective scheduler. The default value is 15. 10601 10602@item max-sched-region-insns 10603The maximum number of insns in a region to be considered for 10604interblock scheduling. The default value is 100. 10605 10606@item max-pipeline-region-insns 10607The maximum number of insns in a region to be considered for 10608pipelining in the selective scheduler. The default value is 200. 10609 10610@item min-spec-prob 10611The minimum probability (in percents) of reaching a source block 10612for interblock speculative scheduling. The default value is 40. 10613 10614@item max-sched-extend-regions-iters 10615The maximum number of iterations through CFG to extend regions. 10616A value of 0 (the default) disables region extensions. 10617 10618@item max-sched-insn-conflict-delay 10619The maximum conflict delay for an insn to be considered for speculative motion. 10620The default value is 3. 10621 10622@item sched-spec-prob-cutoff 10623The minimal probability of speculation success (in percents), so that 10624speculative insns are scheduled. 10625The default value is 40. 10626 10627@item sched-spec-state-edge-prob-cutoff 10628The minimum probability an edge must have for the scheduler to save its 10629state across it. 10630The default value is 10. 10631 10632@item sched-mem-true-dep-cost 10633Minimal distance (in CPU cycles) between store and load targeting same 10634memory locations. The default value is 1. 10635 10636@item selsched-max-lookahead 10637The maximum size of the lookahead window of selective scheduling. It is a 10638depth of search for available instructions. 10639The default value is 50. 10640 10641@item selsched-max-sched-times 10642The maximum number of times that an instruction is scheduled during 10643selective scheduling. This is the limit on the number of iterations 10644through which the instruction may be pipelined. The default value is 2. 10645 10646@item selsched-max-insns-to-rename 10647The maximum number of best instructions in the ready list that are considered 10648for renaming in the selective scheduler. The default value is 2. 10649 10650@item sms-min-sc 10651The minimum value of stage count that swing modulo scheduler 10652generates. The default value is 2. 10653 10654@item max-last-value-rtl 10655The maximum size measured as number of RTLs that can be recorded in an expression 10656in combiner for a pseudo register as last known value of that register. The default 10657is 10000. 10658 10659@item max-combine-insns 10660The maximum number of instructions the RTL combiner tries to combine. 10661The default value is 2 at @option{-Og} and 4 otherwise. 10662 10663@item integer-share-limit 10664Small integer constants can use a shared data structure, reducing the 10665compiler's memory usage and increasing its speed. This sets the maximum 10666value of a shared integer constant. The default value is 256. 10667 10668@item ssp-buffer-size 10669The minimum size of buffers (i.e.@: arrays) that receive stack smashing 10670protection when @option{-fstack-protection} is used. 10671 10672@item min-size-for-stack-sharing 10673The minimum size of variables taking part in stack slot sharing when not 10674optimizing. The default value is 32. 10675 10676@item max-jump-thread-duplication-stmts 10677Maximum number of statements allowed in a block that needs to be 10678duplicated when threading jumps. 10679 10680@item max-fields-for-field-sensitive 10681Maximum number of fields in a structure treated in 10682a field sensitive manner during pointer analysis. The default is zero 10683for @option{-O0} and @option{-O1}, 10684and 100 for @option{-Os}, @option{-O2}, and @option{-O3}. 10685 10686@item prefetch-latency 10687Estimate on average number of instructions that are executed before 10688prefetch finishes. The distance prefetched ahead is proportional 10689to this constant. Increasing this number may also lead to less 10690streams being prefetched (see @option{simultaneous-prefetches}). 10691 10692@item simultaneous-prefetches 10693Maximum number of prefetches that can run at the same time. 10694 10695@item l1-cache-line-size 10696The size of cache line in L1 cache, in bytes. 10697 10698@item l1-cache-size 10699The size of L1 cache, in kilobytes. 10700 10701@item l2-cache-size 10702The size of L2 cache, in kilobytes. 10703 10704@item min-insn-to-prefetch-ratio 10705The minimum ratio between the number of instructions and the 10706number of prefetches to enable prefetching in a loop. 10707 10708@item prefetch-min-insn-to-mem-ratio 10709The minimum ratio between the number of instructions and the 10710number of memory references to enable prefetching in a loop. 10711 10712@item use-canonical-types 10713Whether the compiler should use the ``canonical'' type system. By 10714default, this should always be 1, which uses a more efficient internal 10715mechanism for comparing types in C++ and Objective-C++. However, if 10716bugs in the canonical type system are causing compilation failures, 10717set this value to 0 to disable canonical types. 10718 10719@item switch-conversion-max-branch-ratio 10720Switch initialization conversion refuses to create arrays that are 10721bigger than @option{switch-conversion-max-branch-ratio} times the number of 10722branches in the switch. 10723 10724@item max-partial-antic-length 10725Maximum length of the partial antic set computed during the tree 10726partial redundancy elimination optimization (@option{-ftree-pre}) when 10727optimizing at @option{-O3} and above. For some sorts of source code 10728the enhanced partial redundancy elimination optimization can run away, 10729consuming all of the memory available on the host machine. This 10730parameter sets a limit on the length of the sets that are computed, 10731which prevents the runaway behavior. Setting a value of 0 for 10732this parameter allows an unlimited set length. 10733 10734@item sccvn-max-scc-size 10735Maximum size of a strongly connected component (SCC) during SCCVN 10736processing. If this limit is hit, SCCVN processing for the whole 10737function is not done and optimizations depending on it are 10738disabled. The default maximum SCC size is 10000. 10739 10740@item sccvn-max-alias-queries-per-access 10741Maximum number of alias-oracle queries we perform when looking for 10742redundancies for loads and stores. If this limit is hit the search 10743is aborted and the load or store is not considered redundant. The 10744number of queries is algorithmically limited to the number of 10745stores on all paths from the load to the function entry. 10746The default maxmimum number of queries is 1000. 10747 10748@item ira-max-loops-num 10749IRA uses regional register allocation by default. If a function 10750contains more loops than the number given by this parameter, only at most 10751the given number of the most frequently-executed loops form regions 10752for regional register allocation. The default value of the 10753parameter is 100. 10754 10755@item ira-max-conflict-table-size 10756Although IRA uses a sophisticated algorithm to compress the conflict 10757table, the table can still require excessive amounts of memory for 10758huge functions. If the conflict table for a function could be more 10759than the size in MB given by this parameter, the register allocator 10760instead uses a faster, simpler, and lower-quality 10761algorithm that does not require building a pseudo-register conflict table. 10762The default value of the parameter is 2000. 10763 10764@item ira-loop-reserved-regs 10765IRA can be used to evaluate more accurate register pressure in loops 10766for decisions to move loop invariants (see @option{-O3}). The number 10767of available registers reserved for some other purposes is given 10768by this parameter. The default value of the parameter is 2, which is 10769the minimal number of registers needed by typical instructions. 10770This value is the best found from numerous experiments. 10771 10772@item lra-inheritance-ebb-probability-cutoff 10773LRA tries to reuse values reloaded in registers in subsequent insns. 10774This optimization is called inheritance. EBB is used as a region to 10775do this optimization. The parameter defines a minimal fall-through 10776edge probability in percentage used to add BB to inheritance EBB in 10777LRA. The default value of the parameter is 40. The value was chosen 10778from numerous runs of SPEC2000 on x86-64. 10779 10780@item loop-invariant-max-bbs-in-loop 10781Loop invariant motion can be very expensive, both in compilation time and 10782in amount of needed compile-time memory, with very large loops. Loops 10783with more basic blocks than this parameter won't have loop invariant 10784motion optimization performed on them. The default value of the 10785parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above. 10786 10787@item loop-max-datarefs-for-datadeps 10788Building data dapendencies is expensive for very large loops. This 10789parameter limits the number of data references in loops that are 10790considered for data dependence analysis. These large loops are no 10791handled by the optimizations using loop data dependencies. 10792The default value is 1000. 10793 10794@item max-vartrack-size 10795Sets a maximum number of hash table slots to use during variable 10796tracking dataflow analysis of any function. If this limit is exceeded 10797with variable tracking at assignments enabled, analysis for that 10798function is retried without it, after removing all debug insns from 10799the function. If the limit is exceeded even without debug insns, var 10800tracking analysis is completely disabled for the function. Setting 10801the parameter to zero makes it unlimited. 10802 10803@item max-vartrack-expr-depth 10804Sets a maximum number of recursion levels when attempting to map 10805variable names or debug temporaries to value expressions. This trades 10806compilation time for more complete debug information. If this is set too 10807low, value expressions that are available and could be represented in 10808debug information may end up not being used; setting this higher may 10809enable the compiler to find more complex debug expressions, but compile 10810time and memory use may grow. The default is 12. 10811 10812@item min-nondebug-insn-uid 10813Use uids starting at this parameter for nondebug insns. The range below 10814the parameter is reserved exclusively for debug insns created by 10815@option{-fvar-tracking-assignments}, but debug insns may get 10816(non-overlapping) uids above it if the reserved range is exhausted. 10817 10818@item ipa-sra-ptr-growth-factor 10819IPA-SRA replaces a pointer to an aggregate with one or more new 10820parameters only when their cumulative size is less or equal to 10821@option{ipa-sra-ptr-growth-factor} times the size of the original 10822pointer parameter. 10823 10824@item sra-max-scalarization-size-Ospeed 10825@item sra-max-scalarization-size-Osize 10826The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to 10827replace scalar parts of aggregates with uses of independent scalar 10828variables. These parameters control the maximum size, in storage units, 10829of aggregate which is considered for replacement when compiling for 10830speed 10831(@option{sra-max-scalarization-size-Ospeed}) or size 10832(@option{sra-max-scalarization-size-Osize}) respectively. 10833 10834@item tm-max-aggregate-size 10835When making copies of thread-local variables in a transaction, this 10836parameter specifies the size in bytes after which variables are 10837saved with the logging functions as opposed to save/restore code 10838sequence pairs. This option only applies when using 10839@option{-fgnu-tm}. 10840 10841@item graphite-max-nb-scop-params 10842To avoid exponential effects in the Graphite loop transforms, the 10843number of parameters in a Static Control Part (SCoP) is bounded. The 10844default value is 10 parameters. A variable whose value is unknown at 10845compilation time and defined outside a SCoP is a parameter of the SCoP. 10846 10847@item graphite-max-bbs-per-function 10848To avoid exponential effects in the detection of SCoPs, the size of 10849the functions analyzed by Graphite is bounded. The default value is 10850100 basic blocks. 10851 10852@item loop-block-tile-size 10853Loop blocking or strip mining transforms, enabled with 10854@option{-floop-block} or @option{-floop-strip-mine}, strip mine each 10855loop in the loop nest by a given number of iterations. The strip 10856length can be changed using the @option{loop-block-tile-size} 10857parameter. The default value is 51 iterations. 10858 10859@item loop-unroll-jam-size 10860Specify the unroll factor for the @option{-floop-unroll-and-jam} option. The 10861default value is 4. 10862 10863@item loop-unroll-jam-depth 10864Specify the dimension to be unrolled (counting from the most inner loop) 10865for the @option{-floop-unroll-and-jam}. The default value is 2. 10866 10867@item ipa-cp-value-list-size 10868IPA-CP attempts to track all possible values and types passed to a function's 10869parameter in order to propagate them and perform devirtualization. 10870@option{ipa-cp-value-list-size} is the maximum number of values and types it 10871stores per one formal parameter of a function. 10872 10873@item ipa-cp-eval-threshold 10874IPA-CP calculates its own score of cloning profitability heuristics 10875and performs those cloning opportunities with scores that exceed 10876@option{ipa-cp-eval-threshold}. 10877 10878@item ipa-cp-recursion-penalty 10879Percentage penalty the recursive functions will receive when they 10880are evaluated for cloning. 10881 10882@item ipa-cp-single-call-penalty 10883Percentage penalty functions containg a single call to another 10884function will receive when they are evaluated for cloning. 10885 10886 10887@item ipa-max-agg-items 10888IPA-CP is also capable to propagate a number of scalar values passed 10889in an aggregate. @option{ipa-max-agg-items} controls the maximum 10890number of such values per one parameter. 10891 10892@item ipa-cp-loop-hint-bonus 10893When IPA-CP determines that a cloning candidate would make the number 10894of iterations of a loop known, it adds a bonus of 10895@option{ipa-cp-loop-hint-bonus} to the profitability score of 10896the candidate. 10897 10898@item ipa-cp-array-index-hint-bonus 10899When IPA-CP determines that a cloning candidate would make the index of 10900an array access known, it adds a bonus of 10901@option{ipa-cp-array-index-hint-bonus} to the profitability 10902score of the candidate. 10903 10904@item ipa-max-aa-steps 10905During its analysis of function bodies, IPA-CP employs alias analysis 10906in order to track values pointed to by function parameters. In order 10907not spend too much time analyzing huge functions, it gives up and 10908consider all memory clobbered after examining 10909@option{ipa-max-aa-steps} statements modifying memory. 10910 10911@item lto-partitions 10912Specify desired number of partitions produced during WHOPR compilation. 10913The number of partitions should exceed the number of CPUs used for compilation. 10914The default value is 32. 10915 10916@item lto-minpartition 10917Size of minimal partition for WHOPR (in estimated instructions). 10918This prevents expenses of splitting very small programs into too many 10919partitions. 10920 10921@item cxx-max-namespaces-for-diagnostic-help 10922The maximum number of namespaces to consult for suggestions when C++ 10923name lookup fails for an identifier. The default is 1000. 10924 10925@item sink-frequency-threshold 10926The maximum relative execution frequency (in percents) of the target block 10927relative to a statement's original block to allow statement sinking of a 10928statement. Larger numbers result in more aggressive statement sinking. 10929The default value is 75. A small positive adjustment is applied for 10930statements with memory operands as those are even more profitable so sink. 10931 10932@item max-stores-to-sink 10933The maximum number of conditional stores paires that can be sunk. Set to 0 10934if either vectorization (@option{-ftree-vectorize}) or if-conversion 10935(@option{-ftree-loop-if-convert}) is disabled. The default is 2. 10936 10937@item allow-store-data-races 10938Allow optimizers to introduce new data races on stores. 10939Set to 1 to allow, otherwise to 0. This option is enabled by default 10940at optimization level @option{-Ofast}. 10941 10942@item case-values-threshold 10943The smallest number of different values for which it is best to use a 10944jump-table instead of a tree of conditional branches. If the value is 109450, use the default for the machine. The default is 0. 10946 10947@item tree-reassoc-width 10948Set the maximum number of instructions executed in parallel in 10949reassociated tree. This parameter overrides target dependent 10950heuristics used by default if has non zero value. 10951 10952@item sched-pressure-algorithm 10953Choose between the two available implementations of 10954@option{-fsched-pressure}. Algorithm 1 is the original implementation 10955and is the more likely to prevent instructions from being reordered. 10956Algorithm 2 was designed to be a compromise between the relatively 10957conservative approach taken by algorithm 1 and the rather aggressive 10958approach taken by the default scheduler. It relies more heavily on 10959having a regular register file and accurate register pressure classes. 10960See @file{haifa-sched.c} in the GCC sources for more details. 10961 10962The default choice depends on the target. 10963 10964@item max-slsr-cand-scan 10965Set the maximum number of existing candidates that are considered when 10966seeking a basis for a new straight-line strength reduction candidate. 10967 10968@item asan-globals 10969Enable buffer overflow detection for global objects. This kind 10970of protection is enabled by default if you are using 10971@option{-fsanitize=address} option. 10972To disable global objects protection use @option{--param asan-globals=0}. 10973 10974@item asan-stack 10975Enable buffer overflow detection for stack objects. This kind of 10976protection is enabled by default when using@option{-fsanitize=address}. 10977To disable stack protection use @option{--param asan-stack=0} option. 10978 10979@item asan-instrument-reads 10980Enable buffer overflow detection for memory reads. This kind of 10981protection is enabled by default when using @option{-fsanitize=address}. 10982To disable memory reads protection use 10983@option{--param asan-instrument-reads=0}. 10984 10985@item asan-instrument-writes 10986Enable buffer overflow detection for memory writes. This kind of 10987protection is enabled by default when using @option{-fsanitize=address}. 10988To disable memory writes protection use 10989@option{--param asan-instrument-writes=0} option. 10990 10991@item asan-memintrin 10992Enable detection for built-in functions. This kind of protection 10993is enabled by default when using @option{-fsanitize=address}. 10994To disable built-in functions protection use 10995@option{--param asan-memintrin=0}. 10996 10997@item asan-use-after-return 10998Enable detection of use-after-return. This kind of protection 10999is enabled by default when using @option{-fsanitize=address} option. 11000To disable use-after-return detection use 11001@option{--param asan-use-after-return=0}. 11002 11003@item asan-instrumentation-with-call-threshold 11004If number of memory accesses in function being instrumented 11005is greater or equal to this number, use callbacks instead of inline checks. 11006E.g. to disable inline code use 11007@option{--param asan-instrumentation-with-call-threshold=0}. 11008 11009@item chkp-max-ctor-size 11010Static constructors generated by Pointer Bounds Checker may become very 11011large and significantly increase compile time at optimization level 11012@option{-O1} and higher. This parameter is a maximum nubmer of statements 11013in a single generated constructor. Default value is 5000. 11014 11015@item max-fsm-thread-path-insns 11016Maximum number of instructions to copy when duplicating blocks on a 11017finite state automaton jump thread path. The default is 100. 11018 11019@item max-fsm-thread-length 11020Maximum number of basic blocks on a finite state automaton jump thread 11021path. The default is 10. 11022 11023@item max-fsm-thread-paths 11024Maximum number of new jump thread paths to create for a finite state 11025automaton. The default is 50. 11026 11027@end table 11028@end table 11029 11030@node Preprocessor Options 11031@section Options Controlling the Preprocessor 11032@cindex preprocessor options 11033@cindex options, preprocessor 11034 11035These options control the C preprocessor, which is run on each C source 11036file before actual compilation. 11037 11038If you use the @option{-E} option, nothing is done except preprocessing. 11039Some of these options make sense only together with @option{-E} because 11040they cause the preprocessor output to be unsuitable for actual 11041compilation. 11042 11043@table @gcctabopt 11044@item -Wp,@var{option} 11045@opindex Wp 11046You can use @option{-Wp,@var{option}} to bypass the compiler driver 11047and pass @var{option} directly through to the preprocessor. If 11048@var{option} contains commas, it is split into multiple options at the 11049commas. However, many options are modified, translated or interpreted 11050by the compiler driver before being passed to the preprocessor, and 11051@option{-Wp} forcibly bypasses this phase. The preprocessor's direct 11052interface is undocumented and subject to change, so whenever possible 11053you should avoid using @option{-Wp} and let the driver handle the 11054options instead. 11055 11056@item -Xpreprocessor @var{option} 11057@opindex Xpreprocessor 11058Pass @var{option} as an option to the preprocessor. You can use this to 11059supply system-specific preprocessor options that GCC does not 11060recognize. 11061 11062If you want to pass an option that takes an argument, you must use 11063@option{-Xpreprocessor} twice, once for the option and once for the argument. 11064 11065@item -no-integrated-cpp 11066@opindex no-integrated-cpp 11067Perform preprocessing as a separate pass before compilation. 11068By default, GCC performs preprocessing as an integrated part of 11069input tokenization and parsing. 11070If this option is provided, the appropriate language front end 11071(@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++, 11072and Objective-C, respectively) is instead invoked twice, 11073once for preprocessing only and once for actual compilation 11074of the preprocessed input. 11075This option may be useful in conjunction with the @option{-B} or 11076@option{-wrapper} options to specify an alternate preprocessor or 11077perform additional processing of the program source between 11078normal preprocessing and compilation. 11079@end table 11080 11081@include cppopts.texi 11082 11083@node Assembler Options 11084@section Passing Options to the Assembler 11085 11086@c prevent bad page break with this line 11087You can pass options to the assembler. 11088 11089@table @gcctabopt 11090@item -Wa,@var{option} 11091@opindex Wa 11092Pass @var{option} as an option to the assembler. If @var{option} 11093contains commas, it is split into multiple options at the commas. 11094 11095@item -Xassembler @var{option} 11096@opindex Xassembler 11097Pass @var{option} as an option to the assembler. You can use this to 11098supply system-specific assembler options that GCC does not 11099recognize. 11100 11101If you want to pass an option that takes an argument, you must use 11102@option{-Xassembler} twice, once for the option and once for the argument. 11103 11104@end table 11105 11106@node Link Options 11107@section Options for Linking 11108@cindex link options 11109@cindex options, linking 11110 11111These options come into play when the compiler links object files into 11112an executable output file. They are meaningless if the compiler is 11113not doing a link step. 11114 11115@table @gcctabopt 11116@cindex file names 11117@item @var{object-file-name} 11118A file name that does not end in a special recognized suffix is 11119considered to name an object file or library. (Object files are 11120distinguished from libraries by the linker according to the file 11121contents.) If linking is done, these object files are used as input 11122to the linker. 11123 11124@item -c 11125@itemx -S 11126@itemx -E 11127@opindex c 11128@opindex S 11129@opindex E 11130If any of these options is used, then the linker is not run, and 11131object file names should not be used as arguments. @xref{Overall 11132Options}. 11133 11134@item -fuse-ld=bfd 11135@opindex fuse-ld=bfd 11136Use the @command{bfd} linker instead of the default linker. 11137 11138@item -fuse-ld=gold 11139@opindex fuse-ld=gold 11140Use the @command{gold} linker instead of the default linker. 11141 11142@cindex Libraries 11143@item -l@var{library} 11144@itemx -l @var{library} 11145@opindex l 11146Search the library named @var{library} when linking. (The second 11147alternative with the library as a separate argument is only for 11148POSIX compliance and is not recommended.) 11149 11150It makes a difference where in the command you write this option; the 11151linker searches and processes libraries and object files in the order they 11152are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z} 11153after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers 11154to functions in @samp{z}, those functions may not be loaded. 11155 11156The linker searches a standard list of directories for the library, 11157which is actually a file named @file{lib@var{library}.a}. The linker 11158then uses this file as if it had been specified precisely by name. 11159 11160The directories searched include several standard system directories 11161plus any that you specify with @option{-L}. 11162 11163Normally the files found this way are library files---archive files 11164whose members are object files. The linker handles an archive file by 11165scanning through it for members which define symbols that have so far 11166been referenced but not defined. But if the file that is found is an 11167ordinary object file, it is linked in the usual fashion. The only 11168difference between using an @option{-l} option and specifying a file name 11169is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a} 11170and searches several directories. 11171 11172@item -lobjc 11173@opindex lobjc 11174You need this special case of the @option{-l} option in order to 11175link an Objective-C or Objective-C++ program. 11176 11177@item -nostartfiles 11178@opindex nostartfiles 11179Do not use the standard system startup files when linking. 11180The standard system libraries are used normally, unless @option{-nostdlib} 11181or @option{-nodefaultlibs} is used. 11182 11183@item -nodefaultlibs 11184@opindex nodefaultlibs 11185Do not use the standard system libraries when linking. 11186Only the libraries you specify are passed to the linker, and options 11187specifying linkage of the system libraries, such as @option{-static-libgcc} 11188or @option{-shared-libgcc}, are ignored. 11189The standard startup files are used normally, unless @option{-nostartfiles} 11190is used. 11191 11192The compiler may generate calls to @code{memcmp}, 11193@code{memset}, @code{memcpy} and @code{memmove}. 11194These entries are usually resolved by entries in 11195libc. These entry points should be supplied through some other 11196mechanism when this option is specified. 11197 11198@item -nostdlib 11199@opindex nostdlib 11200Do not use the standard system startup files or libraries when linking. 11201No startup files and only the libraries you specify are passed to 11202the linker, and options specifying linkage of the system libraries, such as 11203@option{-static-libgcc} or @option{-shared-libgcc}, are ignored. 11204 11205The compiler may generate calls to @code{memcmp}, @code{memset}, 11206@code{memcpy} and @code{memmove}. 11207These entries are usually resolved by entries in 11208libc. These entry points should be supplied through some other 11209mechanism when this option is specified. 11210 11211@cindex @option{-lgcc}, use with @option{-nostdlib} 11212@cindex @option{-nostdlib} and unresolved references 11213@cindex unresolved references and @option{-nostdlib} 11214@cindex @option{-lgcc}, use with @option{-nodefaultlibs} 11215@cindex @option{-nodefaultlibs} and unresolved references 11216@cindex unresolved references and @option{-nodefaultlibs} 11217One of the standard libraries bypassed by @option{-nostdlib} and 11218@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines 11219which GCC uses to overcome shortcomings of particular machines, or special 11220needs for some languages. 11221(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler 11222Collection (GCC) Internals}, 11223for more discussion of @file{libgcc.a}.) 11224In most cases, you need @file{libgcc.a} even when you want to avoid 11225other standard libraries. In other words, when you specify @option{-nostdlib} 11226or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well. 11227This ensures that you have no unresolved references to internal GCC 11228library subroutines. 11229(An example of such an internal subroutine is @code{__main}, used to ensure C++ 11230constructors are called; @pxref{Collect2,,@code{collect2}, gccint, 11231GNU Compiler Collection (GCC) Internals}.) 11232 11233@item -pie 11234@opindex pie 11235Produce a position independent executable on targets that support it. 11236For predictable results, you must also specify the same set of options 11237used for compilation (@option{-fpie}, @option{-fPIE}, 11238or model suboptions) when you specify this linker option. 11239 11240@item -rdynamic 11241@opindex rdynamic 11242Pass the flag @option{-export-dynamic} to the ELF linker, on targets 11243that support it. This instructs the linker to add all symbols, not 11244only used ones, to the dynamic symbol table. This option is needed 11245for some uses of @code{dlopen} or to allow obtaining backtraces 11246from within a program. 11247 11248@item -s 11249@opindex s 11250Remove all symbol table and relocation information from the executable. 11251 11252@item -static 11253@opindex static 11254On systems that support dynamic linking, this prevents linking with the shared 11255libraries. On other systems, this option has no effect. 11256 11257@item -shared 11258@opindex shared 11259Produce a shared object which can then be linked with other objects to 11260form an executable. Not all systems support this option. For predictable 11261results, you must also specify the same set of options used for compilation 11262(@option{-fpic}, @option{-fPIC}, or model suboptions) when 11263you specify this linker option.@footnote{On some systems, @samp{gcc -shared} 11264needs to build supplementary stub code for constructors to work. On 11265multi-libbed systems, @samp{gcc -shared} must select the correct support 11266libraries to link against. Failing to supply the correct flags may lead 11267to subtle defects. Supplying them in cases where they are not necessary 11268is innocuous.} 11269 11270@item -shared-libgcc 11271@itemx -static-libgcc 11272@opindex shared-libgcc 11273@opindex static-libgcc 11274On systems that provide @file{libgcc} as a shared library, these options 11275force the use of either the shared or static version, respectively. 11276If no shared version of @file{libgcc} was built when the compiler was 11277configured, these options have no effect. 11278 11279There are several situations in which an application should use the 11280shared @file{libgcc} instead of the static version. The most common 11281of these is when the application wishes to throw and catch exceptions 11282across different shared libraries. In that case, each of the libraries 11283as well as the application itself should use the shared @file{libgcc}. 11284 11285Therefore, the G++ and GCJ drivers automatically add 11286@option{-shared-libgcc} whenever you build a shared library or a main 11287executable, because C++ and Java programs typically use exceptions, so 11288this is the right thing to do. 11289 11290If, instead, you use the GCC driver to create shared libraries, you may 11291find that they are not always linked with the shared @file{libgcc}. 11292If GCC finds, at its configuration time, that you have a non-GNU linker 11293or a GNU linker that does not support option @option{--eh-frame-hdr}, 11294it links the shared version of @file{libgcc} into shared libraries 11295by default. Otherwise, it takes advantage of the linker and optimizes 11296away the linking with the shared version of @file{libgcc}, linking with 11297the static version of libgcc by default. This allows exceptions to 11298propagate through such shared libraries, without incurring relocation 11299costs at library load time. 11300 11301However, if a library or main executable is supposed to throw or catch 11302exceptions, you must link it using the G++ or GCJ driver, as appropriate 11303for the languages used in the program, or using the option 11304@option{-shared-libgcc}, such that it is linked with the shared 11305@file{libgcc}. 11306 11307@item -static-libasan 11308@opindex static-libasan 11309When the @option{-fsanitize=address} option is used to link a program, 11310the GCC driver automatically links against @option{libasan}. If 11311@file{libasan} is available as a shared library, and the @option{-static} 11312option is not used, then this links against the shared version of 11313@file{libasan}. The @option{-static-libasan} option directs the GCC 11314driver to link @file{libasan} statically, without necessarily linking 11315other libraries statically. 11316 11317@item -static-libtsan 11318@opindex static-libtsan 11319When the @option{-fsanitize=thread} option is used to link a program, 11320the GCC driver automatically links against @option{libtsan}. If 11321@file{libtsan} is available as a shared library, and the @option{-static} 11322option is not used, then this links against the shared version of 11323@file{libtsan}. The @option{-static-libtsan} option directs the GCC 11324driver to link @file{libtsan} statically, without necessarily linking 11325other libraries statically. 11326 11327@item -static-liblsan 11328@opindex static-liblsan 11329When the @option{-fsanitize=leak} option is used to link a program, 11330the GCC driver automatically links against @option{liblsan}. If 11331@file{liblsan} is available as a shared library, and the @option{-static} 11332option is not used, then this links against the shared version of 11333@file{liblsan}. The @option{-static-liblsan} option directs the GCC 11334driver to link @file{liblsan} statically, without necessarily linking 11335other libraries statically. 11336 11337@item -static-libubsan 11338@opindex static-libubsan 11339When the @option{-fsanitize=undefined} option is used to link a program, 11340the GCC driver automatically links against @option{libubsan}. If 11341@file{libubsan} is available as a shared library, and the @option{-static} 11342option is not used, then this links against the shared version of 11343@file{libubsan}. The @option{-static-libubsan} option directs the GCC 11344driver to link @file{libubsan} statically, without necessarily linking 11345other libraries statically. 11346 11347@item -static-libmpx 11348@opindex static-libmpx 11349When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are 11350used to link a program, the GCC driver automatically links against 11351@file{libmpx}. If @file{libmpx} is available as a shared library, 11352and the @option{-static} option is not used, then this links against 11353the shared version of @file{libmpx}. The @option{-static-libmpx} 11354option directs the GCC driver to link @file{libmpx} statically, 11355without necessarily linking other libraries statically. 11356 11357@item -static-libmpxwrappers 11358@opindex static-libmpxwrappers 11359When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are used 11360to link a program without also using @option{-fno-chkp-use-wrappers}, the 11361GCC driver automatically links against @file{libmpxwrappers}. If 11362@file{libmpxwrappers} is available as a shared library, and the 11363@option{-static} option is not used, then this links against the shared 11364version of @file{libmpxwrappers}. The @option{-static-libmpxwrappers} 11365option directs the GCC driver to link @file{libmpxwrappers} statically, 11366without necessarily linking other libraries statically. 11367 11368@item -static-libstdc++ 11369@opindex static-libstdc++ 11370When the @command{g++} program is used to link a C++ program, it 11371normally automatically links against @option{libstdc++}. If 11372@file{libstdc++} is available as a shared library, and the 11373@option{-static} option is not used, then this links against the 11374shared version of @file{libstdc++}. That is normally fine. However, it 11375is sometimes useful to freeze the version of @file{libstdc++} used by 11376the program without going all the way to a fully static link. The 11377@option{-static-libstdc++} option directs the @command{g++} driver to 11378link @file{libstdc++} statically, without necessarily linking other 11379libraries statically. 11380 11381@item -symbolic 11382@opindex symbolic 11383Bind references to global symbols when building a shared object. Warn 11384about any unresolved references (unless overridden by the link editor 11385option @option{-Xlinker -z -Xlinker defs}). Only a few systems support 11386this option. 11387 11388@item -T @var{script} 11389@opindex T 11390@cindex linker script 11391Use @var{script} as the linker script. This option is supported by most 11392systems using the GNU linker. On some targets, such as bare-board 11393targets without an operating system, the @option{-T} option may be required 11394when linking to avoid references to undefined symbols. 11395 11396@item -Xlinker @var{option} 11397@opindex Xlinker 11398Pass @var{option} as an option to the linker. You can use this to 11399supply system-specific linker options that GCC does not recognize. 11400 11401If you want to pass an option that takes a separate argument, you must use 11402@option{-Xlinker} twice, once for the option and once for the argument. 11403For example, to pass @option{-assert definitions}, you must write 11404@option{-Xlinker -assert -Xlinker definitions}. It does not work to write 11405@option{-Xlinker "-assert definitions"}, because this passes the entire 11406string as a single argument, which is not what the linker expects. 11407 11408When using the GNU linker, it is usually more convenient to pass 11409arguments to linker options using the @option{@var{option}=@var{value}} 11410syntax than as separate arguments. For example, you can specify 11411@option{-Xlinker -Map=output.map} rather than 11412@option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support 11413this syntax for command-line options. 11414 11415@item -Wl,@var{option} 11416@opindex Wl 11417Pass @var{option} as an option to the linker. If @var{option} contains 11418commas, it is split into multiple options at the commas. You can use this 11419syntax to pass an argument to the option. 11420For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the 11421linker. When using the GNU linker, you can also get the same effect with 11422@option{-Wl,-Map=output.map}. 11423 11424@item -u @var{symbol} 11425@opindex u 11426Pretend the symbol @var{symbol} is undefined, to force linking of 11427library modules to define it. You can use @option{-u} multiple times with 11428different symbols to force loading of additional library modules. 11429 11430@item -z @var{keyword} 11431@opindex z 11432@option{-z} is passed directly on to the linker along with the keyword 11433@var{keyword}. See the section in the documentation of your linker for 11434permitted values and their meanings. 11435@end table 11436 11437@node Directory Options 11438@section Options for Directory Search 11439@cindex directory options 11440@cindex options, directory search 11441@cindex search path 11442 11443These options specify directories to search for header files, for 11444libraries and for parts of the compiler: 11445 11446@table @gcctabopt 11447@item -I@var{dir} 11448@opindex I 11449Add the directory @var{dir} to the head of the list of directories to be 11450searched for header files. This can be used to override a system header 11451file, substituting your own version, since these directories are 11452searched before the system header file directories. However, you should 11453not use this option to add directories that contain vendor-supplied 11454system header files (use @option{-isystem} for that). If you use more than 11455one @option{-I} option, the directories are scanned in left-to-right 11456order; the standard system directories come after. 11457 11458If a standard system include directory, or a directory specified with 11459@option{-isystem}, is also specified with @option{-I}, the @option{-I} 11460option is ignored. The directory is still searched but as a 11461system directory at its normal position in the system include chain. 11462This is to ensure that GCC's procedure to fix buggy system headers and 11463the ordering for the @code{include_next} directive are not inadvertently changed. 11464If you really need to change the search order for system directories, 11465use the @option{-nostdinc} and/or @option{-isystem} options. 11466 11467@item -iplugindir=@var{dir} 11468@opindex iplugindir= 11469Set the directory to search for plugins that are passed 11470by @option{-fplugin=@var{name}} instead of 11471@option{-fplugin=@var{path}/@var{name}.so}. This option is not meant 11472to be used by the user, but only passed by the driver. 11473 11474@item -iquote@var{dir} 11475@opindex iquote 11476Add the directory @var{dir} to the head of the list of directories to 11477be searched for header files only for the case of @code{#include 11478"@var{file}"}; they are not searched for @code{#include <@var{file}>}, 11479otherwise just like @option{-I}. 11480 11481@item -iremap @var{src}:@var{dst} 11482@opindex iremap 11483Replace the prefix @var{src} in __FILE__ with @var{dst} at expansion time. 11484This option can be specified more than once. Processing stops at the first 11485match. 11486 11487@item -L@var{dir} 11488@opindex L 11489Add directory @var{dir} to the list of directories to be searched 11490for @option{-l}. 11491 11492@item -B@var{prefix} 11493@opindex B 11494This option specifies where to find the executables, libraries, 11495include files, and data files of the compiler itself. 11496 11497The compiler driver program runs one or more of the subprograms 11498@command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries 11499@var{prefix} as a prefix for each program it tries to run, both with and 11500without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}). 11501 11502For each subprogram to be run, the compiler driver first tries the 11503@option{-B} prefix, if any. If that name is not found, or if @option{-B} 11504is not specified, the driver tries two standard prefixes, 11505@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of 11506those results in a file name that is found, the unmodified program 11507name is searched for using the directories specified in your 11508@env{PATH} environment variable. 11509 11510The compiler checks to see if the path provided by @option{-B} 11511refers to a directory, and if necessary it adds a directory 11512separator character at the end of the path. 11513 11514@option{-B} prefixes that effectively specify directory names also apply 11515to libraries in the linker, because the compiler translates these 11516options into @option{-L} options for the linker. They also apply to 11517include files in the preprocessor, because the compiler translates these 11518options into @option{-isystem} options for the preprocessor. In this case, 11519the compiler appends @samp{include} to the prefix. 11520 11521The runtime support file @file{libgcc.a} can also be searched for using 11522the @option{-B} prefix, if needed. If it is not found there, the two 11523standard prefixes above are tried, and that is all. The file is left 11524out of the link if it is not found by those means. 11525 11526Another way to specify a prefix much like the @option{-B} prefix is to use 11527the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment 11528Variables}. 11529 11530As a special kludge, if the path provided by @option{-B} is 11531@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to 115329, then it is replaced by @file{[dir/]include}. This is to help 11533with boot-strapping the compiler. 11534 11535@item -specs=@var{file} 11536@opindex specs 11537Process @var{file} after the compiler reads in the standard @file{specs} 11538file, in order to override the defaults which the @command{gcc} driver 11539program uses when determining what switches to pass to @command{cc1}, 11540@command{cc1plus}, @command{as}, @command{ld}, etc. More than one 11541@option{-specs=@var{file}} can be specified on the command line, and they 11542are processed in order, from left to right. 11543 11544@item --sysroot=@var{dir} 11545@opindex sysroot 11546Use @var{dir} as the logical root directory for headers and libraries. 11547For example, if the compiler normally searches for headers in 11548@file{/usr/include} and libraries in @file{/usr/lib}, it instead 11549searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}. 11550 11551If you use both this option and the @option{-isysroot} option, then 11552the @option{--sysroot} option applies to libraries, but the 11553@option{-isysroot} option applies to header files. 11554 11555The GNU linker (beginning with version 2.16) has the necessary support 11556for this option. If your linker does not support this option, the 11557header file aspect of @option{--sysroot} still works, but the 11558library aspect does not. 11559 11560@item --no-sysroot-suffix 11561@opindex no-sysroot-suffix 11562For some targets, a suffix is added to the root directory specified 11563with @option{--sysroot}, depending on the other options used, so that 11564headers may for example be found in 11565@file{@var{dir}/@var{suffix}/usr/include} instead of 11566@file{@var{dir}/usr/include}. This option disables the addition of 11567such a suffix. 11568 11569@item -I- 11570@opindex I- 11571This option has been deprecated. Please use @option{-iquote} instead for 11572@option{-I} directories before the @option{-I-} and remove the @option{-I-} 11573option. 11574Any directories you specify with @option{-I} options before the @option{-I-} 11575option are searched only for the case of @code{#include "@var{file}"}; 11576they are not searched for @code{#include <@var{file}>}. 11577 11578If additional directories are specified with @option{-I} options after 11579the @option{-I-} option, these directories are searched for all @code{#include} 11580directives. (Ordinarily @emph{all} @option{-I} directories are used 11581this way.) 11582 11583In addition, the @option{-I-} option inhibits the use of the current 11584directory (where the current input file came from) as the first search 11585directory for @code{#include "@var{file}"}. There is no way to 11586override this effect of @option{-I-}. With @option{-I.} you can specify 11587searching the directory that is current when the compiler is 11588invoked. That is not exactly the same as what the preprocessor does 11589by default, but it is often satisfactory. 11590 11591@option{-I-} does not inhibit the use of the standard system directories 11592for header files. Thus, @option{-I-} and @option{-nostdinc} are 11593independent. 11594@end table 11595 11596@c man end 11597 11598@node Spec Files 11599@section Specifying Subprocesses and the Switches to Pass to Them 11600@cindex Spec Files 11601 11602@command{gcc} is a driver program. It performs its job by invoking a 11603sequence of other programs to do the work of compiling, assembling and 11604linking. GCC interprets its command-line parameters and uses these to 11605deduce which programs it should invoke, and which command-line options 11606it ought to place on their command lines. This behavior is controlled 11607by @dfn{spec strings}. In most cases there is one spec string for each 11608program that GCC can invoke, but a few programs have multiple spec 11609strings to control their behavior. The spec strings built into GCC can 11610be overridden by using the @option{-specs=} command-line switch to specify 11611a spec file. 11612 11613@dfn{Spec files} are plaintext files that are used to construct spec 11614strings. They consist of a sequence of directives separated by blank 11615lines. The type of directive is determined by the first non-whitespace 11616character on the line, which can be one of the following: 11617 11618@table @code 11619@item %@var{command} 11620Issues a @var{command} to the spec file processor. The commands that can 11621appear here are: 11622 11623@table @code 11624@item %include <@var{file}> 11625@cindex @code{%include} 11626Search for @var{file} and insert its text at the current point in the 11627specs file. 11628 11629@item %include_noerr <@var{file}> 11630@cindex @code{%include_noerr} 11631Just like @samp{%include}, but do not generate an error message if the include 11632file cannot be found. 11633 11634@item %rename @var{old_name} @var{new_name} 11635@cindex @code{%rename} 11636Rename the spec string @var{old_name} to @var{new_name}. 11637 11638@end table 11639 11640@item *[@var{spec_name}]: 11641This tells the compiler to create, override or delete the named spec 11642string. All lines after this directive up to the next directive or 11643blank line are considered to be the text for the spec string. If this 11644results in an empty string then the spec is deleted. (Or, if the 11645spec did not exist, then nothing happens.) Otherwise, if the spec 11646does not currently exist a new spec is created. If the spec does 11647exist then its contents are overridden by the text of this 11648directive, unless the first character of that text is the @samp{+} 11649character, in which case the text is appended to the spec. 11650 11651@item [@var{suffix}]: 11652Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive 11653and up to the next directive or blank line are considered to make up the 11654spec string for the indicated suffix. When the compiler encounters an 11655input file with the named suffix, it processes the spec string in 11656order to work out how to compile that file. For example: 11657 11658@smallexample 11659.ZZ: 11660z-compile -input %i 11661@end smallexample 11662 11663This says that any input file whose name ends in @samp{.ZZ} should be 11664passed to the program @samp{z-compile}, which should be invoked with the 11665command-line switch @option{-input} and with the result of performing the 11666@samp{%i} substitution. (See below.) 11667 11668As an alternative to providing a spec string, the text following a 11669suffix directive can be one of the following: 11670 11671@table @code 11672@item @@@var{language} 11673This says that the suffix is an alias for a known @var{language}. This is 11674similar to using the @option{-x} command-line switch to GCC to specify a 11675language explicitly. For example: 11676 11677@smallexample 11678.ZZ: 11679@@c++ 11680@end smallexample 11681 11682Says that .ZZ files are, in fact, C++ source files. 11683 11684@item #@var{name} 11685This causes an error messages saying: 11686 11687@smallexample 11688@var{name} compiler not installed on this system. 11689@end smallexample 11690@end table 11691 11692GCC already has an extensive list of suffixes built into it. 11693This directive adds an entry to the end of the list of suffixes, but 11694since the list is searched from the end backwards, it is effectively 11695possible to override earlier entries using this technique. 11696 11697@end table 11698 11699GCC has the following spec strings built into it. Spec files can 11700override these strings or create their own. Note that individual 11701targets can also add their own spec strings to this list. 11702 11703@smallexample 11704asm Options to pass to the assembler 11705asm_final Options to pass to the assembler post-processor 11706cpp Options to pass to the C preprocessor 11707cc1 Options to pass to the C compiler 11708cc1plus Options to pass to the C++ compiler 11709endfile Object files to include at the end of the link 11710link Options to pass to the linker 11711lib Libraries to include on the command line to the linker 11712libgcc Decides which GCC support library to pass to the linker 11713linker Sets the name of the linker 11714predefines Defines to be passed to the C preprocessor 11715signed_char Defines to pass to CPP to say whether @code{char} is signed 11716 by default 11717startfile Object files to include at the start of the link 11718@end smallexample 11719 11720Here is a small example of a spec file: 11721 11722@smallexample 11723%rename lib old_lib 11724 11725*lib: 11726--start-group -lgcc -lc -leval1 --end-group %(old_lib) 11727@end smallexample 11728 11729This example renames the spec called @samp{lib} to @samp{old_lib} and 11730then overrides the previous definition of @samp{lib} with a new one. 11731The new definition adds in some extra command-line options before 11732including the text of the old definition. 11733 11734@dfn{Spec strings} are a list of command-line options to be passed to their 11735corresponding program. In addition, the spec strings can contain 11736@samp{%}-prefixed sequences to substitute variable text or to 11737conditionally insert text into the command line. Using these constructs 11738it is possible to generate quite complex command lines. 11739 11740Here is a table of all defined @samp{%}-sequences for spec 11741strings. Note that spaces are not generated automatically around the 11742results of expanding these sequences. Therefore you can concatenate them 11743together or combine them with constant text in a single argument. 11744 11745@table @code 11746@item %% 11747Substitute one @samp{%} into the program name or argument. 11748 11749@item %i 11750Substitute the name of the input file being processed. 11751 11752@item %b 11753Substitute the basename of the input file being processed. 11754This is the substring up to (and not including) the last period 11755and not including the directory. 11756 11757@item %B 11758This is the same as @samp{%b}, but include the file suffix (text after 11759the last period). 11760 11761@item %d 11762Marks the argument containing or following the @samp{%d} as a 11763temporary file name, so that that file is deleted if GCC exits 11764successfully. Unlike @samp{%g}, this contributes no text to the 11765argument. 11766 11767@item %g@var{suffix} 11768Substitute a file name that has suffix @var{suffix} and is chosen 11769once per compilation, and mark the argument in the same way as 11770@samp{%d}. To reduce exposure to denial-of-service attacks, the file 11771name is now chosen in a way that is hard to predict even when previously 11772chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s} 11773might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches 11774the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is 11775treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g} 11776was simply substituted with a file name chosen once per compilation, 11777without regard to any appended suffix (which was therefore treated 11778just like ordinary text), making such attacks more likely to succeed. 11779 11780@item %u@var{suffix} 11781Like @samp{%g}, but generates a new temporary file name 11782each time it appears instead of once per compilation. 11783 11784@item %U@var{suffix} 11785Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a 11786new one if there is no such last file name. In the absence of any 11787@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share 11788the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s} 11789involves the generation of two distinct file names, one 11790for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was 11791simply substituted with a file name chosen for the previous @samp{%u}, 11792without regard to any appended suffix. 11793 11794@item %j@var{suffix} 11795Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is 11796writable, and if @option{-save-temps} is not used; 11797otherwise, substitute the name 11798of a temporary file, just like @samp{%u}. This temporary file is not 11799meant for communication between processes, but rather as a junk 11800disposal mechanism. 11801 11802@item %|@var{suffix} 11803@itemx %m@var{suffix} 11804Like @samp{%g}, except if @option{-pipe} is in effect. In that case 11805@samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at 11806all. These are the two most common ways to instruct a program that it 11807should read from standard input or write to standard output. If you 11808need something more elaborate you can use an @samp{%@{pipe:@code{X}@}} 11809construct: see for example @file{f/lang-specs.h}. 11810 11811@item %.@var{SUFFIX} 11812Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args 11813when it is subsequently output with @samp{%*}. @var{SUFFIX} is 11814terminated by the next space or %. 11815 11816@item %w 11817Marks the argument containing or following the @samp{%w} as the 11818designated output file of this compilation. This puts the argument 11819into the sequence of arguments that @samp{%o} substitutes. 11820 11821@item %o 11822Substitutes the names of all the output files, with spaces 11823automatically placed around them. You should write spaces 11824around the @samp{%o} as well or the results are undefined. 11825@samp{%o} is for use in the specs for running the linker. 11826Input files whose names have no recognized suffix are not compiled 11827at all, but they are included among the output files, so they are 11828linked. 11829 11830@item %O 11831Substitutes the suffix for object files. Note that this is 11832handled specially when it immediately follows @samp{%g, %u, or %U}, 11833because of the need for those to form complete file names. The 11834handling is such that @samp{%O} is treated exactly as if it had already 11835been substituted, except that @samp{%g, %u, and %U} do not currently 11836support additional @var{suffix} characters following @samp{%O} as they do 11837following, for example, @samp{.o}. 11838 11839@item %p 11840Substitutes the standard macro predefinitions for the 11841current target machine. Use this when running @command{cpp}. 11842 11843@item %P 11844Like @samp{%p}, but puts @samp{__} before and after the name of each 11845predefined macro, except for macros that start with @samp{__} or with 11846@samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO 11847C@. 11848 11849@item %I 11850Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}), 11851@option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}), 11852@option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options) 11853and @option{-imultilib} as necessary. 11854 11855@item %s 11856Current argument is the name of a library or startup file of some sort. 11857Search for that file in a standard list of directories and substitute 11858the full name found. The current working directory is included in the 11859list of directories scanned. 11860 11861@item %T 11862Current argument is the name of a linker script. Search for that file 11863in the current list of directories to scan for libraries. If the file 11864is located insert a @option{--script} option into the command line 11865followed by the full path name found. If the file is not found then 11866generate an error message. Note: the current working directory is not 11867searched. 11868 11869@item %e@var{str} 11870Print @var{str} as an error message. @var{str} is terminated by a newline. 11871Use this when inconsistent options are detected. 11872 11873@item %(@var{name}) 11874Substitute the contents of spec string @var{name} at this point. 11875 11876@item %x@{@var{option}@} 11877Accumulate an option for @samp{%X}. 11878 11879@item %X 11880Output the accumulated linker options specified by @option{-Wl} or a @samp{%x} 11881spec string. 11882 11883@item %Y 11884Output the accumulated assembler options specified by @option{-Wa}. 11885 11886@item %Z 11887Output the accumulated preprocessor options specified by @option{-Wp}. 11888 11889@item %a 11890Process the @code{asm} spec. This is used to compute the 11891switches to be passed to the assembler. 11892 11893@item %A 11894Process the @code{asm_final} spec. This is a spec string for 11895passing switches to an assembler post-processor, if such a program is 11896needed. 11897 11898@item %l 11899Process the @code{link} spec. This is the spec for computing the 11900command line passed to the linker. Typically it makes use of the 11901@samp{%L %G %S %D and %E} sequences. 11902 11903@item %D 11904Dump out a @option{-L} option for each directory that GCC believes might 11905contain startup files. If the target supports multilibs then the 11906current multilib directory is prepended to each of these paths. 11907 11908@item %L 11909Process the @code{lib} spec. This is a spec string for deciding which 11910libraries are included on the command line to the linker. 11911 11912@item %G 11913Process the @code{libgcc} spec. This is a spec string for deciding 11914which GCC support library is included on the command line to the linker. 11915 11916@item %S 11917Process the @code{startfile} spec. This is a spec for deciding which 11918object files are the first ones passed to the linker. Typically 11919this might be a file named @file{crt0.o}. 11920 11921@item %E 11922Process the @code{endfile} spec. This is a spec string that specifies 11923the last object files that are passed to the linker. 11924 11925@item %C 11926Process the @code{cpp} spec. This is used to construct the arguments 11927to be passed to the C preprocessor. 11928 11929@item %1 11930Process the @code{cc1} spec. This is used to construct the options to be 11931passed to the actual C compiler (@command{cc1}). 11932 11933@item %2 11934Process the @code{cc1plus} spec. This is used to construct the options to be 11935passed to the actual C++ compiler (@command{cc1plus}). 11936 11937@item %* 11938Substitute the variable part of a matched option. See below. 11939Note that each comma in the substituted string is replaced by 11940a single space. 11941 11942@item %<@code{S} 11943Remove all occurrences of @code{-S} from the command line. Note---this 11944command is position dependent. @samp{%} commands in the spec string 11945before this one see @code{-S}, @samp{%} commands in the spec string 11946after this one do not. 11947 11948@item %:@var{function}(@var{args}) 11949Call the named function @var{function}, passing it @var{args}. 11950@var{args} is first processed as a nested spec string, then split 11951into an argument vector in the usual fashion. The function returns 11952a string which is processed as if it had appeared literally as part 11953of the current spec. 11954 11955The following built-in spec functions are provided: 11956 11957@table @code 11958@item @code{getenv} 11959The @code{getenv} spec function takes two arguments: an environment 11960variable name and a string. If the environment variable is not 11961defined, a fatal error is issued. Otherwise, the return value is the 11962value of the environment variable concatenated with the string. For 11963example, if @env{TOPDIR} is defined as @file{/path/to/top}, then: 11964 11965@smallexample 11966%:getenv(TOPDIR /include) 11967@end smallexample 11968 11969expands to @file{/path/to/top/include}. 11970 11971@item @code{if-exists} 11972The @code{if-exists} spec function takes one argument, an absolute 11973pathname to a file. If the file exists, @code{if-exists} returns the 11974pathname. Here is a small example of its usage: 11975 11976@smallexample 11977*startfile: 11978crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s 11979@end smallexample 11980 11981@item @code{if-exists-else} 11982The @code{if-exists-else} spec function is similar to the @code{if-exists} 11983spec function, except that it takes two arguments. The first argument is 11984an absolute pathname to a file. If the file exists, @code{if-exists-else} 11985returns the pathname. If it does not exist, it returns the second argument. 11986This way, @code{if-exists-else} can be used to select one file or another, 11987based on the existence of the first. Here is a small example of its usage: 11988 11989@smallexample 11990*startfile: 11991crt0%O%s %:if-exists(crti%O%s) \ 11992%:if-exists-else(crtbeginT%O%s crtbegin%O%s) 11993@end smallexample 11994 11995@item @code{replace-outfile} 11996The @code{replace-outfile} spec function takes two arguments. It looks for the 11997first argument in the outfiles array and replaces it with the second argument. Here 11998is a small example of its usage: 11999 12000@smallexample 12001%@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@} 12002@end smallexample 12003 12004@item @code{remove-outfile} 12005The @code{remove-outfile} spec function takes one argument. It looks for the 12006first argument in the outfiles array and removes it. Here is a small example 12007its usage: 12008 12009@smallexample 12010%:remove-outfile(-lm) 12011@end smallexample 12012 12013@item @code{pass-through-libs} 12014The @code{pass-through-libs} spec function takes any number of arguments. It 12015finds any @option{-l} options and any non-options ending in @file{.a} (which it 12016assumes are the names of linker input library archive files) and returns a 12017result containing all the found arguments each prepended by 12018@option{-plugin-opt=-pass-through=} and joined by spaces. This list is 12019intended to be passed to the LTO linker plugin. 12020 12021@smallexample 12022%:pass-through-libs(%G %L %G) 12023@end smallexample 12024 12025@item @code{print-asm-header} 12026The @code{print-asm-header} function takes no arguments and simply 12027prints a banner like: 12028 12029@smallexample 12030Assembler options 12031================= 12032 12033Use "-Wa,OPTION" to pass "OPTION" to the assembler. 12034@end smallexample 12035 12036It is used to separate compiler options from assembler options 12037in the @option{--target-help} output. 12038@end table 12039 12040@item %@{@code{S}@} 12041Substitutes the @code{-S} switch, if that switch is given to GCC@. 12042If that switch is not specified, this substitutes nothing. Note that 12043the leading dash is omitted when specifying this option, and it is 12044automatically inserted if the substitution is performed. Thus the spec 12045string @samp{%@{foo@}} matches the command-line option @option{-foo} 12046and outputs the command-line option @option{-foo}. 12047 12048@item %W@{@code{S}@} 12049Like %@{@code{S}@} but mark last argument supplied within as a file to be 12050deleted on failure. 12051 12052@item %@{@code{S}*@} 12053Substitutes all the switches specified to GCC whose names start 12054with @code{-S}, but which also take an argument. This is used for 12055switches like @option{-o}, @option{-D}, @option{-I}, etc. 12056GCC considers @option{-o foo} as being 12057one switch whose name starts with @samp{o}. %@{o*@} substitutes this 12058text, including the space. Thus two arguments are generated. 12059 12060@item %@{@code{S}*&@code{T}*@} 12061Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options 12062(the order of @code{S} and @code{T} in the spec is not significant). 12063There can be any number of ampersand-separated variables; for each the 12064wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}. 12065 12066@item %@{@code{S}:@code{X}@} 12067Substitutes @code{X}, if the @option{-S} switch is given to GCC@. 12068 12069@item %@{!@code{S}:@code{X}@} 12070Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@. 12071 12072@item %@{@code{S}*:@code{X}@} 12073Substitutes @code{X} if one or more switches whose names start with 12074@code{-S} are specified to GCC@. Normally @code{X} is substituted only 12075once, no matter how many such switches appeared. However, if @code{%*} 12076appears somewhere in @code{X}, then @code{X} is substituted once 12077for each matching switch, with the @code{%*} replaced by the part of 12078that switch matching the @code{*}. 12079 12080If @code{%*} appears as the last part of a spec sequence then a space 12081is added after the end of the last substitution. If there is more 12082text in the sequence, however, then a space is not generated. This 12083allows the @code{%*} substitution to be used as part of a larger 12084string. For example, a spec string like this: 12085 12086@smallexample 12087%@{mcu=*:--script=%*/memory.ld@} 12088@end smallexample 12089 12090@noindent 12091when matching an option like @option{-mcu=newchip} produces: 12092 12093@smallexample 12094--script=newchip/memory.ld 12095@end smallexample 12096 12097@item %@{.@code{S}:@code{X}@} 12098Substitutes @code{X}, if processing a file with suffix @code{S}. 12099 12100@item %@{!.@code{S}:@code{X}@} 12101Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}. 12102 12103@item %@{,@code{S}:@code{X}@} 12104Substitutes @code{X}, if processing a file for language @code{S}. 12105 12106@item %@{!,@code{S}:@code{X}@} 12107Substitutes @code{X}, if not processing a file for language @code{S}. 12108 12109@item %@{@code{S}|@code{P}:@code{X}@} 12110Substitutes @code{X} if either @code{-S} or @code{-P} is given to 12111GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and 12112@code{*} sequences as well, although they have a stronger binding than 12113the @samp{|}. If @code{%*} appears in @code{X}, all of the 12114alternatives must be starred, and only the first matching alternative 12115is substituted. 12116 12117For example, a spec string like this: 12118 12119@smallexample 12120%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@} 12121@end smallexample 12122 12123@noindent 12124outputs the following command-line options from the following input 12125command-line options: 12126 12127@smallexample 12128fred.c -foo -baz 12129jim.d -bar -boggle 12130-d fred.c -foo -baz -boggle 12131-d jim.d -bar -baz -boggle 12132@end smallexample 12133 12134@item %@{S:X; T:Y; :D@} 12135 12136If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is 12137given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can 12138be as many clauses as you need. This may be combined with @code{.}, 12139@code{,}, @code{!}, @code{|}, and @code{*} as needed. 12140 12141 12142@end table 12143 12144The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar 12145construct may contain other nested @samp{%} constructs or spaces, or 12146even newlines. They are processed as usual, as described above. 12147Trailing white space in @code{X} is ignored. White space may also 12148appear anywhere on the left side of the colon in these constructs, 12149except between @code{.} or @code{*} and the corresponding word. 12150 12151The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are 12152handled specifically in these constructs. If another value of 12153@option{-O} or the negated form of a @option{-f}, @option{-m}, or 12154@option{-W} switch is found later in the command line, the earlier 12155switch value is ignored, except with @{@code{S}*@} where @code{S} is 12156just one letter, which passes all matching options. 12157 12158The character @samp{|} at the beginning of the predicate text is used to 12159indicate that a command should be piped to the following command, but 12160only if @option{-pipe} is specified. 12161 12162It is built into GCC which switches take arguments and which do not. 12163(You might think it would be useful to generalize this to allow each 12164compiler's spec to say which switches take arguments. But this cannot 12165be done in a consistent fashion. GCC cannot even decide which input 12166files have been specified without knowing which switches take arguments, 12167and it must know which input files to compile in order to tell which 12168compilers to run). 12169 12170GCC also knows implicitly that arguments starting in @option{-l} are to be 12171treated as compiler output files, and passed to the linker in their 12172proper position among the other output files. 12173 12174@c man begin OPTIONS 12175 12176@node Target Options 12177@section Specifying Target Machine and Compiler Version 12178@cindex target options 12179@cindex cross compiling 12180@cindex specifying machine version 12181@cindex specifying compiler version and target machine 12182@cindex compiler version, specifying 12183@cindex target machine, specifying 12184 12185The usual way to run GCC is to run the executable called @command{gcc}, or 12186@command{@var{machine}-gcc} when cross-compiling, or 12187@command{@var{machine}-gcc-@var{version}} to run a version other than the 12188one that was installed last. 12189 12190@node Submodel Options 12191@section Hardware Models and Configurations 12192@cindex submodel options 12193@cindex specifying hardware config 12194@cindex hardware models and configurations, specifying 12195@cindex machine dependent options 12196 12197Each target machine types can have its own 12198special options, starting with @samp{-m}, to choose among various 12199hardware models or configurations---for example, 68010 vs 68020, 12200floating coprocessor or none. A single installed version of the 12201compiler can compile for any model or configuration, according to the 12202options specified. 12203 12204Some configurations of the compiler also support additional special 12205options, usually for compatibility with other compilers on the same 12206platform. 12207 12208@c This list is ordered alphanumerically by subsection name. 12209@c It should be the same order and spelling as these options are listed 12210@c in Machine Dependent Options 12211 12212@menu 12213* AArch64 Options:: 12214* Adapteva Epiphany Options:: 12215* ARC Options:: 12216* ARM Options:: 12217* AVR Options:: 12218* Blackfin Options:: 12219* C6X Options:: 12220* CRIS Options:: 12221* CR16 Options:: 12222* Darwin Options:: 12223* DEC Alpha Options:: 12224* FR30 Options:: 12225* FRV Options:: 12226* GNU/Linux Options:: 12227* H8/300 Options:: 12228* HPPA Options:: 12229* IA-64 Options:: 12230* LM32 Options:: 12231* M32C Options:: 12232* M32R/D Options:: 12233* M680x0 Options:: 12234* MCore Options:: 12235* MeP Options:: 12236* MicroBlaze Options:: 12237* MIPS Options:: 12238* MMIX Options:: 12239* MN10300 Options:: 12240* Moxie Options:: 12241* MSP430 Options:: 12242* NDS32 Options:: 12243* Nios II Options:: 12244* Nvidia PTX Options:: 12245* PDP-11 Options:: 12246* picoChip Options:: 12247* PowerPC Options:: 12248* RL78 Options:: 12249* RS/6000 and PowerPC Options:: 12250* RX Options:: 12251* S/390 and zSeries Options:: 12252* Score Options:: 12253* SH Options:: 12254* Solaris 2 Options:: 12255* SPARC Options:: 12256* SPU Options:: 12257* System V Options:: 12258* TILE-Gx Options:: 12259* TILEPro Options:: 12260* V850 Options:: 12261* VAX Options:: 12262* Visium Options:: 12263* VMS Options:: 12264* VxWorks Options:: 12265* x86 Options:: 12266* x86 Windows Options:: 12267* Xstormy16 Options:: 12268* Xtensa Options:: 12269* zSeries Options:: 12270@end menu 12271 12272@node AArch64 Options 12273@subsection AArch64 Options 12274@cindex AArch64 Options 12275 12276These options are defined for AArch64 implementations: 12277 12278@table @gcctabopt 12279 12280@item -mabi=@var{name} 12281@opindex mabi 12282Generate code for the specified data model. Permissible values 12283are @samp{ilp32} for SysV-like data model where int, long int and pointer 12284are 32-bit, and @samp{lp64} for SysV-like data model where int is 32-bit, 12285but long int and pointer are 64-bit. 12286 12287The default depends on the specific target configuration. Note that 12288the LP64 and ILP32 ABIs are not link-compatible; you must compile your 12289entire program with the same ABI, and link with a compatible set of libraries. 12290 12291@item -mbig-endian 12292@opindex mbig-endian 12293Generate big-endian code. This is the default when GCC is configured for an 12294@samp{aarch64_be-*-*} target. 12295 12296@item -mgeneral-regs-only 12297@opindex mgeneral-regs-only 12298Generate code which uses only the general registers. 12299 12300@item -mlittle-endian 12301@opindex mlittle-endian 12302Generate little-endian code. This is the default when GCC is configured for an 12303@samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target. 12304 12305@item -mcmodel=tiny 12306@opindex mcmodel=tiny 12307Generate code for the tiny code model. The program and its statically defined 12308symbols must be within 1GB of each other. Pointers are 64 bits. Programs can 12309be statically or dynamically linked. This model is not fully implemented and 12310mostly treated as @samp{small}. 12311 12312@item -mcmodel=small 12313@opindex mcmodel=small 12314Generate code for the small code model. The program and its statically defined 12315symbols must be within 4GB of each other. Pointers are 64 bits. Programs can 12316be statically or dynamically linked. This is the default code model. 12317 12318@item -mcmodel=large 12319@opindex mcmodel=large 12320Generate code for the large code model. This makes no assumptions about 12321addresses and sizes of sections. Pointers are 64 bits. Programs can be 12322statically linked only. 12323 12324@item -mstrict-align 12325@opindex mstrict-align 12326Do not assume that unaligned memory references are handled by the system. 12327 12328@item -momit-leaf-frame-pointer 12329@itemx -mno-omit-leaf-frame-pointer 12330@opindex momit-leaf-frame-pointer 12331@opindex mno-omit-leaf-frame-pointer 12332Omit or keep the frame pointer in leaf functions. The former behaviour is the 12333default. 12334 12335@item -mtls-dialect=desc 12336@opindex mtls-dialect=desc 12337Use TLS descriptors as the thread-local storage mechanism for dynamic accesses 12338of TLS variables. This is the default. 12339 12340@item -mtls-dialect=traditional 12341@opindex mtls-dialect=traditional 12342Use traditional TLS as the thread-local storage mechanism for dynamic accesses 12343of TLS variables. 12344 12345@item -mfix-cortex-a53-835769 12346@itemx -mno-fix-cortex-a53-835769 12347@opindex mfix-cortex-a53-835769 12348@opindex mno-fix-cortex-a53-835769 12349Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769. 12350This involves inserting a NOP instruction between memory instructions and 1235164-bit integer multiply-accumulate instructions. 12352 12353@item -mfix-cortex-a53-843419 12354@itemx -mno-fix-cortex-a53-843419 12355@opindex mfix-cortex-a53-843419 12356@opindex mno-fix-cortex-a53-843419 12357Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419. 12358This erratum workaround is made at link time and this will only pass the 12359corresponding flag to the linker. 12360 12361@item -march=@var{name} 12362@opindex march 12363Specify the name of the target architecture, optionally suffixed by one or 12364more feature modifiers. This option has the form 12365@option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where the 12366only permissible value for @var{arch} is @samp{armv8-a}. The permissible 12367values for @var{feature} are documented in the sub-section below. 12368 12369Where conflicting feature modifiers are specified, the right-most feature is 12370used. 12371 12372GCC uses this name to determine what kind of instructions it can emit when 12373generating assembly code. 12374 12375Where @option{-march} is specified without either of @option{-mtune} 12376or @option{-mcpu} also being specified, the code is tuned to perform 12377well across a range of target processors implementing the target 12378architecture. 12379 12380@item -mtune=@var{name} 12381@opindex mtune 12382Specify the name of the target processor for which GCC should tune the 12383performance of the code. Permissible values for this option are: 12384@samp{generic}, @samp{cortex-a53}, @samp{cortex-a57}, @samp{cortex-a72}, 12385@samp{exynos-m1}, @samp{thunderx}, @samp{xgene1}. 12386 12387Additionally, this option can specify that GCC should tune the performance 12388of the code for a big.LITTLE system. Permissible values for this 12389option are: @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53}. 12390 12391Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=} 12392are specified, the code is tuned to perform well across a range 12393of target processors. 12394 12395This option cannot be suffixed by feature modifiers. 12396 12397@item -mcpu=@var{name} 12398@opindex mcpu 12399Specify the name of the target processor, optionally suffixed by one or more 12400feature modifiers. This option has the form 12401@option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where the 12402permissible values for @var{cpu} are the same as those available for 12403@option{-mtune}. 12404 12405The permissible values for @var{feature} are documented in the sub-section 12406below. 12407 12408Where conflicting feature modifiers are specified, the right-most feature is 12409used. 12410 12411GCC uses this name to determine what kind of instructions it can emit when 12412generating assembly code (as if by @option{-march}) and to determine 12413the target processor for which to tune for performance (as if 12414by @option{-mtune}). Where this option is used in conjunction 12415with @option{-march} or @option{-mtune}, those options take precedence 12416over the appropriate part of this option. 12417@end table 12418 12419@subsubsection @option{-march} and @option{-mcpu} Feature Modifiers 12420@cindex @option{-march} feature modifiers 12421@cindex @option{-mcpu} feature modifiers 12422Feature modifiers used with @option{-march} and @option{-mcpu} can be one 12423the following: 12424 12425@table @samp 12426@item crc 12427Enable CRC extension. 12428@item crypto 12429Enable Crypto extension. This implies Advanced SIMD is enabled. 12430@item fp 12431Enable floating-point instructions. 12432@item simd 12433Enable Advanced SIMD instructions. This implies floating-point instructions 12434are enabled. This is the default for all current possible values for options 12435@option{-march} and @option{-mcpu=}. 12436@end table 12437 12438@node Adapteva Epiphany Options 12439@subsection Adapteva Epiphany Options 12440 12441These @samp{-m} options are defined for Adapteva Epiphany: 12442 12443@table @gcctabopt 12444@item -mhalf-reg-file 12445@opindex mhalf-reg-file 12446Don't allocate any register in the range @code{r32}@dots{}@code{r63}. 12447That allows code to run on hardware variants that lack these registers. 12448 12449@item -mprefer-short-insn-regs 12450@opindex mprefer-short-insn-regs 12451Preferrentially allocate registers that allow short instruction generation. 12452This can result in increased instruction count, so this may either reduce or 12453increase overall code size. 12454 12455@item -mbranch-cost=@var{num} 12456@opindex mbranch-cost 12457Set the cost of branches to roughly @var{num} ``simple'' instructions. 12458This cost is only a heuristic and is not guaranteed to produce 12459consistent results across releases. 12460 12461@item -mcmove 12462@opindex mcmove 12463Enable the generation of conditional moves. 12464 12465@item -mnops=@var{num} 12466@opindex mnops 12467Emit @var{num} NOPs before every other generated instruction. 12468 12469@item -mno-soft-cmpsf 12470@opindex mno-soft-cmpsf 12471For single-precision floating-point comparisons, emit an @code{fsub} instruction 12472and test the flags. This is faster than a software comparison, but can 12473get incorrect results in the presence of NaNs, or when two different small 12474numbers are compared such that their difference is calculated as zero. 12475The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant, 12476software comparisons. 12477 12478@item -mstack-offset=@var{num} 12479@opindex mstack-offset 12480Set the offset between the top of the stack and the stack pointer. 12481E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7} 12482can be used by leaf functions without stack allocation. 12483Values other than @samp{8} or @samp{16} are untested and unlikely to work. 12484Note also that this option changes the ABI; compiling a program with a 12485different stack offset than the libraries have been compiled with 12486generally does not work. 12487This option can be useful if you want to evaluate if a different stack 12488offset would give you better code, but to actually use a different stack 12489offset to build working programs, it is recommended to configure the 12490toolchain with the appropriate @option{--with-stack-offset=@var{num}} option. 12491 12492@item -mno-round-nearest 12493@opindex mno-round-nearest 12494Make the scheduler assume that the rounding mode has been set to 12495truncating. The default is @option{-mround-nearest}. 12496 12497@item -mlong-calls 12498@opindex mlong-calls 12499If not otherwise specified by an attribute, assume all calls might be beyond 12500the offset range of the @code{b} / @code{bl} instructions, and therefore load the 12501function address into a register before performing a (otherwise direct) call. 12502This is the default. 12503 12504@item -mshort-calls 12505@opindex short-calls 12506If not otherwise specified by an attribute, assume all direct calls are 12507in the range of the @code{b} / @code{bl} instructions, so use these instructions 12508for direct calls. The default is @option{-mlong-calls}. 12509 12510@item -msmall16 12511@opindex msmall16 12512Assume addresses can be loaded as 16-bit unsigned values. This does not 12513apply to function addresses for which @option{-mlong-calls} semantics 12514are in effect. 12515 12516@item -mfp-mode=@var{mode} 12517@opindex mfp-mode 12518Set the prevailing mode of the floating-point unit. 12519This determines the floating-point mode that is provided and expected 12520at function call and return time. Making this mode match the mode you 12521predominantly need at function start can make your programs smaller and 12522faster by avoiding unnecessary mode switches. 12523 12524@var{mode} can be set to one the following values: 12525 12526@table @samp 12527@item caller 12528Any mode at function entry is valid, and retained or restored when 12529the function returns, and when it calls other functions. 12530This mode is useful for compiling libraries or other compilation units 12531you might want to incorporate into different programs with different 12532prevailing FPU modes, and the convenience of being able to use a single 12533object file outweighs the size and speed overhead for any extra 12534mode switching that might be needed, compared with what would be needed 12535with a more specific choice of prevailing FPU mode. 12536 12537@item truncate 12538This is the mode used for floating-point calculations with 12539truncating (i.e.@: round towards zero) rounding mode. That includes 12540conversion from floating point to integer. 12541 12542@item round-nearest 12543This is the mode used for floating-point calculations with 12544round-to-nearest-or-even rounding mode. 12545 12546@item int 12547This is the mode used to perform integer calculations in the FPU, e.g.@: 12548integer multiply, or integer multiply-and-accumulate. 12549@end table 12550 12551The default is @option{-mfp-mode=caller} 12552 12553@item -mnosplit-lohi 12554@itemx -mno-postinc 12555@itemx -mno-postmodify 12556@opindex mnosplit-lohi 12557@opindex mno-postinc 12558@opindex mno-postmodify 12559Code generation tweaks that disable, respectively, splitting of 32-bit 12560loads, generation of post-increment addresses, and generation of 12561post-modify addresses. The defaults are @option{msplit-lohi}, 12562@option{-mpost-inc}, and @option{-mpost-modify}. 12563 12564@item -mnovect-double 12565@opindex mno-vect-double 12566Change the preferred SIMD mode to SImode. The default is 12567@option{-mvect-double}, which uses DImode as preferred SIMD mode. 12568 12569@item -max-vect-align=@var{num} 12570@opindex max-vect-align 12571The maximum alignment for SIMD vector mode types. 12572@var{num} may be 4 or 8. The default is 8. 12573Note that this is an ABI change, even though many library function 12574interfaces are unaffected if they don't use SIMD vector modes 12575in places that affect size and/or alignment of relevant types. 12576 12577@item -msplit-vecmove-early 12578@opindex msplit-vecmove-early 12579Split vector moves into single word moves before reload. In theory this 12580can give better register allocation, but so far the reverse seems to be 12581generally the case. 12582 12583@item -m1reg-@var{reg} 12584@opindex m1reg- 12585Specify a register to hold the constant @minus{}1, which makes loading small negative 12586constants and certain bitmasks faster. 12587Allowable values for @var{reg} are @samp{r43} and @samp{r63}, 12588which specify use of that register as a fixed register, 12589and @samp{none}, which means that no register is used for this 12590purpose. The default is @option{-m1reg-none}. 12591 12592@end table 12593 12594@node ARC Options 12595@subsection ARC Options 12596@cindex ARC options 12597 12598The following options control the architecture variant for which code 12599is being compiled: 12600 12601@c architecture variants 12602@table @gcctabopt 12603 12604@item -mbarrel-shifter 12605@opindex mbarrel-shifter 12606Generate instructions supported by barrel shifter. This is the default 12607unless @option{-mcpu=ARC601} is in effect. 12608 12609@item -mcpu=@var{cpu} 12610@opindex mcpu 12611Set architecture type, register usage, and instruction scheduling 12612parameters for @var{cpu}. There are also shortcut alias options 12613available for backward compatibility and convenience. Supported 12614values for @var{cpu} are 12615 12616@table @samp 12617@opindex mA6 12618@opindex mARC600 12619@item ARC600 12620Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}. 12621 12622@item ARC601 12623@opindex mARC601 12624Compile for ARC601. Alias: @option{-mARC601}. 12625 12626@item ARC700 12627@opindex mA7 12628@opindex mARC700 12629Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}. 12630This is the default when configured with @option{--with-cpu=arc700}@. 12631@end table 12632 12633@item -mdpfp 12634@opindex mdpfp 12635@itemx -mdpfp-compact 12636@opindex mdpfp-compact 12637FPX: Generate Double Precision FPX instructions, tuned for the compact 12638implementation. 12639 12640@item -mdpfp-fast 12641@opindex mdpfp-fast 12642FPX: Generate Double Precision FPX instructions, tuned for the fast 12643implementation. 12644 12645@item -mno-dpfp-lrsr 12646@opindex mno-dpfp-lrsr 12647Disable LR and SR instructions from using FPX extension aux registers. 12648 12649@item -mea 12650@opindex mea 12651Generate Extended arithmetic instructions. Currently only 12652@code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are 12653supported. This is always enabled for @option{-mcpu=ARC700}. 12654 12655@item -mno-mpy 12656@opindex mno-mpy 12657Do not generate mpy instructions for ARC700. 12658 12659@item -mmul32x16 12660@opindex mmul32x16 12661Generate 32x16 bit multiply and mac instructions. 12662 12663@item -mmul64 12664@opindex mmul64 12665Generate mul64 and mulu64 instructions. Only valid for @option{-mcpu=ARC600}. 12666 12667@item -mnorm 12668@opindex mnorm 12669Generate norm instruction. This is the default if @option{-mcpu=ARC700} 12670is in effect. 12671 12672@item -mspfp 12673@opindex mspfp 12674@itemx -mspfp-compact 12675@opindex mspfp-compact 12676FPX: Generate Single Precision FPX instructions, tuned for the compact 12677implementation. 12678 12679@item -mspfp-fast 12680@opindex mspfp-fast 12681FPX: Generate Single Precision FPX instructions, tuned for the fast 12682implementation. 12683 12684@item -msimd 12685@opindex msimd 12686Enable generation of ARC SIMD instructions via target-specific 12687builtins. Only valid for @option{-mcpu=ARC700}. 12688 12689@item -msoft-float 12690@opindex msoft-float 12691This option ignored; it is provided for compatibility purposes only. 12692Software floating point code is emitted by default, and this default 12693can overridden by FPX options; @samp{mspfp}, @samp{mspfp-compact}, or 12694@samp{mspfp-fast} for single precision, and @samp{mdpfp}, 12695@samp{mdpfp-compact}, or @samp{mdpfp-fast} for double precision. 12696 12697@item -mswap 12698@opindex mswap 12699Generate swap instructions. 12700 12701@end table 12702 12703The following options are passed through to the assembler, and also 12704define preprocessor macro symbols. 12705 12706@c Flags used by the assembler, but for which we define preprocessor 12707@c macro symbols as well. 12708@table @gcctabopt 12709@item -mdsp-packa 12710@opindex mdsp-packa 12711Passed down to the assembler to enable the DSP Pack A extensions. 12712Also sets the preprocessor symbol @code{__Xdsp_packa}. 12713 12714@item -mdvbf 12715@opindex mdvbf 12716Passed down to the assembler to enable the dual viterbi butterfly 12717extension. Also sets the preprocessor symbol @code{__Xdvbf}. 12718 12719@c ARC700 4.10 extension instruction 12720@item -mlock 12721@opindex mlock 12722Passed down to the assembler to enable the Locked Load/Store 12723Conditional extension. Also sets the preprocessor symbol 12724@code{__Xlock}. 12725 12726@item -mmac-d16 12727@opindex mmac-d16 12728Passed down to the assembler. Also sets the preprocessor symbol 12729@code{__Xxmac_d16}. 12730 12731@item -mmac-24 12732@opindex mmac-24 12733Passed down to the assembler. Also sets the preprocessor symbol 12734@code{__Xxmac_24}. 12735 12736@c ARC700 4.10 extension instruction 12737@item -mrtsc 12738@opindex mrtsc 12739Passed down to the assembler to enable the 64-bit Time-Stamp Counter 12740extension instruction. Also sets the preprocessor symbol 12741@code{__Xrtsc}. 12742 12743@c ARC700 4.10 extension instruction 12744@item -mswape 12745@opindex mswape 12746Passed down to the assembler to enable the swap byte ordering 12747extension instruction. Also sets the preprocessor symbol 12748@code{__Xswape}. 12749 12750@item -mtelephony 12751@opindex mtelephony 12752Passed down to the assembler to enable dual and single operand 12753instructions for telephony. Also sets the preprocessor symbol 12754@code{__Xtelephony}. 12755 12756@item -mxy 12757@opindex mxy 12758Passed down to the assembler to enable the XY Memory extension. Also 12759sets the preprocessor symbol @code{__Xxy}. 12760 12761@end table 12762 12763The following options control how the assembly code is annotated: 12764 12765@c Assembly annotation options 12766@table @gcctabopt 12767@item -misize 12768@opindex misize 12769Annotate assembler instructions with estimated addresses. 12770 12771@item -mannotate-align 12772@opindex mannotate-align 12773Explain what alignment considerations lead to the decision to make an 12774instruction short or long. 12775 12776@end table 12777 12778The following options are passed through to the linker: 12779 12780@c options passed through to the linker 12781@table @gcctabopt 12782@item -marclinux 12783@opindex marclinux 12784Passed through to the linker, to specify use of the @code{arclinux} emulation. 12785This option is enabled by default in tool chains built for 12786@w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets 12787when profiling is not requested. 12788 12789@item -marclinux_prof 12790@opindex marclinux_prof 12791Passed through to the linker, to specify use of the 12792@code{arclinux_prof} emulation. This option is enabled by default in 12793tool chains built for @w{@code{arc-linux-uclibc}} and 12794@w{@code{arceb-linux-uclibc}} targets when profiling is requested. 12795 12796@end table 12797 12798The following options control the semantics of generated code: 12799 12800@c semantically relevant code generation options 12801@table @gcctabopt 12802@item -mepilogue-cfi 12803@opindex mepilogue-cfi 12804Enable generation of call frame information for epilogues. 12805 12806@item -mno-epilogue-cfi 12807@opindex mno-epilogue-cfi 12808Disable generation of call frame information for epilogues. 12809 12810@item -mlong-calls 12811@opindex mlong-calls 12812Generate call insns as register indirect calls, thus providing access 12813to the full 32-bit address range. 12814 12815@item -mmedium-calls 12816@opindex mmedium-calls 12817Don't use less than 25 bit addressing range for calls, which is the 12818offset available for an unconditional branch-and-link 12819instruction. Conditional execution of function calls is suppressed, to 12820allow use of the 25-bit range, rather than the 21-bit range with 12821conditional branch-and-link. This is the default for tool chains built 12822for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets. 12823 12824@item -mno-sdata 12825@opindex mno-sdata 12826Do not generate sdata references. This is the default for tool chains 12827built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} 12828targets. 12829 12830@item -mucb-mcount 12831@opindex mucb-mcount 12832Instrument with mcount calls as used in UCB code. I.e. do the 12833counting in the callee, not the caller. By default ARC instrumentation 12834counts in the caller. 12835 12836@item -mvolatile-cache 12837@opindex mvolatile-cache 12838Use ordinarily cached memory accesses for volatile references. This is the 12839default. 12840 12841@item -mno-volatile-cache 12842@opindex mno-volatile-cache 12843Enable cache bypass for volatile references. 12844 12845@end table 12846 12847The following options fine tune code generation: 12848@c code generation tuning options 12849@table @gcctabopt 12850@item -malign-call 12851@opindex malign-call 12852Do alignment optimizations for call instructions. 12853 12854@item -mauto-modify-reg 12855@opindex mauto-modify-reg 12856Enable the use of pre/post modify with register displacement. 12857 12858@item -mbbit-peephole 12859@opindex mbbit-peephole 12860Enable bbit peephole2. 12861 12862@item -mno-brcc 12863@opindex mno-brcc 12864This option disables a target-specific pass in @file{arc_reorg} to 12865generate @code{BRcc} instructions. It has no effect on @code{BRcc} 12866generation driven by the combiner pass. 12867 12868@item -mcase-vector-pcrel 12869@opindex mcase-vector-pcrel 12870Use pc-relative switch case tables - this enables case table shortening. 12871This is the default for @option{-Os}. 12872 12873@item -mcompact-casesi 12874@opindex mcompact-casesi 12875Enable compact casesi pattern. 12876This is the default for @option{-Os}. 12877 12878@item -mno-cond-exec 12879@opindex mno-cond-exec 12880Disable ARCompact specific pass to generate conditional execution instructions. 12881Due to delay slot scheduling and interactions between operand numbers, 12882literal sizes, instruction lengths, and the support for conditional execution, 12883the target-independent pass to generate conditional execution is often lacking, 12884so the ARC port has kept a special pass around that tries to find more 12885conditional execution generating opportunities after register allocation, 12886branch shortening, and delay slot scheduling have been done. This pass 12887generally, but not always, improves performance and code size, at the cost of 12888extra compilation time, which is why there is an option to switch it off. 12889If you have a problem with call instructions exceeding their allowable 12890offset range because they are conditionalized, you should consider using 12891@option{-mmedium-calls} instead. 12892 12893@item -mearly-cbranchsi 12894@opindex mearly-cbranchsi 12895Enable pre-reload use of the cbranchsi pattern. 12896 12897@item -mexpand-adddi 12898@opindex mexpand-adddi 12899Expand @code{adddi3} and @code{subdi3} at rtl generation time into 12900@code{add.f}, @code{adc} etc. 12901 12902@item -mindexed-loads 12903@opindex mindexed-loads 12904Enable the use of indexed loads. This can be problematic because some 12905optimizers then assume that indexed stores exist, which is not 12906the case. 12907 12908@item -mlra 12909@opindex mlra 12910Enable Local Register Allocation. This is still experimental for ARC, 12911so by default the compiler uses standard reload 12912(i.e. @option{-mno-lra}). 12913 12914@item -mlra-priority-none 12915@opindex mlra-priority-none 12916Don't indicate any priority for target registers. 12917 12918@item -mlra-priority-compact 12919@opindex mlra-priority-compact 12920Indicate target register priority for r0..r3 / r12..r15. 12921 12922@item -mlra-priority-noncompact 12923@opindex mlra-priority-noncompact 12924Reduce target regsiter priority for r0..r3 / r12..r15. 12925 12926@item -mno-millicode 12927@opindex mno-millicode 12928When optimizing for size (using @option{-Os}), prologues and epilogues 12929that have to save or restore a large number of registers are often 12930shortened by using call to a special function in libgcc; this is 12931referred to as a @emph{millicode} call. As these calls can pose 12932performance issues, and/or cause linking issues when linking in a 12933nonstandard way, this option is provided to turn off millicode call 12934generation. 12935 12936@item -mmixed-code 12937@opindex mmixed-code 12938Tweak register allocation to help 16-bit instruction generation. 12939This generally has the effect of decreasing the average instruction size 12940while increasing the instruction count. 12941 12942@item -mq-class 12943@opindex mq-class 12944Enable 'q' instruction alternatives. 12945This is the default for @option{-Os}. 12946 12947@item -mRcq 12948@opindex mRcq 12949Enable Rcq constraint handling - most short code generation depends on this. 12950This is the default. 12951 12952@item -mRcw 12953@opindex mRcw 12954Enable Rcw constraint handling - ccfsm condexec mostly depends on this. 12955This is the default. 12956 12957@item -msize-level=@var{level} 12958@opindex msize-level 12959Fine-tune size optimization with regards to instruction lengths and alignment. 12960The recognized values for @var{level} are: 12961@table @samp 12962@item 0 12963No size optimization. This level is deprecated and treated like @samp{1}. 12964 12965@item 1 12966Short instructions are used opportunistically. 12967 12968@item 2 12969In addition, alignment of loops and of code after barriers are dropped. 12970 12971@item 3 12972In addition, optional data alignment is dropped, and the option @option{Os} is enabled. 12973 12974@end table 12975 12976This defaults to @samp{3} when @option{-Os} is in effect. Otherwise, 12977the behavior when this is not set is equivalent to level @samp{1}. 12978 12979@item -mtune=@var{cpu} 12980@opindex mtune 12981Set instruction scheduling parameters for @var{cpu}, overriding any implied 12982by @option{-mcpu=}. 12983 12984Supported values for @var{cpu} are 12985 12986@table @samp 12987@item ARC600 12988Tune for ARC600 cpu. 12989 12990@item ARC601 12991Tune for ARC601 cpu. 12992 12993@item ARC700 12994Tune for ARC700 cpu with standard multiplier block. 12995 12996@item ARC700-xmac 12997Tune for ARC700 cpu with XMAC block. 12998 12999@item ARC725D 13000Tune for ARC725D cpu. 13001 13002@item ARC750D 13003Tune for ARC750D cpu. 13004 13005@end table 13006 13007@item -mmultcost=@var{num} 13008@opindex mmultcost 13009Cost to assume for a multiply instruction, with @samp{4} being equal to a 13010normal instruction. 13011 13012@item -munalign-prob-threshold=@var{probability} 13013@opindex munalign-prob-threshold 13014Set probability threshold for unaligning branches. 13015When tuning for @samp{ARC700} and optimizing for speed, branches without 13016filled delay slot are preferably emitted unaligned and long, unless 13017profiling indicates that the probability for the branch to be taken 13018is below @var{probability}. @xref{Cross-profiling}. 13019The default is (REG_BR_PROB_BASE/2), i.e.@: 5000. 13020 13021@end table 13022 13023The following options are maintained for backward compatibility, but 13024are now deprecated and will be removed in a future release: 13025 13026@c Deprecated options 13027@table @gcctabopt 13028 13029@item -margonaut 13030@opindex margonaut 13031Obsolete FPX. 13032 13033@item -mbig-endian 13034@opindex mbig-endian 13035@itemx -EB 13036@opindex EB 13037Compile code for big endian targets. Use of these options is now 13038deprecated. Users wanting big-endian code, should use the 13039@w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets when 13040building the tool chain, for which big-endian is the default. 13041 13042@item -mlittle-endian 13043@opindex mlittle-endian 13044@itemx -EL 13045@opindex EL 13046Compile code for little endian targets. Use of these options is now 13047deprecated. Users wanting little-endian code should use the 13048@w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets when 13049building the tool chain, for which little-endian is the default. 13050 13051@item -mbarrel_shifter 13052@opindex mbarrel_shifter 13053Replaced by @option{-mbarrel-shifter}. 13054 13055@item -mdpfp_compact 13056@opindex mdpfp_compact 13057Replaced by @option{-mdpfp-compact}. 13058 13059@item -mdpfp_fast 13060@opindex mdpfp_fast 13061Replaced by @option{-mdpfp-fast}. 13062 13063@item -mdsp_packa 13064@opindex mdsp_packa 13065Replaced by @option{-mdsp-packa}. 13066 13067@item -mEA 13068@opindex mEA 13069Replaced by @option{-mea}. 13070 13071@item -mmac_24 13072@opindex mmac_24 13073Replaced by @option{-mmac-24}. 13074 13075@item -mmac_d16 13076@opindex mmac_d16 13077Replaced by @option{-mmac-d16}. 13078 13079@item -mspfp_compact 13080@opindex mspfp_compact 13081Replaced by @option{-mspfp-compact}. 13082 13083@item -mspfp_fast 13084@opindex mspfp_fast 13085Replaced by @option{-mspfp-fast}. 13086 13087@item -mtune=@var{cpu} 13088@opindex mtune 13089Values @samp{arc600}, @samp{arc601}, @samp{arc700} and 13090@samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600}, 13091@samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively 13092 13093@item -multcost=@var{num} 13094@opindex multcost 13095Replaced by @option{-mmultcost}. 13096 13097@end table 13098 13099@node ARM Options 13100@subsection ARM Options 13101@cindex ARM options 13102 13103These @samp{-m} options are defined for the ARM port: 13104 13105@table @gcctabopt 13106@item -mabi=@var{name} 13107@opindex mabi 13108Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu}, 13109@samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}. 13110 13111@item -mapcs-frame 13112@opindex mapcs-frame 13113Generate a stack frame that is compliant with the ARM Procedure Call 13114Standard for all functions, even if this is not strictly necessary for 13115correct execution of the code. Specifying @option{-fomit-frame-pointer} 13116with this option causes the stack frames not to be generated for 13117leaf functions. The default is @option{-mno-apcs-frame}. 13118This option is deprecated. 13119 13120@item -mapcs 13121@opindex mapcs 13122This is a synonym for @option{-mapcs-frame} and is deprecated. 13123 13124@ignore 13125@c not currently implemented 13126@item -mapcs-stack-check 13127@opindex mapcs-stack-check 13128Generate code to check the amount of stack space available upon entry to 13129every function (that actually uses some stack space). If there is 13130insufficient space available then either the function 13131@code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is 13132called, depending upon the amount of stack space required. The runtime 13133system is required to provide these functions. The default is 13134@option{-mno-apcs-stack-check}, since this produces smaller code. 13135 13136@c not currently implemented 13137@item -mapcs-float 13138@opindex mapcs-float 13139Pass floating-point arguments using the floating-point registers. This is 13140one of the variants of the APCS@. This option is recommended if the 13141target hardware has a floating-point unit or if a lot of floating-point 13142arithmetic is going to be performed by the code. The default is 13143@option{-mno-apcs-float}, since the size of integer-only code is 13144slightly increased if @option{-mapcs-float} is used. 13145 13146@c not currently implemented 13147@item -mapcs-reentrant 13148@opindex mapcs-reentrant 13149Generate reentrant, position-independent code. The default is 13150@option{-mno-apcs-reentrant}. 13151@end ignore 13152 13153@item -mthumb-interwork 13154@opindex mthumb-interwork 13155Generate code that supports calling between the ARM and Thumb 13156instruction sets. Without this option, on pre-v5 architectures, the 13157two instruction sets cannot be reliably used inside one program. The 13158default is @option{-mno-thumb-interwork}, since slightly larger code 13159is generated when @option{-mthumb-interwork} is specified. In AAPCS 13160configurations this option is meaningless. 13161 13162@item -mno-sched-prolog 13163@opindex mno-sched-prolog 13164Prevent the reordering of instructions in the function prologue, or the 13165merging of those instruction with the instructions in the function's 13166body. This means that all functions start with a recognizable set 13167of instructions (or in fact one of a choice from a small set of 13168different function prologues), and this information can be used to 13169locate the start of functions inside an executable piece of code. The 13170default is @option{-msched-prolog}. 13171 13172@item -mfloat-abi=@var{name} 13173@opindex mfloat-abi 13174Specifies which floating-point ABI to use. Permissible values 13175are: @samp{soft}, @samp{softfp} and @samp{hard}. 13176 13177Specifying @samp{soft} causes GCC to generate output containing 13178library calls for floating-point operations. 13179@samp{softfp} allows the generation of code using hardware floating-point 13180instructions, but still uses the soft-float calling conventions. 13181@samp{hard} allows generation of floating-point instructions 13182and uses FPU-specific calling conventions. 13183 13184The default depends on the specific target configuration. Note that 13185the hard-float and soft-float ABIs are not link-compatible; you must 13186compile your entire program with the same ABI, and link with a 13187compatible set of libraries. 13188 13189@item -mlittle-endian 13190@opindex mlittle-endian 13191Generate code for a processor running in little-endian mode. This is 13192the default for all standard configurations. 13193 13194@item -mbig-endian 13195@opindex mbig-endian 13196Generate code for a processor running in big-endian mode; the default is 13197to compile code for a little-endian processor. 13198 13199@item -march=@var{name} 13200@opindex march 13201This specifies the name of the target ARM architecture. GCC uses this 13202name to determine what kind of instructions it can emit when generating 13203assembly code. This option can be used in conjunction with or instead 13204of the @option{-mcpu=} option. Permissible names are: @samp{armv2}, 13205@samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t}, 13206@samp{armv5}, @samp{armv5t}, @samp{armv5e}, @samp{armv5te}, 13207@samp{armv6}, @samp{armv6j}, 13208@samp{armv6t2}, @samp{armv6z}, @samp{armv6zk}, @samp{armv6-m}, 13209@samp{armv7}, @samp{armv7-a}, @samp{armv7-r}, @samp{armv7-m}, @samp{armv7e-m}, 13210@samp{armv7ve}, @samp{armv8-a}, @samp{armv8-a+crc}, 13211@samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}. 13212 13213@option{-march=armv7ve} is the armv7-a architecture with virtualization 13214extensions. 13215 13216@option{-march=armv8-a+crc} enables code generation for the ARMv8-A 13217architecture together with the optional CRC32 extensions. 13218 13219@option{-march=native} causes the compiler to auto-detect the architecture 13220of the build computer. At present, this feature is only supported on 13221GNU/Linux, and not all architectures are recognized. If the auto-detect 13222is unsuccessful the option has no effect. 13223 13224@item -mtune=@var{name} 13225@opindex mtune 13226This option specifies the name of the target ARM processor for 13227which GCC should tune the performance of the code. 13228For some ARM implementations better performance can be obtained by using 13229this option. 13230Permissible names are: @samp{arm2}, @samp{arm250}, 13231@samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610}, 13232@samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm}, 13233@samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700}, 13234@samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100}, 13235@samp{arm720}, 13236@samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s}, 13237@samp{arm710t}, @samp{arm720t}, @samp{arm740t}, 13238@samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100}, 13239@samp{strongarm1110}, 13240@samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920}, 13241@samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s}, 13242@samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi}, 13243@samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s}, 13244@samp{arm10e}, @samp{arm1020e}, @samp{arm1022e}, 13245@samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp}, 13246@samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s}, 13247@samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8}, @samp{cortex-a9}, 13248@samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a53}, 13249@samp{cortex-a57}, @samp{cortex-a72}, 13250@samp{cortex-r4}, 13251@samp{cortex-r4f}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-m7}, 13252@samp{cortex-m4}, 13253@samp{cortex-m3}, 13254@samp{cortex-m1}, 13255@samp{cortex-m0}, 13256@samp{cortex-m0plus}, 13257@samp{cortex-m1.small-multiply}, 13258@samp{cortex-m0.small-multiply}, 13259@samp{cortex-m0plus.small-multiply}, 13260@samp{exynos-m1}, 13261@samp{marvell-pj4}, 13262@samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, 13263@samp{fa526}, @samp{fa626}, 13264@samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}, 13265@samp{xgene1}. 13266 13267Additionally, this option can specify that GCC should tune the performance 13268of the code for a big.LITTLE system. Permissible names are: 13269@samp{cortex-a15.cortex-a7}, @samp{cortex-a57.cortex-a53}, 13270@samp{cortex-a72.cortex-a53}. 13271 13272@option{-mtune=generic-@var{arch}} specifies that GCC should tune the 13273performance for a blend of processors within architecture @var{arch}. 13274The aim is to generate code that run well on the current most popular 13275processors, balancing between optimizations that benefit some CPUs in the 13276range, and avoiding performance pitfalls of other CPUs. The effects of 13277this option may change in future GCC versions as CPU models come and go. 13278 13279@option{-mtune=native} causes the compiler to auto-detect the CPU 13280of the build computer. At present, this feature is only supported on 13281GNU/Linux, and not all architectures are recognized. If the auto-detect is 13282unsuccessful the option has no effect. 13283 13284@item -mcpu=@var{name} 13285@opindex mcpu 13286This specifies the name of the target ARM processor. GCC uses this name 13287to derive the name of the target ARM architecture (as if specified 13288by @option{-march}) and the ARM processor type for which to tune for 13289performance (as if specified by @option{-mtune}). Where this option 13290is used in conjunction with @option{-march} or @option{-mtune}, 13291those options take precedence over the appropriate part of this option. 13292 13293Permissible names for this option are the same as those for 13294@option{-mtune}. 13295 13296@option{-mcpu=generic-@var{arch}} is also permissible, and is 13297equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}. 13298See @option{-mtune} for more information. 13299 13300@option{-mcpu=native} causes the compiler to auto-detect the CPU 13301of the build computer. At present, this feature is only supported on 13302GNU/Linux, and not all architectures are recognized. If the auto-detect 13303is unsuccessful the option has no effect. 13304 13305@item -mfpu=@var{name} 13306@opindex mfpu 13307This specifies what floating-point hardware (or hardware emulation) is 13308available on the target. Permissible names are: @samp{vfp}, @samp{vfpv3}, 13309@samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd}, 13310@samp{vfpv3xd-fp16}, @samp{neon}, @samp{neon-fp16}, @samp{vfpv4}, 13311@samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4}, 13312@samp{fpv5-d16}, @samp{fpv5-sp-d16}, 13313@samp{fp-armv8}, @samp{neon-fp-armv8}, and @samp{crypto-neon-fp-armv8}. 13314 13315If @option{-msoft-float} is specified this specifies the format of 13316floating-point values. 13317 13318If the selected floating-point hardware includes the NEON extension 13319(e.g. @option{-mfpu}=@samp{neon}), note that floating-point 13320operations are not generated by GCC's auto-vectorization pass unless 13321@option{-funsafe-math-optimizations} is also specified. This is 13322because NEON hardware does not fully implement the IEEE 754 standard for 13323floating-point arithmetic (in particular denormal values are treated as 13324zero), so the use of NEON instructions may lead to a loss of precision. 13325 13326@item -mfp16-format=@var{name} 13327@opindex mfp16-format 13328Specify the format of the @code{__fp16} half-precision floating-point type. 13329Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative}; 13330the default is @samp{none}, in which case the @code{__fp16} type is not 13331defined. @xref{Half-Precision}, for more information. 13332 13333@item -mstructure-size-boundary=@var{n} 13334@opindex mstructure-size-boundary 13335The sizes of all structures and unions are rounded up to a multiple 13336of the number of bits set by this option. Permissible values are 8, 32 13337and 64. The default value varies for different toolchains. For the COFF 13338targeted toolchain the default value is 8. A value of 64 is only allowed 13339if the underlying ABI supports it. 13340 13341Specifying a larger number can produce faster, more efficient code, but 13342can also increase the size of the program. Different values are potentially 13343incompatible. Code compiled with one value cannot necessarily expect to 13344work with code or libraries compiled with another value, if they exchange 13345information using structures or unions. 13346 13347@item -mabort-on-noreturn 13348@opindex mabort-on-noreturn 13349Generate a call to the function @code{abort} at the end of a 13350@code{noreturn} function. It is executed if the function tries to 13351return. 13352 13353@item -mlong-calls 13354@itemx -mno-long-calls 13355@opindex mlong-calls 13356@opindex mno-long-calls 13357Tells the compiler to perform function calls by first loading the 13358address of the function into a register and then performing a subroutine 13359call on this register. This switch is needed if the target function 13360lies outside of the 64-megabyte addressing range of the offset-based 13361version of subroutine call instruction. 13362 13363Even if this switch is enabled, not all function calls are turned 13364into long calls. The heuristic is that static functions, functions 13365that have the @code{short_call} attribute, functions that are inside 13366the scope of a @code{#pragma no_long_calls} directive, and functions whose 13367definitions have already been compiled within the current compilation 13368unit are not turned into long calls. The exceptions to this rule are 13369that weak function definitions, functions with the @code{long_call} 13370attribute or the @code{section} attribute, and functions that are within 13371the scope of a @code{#pragma long_calls} directive are always 13372turned into long calls. 13373 13374This feature is not enabled by default. Specifying 13375@option{-mno-long-calls} restores the default behavior, as does 13376placing the function calls within the scope of a @code{#pragma 13377long_calls_off} directive. Note these switches have no effect on how 13378the compiler generates code to handle function calls via function 13379pointers. 13380 13381@item -msingle-pic-base 13382@opindex msingle-pic-base 13383Treat the register used for PIC addressing as read-only, rather than 13384loading it in the prologue for each function. The runtime system is 13385responsible for initializing this register with an appropriate value 13386before execution begins. 13387 13388@item -mpic-register=@var{reg} 13389@opindex mpic-register 13390Specify the register to be used for PIC addressing. 13391For standard PIC base case, the default is any suitable register 13392determined by compiler. For single PIC base case, the default is 13393@samp{R9} if target is EABI based or stack-checking is enabled, 13394otherwise the default is @samp{R10}. 13395 13396@item -mpic-data-is-text-relative 13397@opindex mpic-data-is-text-relative 13398Assume that each data segments are relative to text segment at load time. 13399Therefore, it permits addressing data using PC-relative operations. 13400This option is on by default for targets other than VxWorks RTP. 13401 13402@item -mpoke-function-name 13403@opindex mpoke-function-name 13404Write the name of each function into the text section, directly 13405preceding the function prologue. The generated code is similar to this: 13406 13407@smallexample 13408 t0 13409 .ascii "arm_poke_function_name", 0 13410 .align 13411 t1 13412 .word 0xff000000 + (t1 - t0) 13413 arm_poke_function_name 13414 mov ip, sp 13415 stmfd sp!, @{fp, ip, lr, pc@} 13416 sub fp, ip, #4 13417@end smallexample 13418 13419When performing a stack backtrace, code can inspect the value of 13420@code{pc} stored at @code{fp + 0}. If the trace function then looks at 13421location @code{pc - 12} and the top 8 bits are set, then we know that 13422there is a function name embedded immediately preceding this location 13423and has length @code{((pc[-3]) & 0xff000000)}. 13424 13425@item -mthumb 13426@itemx -marm 13427@opindex marm 13428@opindex mthumb 13429 13430Select between generating code that executes in ARM and Thumb 13431states. The default for most configurations is to generate code 13432that executes in ARM state, but the default can be changed by 13433configuring GCC with the @option{--with-mode=}@var{state} 13434configure option. 13435 13436@item -mtpcs-frame 13437@opindex mtpcs-frame 13438Generate a stack frame that is compliant with the Thumb Procedure Call 13439Standard for all non-leaf functions. (A leaf function is one that does 13440not call any other functions.) The default is @option{-mno-tpcs-frame}. 13441 13442@item -mtpcs-leaf-frame 13443@opindex mtpcs-leaf-frame 13444Generate a stack frame that is compliant with the Thumb Procedure Call 13445Standard for all leaf functions. (A leaf function is one that does 13446not call any other functions.) The default is @option{-mno-apcs-leaf-frame}. 13447 13448@item -mcallee-super-interworking 13449@opindex mcallee-super-interworking 13450Gives all externally visible functions in the file being compiled an ARM 13451instruction set header which switches to Thumb mode before executing the 13452rest of the function. This allows these functions to be called from 13453non-interworking code. This option is not valid in AAPCS configurations 13454because interworking is enabled by default. 13455 13456@item -mcaller-super-interworking 13457@opindex mcaller-super-interworking 13458Allows calls via function pointers (including virtual functions) to 13459execute correctly regardless of whether the target code has been 13460compiled for interworking or not. There is a small overhead in the cost 13461of executing a function pointer if this option is enabled. This option 13462is not valid in AAPCS configurations because interworking is enabled 13463by default. 13464 13465@item -mtp=@var{name} 13466@opindex mtp 13467Specify the access model for the thread local storage pointer. The valid 13468models are @samp{soft}, which generates calls to @code{__aeabi_read_tp}, 13469@samp{cp15}, which fetches the thread pointer from @code{cp15} directly 13470(supported in the arm6k architecture), and @samp{auto}, which uses the 13471best available method for the selected processor. The default setting is 13472@samp{auto}. 13473 13474@item -mtls-dialect=@var{dialect} 13475@opindex mtls-dialect 13476Specify the dialect to use for accessing thread local storage. Two 13477@var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The 13478@samp{gnu} dialect selects the original GNU scheme for supporting 13479local and global dynamic TLS models. The @samp{gnu2} dialect 13480selects the GNU descriptor scheme, which provides better performance 13481for shared libraries. The GNU descriptor scheme is compatible with 13482the original scheme, but does require new assembler, linker and 13483library support. Initial and local exec TLS models are unaffected by 13484this option and always use the original scheme. 13485 13486@item -mword-relocations 13487@opindex mword-relocations 13488Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32). 13489This is enabled by default on targets (uClinux, SymbianOS) where the runtime 13490loader imposes this restriction, and when @option{-fpic} or @option{-fPIC} 13491is specified. 13492 13493@item -mfix-cortex-m3-ldrd 13494@opindex mfix-cortex-m3-ldrd 13495Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions 13496with overlapping destination and base registers are used. This option avoids 13497generating these instructions. This option is enabled by default when 13498@option{-mcpu=cortex-m3} is specified. 13499 13500@item -munaligned-access 13501@itemx -mno-unaligned-access 13502@opindex munaligned-access 13503@opindex mno-unaligned-access 13504Enables (or disables) reading and writing of 16- and 32- bit values 13505from addresses that are not 16- or 32- bit aligned. By default 13506unaligned access is disabled for all pre-ARMv6 and all ARMv6-M 13507architectures, and enabled for all other architectures. If unaligned 13508access is not enabled then words in packed data structures are 13509accessed a byte at a time. 13510 13511The ARM attribute @code{Tag_CPU_unaligned_access} is set in the 13512generated object file to either true or false, depending upon the 13513setting of this option. If unaligned access is enabled then the 13514preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also 13515defined. 13516 13517@item -mneon-for-64bits 13518@opindex mneon-for-64bits 13519Enables using Neon to handle scalar 64-bits operations. This is 13520disabled by default since the cost of moving data from core registers 13521to Neon is high. 13522 13523@item -mslow-flash-data 13524@opindex mslow-flash-data 13525Assume loading data from flash is slower than fetching instruction. 13526Therefore literal load is minimized for better performance. 13527This option is only supported when compiling for ARMv7 M-profile and 13528off by default. 13529 13530@item -masm-syntax-unified 13531@opindex masm-syntax-unified 13532Assume inline assembler is using unified asm syntax. The default is 13533currently off which implies divided syntax. Currently this option is 13534available only for Thumb1 and has no effect on ARM state and Thumb2. 13535However, this may change in future releases of GCC. Divided syntax 13536should be considered deprecated. 13537 13538@item -mrestrict-it 13539@opindex mrestrict-it 13540Restricts generation of IT blocks to conform to the rules of ARMv8. 13541IT blocks can only contain a single 16-bit instruction from a select 13542set of instructions. This option is on by default for ARMv8 Thumb mode. 13543 13544@item -mprint-tune-info 13545@opindex mprint-tune-info 13546Print CPU tuning information as comment in assembler file. This is 13547an option used only for regression testing of the compiler and not 13548intended for ordinary use in compiling code. This option is disabled 13549by default. 13550@end table 13551 13552@node AVR Options 13553@subsection AVR Options 13554@cindex AVR Options 13555 13556These options are defined for AVR implementations: 13557 13558@table @gcctabopt 13559@item -mmcu=@var{mcu} 13560@opindex mmcu 13561Specify Atmel AVR instruction set architectures (ISA) or MCU type. 13562 13563The default for this option is@tie{}@samp{avr2}. 13564 13565GCC supports the following AVR devices and ISAs: 13566 13567@include avr-mmcu.texi 13568 13569@item -maccumulate-args 13570@opindex maccumulate-args 13571Accumulate outgoing function arguments and acquire/release the needed 13572stack space for outgoing function arguments once in function 13573prologue/epilogue. Without this option, outgoing arguments are pushed 13574before calling a function and popped afterwards. 13575 13576Popping the arguments after the function call can be expensive on 13577AVR so that accumulating the stack space might lead to smaller 13578executables because arguments need not to be removed from the 13579stack after such a function call. 13580 13581This option can lead to reduced code size for functions that perform 13582several calls to functions that get their arguments on the stack like 13583calls to printf-like functions. 13584 13585@item -mbranch-cost=@var{cost} 13586@opindex mbranch-cost 13587Set the branch costs for conditional branch instructions to 13588@var{cost}. Reasonable values for @var{cost} are small, non-negative 13589integers. The default branch cost is 0. 13590 13591@item -mcall-prologues 13592@opindex mcall-prologues 13593Functions prologues/epilogues are expanded as calls to appropriate 13594subroutines. Code size is smaller. 13595 13596@item -mint8 13597@opindex mint8 13598Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a 13599@code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes, 13600and @code{long long} is 4 bytes. Please note that this option does not 13601conform to the C standards, but it results in smaller code 13602size. 13603 13604@item -mn-flash=@var{num} 13605@opindex mn-flash 13606Assume that the flash memory has a size of 13607@var{num} times 64@tie{}KiB. 13608 13609@item -mno-interrupts 13610@opindex mno-interrupts 13611Generated code is not compatible with hardware interrupts. 13612Code size is smaller. 13613 13614@item -mrelax 13615@opindex mrelax 13616Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter 13617@code{RCALL} resp.@: @code{RJMP} instruction if applicable. 13618Setting @option{-mrelax} just adds the @option{--mlink-relax} option to 13619the assembler's command line and the @option{--relax} option to the 13620linker's command line. 13621 13622Jump relaxing is performed by the linker because jump offsets are not 13623known before code is located. Therefore, the assembler code generated by the 13624compiler is the same, but the instructions in the executable may 13625differ from instructions in the assembler code. 13626 13627Relaxing must be turned on if linker stubs are needed, see the 13628section on @code{EIND} and linker stubs below. 13629 13630@item -mrmw 13631@opindex mrmw 13632Assume that the device supports the Read-Modify-Write 13633instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}. 13634 13635@item -msp8 13636@opindex msp8 13637Treat the stack pointer register as an 8-bit register, 13638i.e.@: assume the high byte of the stack pointer is zero. 13639In general, you don't need to set this option by hand. 13640 13641This option is used internally by the compiler to select and 13642build multilibs for architectures @code{avr2} and @code{avr25}. 13643These architectures mix devices with and without @code{SPH}. 13644For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25} 13645the compiler driver adds or removes this option from the compiler 13646proper's command line, because the compiler then knows if the device 13647or architecture has an 8-bit stack pointer and thus no @code{SPH} 13648register or not. 13649 13650@item -mstrict-X 13651@opindex mstrict-X 13652Use address register @code{X} in a way proposed by the hardware. This means 13653that @code{X} is only used in indirect, post-increment or 13654pre-decrement addressing. 13655 13656Without this option, the @code{X} register may be used in the same way 13657as @code{Y} or @code{Z} which then is emulated by additional 13658instructions. 13659For example, loading a value with @code{X+const} addressing with a 13660small non-negative @code{const < 64} to a register @var{Rn} is 13661performed as 13662 13663@example 13664adiw r26, const ; X += const 13665ld @var{Rn}, X ; @var{Rn} = *X 13666sbiw r26, const ; X -= const 13667@end example 13668 13669@item -mtiny-stack 13670@opindex mtiny-stack 13671Only change the lower 8@tie{}bits of the stack pointer. 13672 13673@item -nodevicelib 13674@opindex nodevicelib 13675Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}. 13676 13677@item -Waddr-space-convert 13678@opindex Waddr-space-convert 13679Warn about conversions between address spaces in the case where the 13680resulting address space is not contained in the incoming address space. 13681 13682@item -Wmisspelled-isr 13683@opindex Wmisspelled-isr 13684Warn if the ISR is misspelled, i.e. without @code{__vector} prefix. 13685Enabled by default. 13686@end table 13687 13688@subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash 13689@cindex @code{EIND} 13690Pointers in the implementation are 16@tie{}bits wide. 13691The address of a function or label is represented as word address so 13692that indirect jumps and calls can target any code address in the 13693range of 64@tie{}Ki words. 13694 13695In order to facilitate indirect jump on devices with more than 128@tie{}Ki 13696bytes of program memory space, there is a special function register called 13697@code{EIND} that serves as most significant part of the target address 13698when @code{EICALL} or @code{EIJMP} instructions are used. 13699 13700Indirect jumps and calls on these devices are handled as follows by 13701the compiler and are subject to some limitations: 13702 13703@itemize @bullet 13704 13705@item 13706The compiler never sets @code{EIND}. 13707 13708@item 13709The compiler uses @code{EIND} implicitely in @code{EICALL}/@code{EIJMP} 13710instructions or might read @code{EIND} directly in order to emulate an 13711indirect call/jump by means of a @code{RET} instruction. 13712 13713@item 13714The compiler assumes that @code{EIND} never changes during the startup 13715code or during the application. In particular, @code{EIND} is not 13716saved/restored in function or interrupt service routine 13717prologue/epilogue. 13718 13719@item 13720For indirect calls to functions and computed goto, the linker 13721generates @emph{stubs}. Stubs are jump pads sometimes also called 13722@emph{trampolines}. Thus, the indirect call/jump jumps to such a stub. 13723The stub contains a direct jump to the desired address. 13724 13725@item 13726Linker relaxation must be turned on so that the linker generates 13727the stubs correctly in all situations. See the compiler option 13728@option{-mrelax} and the linker option @option{--relax}. 13729There are corner cases where the linker is supposed to generate stubs 13730but aborts without relaxation and without a helpful error message. 13731 13732@item 13733The default linker script is arranged for code with @code{EIND = 0}. 13734If code is supposed to work for a setup with @code{EIND != 0}, a custom 13735linker script has to be used in order to place the sections whose 13736name start with @code{.trampolines} into the segment where @code{EIND} 13737points to. 13738 13739@item 13740The startup code from libgcc never sets @code{EIND}. 13741Notice that startup code is a blend of code from libgcc and AVR-LibC. 13742For the impact of AVR-LibC on @code{EIND}, see the 13743@w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}. 13744 13745@item 13746It is legitimate for user-specific startup code to set up @code{EIND} 13747early, for example by means of initialization code located in 13748section @code{.init3}. Such code runs prior to general startup code 13749that initializes RAM and calls constructors, but after the bit 13750of startup code from AVR-LibC that sets @code{EIND} to the segment 13751where the vector table is located. 13752@example 13753#include <avr/io.h> 13754 13755static void 13756__attribute__((section(".init3"),naked,used,no_instrument_function)) 13757init3_set_eind (void) 13758@{ 13759 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t" 13760 "out %i0,r24" :: "n" (&EIND) : "r24","memory"); 13761@} 13762@end example 13763 13764@noindent 13765The @code{__trampolines_start} symbol is defined in the linker script. 13766 13767@item 13768Stubs are generated automatically by the linker if 13769the following two conditions are met: 13770@itemize @minus 13771 13772@item The address of a label is taken by means of the @code{gs} modifier 13773(short for @emph{generate stubs}) like so: 13774@example 13775LDI r24, lo8(gs(@var{func})) 13776LDI r25, hi8(gs(@var{func})) 13777@end example 13778@item The final location of that label is in a code segment 13779@emph{outside} the segment where the stubs are located. 13780@end itemize 13781 13782@item 13783The compiler emits such @code{gs} modifiers for code labels in the 13784following situations: 13785@itemize @minus 13786@item Taking address of a function or code label. 13787@item Computed goto. 13788@item If prologue-save function is used, see @option{-mcall-prologues} 13789command-line option. 13790@item Switch/case dispatch tables. If you do not want such dispatch 13791tables you can specify the @option{-fno-jump-tables} command-line option. 13792@item C and C++ constructors/destructors called during startup/shutdown. 13793@item If the tools hit a @code{gs()} modifier explained above. 13794@end itemize 13795 13796@item 13797Jumping to non-symbolic addresses like so is @emph{not} supported: 13798 13799@example 13800int main (void) 13801@{ 13802 /* Call function at word address 0x2 */ 13803 return ((int(*)(void)) 0x2)(); 13804@} 13805@end example 13806 13807Instead, a stub has to be set up, i.e.@: the function has to be called 13808through a symbol (@code{func_4} in the example): 13809 13810@example 13811int main (void) 13812@{ 13813 extern int func_4 (void); 13814 13815 /* Call function at byte address 0x4 */ 13816 return func_4(); 13817@} 13818@end example 13819 13820and the application be linked with @option{-Wl,--defsym,func_4=0x4}. 13821Alternatively, @code{func_4} can be defined in the linker script. 13822@end itemize 13823 13824@subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers 13825@cindex @code{RAMPD} 13826@cindex @code{RAMPX} 13827@cindex @code{RAMPY} 13828@cindex @code{RAMPZ} 13829Some AVR devices support memories larger than the 64@tie{}KiB range 13830that can be accessed with 16-bit pointers. To access memory locations 13831outside this 64@tie{}KiB range, the contentent of a @code{RAMP} 13832register is used as high part of the address: 13833The @code{X}, @code{Y}, @code{Z} address register is concatenated 13834with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function 13835register, respectively, to get a wide address. Similarly, 13836@code{RAMPD} is used together with direct addressing. 13837 13838@itemize 13839@item 13840The startup code initializes the @code{RAMP} special function 13841registers with zero. 13842 13843@item 13844If a @ref{AVR Named Address Spaces,named address space} other than 13845generic or @code{__flash} is used, then @code{RAMPZ} is set 13846as needed before the operation. 13847 13848@item 13849If the device supports RAM larger than 64@tie{}KiB and the compiler 13850needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ} 13851is reset to zero after the operation. 13852 13853@item 13854If the device comes with a specific @code{RAMP} register, the ISR 13855prologue/epilogue saves/restores that SFR and initializes it with 13856zero in case the ISR code might (implicitly) use it. 13857 13858@item 13859RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets. 13860If you use inline assembler to read from locations outside the 1386116-bit address range and change one of the @code{RAMP} registers, 13862you must reset it to zero after the access. 13863 13864@end itemize 13865 13866@subsubsection AVR Built-in Macros 13867 13868GCC defines several built-in macros so that the user code can test 13869for the presence or absence of features. Almost any of the following 13870built-in macros are deduced from device capabilities and thus 13871triggered by the @option{-mmcu=} command-line option. 13872 13873For even more AVR-specific built-in macros see 13874@ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}. 13875 13876@table @code 13877 13878@item __AVR_ARCH__ 13879Build-in macro that resolves to a decimal number that identifies the 13880architecture and depends on the @option{-mmcu=@var{mcu}} option. 13881Possible values are: 13882 13883@code{2}, @code{25}, @code{3}, @code{31}, @code{35}, 13884@code{4}, @code{5}, @code{51}, @code{6} 13885 13886for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31}, 13887@code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6}, 13888 13889respectively and 13890 13891@code{100}, @code{102}, @code{104}, 13892@code{105}, @code{106}, @code{107} 13893 13894for @var{mcu}=@code{avrtiny}, @code{avrxmega2}, @code{avrxmega4}, 13895@code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively. 13896If @var{mcu} specifies a device, this built-in macro is set 13897accordingly. For example, with @option{-mmcu=atmega8} the macro is 13898defined to @code{4}. 13899 13900@item __AVR_@var{Device}__ 13901Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects 13902the device's name. For example, @option{-mmcu=atmega8} defines the 13903built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines 13904@code{__AVR_ATtiny261A__}, etc. 13905 13906The built-in macros' names follow 13907the scheme @code{__AVR_@var{Device}__} where @var{Device} is 13908the device name as from the AVR user manual. The difference between 13909@var{Device} in the built-in macro and @var{device} in 13910@option{-mmcu=@var{device}} is that the latter is always lowercase. 13911 13912If @var{device} is not a device but only a core architecture like 13913@samp{avr51}, this macro is not defined. 13914 13915@item __AVR_DEVICE_NAME__ 13916Setting @option{-mmcu=@var{device}} defines this built-in macro to 13917the device's name. For example, with @option{-mmcu=atmega8} the macro 13918is defined to @code{atmega8}. 13919 13920If @var{device} is not a device but only a core architecture like 13921@samp{avr51}, this macro is not defined. 13922 13923@item __AVR_XMEGA__ 13924The device / architecture belongs to the XMEGA family of devices. 13925 13926@item __AVR_HAVE_ELPM__ 13927The device has the the @code{ELPM} instruction. 13928 13929@item __AVR_HAVE_ELPMX__ 13930The device has the @code{ELPM R@var{n},Z} and @code{ELPM 13931R@var{n},Z+} instructions. 13932 13933@item __AVR_HAVE_MOVW__ 13934The device has the @code{MOVW} instruction to perform 16-bit 13935register-register moves. 13936 13937@item __AVR_HAVE_LPMX__ 13938The device has the @code{LPM R@var{n},Z} and 13939@code{LPM R@var{n},Z+} instructions. 13940 13941@item __AVR_HAVE_MUL__ 13942The device has a hardware multiplier. 13943 13944@item __AVR_HAVE_JMP_CALL__ 13945The device has the @code{JMP} and @code{CALL} instructions. 13946This is the case for devices with at least 16@tie{}KiB of program 13947memory. 13948 13949@item __AVR_HAVE_EIJMP_EICALL__ 13950@itemx __AVR_3_BYTE_PC__ 13951The device has the @code{EIJMP} and @code{EICALL} instructions. 13952This is the case for devices with more than 128@tie{}KiB of program memory. 13953This also means that the program counter 13954(PC) is 3@tie{}bytes wide. 13955 13956@item __AVR_2_BYTE_PC__ 13957The program counter (PC) is 2@tie{}bytes wide. This is the case for devices 13958with up to 128@tie{}KiB of program memory. 13959 13960@item __AVR_HAVE_8BIT_SP__ 13961@itemx __AVR_HAVE_16BIT_SP__ 13962The stack pointer (SP) register is treated as 8-bit respectively 1396316-bit register by the compiler. 13964The definition of these macros is affected by @option{-mtiny-stack}. 13965 13966@item __AVR_HAVE_SPH__ 13967@itemx __AVR_SP8__ 13968The device has the SPH (high part of stack pointer) special function 13969register or has an 8-bit stack pointer, respectively. 13970The definition of these macros is affected by @option{-mmcu=} and 13971in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also 13972by @option{-msp8}. 13973 13974@item __AVR_HAVE_RAMPD__ 13975@itemx __AVR_HAVE_RAMPX__ 13976@itemx __AVR_HAVE_RAMPY__ 13977@itemx __AVR_HAVE_RAMPZ__ 13978The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY}, 13979@code{RAMPZ} special function register, respectively. 13980 13981@item __NO_INTERRUPTS__ 13982This macro reflects the @option{-mno-interrupts} command-line option. 13983 13984@item __AVR_ERRATA_SKIP__ 13985@itemx __AVR_ERRATA_SKIP_JMP_CALL__ 13986Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit 13987instructions because of a hardware erratum. Skip instructions are 13988@code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}. 13989The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also 13990set. 13991 13992@item __AVR_ISA_RMW__ 13993The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT). 13994 13995@item __AVR_SFR_OFFSET__=@var{offset} 13996Instructions that can address I/O special function registers directly 13997like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different 13998address as if addressed by an instruction to access RAM like @code{LD} 13999or @code{STS}. This offset depends on the device architecture and has 14000to be subtracted from the RAM address in order to get the 14001respective I/O@tie{}address. 14002 14003@item __WITH_AVRLIBC__ 14004The compiler is configured to be used together with AVR-Libc. 14005See the @option{--with-avrlibc} configure option. 14006 14007@end table 14008 14009@node Blackfin Options 14010@subsection Blackfin Options 14011@cindex Blackfin Options 14012 14013@table @gcctabopt 14014@item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} 14015@opindex mcpu= 14016Specifies the name of the target Blackfin processor. Currently, @var{cpu} 14017can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518}, 14018@samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526}, 14019@samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533}, 14020@samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539}, 14021@samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549}, 14022@samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m}, 14023@samp{bf561}, @samp{bf592}. 14024 14025The optional @var{sirevision} specifies the silicon revision of the target 14026Blackfin processor. Any workarounds available for the targeted silicon revision 14027are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled. 14028If @var{sirevision} is @samp{any}, all workarounds for the targeted processor 14029are enabled. The @code{__SILICON_REVISION__} macro is defined to two 14030hexadecimal digits representing the major and minor numbers in the silicon 14031revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__} 14032is not defined. If @var{sirevision} is @samp{any}, the 14033@code{__SILICON_REVISION__} is defined to be @code{0xffff}. 14034If this optional @var{sirevision} is not used, GCC assumes the latest known 14035silicon revision of the targeted Blackfin processor. 14036 14037GCC defines a preprocessor macro for the specified @var{cpu}. 14038For the @samp{bfin-elf} toolchain, this option causes the hardware BSP 14039provided by libgloss to be linked in if @option{-msim} is not given. 14040 14041Without this option, @samp{bf532} is used as the processor by default. 14042 14043Note that support for @samp{bf561} is incomplete. For @samp{bf561}, 14044only the preprocessor macro is defined. 14045 14046@item -msim 14047@opindex msim 14048Specifies that the program will be run on the simulator. This causes 14049the simulator BSP provided by libgloss to be linked in. This option 14050has effect only for @samp{bfin-elf} toolchain. 14051Certain other options, such as @option{-mid-shared-library} and 14052@option{-mfdpic}, imply @option{-msim}. 14053 14054@item -momit-leaf-frame-pointer 14055@opindex momit-leaf-frame-pointer 14056Don't keep the frame pointer in a register for leaf functions. This 14057avoids the instructions to save, set up and restore frame pointers and 14058makes an extra register available in leaf functions. The option 14059@option{-fomit-frame-pointer} removes the frame pointer for all functions, 14060which might make debugging harder. 14061 14062@item -mspecld-anomaly 14063@opindex mspecld-anomaly 14064When enabled, the compiler ensures that the generated code does not 14065contain speculative loads after jump instructions. If this option is used, 14066@code{__WORKAROUND_SPECULATIVE_LOADS} is defined. 14067 14068@item -mno-specld-anomaly 14069@opindex mno-specld-anomaly 14070Don't generate extra code to prevent speculative loads from occurring. 14071 14072@item -mcsync-anomaly 14073@opindex mcsync-anomaly 14074When enabled, the compiler ensures that the generated code does not 14075contain CSYNC or SSYNC instructions too soon after conditional branches. 14076If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined. 14077 14078@item -mno-csync-anomaly 14079@opindex mno-csync-anomaly 14080Don't generate extra code to prevent CSYNC or SSYNC instructions from 14081occurring too soon after a conditional branch. 14082 14083@item -mlow-64k 14084@opindex mlow-64k 14085When enabled, the compiler is free to take advantage of the knowledge that 14086the entire program fits into the low 64k of memory. 14087 14088@item -mno-low-64k 14089@opindex mno-low-64k 14090Assume that the program is arbitrarily large. This is the default. 14091 14092@item -mstack-check-l1 14093@opindex mstack-check-l1 14094Do stack checking using information placed into L1 scratchpad memory by the 14095uClinux kernel. 14096 14097@item -mid-shared-library 14098@opindex mid-shared-library 14099Generate code that supports shared libraries via the library ID method. 14100This allows for execute in place and shared libraries in an environment 14101without virtual memory management. This option implies @option{-fPIC}. 14102With a @samp{bfin-elf} target, this option implies @option{-msim}. 14103 14104@item -mno-id-shared-library 14105@opindex mno-id-shared-library 14106Generate code that doesn't assume ID-based shared libraries are being used. 14107This is the default. 14108 14109@item -mleaf-id-shared-library 14110@opindex mleaf-id-shared-library 14111Generate code that supports shared libraries via the library ID method, 14112but assumes that this library or executable won't link against any other 14113ID shared libraries. That allows the compiler to use faster code for jumps 14114and calls. 14115 14116@item -mno-leaf-id-shared-library 14117@opindex mno-leaf-id-shared-library 14118Do not assume that the code being compiled won't link against any ID shared 14119libraries. Slower code is generated for jump and call insns. 14120 14121@item -mshared-library-id=n 14122@opindex mshared-library-id 14123Specifies the identification number of the ID-based shared library being 14124compiled. Specifying a value of 0 generates more compact code; specifying 14125other values forces the allocation of that number to the current 14126library but is no more space- or time-efficient than omitting this option. 14127 14128@item -msep-data 14129@opindex msep-data 14130Generate code that allows the data segment to be located in a different 14131area of memory from the text segment. This allows for execute in place in 14132an environment without virtual memory management by eliminating relocations 14133against the text section. 14134 14135@item -mno-sep-data 14136@opindex mno-sep-data 14137Generate code that assumes that the data segment follows the text segment. 14138This is the default. 14139 14140@item -mlong-calls 14141@itemx -mno-long-calls 14142@opindex mlong-calls 14143@opindex mno-long-calls 14144Tells the compiler to perform function calls by first loading the 14145address of the function into a register and then performing a subroutine 14146call on this register. This switch is needed if the target function 14147lies outside of the 24-bit addressing range of the offset-based 14148version of subroutine call instruction. 14149 14150This feature is not enabled by default. Specifying 14151@option{-mno-long-calls} restores the default behavior. Note these 14152switches have no effect on how the compiler generates code to handle 14153function calls via function pointers. 14154 14155@item -mfast-fp 14156@opindex mfast-fp 14157Link with the fast floating-point library. This library relaxes some of 14158the IEEE floating-point standard's rules for checking inputs against 14159Not-a-Number (NAN), in the interest of performance. 14160 14161@item -minline-plt 14162@opindex minline-plt 14163Enable inlining of PLT entries in function calls to functions that are 14164not known to bind locally. It has no effect without @option{-mfdpic}. 14165 14166@item -mmulticore 14167@opindex mmulticore 14168Build a standalone application for multicore Blackfin processors. 14169This option causes proper start files and link scripts supporting 14170multicore to be used, and defines the macro @code{__BFIN_MULTICORE}. 14171It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}. 14172 14173This option can be used with @option{-mcorea} or @option{-mcoreb}, which 14174selects the one-application-per-core programming model. Without 14175@option{-mcorea} or @option{-mcoreb}, the single-application/dual-core 14176programming model is used. In this model, the main function of Core B 14177should be named as @code{coreb_main}. 14178 14179If this option is not used, the single-core application programming 14180model is used. 14181 14182@item -mcorea 14183@opindex mcorea 14184Build a standalone application for Core A of BF561 when using 14185the one-application-per-core programming model. Proper start files 14186and link scripts are used to support Core A, and the macro 14187@code{__BFIN_COREA} is defined. 14188This option can only be used in conjunction with @option{-mmulticore}. 14189 14190@item -mcoreb 14191@opindex mcoreb 14192Build a standalone application for Core B of BF561 when using 14193the one-application-per-core programming model. Proper start files 14194and link scripts are used to support Core B, and the macro 14195@code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main} 14196should be used instead of @code{main}. 14197This option can only be used in conjunction with @option{-mmulticore}. 14198 14199@item -msdram 14200@opindex msdram 14201Build a standalone application for SDRAM. Proper start files and 14202link scripts are used to put the application into SDRAM, and the macro 14203@code{__BFIN_SDRAM} is defined. 14204The loader should initialize SDRAM before loading the application. 14205 14206@item -micplb 14207@opindex micplb 14208Assume that ICPLBs are enabled at run time. This has an effect on certain 14209anomaly workarounds. For Linux targets, the default is to assume ICPLBs 14210are enabled; for standalone applications the default is off. 14211@end table 14212 14213@node C6X Options 14214@subsection C6X Options 14215@cindex C6X Options 14216 14217@table @gcctabopt 14218@item -march=@var{name} 14219@opindex march 14220This specifies the name of the target architecture. GCC uses this 14221name to determine what kind of instructions it can emit when generating 14222assembly code. Permissible names are: @samp{c62x}, 14223@samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}. 14224 14225@item -mbig-endian 14226@opindex mbig-endian 14227Generate code for a big-endian target. 14228 14229@item -mlittle-endian 14230@opindex mlittle-endian 14231Generate code for a little-endian target. This is the default. 14232 14233@item -msim 14234@opindex msim 14235Choose startup files and linker script suitable for the simulator. 14236 14237@item -msdata=default 14238@opindex msdata=default 14239Put small global and static data in the @code{.neardata} section, 14240which is pointed to by register @code{B14}. Put small uninitialized 14241global and static data in the @code{.bss} section, which is adjacent 14242to the @code{.neardata} section. Put small read-only data into the 14243@code{.rodata} section. The corresponding sections used for large 14244pieces of data are @code{.fardata}, @code{.far} and @code{.const}. 14245 14246@item -msdata=all 14247@opindex msdata=all 14248Put all data, not just small objects, into the sections reserved for 14249small data, and use addressing relative to the @code{B14} register to 14250access them. 14251 14252@item -msdata=none 14253@opindex msdata=none 14254Make no use of the sections reserved for small data, and use absolute 14255addresses to access all data. Put all initialized global and static 14256data in the @code{.fardata} section, and all uninitialized data in the 14257@code{.far} section. Put all constant data into the @code{.const} 14258section. 14259@end table 14260 14261@node CRIS Options 14262@subsection CRIS Options 14263@cindex CRIS Options 14264 14265These options are defined specifically for the CRIS ports. 14266 14267@table @gcctabopt 14268@item -march=@var{architecture-type} 14269@itemx -mcpu=@var{architecture-type} 14270@opindex march 14271@opindex mcpu 14272Generate code for the specified architecture. The choices for 14273@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for 14274respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@. 14275Default is @samp{v0} except for cris-axis-linux-gnu, where the default is 14276@samp{v10}. 14277 14278@item -mtune=@var{architecture-type} 14279@opindex mtune 14280Tune to @var{architecture-type} everything applicable about the generated 14281code, except for the ABI and the set of available instructions. The 14282choices for @var{architecture-type} are the same as for 14283@option{-march=@var{architecture-type}}. 14284 14285@item -mmax-stack-frame=@var{n} 14286@opindex mmax-stack-frame 14287Warn when the stack frame of a function exceeds @var{n} bytes. 14288 14289@item -metrax4 14290@itemx -metrax100 14291@opindex metrax4 14292@opindex metrax100 14293The options @option{-metrax4} and @option{-metrax100} are synonyms for 14294@option{-march=v3} and @option{-march=v8} respectively. 14295 14296@item -mmul-bug-workaround 14297@itemx -mno-mul-bug-workaround 14298@opindex mmul-bug-workaround 14299@opindex mno-mul-bug-workaround 14300Work around a bug in the @code{muls} and @code{mulu} instructions for CPU 14301models where it applies. This option is active by default. 14302 14303@item -mpdebug 14304@opindex mpdebug 14305Enable CRIS-specific verbose debug-related information in the assembly 14306code. This option also has the effect of turning off the @samp{#NO_APP} 14307formatted-code indicator to the assembler at the beginning of the 14308assembly file. 14309 14310@item -mcc-init 14311@opindex mcc-init 14312Do not use condition-code results from previous instruction; always emit 14313compare and test instructions before use of condition codes. 14314 14315@item -mno-side-effects 14316@opindex mno-side-effects 14317Do not emit instructions with side effects in addressing modes other than 14318post-increment. 14319 14320@item -mstack-align 14321@itemx -mno-stack-align 14322@itemx -mdata-align 14323@itemx -mno-data-align 14324@itemx -mconst-align 14325@itemx -mno-const-align 14326@opindex mstack-align 14327@opindex mno-stack-align 14328@opindex mdata-align 14329@opindex mno-data-align 14330@opindex mconst-align 14331@opindex mno-const-align 14332These options (@samp{no-} options) arrange (eliminate arrangements) for the 14333stack frame, individual data and constants to be aligned for the maximum 14334single data access size for the chosen CPU model. The default is to 14335arrange for 32-bit alignment. ABI details such as structure layout are 14336not affected by these options. 14337 14338@item -m32-bit 14339@itemx -m16-bit 14340@itemx -m8-bit 14341@opindex m32-bit 14342@opindex m16-bit 14343@opindex m8-bit 14344Similar to the stack- data- and const-align options above, these options 14345arrange for stack frame, writable data and constants to all be 32-bit, 1434616-bit or 8-bit aligned. The default is 32-bit alignment. 14347 14348@item -mno-prologue-epilogue 14349@itemx -mprologue-epilogue 14350@opindex mno-prologue-epilogue 14351@opindex mprologue-epilogue 14352With @option{-mno-prologue-epilogue}, the normal function prologue and 14353epilogue which set up the stack frame are omitted and no return 14354instructions or return sequences are generated in the code. Use this 14355option only together with visual inspection of the compiled code: no 14356warnings or errors are generated when call-saved registers must be saved, 14357or storage for local variables needs to be allocated. 14358 14359@item -mno-gotplt 14360@itemx -mgotplt 14361@opindex mno-gotplt 14362@opindex mgotplt 14363With @option{-fpic} and @option{-fPIC}, don't generate (do generate) 14364instruction sequences that load addresses for functions from the PLT part 14365of the GOT rather than (traditional on other architectures) calls to the 14366PLT@. The default is @option{-mgotplt}. 14367 14368@item -melf 14369@opindex melf 14370Legacy no-op option only recognized with the cris-axis-elf and 14371cris-axis-linux-gnu targets. 14372 14373@item -mlinux 14374@opindex mlinux 14375Legacy no-op option only recognized with the cris-axis-linux-gnu target. 14376 14377@item -sim 14378@opindex sim 14379This option, recognized for the cris-axis-elf, arranges 14380to link with input-output functions from a simulator library. Code, 14381initialized data and zero-initialized data are allocated consecutively. 14382 14383@item -sim2 14384@opindex sim2 14385Like @option{-sim}, but pass linker options to locate initialized data at 143860x40000000 and zero-initialized data at 0x80000000. 14387@end table 14388 14389@node CR16 Options 14390@subsection CR16 Options 14391@cindex CR16 Options 14392 14393These options are defined specifically for the CR16 ports. 14394 14395@table @gcctabopt 14396 14397@item -mmac 14398@opindex mmac 14399Enable the use of multiply-accumulate instructions. Disabled by default. 14400 14401@item -mcr16cplus 14402@itemx -mcr16c 14403@opindex mcr16cplus 14404@opindex mcr16c 14405Generate code for CR16C or CR16C+ architecture. CR16C+ architecture 14406is default. 14407 14408@item -msim 14409@opindex msim 14410Links the library libsim.a which is in compatible with simulator. Applicable 14411to ELF compiler only. 14412 14413@item -mint32 14414@opindex mint32 14415Choose integer type as 32-bit wide. 14416 14417@item -mbit-ops 14418@opindex mbit-ops 14419Generates @code{sbit}/@code{cbit} instructions for bit manipulations. 14420 14421@item -mdata-model=@var{model} 14422@opindex mdata-model 14423Choose a data model. The choices for @var{model} are @samp{near}, 14424@samp{far} or @samp{medium}. @samp{medium} is default. 14425However, @samp{far} is not valid with @option{-mcr16c}, as the 14426CR16C architecture does not support the far data model. 14427@end table 14428 14429@node Darwin Options 14430@subsection Darwin Options 14431@cindex Darwin options 14432 14433These options are defined for all architectures running the Darwin operating 14434system. 14435 14436FSF GCC on Darwin does not create ``fat'' object files; it creates 14437an object file for the single architecture that GCC was built to 14438target. Apple's GCC on Darwin does create ``fat'' files if multiple 14439@option{-arch} options are used; it does so by running the compiler or 14440linker multiple times and joining the results together with 14441@file{lipo}. 14442 14443The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or 14444@samp{i686}) is determined by the flags that specify the ISA 14445that GCC is targeting, like @option{-mcpu} or @option{-march}. The 14446@option{-force_cpusubtype_ALL} option can be used to override this. 14447 14448The Darwin tools vary in their behavior when presented with an ISA 14449mismatch. The assembler, @file{as}, only permits instructions to 14450be used that are valid for the subtype of the file it is generating, 14451so you cannot put 64-bit instructions in a @samp{ppc750} object file. 14452The linker for shared libraries, @file{/usr/bin/libtool}, fails 14453and prints an error if asked to create a shared library with a less 14454restrictive subtype than its input files (for instance, trying to put 14455a @samp{ppc970} object file in a @samp{ppc7400} library). The linker 14456for executables, @command{ld}, quietly gives the executable the most 14457restrictive subtype of any of its input files. 14458 14459@table @gcctabopt 14460@item -F@var{dir} 14461@opindex F 14462Add the framework directory @var{dir} to the head of the list of 14463directories to be searched for header files. These directories are 14464interleaved with those specified by @option{-I} options and are 14465scanned in a left-to-right order. 14466 14467A framework directory is a directory with frameworks in it. A 14468framework is a directory with a @file{Headers} and/or 14469@file{PrivateHeaders} directory contained directly in it that ends 14470in @file{.framework}. The name of a framework is the name of this 14471directory excluding the @file{.framework}. Headers associated with 14472the framework are found in one of those two directories, with 14473@file{Headers} being searched first. A subframework is a framework 14474directory that is in a framework's @file{Frameworks} directory. 14475Includes of subframework headers can only appear in a header of a 14476framework that contains the subframework, or in a sibling subframework 14477header. Two subframeworks are siblings if they occur in the same 14478framework. A subframework should not have the same name as a 14479framework; a warning is issued if this is violated. Currently a 14480subframework cannot have subframeworks; in the future, the mechanism 14481may be extended to support this. The standard frameworks can be found 14482in @file{/System/Library/Frameworks} and 14483@file{/Library/Frameworks}. An example include looks like 14484@code{#include <Framework/header.h>}, where @file{Framework} denotes 14485the name of the framework and @file{header.h} is found in the 14486@file{PrivateHeaders} or @file{Headers} directory. 14487 14488@item -iframework@var{dir} 14489@opindex iframework 14490Like @option{-F} except the directory is a treated as a system 14491directory. The main difference between this @option{-iframework} and 14492@option{-F} is that with @option{-iframework} the compiler does not 14493warn about constructs contained within header files found via 14494@var{dir}. This option is valid only for the C family of languages. 14495 14496@item -gused 14497@opindex gused 14498Emit debugging information for symbols that are used. For stabs 14499debugging format, this enables @option{-feliminate-unused-debug-symbols}. 14500This is by default ON@. 14501 14502@item -gfull 14503@opindex gfull 14504Emit debugging information for all symbols and types. 14505 14506@item -mmacosx-version-min=@var{version} 14507The earliest version of MacOS X that this executable will run on 14508is @var{version}. Typical values of @var{version} include @code{10.1}, 14509@code{10.2}, and @code{10.3.9}. 14510 14511If the compiler was built to use the system's headers by default, 14512then the default for this option is the system version on which the 14513compiler is running, otherwise the default is to make choices that 14514are compatible with as many systems and code bases as possible. 14515 14516@item -mkernel 14517@opindex mkernel 14518Enable kernel development mode. The @option{-mkernel} option sets 14519@option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit}, 14520@option{-fno-exceptions}, @option{-fno-non-call-exceptions}, 14521@option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where 14522applicable. This mode also sets @option{-mno-altivec}, 14523@option{-msoft-float}, @option{-fno-builtin} and 14524@option{-mlong-branch} for PowerPC targets. 14525 14526@item -mone-byte-bool 14527@opindex mone-byte-bool 14528Override the defaults for @code{bool} so that @code{sizeof(bool)==1}. 14529By default @code{sizeof(bool)} is @code{4} when compiling for 14530Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this 14531option has no effect on x86. 14532 14533@strong{Warning:} The @option{-mone-byte-bool} switch causes GCC 14534to generate code that is not binary compatible with code generated 14535without that switch. Using this switch may require recompiling all 14536other modules in a program, including system libraries. Use this 14537switch to conform to a non-default data model. 14538 14539@item -mfix-and-continue 14540@itemx -ffix-and-continue 14541@itemx -findirect-data 14542@opindex mfix-and-continue 14543@opindex ffix-and-continue 14544@opindex findirect-data 14545Generate code suitable for fast turnaround development, such as to 14546allow GDB to dynamically load @file{.o} files into already-running 14547programs. @option{-findirect-data} and @option{-ffix-and-continue} 14548are provided for backwards compatibility. 14549 14550@item -all_load 14551@opindex all_load 14552Loads all members of static archive libraries. 14553See man ld(1) for more information. 14554 14555@item -arch_errors_fatal 14556@opindex arch_errors_fatal 14557Cause the errors having to do with files that have the wrong architecture 14558to be fatal. 14559 14560@item -bind_at_load 14561@opindex bind_at_load 14562Causes the output file to be marked such that the dynamic linker will 14563bind all undefined references when the file is loaded or launched. 14564 14565@item -bundle 14566@opindex bundle 14567Produce a Mach-o bundle format file. 14568See man ld(1) for more information. 14569 14570@item -bundle_loader @var{executable} 14571@opindex bundle_loader 14572This option specifies the @var{executable} that will load the build 14573output file being linked. See man ld(1) for more information. 14574 14575@item -dynamiclib 14576@opindex dynamiclib 14577When passed this option, GCC produces a dynamic library instead of 14578an executable when linking, using the Darwin @file{libtool} command. 14579 14580@item -force_cpusubtype_ALL 14581@opindex force_cpusubtype_ALL 14582This causes GCC's output file to have the @samp{ALL} subtype, instead of 14583one controlled by the @option{-mcpu} or @option{-march} option. 14584 14585@item -allowable_client @var{client_name} 14586@itemx -client_name 14587@itemx -compatibility_version 14588@itemx -current_version 14589@itemx -dead_strip 14590@itemx -dependency-file 14591@itemx -dylib_file 14592@itemx -dylinker_install_name 14593@itemx -dynamic 14594@itemx -exported_symbols_list 14595@itemx -filelist 14596@need 800 14597@itemx -flat_namespace 14598@itemx -force_flat_namespace 14599@itemx -headerpad_max_install_names 14600@itemx -image_base 14601@itemx -init 14602@itemx -install_name 14603@itemx -keep_private_externs 14604@itemx -multi_module 14605@itemx -multiply_defined 14606@itemx -multiply_defined_unused 14607@need 800 14608@itemx -noall_load 14609@itemx -no_dead_strip_inits_and_terms 14610@itemx -nofixprebinding 14611@itemx -nomultidefs 14612@itemx -noprebind 14613@itemx -noseglinkedit 14614@itemx -pagezero_size 14615@itemx -prebind 14616@itemx -prebind_all_twolevel_modules 14617@itemx -private_bundle 14618@need 800 14619@itemx -read_only_relocs 14620@itemx -sectalign 14621@itemx -sectobjectsymbols 14622@itemx -whyload 14623@itemx -seg1addr 14624@itemx -sectcreate 14625@itemx -sectobjectsymbols 14626@itemx -sectorder 14627@itemx -segaddr 14628@itemx -segs_read_only_addr 14629@need 800 14630@itemx -segs_read_write_addr 14631@itemx -seg_addr_table 14632@itemx -seg_addr_table_filename 14633@itemx -seglinkedit 14634@itemx -segprot 14635@itemx -segs_read_only_addr 14636@itemx -segs_read_write_addr 14637@itemx -single_module 14638@itemx -static 14639@itemx -sub_library 14640@need 800 14641@itemx -sub_umbrella 14642@itemx -twolevel_namespace 14643@itemx -umbrella 14644@itemx -undefined 14645@itemx -unexported_symbols_list 14646@itemx -weak_reference_mismatches 14647@itemx -whatsloaded 14648@opindex allowable_client 14649@opindex client_name 14650@opindex compatibility_version 14651@opindex current_version 14652@opindex dead_strip 14653@opindex dependency-file 14654@opindex dylib_file 14655@opindex dylinker_install_name 14656@opindex dynamic 14657@opindex exported_symbols_list 14658@opindex filelist 14659@opindex flat_namespace 14660@opindex force_flat_namespace 14661@opindex headerpad_max_install_names 14662@opindex image_base 14663@opindex init 14664@opindex install_name 14665@opindex keep_private_externs 14666@opindex multi_module 14667@opindex multiply_defined 14668@opindex multiply_defined_unused 14669@opindex noall_load 14670@opindex no_dead_strip_inits_and_terms 14671@opindex nofixprebinding 14672@opindex nomultidefs 14673@opindex noprebind 14674@opindex noseglinkedit 14675@opindex pagezero_size 14676@opindex prebind 14677@opindex prebind_all_twolevel_modules 14678@opindex private_bundle 14679@opindex read_only_relocs 14680@opindex sectalign 14681@opindex sectobjectsymbols 14682@opindex whyload 14683@opindex seg1addr 14684@opindex sectcreate 14685@opindex sectobjectsymbols 14686@opindex sectorder 14687@opindex segaddr 14688@opindex segs_read_only_addr 14689@opindex segs_read_write_addr 14690@opindex seg_addr_table 14691@opindex seg_addr_table_filename 14692@opindex seglinkedit 14693@opindex segprot 14694@opindex segs_read_only_addr 14695@opindex segs_read_write_addr 14696@opindex single_module 14697@opindex static 14698@opindex sub_library 14699@opindex sub_umbrella 14700@opindex twolevel_namespace 14701@opindex umbrella 14702@opindex undefined 14703@opindex unexported_symbols_list 14704@opindex weak_reference_mismatches 14705@opindex whatsloaded 14706These options are passed to the Darwin linker. The Darwin linker man page 14707describes them in detail. 14708@end table 14709 14710@node DEC Alpha Options 14711@subsection DEC Alpha Options 14712 14713These @samp{-m} options are defined for the DEC Alpha implementations: 14714 14715@table @gcctabopt 14716@item -mno-soft-float 14717@itemx -msoft-float 14718@opindex mno-soft-float 14719@opindex msoft-float 14720Use (do not use) the hardware floating-point instructions for 14721floating-point operations. When @option{-msoft-float} is specified, 14722functions in @file{libgcc.a} are used to perform floating-point 14723operations. Unless they are replaced by routines that emulate the 14724floating-point operations, or compiled in such a way as to call such 14725emulations routines, these routines issue floating-point 14726operations. If you are compiling for an Alpha without floating-point 14727operations, you must ensure that the library is built so as not to call 14728them. 14729 14730Note that Alpha implementations without floating-point operations are 14731required to have floating-point registers. 14732 14733@item -mfp-reg 14734@itemx -mno-fp-regs 14735@opindex mfp-reg 14736@opindex mno-fp-regs 14737Generate code that uses (does not use) the floating-point register set. 14738@option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point 14739register set is not used, floating-point operands are passed in integer 14740registers as if they were integers and floating-point results are passed 14741in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence, 14742so any function with a floating-point argument or return value called by code 14743compiled with @option{-mno-fp-regs} must also be compiled with that 14744option. 14745 14746A typical use of this option is building a kernel that does not use, 14747and hence need not save and restore, any floating-point registers. 14748 14749@item -mieee 14750@opindex mieee 14751The Alpha architecture implements floating-point hardware optimized for 14752maximum performance. It is mostly compliant with the IEEE floating-point 14753standard. However, for full compliance, software assistance is 14754required. This option generates code fully IEEE-compliant code 14755@emph{except} that the @var{inexact-flag} is not maintained (see below). 14756If this option is turned on, the preprocessor macro @code{_IEEE_FP} is 14757defined during compilation. The resulting code is less efficient but is 14758able to correctly support denormalized numbers and exceptional IEEE 14759values such as not-a-number and plus/minus infinity. Other Alpha 14760compilers call this option @option{-ieee_with_no_inexact}. 14761 14762@item -mieee-with-inexact 14763@opindex mieee-with-inexact 14764This is like @option{-mieee} except the generated code also maintains 14765the IEEE @var{inexact-flag}. Turning on this option causes the 14766generated code to implement fully-compliant IEEE math. In addition to 14767@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor 14768macro. On some Alpha implementations the resulting code may execute 14769significantly slower than the code generated by default. Since there is 14770very little code that depends on the @var{inexact-flag}, you should 14771normally not specify this option. Other Alpha compilers call this 14772option @option{-ieee_with_inexact}. 14773 14774@item -mfp-trap-mode=@var{trap-mode} 14775@opindex mfp-trap-mode 14776This option controls what floating-point related traps are enabled. 14777Other Alpha compilers call this option @option{-fptm @var{trap-mode}}. 14778The trap mode can be set to one of four values: 14779 14780@table @samp 14781@item n 14782This is the default (normal) setting. The only traps that are enabled 14783are the ones that cannot be disabled in software (e.g., division by zero 14784trap). 14785 14786@item u 14787In addition to the traps enabled by @samp{n}, underflow traps are enabled 14788as well. 14789 14790@item su 14791Like @samp{u}, but the instructions are marked to be safe for software 14792completion (see Alpha architecture manual for details). 14793 14794@item sui 14795Like @samp{su}, but inexact traps are enabled as well. 14796@end table 14797 14798@item -mfp-rounding-mode=@var{rounding-mode} 14799@opindex mfp-rounding-mode 14800Selects the IEEE rounding mode. Other Alpha compilers call this option 14801@option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one 14802of: 14803 14804@table @samp 14805@item n 14806Normal IEEE rounding mode. Floating-point numbers are rounded towards 14807the nearest machine number or towards the even machine number in case 14808of a tie. 14809 14810@item m 14811Round towards minus infinity. 14812 14813@item c 14814Chopped rounding mode. Floating-point numbers are rounded towards zero. 14815 14816@item d 14817Dynamic rounding mode. A field in the floating-point control register 14818(@var{fpcr}, see Alpha architecture reference manual) controls the 14819rounding mode in effect. The C library initializes this register for 14820rounding towards plus infinity. Thus, unless your program modifies the 14821@var{fpcr}, @samp{d} corresponds to round towards plus infinity. 14822@end table 14823 14824@item -mtrap-precision=@var{trap-precision} 14825@opindex mtrap-precision 14826In the Alpha architecture, floating-point traps are imprecise. This 14827means without software assistance it is impossible to recover from a 14828floating trap and program execution normally needs to be terminated. 14829GCC can generate code that can assist operating system trap handlers 14830in determining the exact location that caused a floating-point trap. 14831Depending on the requirements of an application, different levels of 14832precisions can be selected: 14833 14834@table @samp 14835@item p 14836Program precision. This option is the default and means a trap handler 14837can only identify which program caused a floating-point exception. 14838 14839@item f 14840Function precision. The trap handler can determine the function that 14841caused a floating-point exception. 14842 14843@item i 14844Instruction precision. The trap handler can determine the exact 14845instruction that caused a floating-point exception. 14846@end table 14847 14848Other Alpha compilers provide the equivalent options called 14849@option{-scope_safe} and @option{-resumption_safe}. 14850 14851@item -mieee-conformant 14852@opindex mieee-conformant 14853This option marks the generated code as IEEE conformant. You must not 14854use this option unless you also specify @option{-mtrap-precision=i} and either 14855@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect 14856is to emit the line @samp{.eflag 48} in the function prologue of the 14857generated assembly file. 14858 14859@item -mbuild-constants 14860@opindex mbuild-constants 14861Normally GCC examines a 32- or 64-bit integer constant to 14862see if it can construct it from smaller constants in two or three 14863instructions. If it cannot, it outputs the constant as a literal and 14864generates code to load it from the data segment at run time. 14865 14866Use this option to require GCC to construct @emph{all} integer constants 14867using code, even if it takes more instructions (the maximum is six). 14868 14869You typically use this option to build a shared library dynamic 14870loader. Itself a shared library, it must relocate itself in memory 14871before it can find the variables and constants in its own data segment. 14872 14873@item -mbwx 14874@itemx -mno-bwx 14875@itemx -mcix 14876@itemx -mno-cix 14877@itemx -mfix 14878@itemx -mno-fix 14879@itemx -mmax 14880@itemx -mno-max 14881@opindex mbwx 14882@opindex mno-bwx 14883@opindex mcix 14884@opindex mno-cix 14885@opindex mfix 14886@opindex mno-fix 14887@opindex mmax 14888@opindex mno-max 14889Indicate whether GCC should generate code to use the optional BWX, 14890CIX, FIX and MAX instruction sets. The default is to use the instruction 14891sets supported by the CPU type specified via @option{-mcpu=} option or that 14892of the CPU on which GCC was built if none is specified. 14893 14894@item -mfloat-vax 14895@itemx -mfloat-ieee 14896@opindex mfloat-vax 14897@opindex mfloat-ieee 14898Generate code that uses (does not use) VAX F and G floating-point 14899arithmetic instead of IEEE single and double precision. 14900 14901@item -mexplicit-relocs 14902@itemx -mno-explicit-relocs 14903@opindex mexplicit-relocs 14904@opindex mno-explicit-relocs 14905Older Alpha assemblers provided no way to generate symbol relocations 14906except via assembler macros. Use of these macros does not allow 14907optimal instruction scheduling. GNU binutils as of version 2.12 14908supports a new syntax that allows the compiler to explicitly mark 14909which relocations should apply to which instructions. This option 14910is mostly useful for debugging, as GCC detects the capabilities of 14911the assembler when it is built and sets the default accordingly. 14912 14913@item -msmall-data 14914@itemx -mlarge-data 14915@opindex msmall-data 14916@opindex mlarge-data 14917When @option{-mexplicit-relocs} is in effect, static data is 14918accessed via @dfn{gp-relative} relocations. When @option{-msmall-data} 14919is used, objects 8 bytes long or smaller are placed in a @dfn{small data area} 14920(the @code{.sdata} and @code{.sbss} sections) and are accessed via 1492116-bit relocations off of the @code{$gp} register. This limits the 14922size of the small data area to 64KB, but allows the variables to be 14923directly accessed via a single instruction. 14924 14925The default is @option{-mlarge-data}. With this option the data area 14926is limited to just below 2GB@. Programs that require more than 2GB of 14927data must use @code{malloc} or @code{mmap} to allocate the data in the 14928heap instead of in the program's data segment. 14929 14930When generating code for shared libraries, @option{-fpic} implies 14931@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}. 14932 14933@item -msmall-text 14934@itemx -mlarge-text 14935@opindex msmall-text 14936@opindex mlarge-text 14937When @option{-msmall-text} is used, the compiler assumes that the 14938code of the entire program (or shared library) fits in 4MB, and is 14939thus reachable with a branch instruction. When @option{-msmall-data} 14940is used, the compiler can assume that all local symbols share the 14941same @code{$gp} value, and thus reduce the number of instructions 14942required for a function call from 4 to 1. 14943 14944The default is @option{-mlarge-text}. 14945 14946@item -mcpu=@var{cpu_type} 14947@opindex mcpu 14948Set the instruction set and instruction scheduling parameters for 14949machine type @var{cpu_type}. You can specify either the @samp{EV} 14950style name or the corresponding chip number. GCC supports scheduling 14951parameters for the EV4, EV5 and EV6 family of processors and 14952chooses the default values for the instruction set from the processor 14953you specify. If you do not specify a processor type, GCC defaults 14954to the processor on which the compiler was built. 14955 14956Supported values for @var{cpu_type} are 14957 14958@table @samp 14959@item ev4 14960@itemx ev45 14961@itemx 21064 14962Schedules as an EV4 and has no instruction set extensions. 14963 14964@item ev5 14965@itemx 21164 14966Schedules as an EV5 and has no instruction set extensions. 14967 14968@item ev56 14969@itemx 21164a 14970Schedules as an EV5 and supports the BWX extension. 14971 14972@item pca56 14973@itemx 21164pc 14974@itemx 21164PC 14975Schedules as an EV5 and supports the BWX and MAX extensions. 14976 14977@item ev6 14978@itemx 21264 14979Schedules as an EV6 and supports the BWX, FIX, and MAX extensions. 14980 14981@item ev67 14982@itemx 21264a 14983Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions. 14984@end table 14985 14986Native toolchains also support the value @samp{native}, 14987which selects the best architecture option for the host processor. 14988@option{-mcpu=native} has no effect if GCC does not recognize 14989the processor. 14990 14991@item -mtune=@var{cpu_type} 14992@opindex mtune 14993Set only the instruction scheduling parameters for machine type 14994@var{cpu_type}. The instruction set is not changed. 14995 14996Native toolchains also support the value @samp{native}, 14997which selects the best architecture option for the host processor. 14998@option{-mtune=native} has no effect if GCC does not recognize 14999the processor. 15000 15001@item -mmemory-latency=@var{time} 15002@opindex mmemory-latency 15003Sets the latency the scheduler should assume for typical memory 15004references as seen by the application. This number is highly 15005dependent on the memory access patterns used by the application 15006and the size of the external cache on the machine. 15007 15008Valid options for @var{time} are 15009 15010@table @samp 15011@item @var{number} 15012A decimal number representing clock cycles. 15013 15014@item L1 15015@itemx L2 15016@itemx L3 15017@itemx main 15018The compiler contains estimates of the number of clock cycles for 15019``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches 15020(also called Dcache, Scache, and Bcache), as well as to main memory. 15021Note that L3 is only valid for EV5. 15022 15023@end table 15024@end table 15025 15026@node FR30 Options 15027@subsection FR30 Options 15028@cindex FR30 Options 15029 15030These options are defined specifically for the FR30 port. 15031 15032@table @gcctabopt 15033 15034@item -msmall-model 15035@opindex msmall-model 15036Use the small address space model. This can produce smaller code, but 15037it does assume that all symbolic values and addresses fit into a 1503820-bit range. 15039 15040@item -mno-lsim 15041@opindex mno-lsim 15042Assume that runtime support has been provided and so there is no need 15043to include the simulator library (@file{libsim.a}) on the linker 15044command line. 15045 15046@end table 15047 15048@node FRV Options 15049@subsection FRV Options 15050@cindex FRV Options 15051 15052@table @gcctabopt 15053@item -mgpr-32 15054@opindex mgpr-32 15055 15056Only use the first 32 general-purpose registers. 15057 15058@item -mgpr-64 15059@opindex mgpr-64 15060 15061Use all 64 general-purpose registers. 15062 15063@item -mfpr-32 15064@opindex mfpr-32 15065 15066Use only the first 32 floating-point registers. 15067 15068@item -mfpr-64 15069@opindex mfpr-64 15070 15071Use all 64 floating-point registers. 15072 15073@item -mhard-float 15074@opindex mhard-float 15075 15076Use hardware instructions for floating-point operations. 15077 15078@item -msoft-float 15079@opindex msoft-float 15080 15081Use library routines for floating-point operations. 15082 15083@item -malloc-cc 15084@opindex malloc-cc 15085 15086Dynamically allocate condition code registers. 15087 15088@item -mfixed-cc 15089@opindex mfixed-cc 15090 15091Do not try to dynamically allocate condition code registers, only 15092use @code{icc0} and @code{fcc0}. 15093 15094@item -mdword 15095@opindex mdword 15096 15097Change ABI to use double word insns. 15098 15099@item -mno-dword 15100@opindex mno-dword 15101 15102Do not use double word instructions. 15103 15104@item -mdouble 15105@opindex mdouble 15106 15107Use floating-point double instructions. 15108 15109@item -mno-double 15110@opindex mno-double 15111 15112Do not use floating-point double instructions. 15113 15114@item -mmedia 15115@opindex mmedia 15116 15117Use media instructions. 15118 15119@item -mno-media 15120@opindex mno-media 15121 15122Do not use media instructions. 15123 15124@item -mmuladd 15125@opindex mmuladd 15126 15127Use multiply and add/subtract instructions. 15128 15129@item -mno-muladd 15130@opindex mno-muladd 15131 15132Do not use multiply and add/subtract instructions. 15133 15134@item -mfdpic 15135@opindex mfdpic 15136 15137Select the FDPIC ABI, which uses function descriptors to represent 15138pointers to functions. Without any PIC/PIE-related options, it 15139implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it 15140assumes GOT entries and small data are within a 12-bit range from the 15141GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets 15142are computed with 32 bits. 15143With a @samp{bfin-elf} target, this option implies @option{-msim}. 15144 15145@item -minline-plt 15146@opindex minline-plt 15147 15148Enable inlining of PLT entries in function calls to functions that are 15149not known to bind locally. It has no effect without @option{-mfdpic}. 15150It's enabled by default if optimizing for speed and compiling for 15151shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an 15152optimization option such as @option{-O3} or above is present in the 15153command line. 15154 15155@item -mTLS 15156@opindex mTLS 15157 15158Assume a large TLS segment when generating thread-local code. 15159 15160@item -mtls 15161@opindex mtls 15162 15163Do not assume a large TLS segment when generating thread-local code. 15164 15165@item -mgprel-ro 15166@opindex mgprel-ro 15167 15168Enable the use of @code{GPREL} relocations in the FDPIC ABI for data 15169that is known to be in read-only sections. It's enabled by default, 15170except for @option{-fpic} or @option{-fpie}: even though it may help 15171make the global offset table smaller, it trades 1 instruction for 4. 15172With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4, 15173one of which may be shared by multiple symbols, and it avoids the need 15174for a GOT entry for the referenced symbol, so it's more likely to be a 15175win. If it is not, @option{-mno-gprel-ro} can be used to disable it. 15176 15177@item -multilib-library-pic 15178@opindex multilib-library-pic 15179 15180Link with the (library, not FD) pic libraries. It's implied by 15181@option{-mlibrary-pic}, as well as by @option{-fPIC} and 15182@option{-fpic} without @option{-mfdpic}. You should never have to use 15183it explicitly. 15184 15185@item -mlinked-fp 15186@opindex mlinked-fp 15187 15188Follow the EABI requirement of always creating a frame pointer whenever 15189a stack frame is allocated. This option is enabled by default and can 15190be disabled with @option{-mno-linked-fp}. 15191 15192@item -mlong-calls 15193@opindex mlong-calls 15194 15195Use indirect addressing to call functions outside the current 15196compilation unit. This allows the functions to be placed anywhere 15197within the 32-bit address space. 15198 15199@item -malign-labels 15200@opindex malign-labels 15201 15202Try to align labels to an 8-byte boundary by inserting NOPs into the 15203previous packet. This option only has an effect when VLIW packing 15204is enabled. It doesn't create new packets; it merely adds NOPs to 15205existing ones. 15206 15207@item -mlibrary-pic 15208@opindex mlibrary-pic 15209 15210Generate position-independent EABI code. 15211 15212@item -macc-4 15213@opindex macc-4 15214 15215Use only the first four media accumulator registers. 15216 15217@item -macc-8 15218@opindex macc-8 15219 15220Use all eight media accumulator registers. 15221 15222@item -mpack 15223@opindex mpack 15224 15225Pack VLIW instructions. 15226 15227@item -mno-pack 15228@opindex mno-pack 15229 15230Do not pack VLIW instructions. 15231 15232@item -mno-eflags 15233@opindex mno-eflags 15234 15235Do not mark ABI switches in e_flags. 15236 15237@item -mcond-move 15238@opindex mcond-move 15239 15240Enable the use of conditional-move instructions (default). 15241 15242This switch is mainly for debugging the compiler and will likely be removed 15243in a future version. 15244 15245@item -mno-cond-move 15246@opindex mno-cond-move 15247 15248Disable the use of conditional-move instructions. 15249 15250This switch is mainly for debugging the compiler and will likely be removed 15251in a future version. 15252 15253@item -mscc 15254@opindex mscc 15255 15256Enable the use of conditional set instructions (default). 15257 15258This switch is mainly for debugging the compiler and will likely be removed 15259in a future version. 15260 15261@item -mno-scc 15262@opindex mno-scc 15263 15264Disable the use of conditional set instructions. 15265 15266This switch is mainly for debugging the compiler and will likely be removed 15267in a future version. 15268 15269@item -mcond-exec 15270@opindex mcond-exec 15271 15272Enable the use of conditional execution (default). 15273 15274This switch is mainly for debugging the compiler and will likely be removed 15275in a future version. 15276 15277@item -mno-cond-exec 15278@opindex mno-cond-exec 15279 15280Disable the use of conditional execution. 15281 15282This switch is mainly for debugging the compiler and will likely be removed 15283in a future version. 15284 15285@item -mvliw-branch 15286@opindex mvliw-branch 15287 15288Run a pass to pack branches into VLIW instructions (default). 15289 15290This switch is mainly for debugging the compiler and will likely be removed 15291in a future version. 15292 15293@item -mno-vliw-branch 15294@opindex mno-vliw-branch 15295 15296Do not run a pass to pack branches into VLIW instructions. 15297 15298This switch is mainly for debugging the compiler and will likely be removed 15299in a future version. 15300 15301@item -mmulti-cond-exec 15302@opindex mmulti-cond-exec 15303 15304Enable optimization of @code{&&} and @code{||} in conditional execution 15305(default). 15306 15307This switch is mainly for debugging the compiler and will likely be removed 15308in a future version. 15309 15310@item -mno-multi-cond-exec 15311@opindex mno-multi-cond-exec 15312 15313Disable optimization of @code{&&} and @code{||} in conditional execution. 15314 15315This switch is mainly for debugging the compiler and will likely be removed 15316in a future version. 15317 15318@item -mnested-cond-exec 15319@opindex mnested-cond-exec 15320 15321Enable nested conditional execution optimizations (default). 15322 15323This switch is mainly for debugging the compiler and will likely be removed 15324in a future version. 15325 15326@item -mno-nested-cond-exec 15327@opindex mno-nested-cond-exec 15328 15329Disable nested conditional execution optimizations. 15330 15331This switch is mainly for debugging the compiler and will likely be removed 15332in a future version. 15333 15334@item -moptimize-membar 15335@opindex moptimize-membar 15336 15337This switch removes redundant @code{membar} instructions from the 15338compiler-generated code. It is enabled by default. 15339 15340@item -mno-optimize-membar 15341@opindex mno-optimize-membar 15342 15343This switch disables the automatic removal of redundant @code{membar} 15344instructions from the generated code. 15345 15346@item -mtomcat-stats 15347@opindex mtomcat-stats 15348 15349Cause gas to print out tomcat statistics. 15350 15351@item -mcpu=@var{cpu} 15352@opindex mcpu 15353 15354Select the processor type for which to generate code. Possible values are 15355@samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450}, 15356@samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}. 15357 15358@end table 15359 15360@node GNU/Linux Options 15361@subsection GNU/Linux Options 15362 15363These @samp{-m} options are defined for GNU/Linux targets: 15364 15365@table @gcctabopt 15366@item -mglibc 15367@opindex mglibc 15368Use the GNU C library. This is the default except 15369on @samp{*-*-linux-*uclibc*} and @samp{*-*-linux-*android*} targets. 15370 15371@item -muclibc 15372@opindex muclibc 15373Use uClibc C library. This is the default on 15374@samp{*-*-linux-*uclibc*} targets. 15375 15376@item -mbionic 15377@opindex mbionic 15378Use Bionic C library. This is the default on 15379@samp{*-*-linux-*android*} targets. 15380 15381@item -mandroid 15382@opindex mandroid 15383Compile code compatible with Android platform. This is the default on 15384@samp{*-*-linux-*android*} targets. 15385 15386When compiling, this option enables @option{-mbionic}, @option{-fPIC}, 15387@option{-fno-exceptions} and @option{-fno-rtti} by default. When linking, 15388this option makes the GCC driver pass Android-specific options to the linker. 15389Finally, this option causes the preprocessor macro @code{__ANDROID__} 15390to be defined. 15391 15392@item -tno-android-cc 15393@opindex tno-android-cc 15394Disable compilation effects of @option{-mandroid}, i.e., do not enable 15395@option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and 15396@option{-fno-rtti} by default. 15397 15398@item -tno-android-ld 15399@opindex tno-android-ld 15400Disable linking effects of @option{-mandroid}, i.e., pass standard Linux 15401linking options to the linker. 15402 15403@end table 15404 15405@node H8/300 Options 15406@subsection H8/300 Options 15407 15408These @samp{-m} options are defined for the H8/300 implementations: 15409 15410@table @gcctabopt 15411@item -mrelax 15412@opindex mrelax 15413Shorten some address references at link time, when possible; uses the 15414linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300, 15415ld, Using ld}, for a fuller description. 15416 15417@item -mh 15418@opindex mh 15419Generate code for the H8/300H@. 15420 15421@item -ms 15422@opindex ms 15423Generate code for the H8S@. 15424 15425@item -mn 15426@opindex mn 15427Generate code for the H8S and H8/300H in the normal mode. This switch 15428must be used either with @option{-mh} or @option{-ms}. 15429 15430@item -ms2600 15431@opindex ms2600 15432Generate code for the H8S/2600. This switch must be used with @option{-ms}. 15433 15434@item -mexr 15435@opindex mexr 15436Extended registers are stored on stack before execution of function 15437with monitor attribute. Default option is @option{-mexr}. 15438This option is valid only for H8S targets. 15439 15440@item -mno-exr 15441@opindex mno-exr 15442Extended registers are not stored on stack before execution of function 15443with monitor attribute. Default option is @option{-mno-exr}. 15444This option is valid only for H8S targets. 15445 15446@item -mint32 15447@opindex mint32 15448Make @code{int} data 32 bits by default. 15449 15450@item -malign-300 15451@opindex malign-300 15452On the H8/300H and H8S, use the same alignment rules as for the H8/300. 15453The default for the H8/300H and H8S is to align longs and floats on 154544-byte boundaries. 15455@option{-malign-300} causes them to be aligned on 2-byte boundaries. 15456This option has no effect on the H8/300. 15457@end table 15458 15459@node HPPA Options 15460@subsection HPPA Options 15461@cindex HPPA Options 15462 15463These @samp{-m} options are defined for the HPPA family of computers: 15464 15465@table @gcctabopt 15466@item -march=@var{architecture-type} 15467@opindex march 15468Generate code for the specified architecture. The choices for 15469@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA 154701.1, and @samp{2.0} for PA 2.0 processors. Refer to 15471@file{/usr/lib/sched.models} on an HP-UX system to determine the proper 15472architecture option for your machine. Code compiled for lower numbered 15473architectures runs on higher numbered architectures, but not the 15474other way around. 15475 15476@item -mpa-risc-1-0 15477@itemx -mpa-risc-1-1 15478@itemx -mpa-risc-2-0 15479@opindex mpa-risc-1-0 15480@opindex mpa-risc-1-1 15481@opindex mpa-risc-2-0 15482Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively. 15483 15484@item -mjump-in-delay 15485@opindex mjump-in-delay 15486This option is ignored and provided for compatibility purposes only. 15487 15488@item -mdisable-fpregs 15489@opindex mdisable-fpregs 15490Prevent floating-point registers from being used in any manner. This is 15491necessary for compiling kernels that perform lazy context switching of 15492floating-point registers. If you use this option and attempt to perform 15493floating-point operations, the compiler aborts. 15494 15495@item -mdisable-indexing 15496@opindex mdisable-indexing 15497Prevent the compiler from using indexing address modes. This avoids some 15498rather obscure problems when compiling MIG generated code under MACH@. 15499 15500@item -mno-space-regs 15501@opindex mno-space-regs 15502Generate code that assumes the target has no space registers. This allows 15503GCC to generate faster indirect calls and use unscaled index address modes. 15504 15505Such code is suitable for level 0 PA systems and kernels. 15506 15507@item -mfast-indirect-calls 15508@opindex mfast-indirect-calls 15509Generate code that assumes calls never cross space boundaries. This 15510allows GCC to emit code that performs faster indirect calls. 15511 15512This option does not work in the presence of shared libraries or nested 15513functions. 15514 15515@item -mfixed-range=@var{register-range} 15516@opindex mfixed-range 15517Generate code treating the given register range as fixed registers. 15518A fixed register is one that the register allocator cannot use. This is 15519useful when compiling kernel code. A register range is specified as 15520two registers separated by a dash. Multiple register ranges can be 15521specified separated by a comma. 15522 15523@item -mlong-load-store 15524@opindex mlong-load-store 15525Generate 3-instruction load and store sequences as sometimes required by 15526the HP-UX 10 linker. This is equivalent to the @samp{+k} option to 15527the HP compilers. 15528 15529@item -mportable-runtime 15530@opindex mportable-runtime 15531Use the portable calling conventions proposed by HP for ELF systems. 15532 15533@item -mgas 15534@opindex mgas 15535Enable the use of assembler directives only GAS understands. 15536 15537@item -mschedule=@var{cpu-type} 15538@opindex mschedule 15539Schedule code according to the constraints for the machine type 15540@var{cpu-type}. The choices for @var{cpu-type} are @samp{700} 15541@samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer 15542to @file{/usr/lib/sched.models} on an HP-UX system to determine the 15543proper scheduling option for your machine. The default scheduling is 15544@samp{8000}. 15545 15546@item -mlinker-opt 15547@opindex mlinker-opt 15548Enable the optimization pass in the HP-UX linker. Note this makes symbolic 15549debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9 15550linkers in which they give bogus error messages when linking some programs. 15551 15552@item -msoft-float 15553@opindex msoft-float 15554Generate output containing library calls for floating point. 15555@strong{Warning:} the requisite libraries are not available for all HPPA 15556targets. Normally the facilities of the machine's usual C compiler are 15557used, but this cannot be done directly in cross-compilation. You must make 15558your own arrangements to provide suitable library functions for 15559cross-compilation. 15560 15561@option{-msoft-float} changes the calling convention in the output file; 15562therefore, it is only useful if you compile @emph{all} of a program with 15563this option. In particular, you need to compile @file{libgcc.a}, the 15564library that comes with GCC, with @option{-msoft-float} in order for 15565this to work. 15566 15567@item -msio 15568@opindex msio 15569Generate the predefine, @code{_SIO}, for server IO@. The default is 15570@option{-mwsio}. This generates the predefines, @code{__hp9000s700}, 15571@code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These 15572options are available under HP-UX and HI-UX@. 15573 15574@item -mgnu-ld 15575@opindex mgnu-ld 15576Use options specific to GNU @command{ld}. 15577This passes @option{-shared} to @command{ld} when 15578building a shared library. It is the default when GCC is configured, 15579explicitly or implicitly, with the GNU linker. This option does not 15580affect which @command{ld} is called; it only changes what parameters 15581are passed to that @command{ld}. 15582The @command{ld} that is called is determined by the 15583@option{--with-ld} configure option, GCC's program search path, and 15584finally by the user's @env{PATH}. The linker used by GCC can be printed 15585using @samp{which `gcc -print-prog-name=ld`}. This option is only available 15586on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}. 15587 15588@item -mhp-ld 15589@opindex mhp-ld 15590Use options specific to HP @command{ld}. 15591This passes @option{-b} to @command{ld} when building 15592a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all 15593links. It is the default when GCC is configured, explicitly or 15594implicitly, with the HP linker. This option does not affect 15595which @command{ld} is called; it only changes what parameters are passed to that 15596@command{ld}. 15597The @command{ld} that is called is determined by the @option{--with-ld} 15598configure option, GCC's program search path, and finally by the user's 15599@env{PATH}. The linker used by GCC can be printed using @samp{which 15600`gcc -print-prog-name=ld`}. This option is only available on the 64-bit 15601HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}. 15602 15603@item -mlong-calls 15604@opindex mno-long-calls 15605Generate code that uses long call sequences. This ensures that a call 15606is always able to reach linker generated stubs. The default is to generate 15607long calls only when the distance from the call site to the beginning 15608of the function or translation unit, as the case may be, exceeds a 15609predefined limit set by the branch type being used. The limits for 15610normal calls are 7,600,000 and 240,000 bytes, respectively for the 15611PA 2.0 and PA 1.X architectures. Sibcalls are always limited at 15612240,000 bytes. 15613 15614Distances are measured from the beginning of functions when using the 15615@option{-ffunction-sections} option, or when using the @option{-mgas} 15616and @option{-mno-portable-runtime} options together under HP-UX with 15617the SOM linker. 15618 15619It is normally not desirable to use this option as it degrades 15620performance. However, it may be useful in large applications, 15621particularly when partial linking is used to build the application. 15622 15623The types of long calls used depends on the capabilities of the 15624assembler and linker, and the type of code being generated. The 15625impact on systems that support long absolute calls, and long pic 15626symbol-difference or pc-relative calls should be relatively small. 15627However, an indirect call is used on 32-bit ELF systems in pic code 15628and it is quite long. 15629 15630@item -munix=@var{unix-std} 15631@opindex march 15632Generate compiler predefines and select a startfile for the specified 15633UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95} 15634and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95} 15635is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX 1563611.11 and later. The default values are @samp{93} for HP-UX 10.00, 15637@samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11 15638and later. 15639 15640@option{-munix=93} provides the same predefines as GCC 3.3 and 3.4. 15641@option{-munix=95} provides additional predefines for @code{XOPEN_UNIX} 15642and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}. 15643@option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX}, 15644@code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and 15645@code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}. 15646 15647It is @emph{important} to note that this option changes the interfaces 15648for various library routines. It also affects the operational behavior 15649of the C library. Thus, @emph{extreme} care is needed in using this 15650option. 15651 15652Library code that is intended to operate with more than one UNIX 15653standard must test, set and restore the variable @code{__xpg4_extended_mask} 15654as appropriate. Most GNU software doesn't provide this capability. 15655 15656@item -nolibdld 15657@opindex nolibdld 15658Suppress the generation of link options to search libdld.sl when the 15659@option{-static} option is specified on HP-UX 10 and later. 15660 15661@item -static 15662@opindex static 15663The HP-UX implementation of setlocale in libc has a dependency on 15664libdld.sl. There isn't an archive version of libdld.sl. Thus, 15665when the @option{-static} option is specified, special link options 15666are needed to resolve this dependency. 15667 15668On HP-UX 10 and later, the GCC driver adds the necessary options to 15669link with libdld.sl when the @option{-static} option is specified. 15670This causes the resulting binary to be dynamic. On the 64-bit port, 15671the linkers generate dynamic binaries by default in any case. The 15672@option{-nolibdld} option can be used to prevent the GCC driver from 15673adding these link options. 15674 15675@item -threads 15676@opindex threads 15677Add support for multithreading with the @dfn{dce thread} library 15678under HP-UX@. This option sets flags for both the preprocessor and 15679linker. 15680@end table 15681 15682@node IA-64 Options 15683@subsection IA-64 Options 15684@cindex IA-64 Options 15685 15686These are the @samp{-m} options defined for the Intel IA-64 architecture. 15687 15688@table @gcctabopt 15689@item -mbig-endian 15690@opindex mbig-endian 15691Generate code for a big-endian target. This is the default for HP-UX@. 15692 15693@item -mlittle-endian 15694@opindex mlittle-endian 15695Generate code for a little-endian target. This is the default for AIX5 15696and GNU/Linux. 15697 15698@item -mgnu-as 15699@itemx -mno-gnu-as 15700@opindex mgnu-as 15701@opindex mno-gnu-as 15702Generate (or don't) code for the GNU assembler. This is the default. 15703@c Also, this is the default if the configure option @option{--with-gnu-as} 15704@c is used. 15705 15706@item -mgnu-ld 15707@itemx -mno-gnu-ld 15708@opindex mgnu-ld 15709@opindex mno-gnu-ld 15710Generate (or don't) code for the GNU linker. This is the default. 15711@c Also, this is the default if the configure option @option{--with-gnu-ld} 15712@c is used. 15713 15714@item -mno-pic 15715@opindex mno-pic 15716Generate code that does not use a global pointer register. The result 15717is not position independent code, and violates the IA-64 ABI@. 15718 15719@item -mvolatile-asm-stop 15720@itemx -mno-volatile-asm-stop 15721@opindex mvolatile-asm-stop 15722@opindex mno-volatile-asm-stop 15723Generate (or don't) a stop bit immediately before and after volatile asm 15724statements. 15725 15726@item -mregister-names 15727@itemx -mno-register-names 15728@opindex mregister-names 15729@opindex mno-register-names 15730Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for 15731the stacked registers. This may make assembler output more readable. 15732 15733@item -mno-sdata 15734@itemx -msdata 15735@opindex mno-sdata 15736@opindex msdata 15737Disable (or enable) optimizations that use the small data section. This may 15738be useful for working around optimizer bugs. 15739 15740@item -mconstant-gp 15741@opindex mconstant-gp 15742Generate code that uses a single constant global pointer value. This is 15743useful when compiling kernel code. 15744 15745@item -mauto-pic 15746@opindex mauto-pic 15747Generate code that is self-relocatable. This implies @option{-mconstant-gp}. 15748This is useful when compiling firmware code. 15749 15750@item -minline-float-divide-min-latency 15751@opindex minline-float-divide-min-latency 15752Generate code for inline divides of floating-point values 15753using the minimum latency algorithm. 15754 15755@item -minline-float-divide-max-throughput 15756@opindex minline-float-divide-max-throughput 15757Generate code for inline divides of floating-point values 15758using the maximum throughput algorithm. 15759 15760@item -mno-inline-float-divide 15761@opindex mno-inline-float-divide 15762Do not generate inline code for divides of floating-point values. 15763 15764@item -minline-int-divide-min-latency 15765@opindex minline-int-divide-min-latency 15766Generate code for inline divides of integer values 15767using the minimum latency algorithm. 15768 15769@item -minline-int-divide-max-throughput 15770@opindex minline-int-divide-max-throughput 15771Generate code for inline divides of integer values 15772using the maximum throughput algorithm. 15773 15774@item -mno-inline-int-divide 15775@opindex mno-inline-int-divide 15776Do not generate inline code for divides of integer values. 15777 15778@item -minline-sqrt-min-latency 15779@opindex minline-sqrt-min-latency 15780Generate code for inline square roots 15781using the minimum latency algorithm. 15782 15783@item -minline-sqrt-max-throughput 15784@opindex minline-sqrt-max-throughput 15785Generate code for inline square roots 15786using the maximum throughput algorithm. 15787 15788@item -mno-inline-sqrt 15789@opindex mno-inline-sqrt 15790Do not generate inline code for @code{sqrt}. 15791 15792@item -mfused-madd 15793@itemx -mno-fused-madd 15794@opindex mfused-madd 15795@opindex mno-fused-madd 15796Do (don't) generate code that uses the fused multiply/add or multiply/subtract 15797instructions. The default is to use these instructions. 15798 15799@item -mno-dwarf2-asm 15800@itemx -mdwarf2-asm 15801@opindex mno-dwarf2-asm 15802@opindex mdwarf2-asm 15803Don't (or do) generate assembler code for the DWARF 2 line number debugging 15804info. This may be useful when not using the GNU assembler. 15805 15806@item -mearly-stop-bits 15807@itemx -mno-early-stop-bits 15808@opindex mearly-stop-bits 15809@opindex mno-early-stop-bits 15810Allow stop bits to be placed earlier than immediately preceding the 15811instruction that triggered the stop bit. This can improve instruction 15812scheduling, but does not always do so. 15813 15814@item -mfixed-range=@var{register-range} 15815@opindex mfixed-range 15816Generate code treating the given register range as fixed registers. 15817A fixed register is one that the register allocator cannot use. This is 15818useful when compiling kernel code. A register range is specified as 15819two registers separated by a dash. Multiple register ranges can be 15820specified separated by a comma. 15821 15822@item -mtls-size=@var{tls-size} 15823@opindex mtls-size 15824Specify bit size of immediate TLS offsets. Valid values are 14, 22, and 1582564. 15826 15827@item -mtune=@var{cpu-type} 15828@opindex mtune 15829Tune the instruction scheduling for a particular CPU, Valid values are 15830@samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2}, 15831and @samp{mckinley}. 15832 15833@item -milp32 15834@itemx -mlp64 15835@opindex milp32 15836@opindex mlp64 15837Generate code for a 32-bit or 64-bit environment. 15838The 32-bit environment sets int, long and pointer to 32 bits. 15839The 64-bit environment sets int to 32 bits and long and pointer 15840to 64 bits. These are HP-UX specific flags. 15841 15842@item -mno-sched-br-data-spec 15843@itemx -msched-br-data-spec 15844@opindex mno-sched-br-data-spec 15845@opindex msched-br-data-spec 15846(Dis/En)able data speculative scheduling before reload. 15847This results in generation of @code{ld.a} instructions and 15848the corresponding check instructions (@code{ld.c} / @code{chk.a}). 15849The default is 'disable'. 15850 15851@item -msched-ar-data-spec 15852@itemx -mno-sched-ar-data-spec 15853@opindex msched-ar-data-spec 15854@opindex mno-sched-ar-data-spec 15855(En/Dis)able data speculative scheduling after reload. 15856This results in generation of @code{ld.a} instructions and 15857the corresponding check instructions (@code{ld.c} / @code{chk.a}). 15858The default is 'enable'. 15859 15860@item -mno-sched-control-spec 15861@itemx -msched-control-spec 15862@opindex mno-sched-control-spec 15863@opindex msched-control-spec 15864(Dis/En)able control speculative scheduling. This feature is 15865available only during region scheduling (i.e.@: before reload). 15866This results in generation of the @code{ld.s} instructions and 15867the corresponding check instructions @code{chk.s}. 15868The default is 'disable'. 15869 15870@item -msched-br-in-data-spec 15871@itemx -mno-sched-br-in-data-spec 15872@opindex msched-br-in-data-spec 15873@opindex mno-sched-br-in-data-spec 15874(En/Dis)able speculative scheduling of the instructions that 15875are dependent on the data speculative loads before reload. 15876This is effective only with @option{-msched-br-data-spec} enabled. 15877The default is 'enable'. 15878 15879@item -msched-ar-in-data-spec 15880@itemx -mno-sched-ar-in-data-spec 15881@opindex msched-ar-in-data-spec 15882@opindex mno-sched-ar-in-data-spec 15883(En/Dis)able speculative scheduling of the instructions that 15884are dependent on the data speculative loads after reload. 15885This is effective only with @option{-msched-ar-data-spec} enabled. 15886The default is 'enable'. 15887 15888@item -msched-in-control-spec 15889@itemx -mno-sched-in-control-spec 15890@opindex msched-in-control-spec 15891@opindex mno-sched-in-control-spec 15892(En/Dis)able speculative scheduling of the instructions that 15893are dependent on the control speculative loads. 15894This is effective only with @option{-msched-control-spec} enabled. 15895The default is 'enable'. 15896 15897@item -mno-sched-prefer-non-data-spec-insns 15898@itemx -msched-prefer-non-data-spec-insns 15899@opindex mno-sched-prefer-non-data-spec-insns 15900@opindex msched-prefer-non-data-spec-insns 15901If enabled, data-speculative instructions are chosen for schedule 15902only if there are no other choices at the moment. This makes 15903the use of the data speculation much more conservative. 15904The default is 'disable'. 15905 15906@item -mno-sched-prefer-non-control-spec-insns 15907@itemx -msched-prefer-non-control-spec-insns 15908@opindex mno-sched-prefer-non-control-spec-insns 15909@opindex msched-prefer-non-control-spec-insns 15910If enabled, control-speculative instructions are chosen for schedule 15911only if there are no other choices at the moment. This makes 15912the use of the control speculation much more conservative. 15913The default is 'disable'. 15914 15915@item -mno-sched-count-spec-in-critical-path 15916@itemx -msched-count-spec-in-critical-path 15917@opindex mno-sched-count-spec-in-critical-path 15918@opindex msched-count-spec-in-critical-path 15919If enabled, speculative dependencies are considered during 15920computation of the instructions priorities. This makes the use of the 15921speculation a bit more conservative. 15922The default is 'disable'. 15923 15924@item -msched-spec-ldc 15925@opindex msched-spec-ldc 15926Use a simple data speculation check. This option is on by default. 15927 15928@item -msched-control-spec-ldc 15929@opindex msched-spec-ldc 15930Use a simple check for control speculation. This option is on by default. 15931 15932@item -msched-stop-bits-after-every-cycle 15933@opindex msched-stop-bits-after-every-cycle 15934Place a stop bit after every cycle when scheduling. This option is on 15935by default. 15936 15937@item -msched-fp-mem-deps-zero-cost 15938@opindex msched-fp-mem-deps-zero-cost 15939Assume that floating-point stores and loads are not likely to cause a conflict 15940when placed into the same instruction group. This option is disabled by 15941default. 15942 15943@item -msel-sched-dont-check-control-spec 15944@opindex msel-sched-dont-check-control-spec 15945Generate checks for control speculation in selective scheduling. 15946This flag is disabled by default. 15947 15948@item -msched-max-memory-insns=@var{max-insns} 15949@opindex msched-max-memory-insns 15950Limit on the number of memory insns per instruction group, giving lower 15951priority to subsequent memory insns attempting to schedule in the same 15952instruction group. Frequently useful to prevent cache bank conflicts. 15953The default value is 1. 15954 15955@item -msched-max-memory-insns-hard-limit 15956@opindex msched-max-memory-insns-hard-limit 15957Makes the limit specified by @option{msched-max-memory-insns} a hard limit, 15958disallowing more than that number in an instruction group. 15959Otherwise, the limit is ``soft'', meaning that non-memory operations 15960are preferred when the limit is reached, but memory operations may still 15961be scheduled. 15962 15963@end table 15964 15965@node LM32 Options 15966@subsection LM32 Options 15967@cindex LM32 options 15968 15969These @option{-m} options are defined for the LatticeMico32 architecture: 15970 15971@table @gcctabopt 15972@item -mbarrel-shift-enabled 15973@opindex mbarrel-shift-enabled 15974Enable barrel-shift instructions. 15975 15976@item -mdivide-enabled 15977@opindex mdivide-enabled 15978Enable divide and modulus instructions. 15979 15980@item -mmultiply-enabled 15981@opindex multiply-enabled 15982Enable multiply instructions. 15983 15984@item -msign-extend-enabled 15985@opindex msign-extend-enabled 15986Enable sign extend instructions. 15987 15988@item -muser-enabled 15989@opindex muser-enabled 15990Enable user-defined instructions. 15991 15992@end table 15993 15994@node M32C Options 15995@subsection M32C Options 15996@cindex M32C options 15997 15998@table @gcctabopt 15999@item -mcpu=@var{name} 16000@opindex mcpu= 16001Select the CPU for which code is generated. @var{name} may be one of 16002@samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to 16003/60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for 16004the M32C/80 series. 16005 16006@item -msim 16007@opindex msim 16008Specifies that the program will be run on the simulator. This causes 16009an alternate runtime library to be linked in which supports, for 16010example, file I/O@. You must not use this option when generating 16011programs that will run on real hardware; you must provide your own 16012runtime library for whatever I/O functions are needed. 16013 16014@item -memregs=@var{number} 16015@opindex memregs= 16016Specifies the number of memory-based pseudo-registers GCC uses 16017during code generation. These pseudo-registers are used like real 16018registers, so there is a tradeoff between GCC's ability to fit the 16019code into available registers, and the performance penalty of using 16020memory instead of registers. Note that all modules in a program must 16021be compiled with the same value for this option. Because of that, you 16022must not use this option with GCC's default runtime libraries. 16023 16024@end table 16025 16026@node M32R/D Options 16027@subsection M32R/D Options 16028@cindex M32R/D options 16029 16030These @option{-m} options are defined for Renesas M32R/D architectures: 16031 16032@table @gcctabopt 16033@item -m32r2 16034@opindex m32r2 16035Generate code for the M32R/2@. 16036 16037@item -m32rx 16038@opindex m32rx 16039Generate code for the M32R/X@. 16040 16041@item -m32r 16042@opindex m32r 16043Generate code for the M32R@. This is the default. 16044 16045@item -mmodel=small 16046@opindex mmodel=small 16047Assume all objects live in the lower 16MB of memory (so that their addresses 16048can be loaded with the @code{ld24} instruction), and assume all subroutines 16049are reachable with the @code{bl} instruction. 16050This is the default. 16051 16052The addressability of a particular object can be set with the 16053@code{model} attribute. 16054 16055@item -mmodel=medium 16056@opindex mmodel=medium 16057Assume objects may be anywhere in the 32-bit address space (the compiler 16058generates @code{seth/add3} instructions to load their addresses), and 16059assume all subroutines are reachable with the @code{bl} instruction. 16060 16061@item -mmodel=large 16062@opindex mmodel=large 16063Assume objects may be anywhere in the 32-bit address space (the compiler 16064generates @code{seth/add3} instructions to load their addresses), and 16065assume subroutines may not be reachable with the @code{bl} instruction 16066(the compiler generates the much slower @code{seth/add3/jl} 16067instruction sequence). 16068 16069@item -msdata=none 16070@opindex msdata=none 16071Disable use of the small data area. Variables are put into 16072one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the 16073@code{section} attribute has been specified). 16074This is the default. 16075 16076The small data area consists of sections @code{.sdata} and @code{.sbss}. 16077Objects may be explicitly put in the small data area with the 16078@code{section} attribute using one of these sections. 16079 16080@item -msdata=sdata 16081@opindex msdata=sdata 16082Put small global and static data in the small data area, but do not 16083generate special code to reference them. 16084 16085@item -msdata=use 16086@opindex msdata=use 16087Put small global and static data in the small data area, and generate 16088special instructions to reference them. 16089 16090@item -G @var{num} 16091@opindex G 16092@cindex smaller data references 16093Put global and static objects less than or equal to @var{num} bytes 16094into the small data or BSS sections instead of the normal data or BSS 16095sections. The default value of @var{num} is 8. 16096The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use} 16097for this option to have any effect. 16098 16099All modules should be compiled with the same @option{-G @var{num}} value. 16100Compiling with different values of @var{num} may or may not work; if it 16101doesn't the linker gives an error message---incorrect code is not 16102generated. 16103 16104@item -mdebug 16105@opindex mdebug 16106Makes the M32R-specific code in the compiler display some statistics 16107that might help in debugging programs. 16108 16109@item -malign-loops 16110@opindex malign-loops 16111Align all loops to a 32-byte boundary. 16112 16113@item -mno-align-loops 16114@opindex mno-align-loops 16115Do not enforce a 32-byte alignment for loops. This is the default. 16116 16117@item -missue-rate=@var{number} 16118@opindex missue-rate=@var{number} 16119Issue @var{number} instructions per cycle. @var{number} can only be 1 16120or 2. 16121 16122@item -mbranch-cost=@var{number} 16123@opindex mbranch-cost=@var{number} 16124@var{number} can only be 1 or 2. If it is 1 then branches are 16125preferred over conditional code, if it is 2, then the opposite applies. 16126 16127@item -mflush-trap=@var{number} 16128@opindex mflush-trap=@var{number} 16129Specifies the trap number to use to flush the cache. The default is 1613012. Valid numbers are between 0 and 15 inclusive. 16131 16132@item -mno-flush-trap 16133@opindex mno-flush-trap 16134Specifies that the cache cannot be flushed by using a trap. 16135 16136@item -mflush-func=@var{name} 16137@opindex mflush-func=@var{name} 16138Specifies the name of the operating system function to call to flush 16139the cache. The default is @samp{_flush_cache}, but a function call 16140is only used if a trap is not available. 16141 16142@item -mno-flush-func 16143@opindex mno-flush-func 16144Indicates that there is no OS function for flushing the cache. 16145 16146@end table 16147 16148@node M680x0 Options 16149@subsection M680x0 Options 16150@cindex M680x0 options 16151 16152These are the @samp{-m} options defined for M680x0 and ColdFire processors. 16153The default settings depend on which architecture was selected when 16154the compiler was configured; the defaults for the most common choices 16155are given below. 16156 16157@table @gcctabopt 16158@item -march=@var{arch} 16159@opindex march 16160Generate code for a specific M680x0 or ColdFire instruction set 16161architecture. Permissible values of @var{arch} for M680x0 16162architectures are: @samp{68000}, @samp{68010}, @samp{68020}, 16163@samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire 16164architectures are selected according to Freescale's ISA classification 16165and the permissible values are: @samp{isaa}, @samp{isaaplus}, 16166@samp{isab} and @samp{isac}. 16167 16168GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating 16169code for a ColdFire target. The @var{arch} in this macro is one of the 16170@option{-march} arguments given above. 16171 16172When used together, @option{-march} and @option{-mtune} select code 16173that runs on a family of similar processors but that is optimized 16174for a particular microarchitecture. 16175 16176@item -mcpu=@var{cpu} 16177@opindex mcpu 16178Generate code for a specific M680x0 or ColdFire processor. 16179The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020}, 16180@samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332} 16181and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table 16182below, which also classifies the CPUs into families: 16183 16184@multitable @columnfractions 0.20 0.80 16185@item @strong{Family} @tab @strong{@samp{-mcpu} arguments} 16186@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} 16187@item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206} 16188@item @samp{5206e} @tab @samp{5206e} 16189@item @samp{5208} @tab @samp{5207} @samp{5208} 16190@item @samp{5211a} @tab @samp{5210a} @samp{5211a} 16191@item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213} 16192@item @samp{5216} @tab @samp{5214} @samp{5216} 16193@item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235} 16194@item @samp{5225} @tab @samp{5224} @samp{5225} 16195@item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259} 16196@item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x} 16197@item @samp{5249} @tab @samp{5249} 16198@item @samp{5250} @tab @samp{5250} 16199@item @samp{5271} @tab @samp{5270} @samp{5271} 16200@item @samp{5272} @tab @samp{5272} 16201@item @samp{5275} @tab @samp{5274} @samp{5275} 16202@item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x} 16203@item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017} 16204@item @samp{5307} @tab @samp{5307} 16205@item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x} 16206@item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x} 16207@item @samp{5407} @tab @samp{5407} 16208@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} 16209@end multitable 16210 16211@option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if 16212@var{arch} is compatible with @var{cpu}. Other combinations of 16213@option{-mcpu} and @option{-march} are rejected. 16214 16215GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target 16216@var{cpu} is selected. It also defines @code{__mcf_family_@var{family}}, 16217where the value of @var{family} is given by the table above. 16218 16219@item -mtune=@var{tune} 16220@opindex mtune 16221Tune the code for a particular microarchitecture within the 16222constraints set by @option{-march} and @option{-mcpu}. 16223The M680x0 microarchitectures are: @samp{68000}, @samp{68010}, 16224@samp{68020}, @samp{68030}, @samp{68040}, @samp{68060} 16225and @samp{cpu32}. The ColdFire microarchitectures 16226are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}. 16227 16228You can also use @option{-mtune=68020-40} for code that needs 16229to run relatively well on 68020, 68030 and 68040 targets. 16230@option{-mtune=68020-60} is similar but includes 68060 targets 16231as well. These two options select the same tuning decisions as 16232@option{-m68020-40} and @option{-m68020-60} respectively. 16233 16234GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__} 16235when tuning for 680x0 architecture @var{arch}. It also defines 16236@code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std} 16237option is used. If GCC is tuning for a range of architectures, 16238as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60}, 16239it defines the macros for every architecture in the range. 16240 16241GCC also defines the macro @code{__m@var{uarch}__} when tuning for 16242ColdFire microarchitecture @var{uarch}, where @var{uarch} is one 16243of the arguments given above. 16244 16245@item -m68000 16246@itemx -mc68000 16247@opindex m68000 16248@opindex mc68000 16249Generate output for a 68000. This is the default 16250when the compiler is configured for 68000-based systems. 16251It is equivalent to @option{-march=68000}. 16252 16253Use this option for microcontrollers with a 68000 or EC000 core, 16254including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356. 16255 16256@item -m68010 16257@opindex m68010 16258Generate output for a 68010. This is the default 16259when the compiler is configured for 68010-based systems. 16260It is equivalent to @option{-march=68010}. 16261 16262@item -m68020 16263@itemx -mc68020 16264@opindex m68020 16265@opindex mc68020 16266Generate output for a 68020. This is the default 16267when the compiler is configured for 68020-based systems. 16268It is equivalent to @option{-march=68020}. 16269 16270@item -m68030 16271@opindex m68030 16272Generate output for a 68030. This is the default when the compiler is 16273configured for 68030-based systems. It is equivalent to 16274@option{-march=68030}. 16275 16276@item -m68040 16277@opindex m68040 16278Generate output for a 68040. This is the default when the compiler is 16279configured for 68040-based systems. It is equivalent to 16280@option{-march=68040}. 16281 16282This option inhibits the use of 68881/68882 instructions that have to be 16283emulated by software on the 68040. Use this option if your 68040 does not 16284have code to emulate those instructions. 16285 16286@item -m68060 16287@opindex m68060 16288Generate output for a 68060. This is the default when the compiler is 16289configured for 68060-based systems. It is equivalent to 16290@option{-march=68060}. 16291 16292This option inhibits the use of 68020 and 68881/68882 instructions that 16293have to be emulated by software on the 68060. Use this option if your 68060 16294does not have code to emulate those instructions. 16295 16296@item -mcpu32 16297@opindex mcpu32 16298Generate output for a CPU32. This is the default 16299when the compiler is configured for CPU32-based systems. 16300It is equivalent to @option{-march=cpu32}. 16301 16302Use this option for microcontrollers with a 16303CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334, 1630468336, 68340, 68341, 68349 and 68360. 16305 16306@item -m5200 16307@opindex m5200 16308Generate output for a 520X ColdFire CPU@. This is the default 16309when the compiler is configured for 520X-based systems. 16310It is equivalent to @option{-mcpu=5206}, and is now deprecated 16311in favor of that option. 16312 16313Use this option for microcontroller with a 5200 core, including 16314the MCF5202, MCF5203, MCF5204 and MCF5206. 16315 16316@item -m5206e 16317@opindex m5206e 16318Generate output for a 5206e ColdFire CPU@. The option is now 16319deprecated in favor of the equivalent @option{-mcpu=5206e}. 16320 16321@item -m528x 16322@opindex m528x 16323Generate output for a member of the ColdFire 528X family. 16324The option is now deprecated in favor of the equivalent 16325@option{-mcpu=528x}. 16326 16327@item -m5307 16328@opindex m5307 16329Generate output for a ColdFire 5307 CPU@. The option is now deprecated 16330in favor of the equivalent @option{-mcpu=5307}. 16331 16332@item -m5407 16333@opindex m5407 16334Generate output for a ColdFire 5407 CPU@. The option is now deprecated 16335in favor of the equivalent @option{-mcpu=5407}. 16336 16337@item -mcfv4e 16338@opindex mcfv4e 16339Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x). 16340This includes use of hardware floating-point instructions. 16341The option is equivalent to @option{-mcpu=547x}, and is now 16342deprecated in favor of that option. 16343 16344@item -m68020-40 16345@opindex m68020-40 16346Generate output for a 68040, without using any of the new instructions. 16347This results in code that can run relatively efficiently on either a 1634868020/68881 or a 68030 or a 68040. The generated code does use the 1634968881 instructions that are emulated on the 68040. 16350 16351The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}. 16352 16353@item -m68020-60 16354@opindex m68020-60 16355Generate output for a 68060, without using any of the new instructions. 16356This results in code that can run relatively efficiently on either a 1635768020/68881 or a 68030 or a 68040. The generated code does use the 1635868881 instructions that are emulated on the 68060. 16359 16360The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}. 16361 16362@item -mhard-float 16363@itemx -m68881 16364@opindex mhard-float 16365@opindex m68881 16366Generate floating-point instructions. This is the default for 68020 16367and above, and for ColdFire devices that have an FPU@. It defines the 16368macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__} 16369on ColdFire targets. 16370 16371@item -msoft-float 16372@opindex msoft-float 16373Do not generate floating-point instructions; use library calls instead. 16374This is the default for 68000, 68010, and 68832 targets. It is also 16375the default for ColdFire devices that have no FPU. 16376 16377@item -mdiv 16378@itemx -mno-div 16379@opindex mdiv 16380@opindex mno-div 16381Generate (do not generate) ColdFire hardware divide and remainder 16382instructions. If @option{-march} is used without @option{-mcpu}, 16383the default is ``on'' for ColdFire architectures and ``off'' for M680x0 16384architectures. Otherwise, the default is taken from the target CPU 16385(either the default CPU, or the one specified by @option{-mcpu}). For 16386example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for 16387@option{-mcpu=5206e}. 16388 16389GCC defines the macro @code{__mcfhwdiv__} when this option is enabled. 16390 16391@item -mshort 16392@opindex mshort 16393Consider type @code{int} to be 16 bits wide, like @code{short int}. 16394Additionally, parameters passed on the stack are also aligned to a 1639516-bit boundary even on targets whose API mandates promotion to 32-bit. 16396 16397@item -mno-short 16398@opindex mno-short 16399Do not consider type @code{int} to be 16 bits wide. This is the default. 16400 16401@item -mnobitfield 16402@itemx -mno-bitfield 16403@opindex mnobitfield 16404@opindex mno-bitfield 16405Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32} 16406and @option{-m5200} options imply @w{@option{-mnobitfield}}. 16407 16408@item -mbitfield 16409@opindex mbitfield 16410Do use the bit-field instructions. The @option{-m68020} option implies 16411@option{-mbitfield}. This is the default if you use a configuration 16412designed for a 68020. 16413 16414@item -mrtd 16415@opindex mrtd 16416Use a different function-calling convention, in which functions 16417that take a fixed number of arguments return with the @code{rtd} 16418instruction, which pops their arguments while returning. This 16419saves one instruction in the caller since there is no need to pop 16420the arguments there. 16421 16422This calling convention is incompatible with the one normally 16423used on Unix, so you cannot use it if you need to call libraries 16424compiled with the Unix compiler. 16425 16426Also, you must provide function prototypes for all functions that 16427take variable numbers of arguments (including @code{printf}); 16428otherwise incorrect code is generated for calls to those 16429functions. 16430 16431In addition, seriously incorrect code results if you call a 16432function with too many arguments. (Normally, extra arguments are 16433harmlessly ignored.) 16434 16435The @code{rtd} instruction is supported by the 68010, 68020, 68030, 1643668040, 68060 and CPU32 processors, but not by the 68000 or 5200. 16437 16438@item -mno-rtd 16439@opindex mno-rtd 16440Do not use the calling conventions selected by @option{-mrtd}. 16441This is the default. 16442 16443@item -malign-int 16444@itemx -mno-align-int 16445@opindex malign-int 16446@opindex mno-align-int 16447Control whether GCC aligns @code{int}, @code{long}, @code{long long}, 16448@code{float}, @code{double}, and @code{long double} variables on a 32-bit 16449boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}). 16450Aligning variables on 32-bit boundaries produces code that runs somewhat 16451faster on processors with 32-bit busses at the expense of more memory. 16452 16453@strong{Warning:} if you use the @option{-malign-int} switch, GCC 16454aligns structures containing the above types differently than 16455most published application binary interface specifications for the m68k. 16456 16457@item -mpcrel 16458@opindex mpcrel 16459Use the pc-relative addressing mode of the 68000 directly, instead of 16460using a global offset table. At present, this option implies @option{-fpic}, 16461allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is 16462not presently supported with @option{-mpcrel}, though this could be supported for 1646368020 and higher processors. 16464 16465@item -mno-strict-align 16466@itemx -mstrict-align 16467@opindex mno-strict-align 16468@opindex mstrict-align 16469Do not (do) assume that unaligned memory references are handled by 16470the system. 16471 16472@item -msep-data 16473Generate code that allows the data segment to be located in a different 16474area of memory from the text segment. This allows for execute-in-place in 16475an environment without virtual memory management. This option implies 16476@option{-fPIC}. 16477 16478@item -mno-sep-data 16479Generate code that assumes that the data segment follows the text segment. 16480This is the default. 16481 16482@item -mid-shared-library 16483Generate code that supports shared libraries via the library ID method. 16484This allows for execute-in-place and shared libraries in an environment 16485without virtual memory management. This option implies @option{-fPIC}. 16486 16487@item -mno-id-shared-library 16488Generate code that doesn't assume ID-based shared libraries are being used. 16489This is the default. 16490 16491@item -mshared-library-id=n 16492Specifies the identification number of the ID-based shared library being 16493compiled. Specifying a value of 0 generates more compact code; specifying 16494other values forces the allocation of that number to the current 16495library, but is no more space- or time-efficient than omitting this option. 16496 16497@item -mxgot 16498@itemx -mno-xgot 16499@opindex mxgot 16500@opindex mno-xgot 16501When generating position-independent code for ColdFire, generate code 16502that works if the GOT has more than 8192 entries. This code is 16503larger and slower than code generated without this option. On M680x0 16504processors, this option is not needed; @option{-fPIC} suffices. 16505 16506GCC normally uses a single instruction to load values from the GOT@. 16507While this is relatively efficient, it only works if the GOT 16508is smaller than about 64k. Anything larger causes the linker 16509to report an error such as: 16510 16511@cindex relocation truncated to fit (ColdFire) 16512@smallexample 16513relocation truncated to fit: R_68K_GOT16O foobar 16514@end smallexample 16515 16516If this happens, you should recompile your code with @option{-mxgot}. 16517It should then work with very large GOTs. However, code generated with 16518@option{-mxgot} is less efficient, since it takes 4 instructions to fetch 16519the value of a global symbol. 16520 16521Note that some linkers, including newer versions of the GNU linker, 16522can create multiple GOTs and sort GOT entries. If you have such a linker, 16523you should only need to use @option{-mxgot} when compiling a single 16524object file that accesses more than 8192 GOT entries. Very few do. 16525 16526These options have no effect unless GCC is generating 16527position-independent code. 16528 16529@end table 16530 16531@node MCore Options 16532@subsection MCore Options 16533@cindex MCore options 16534 16535These are the @samp{-m} options defined for the Motorola M*Core 16536processors. 16537 16538@table @gcctabopt 16539 16540@item -mhardlit 16541@itemx -mno-hardlit 16542@opindex mhardlit 16543@opindex mno-hardlit 16544Inline constants into the code stream if it can be done in two 16545instructions or less. 16546 16547@item -mdiv 16548@itemx -mno-div 16549@opindex mdiv 16550@opindex mno-div 16551Use the divide instruction. (Enabled by default). 16552 16553@item -mrelax-immediate 16554@itemx -mno-relax-immediate 16555@opindex mrelax-immediate 16556@opindex mno-relax-immediate 16557Allow arbitrary-sized immediates in bit operations. 16558 16559@item -mwide-bitfields 16560@itemx -mno-wide-bitfields 16561@opindex mwide-bitfields 16562@opindex mno-wide-bitfields 16563Always treat bit-fields as @code{int}-sized. 16564 16565@item -m4byte-functions 16566@itemx -mno-4byte-functions 16567@opindex m4byte-functions 16568@opindex mno-4byte-functions 16569Force all functions to be aligned to a 4-byte boundary. 16570 16571@item -mcallgraph-data 16572@itemx -mno-callgraph-data 16573@opindex mcallgraph-data 16574@opindex mno-callgraph-data 16575Emit callgraph information. 16576 16577@item -mslow-bytes 16578@itemx -mno-slow-bytes 16579@opindex mslow-bytes 16580@opindex mno-slow-bytes 16581Prefer word access when reading byte quantities. 16582 16583@item -mlittle-endian 16584@itemx -mbig-endian 16585@opindex mlittle-endian 16586@opindex mbig-endian 16587Generate code for a little-endian target. 16588 16589@item -m210 16590@itemx -m340 16591@opindex m210 16592@opindex m340 16593Generate code for the 210 processor. 16594 16595@item -mno-lsim 16596@opindex mno-lsim 16597Assume that runtime support has been provided and so omit the 16598simulator library (@file{libsim.a)} from the linker command line. 16599 16600@item -mstack-increment=@var{size} 16601@opindex mstack-increment 16602Set the maximum amount for a single stack increment operation. Large 16603values can increase the speed of programs that contain functions 16604that need a large amount of stack space, but they can also trigger a 16605segmentation fault if the stack is extended too much. The default 16606value is 0x1000. 16607 16608@end table 16609 16610@node MeP Options 16611@subsection MeP Options 16612@cindex MeP options 16613 16614@table @gcctabopt 16615 16616@item -mabsdiff 16617@opindex mabsdiff 16618Enables the @code{abs} instruction, which is the absolute difference 16619between two registers. 16620 16621@item -mall-opts 16622@opindex mall-opts 16623Enables all the optional instructions---average, multiply, divide, bit 16624operations, leading zero, absolute difference, min/max, clip, and 16625saturation. 16626 16627 16628@item -maverage 16629@opindex maverage 16630Enables the @code{ave} instruction, which computes the average of two 16631registers. 16632 16633@item -mbased=@var{n} 16634@opindex mbased= 16635Variables of size @var{n} bytes or smaller are placed in the 16636@code{.based} section by default. Based variables use the @code{$tp} 16637register as a base register, and there is a 128-byte limit to the 16638@code{.based} section. 16639 16640@item -mbitops 16641@opindex mbitops 16642Enables the bit operation instructions---bit test (@code{btstm}), set 16643(@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and 16644test-and-set (@code{tas}). 16645 16646@item -mc=@var{name} 16647@opindex mc= 16648Selects which section constant data is placed in. @var{name} may 16649be @samp{tiny}, @samp{near}, or @samp{far}. 16650 16651@item -mclip 16652@opindex mclip 16653Enables the @code{clip} instruction. Note that @option{-mclip} is not 16654useful unless you also provide @option{-mminmax}. 16655 16656@item -mconfig=@var{name} 16657@opindex mconfig= 16658Selects one of the built-in core configurations. Each MeP chip has 16659one or more modules in it; each module has a core CPU and a variety of 16660coprocessors, optional instructions, and peripherals. The 16661@code{MeP-Integrator} tool, not part of GCC, provides these 16662configurations through this option; using this option is the same as 16663using all the corresponding command-line options. The default 16664configuration is @samp{default}. 16665 16666@item -mcop 16667@opindex mcop 16668Enables the coprocessor instructions. By default, this is a 32-bit 16669coprocessor. Note that the coprocessor is normally enabled via the 16670@option{-mconfig=} option. 16671 16672@item -mcop32 16673@opindex mcop32 16674Enables the 32-bit coprocessor's instructions. 16675 16676@item -mcop64 16677@opindex mcop64 16678Enables the 64-bit coprocessor's instructions. 16679 16680@item -mivc2 16681@opindex mivc2 16682Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor. 16683 16684@item -mdc 16685@opindex mdc 16686Causes constant variables to be placed in the @code{.near} section. 16687 16688@item -mdiv 16689@opindex mdiv 16690Enables the @code{div} and @code{divu} instructions. 16691 16692@item -meb 16693@opindex meb 16694Generate big-endian code. 16695 16696@item -mel 16697@opindex mel 16698Generate little-endian code. 16699 16700@item -mio-volatile 16701@opindex mio-volatile 16702Tells the compiler that any variable marked with the @code{io} 16703attribute is to be considered volatile. 16704 16705@item -ml 16706@opindex ml 16707Causes variables to be assigned to the @code{.far} section by default. 16708 16709@item -mleadz 16710@opindex mleadz 16711Enables the @code{leadz} (leading zero) instruction. 16712 16713@item -mm 16714@opindex mm 16715Causes variables to be assigned to the @code{.near} section by default. 16716 16717@item -mminmax 16718@opindex mminmax 16719Enables the @code{min} and @code{max} instructions. 16720 16721@item -mmult 16722@opindex mmult 16723Enables the multiplication and multiply-accumulate instructions. 16724 16725@item -mno-opts 16726@opindex mno-opts 16727Disables all the optional instructions enabled by @option{-mall-opts}. 16728 16729@item -mrepeat 16730@opindex mrepeat 16731Enables the @code{repeat} and @code{erepeat} instructions, used for 16732low-overhead looping. 16733 16734@item -ms 16735@opindex ms 16736Causes all variables to default to the @code{.tiny} section. Note 16737that there is a 65536-byte limit to this section. Accesses to these 16738variables use the @code{%gp} base register. 16739 16740@item -msatur 16741@opindex msatur 16742Enables the saturation instructions. Note that the compiler does not 16743currently generate these itself, but this option is included for 16744compatibility with other tools, like @code{as}. 16745 16746@item -msdram 16747@opindex msdram 16748Link the SDRAM-based runtime instead of the default ROM-based runtime. 16749 16750@item -msim 16751@opindex msim 16752Link the simulator run-time libraries. 16753 16754@item -msimnovec 16755@opindex msimnovec 16756Link the simulator runtime libraries, excluding built-in support 16757for reset and exception vectors and tables. 16758 16759@item -mtf 16760@opindex mtf 16761Causes all functions to default to the @code{.far} section. Without 16762this option, functions default to the @code{.near} section. 16763 16764@item -mtiny=@var{n} 16765@opindex mtiny= 16766Variables that are @var{n} bytes or smaller are allocated to the 16767@code{.tiny} section. These variables use the @code{$gp} base 16768register. The default for this option is 4, but note that there's a 1676965536-byte limit to the @code{.tiny} section. 16770 16771@end table 16772 16773@node MicroBlaze Options 16774@subsection MicroBlaze Options 16775@cindex MicroBlaze Options 16776 16777@table @gcctabopt 16778 16779@item -msoft-float 16780@opindex msoft-float 16781Use software emulation for floating point (default). 16782 16783@item -mhard-float 16784@opindex mhard-float 16785Use hardware floating-point instructions. 16786 16787@item -mmemcpy 16788@opindex mmemcpy 16789Do not optimize block moves, use @code{memcpy}. 16790 16791@item -mno-clearbss 16792@opindex mno-clearbss 16793This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead. 16794 16795@item -mcpu=@var{cpu-type} 16796@opindex mcpu= 16797Use features of, and schedule code for, the given CPU. 16798Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}}, 16799where @var{X} is a major version, @var{YY} is the minor version, and 16800@var{Z} is compatibility code. Example values are @samp{v3.00.a}, 16801@samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}. 16802 16803@item -mxl-soft-mul 16804@opindex mxl-soft-mul 16805Use software multiply emulation (default). 16806 16807@item -mxl-soft-div 16808@opindex mxl-soft-div 16809Use software emulation for divides (default). 16810 16811@item -mxl-barrel-shift 16812@opindex mxl-barrel-shift 16813Use the hardware barrel shifter. 16814 16815@item -mxl-pattern-compare 16816@opindex mxl-pattern-compare 16817Use pattern compare instructions. 16818 16819@item -msmall-divides 16820@opindex msmall-divides 16821Use table lookup optimization for small signed integer divisions. 16822 16823@item -mxl-stack-check 16824@opindex mxl-stack-check 16825This option is deprecated. Use @option{-fstack-check} instead. 16826 16827@item -mxl-gp-opt 16828@opindex mxl-gp-opt 16829Use GP-relative @code{.sdata}/@code{.sbss} sections. 16830 16831@item -mxl-multiply-high 16832@opindex mxl-multiply-high 16833Use multiply high instructions for high part of 32x32 multiply. 16834 16835@item -mxl-float-convert 16836@opindex mxl-float-convert 16837Use hardware floating-point conversion instructions. 16838 16839@item -mxl-float-sqrt 16840@opindex mxl-float-sqrt 16841Use hardware floating-point square root instruction. 16842 16843@item -mbig-endian 16844@opindex mbig-endian 16845Generate code for a big-endian target. 16846 16847@item -mlittle-endian 16848@opindex mlittle-endian 16849Generate code for a little-endian target. 16850 16851@item -mxl-reorder 16852@opindex mxl-reorder 16853Use reorder instructions (swap and byte reversed load/store). 16854 16855@item -mxl-mode-@var{app-model} 16856Select application model @var{app-model}. Valid models are 16857@table @samp 16858@item executable 16859normal executable (default), uses startup code @file{crt0.o}. 16860 16861@item xmdstub 16862for use with Xilinx Microprocessor Debugger (XMD) based 16863software intrusive debug agent called xmdstub. This uses startup file 16864@file{crt1.o} and sets the start address of the program to 0x800. 16865 16866@item bootstrap 16867for applications that are loaded using a bootloader. 16868This model uses startup file @file{crt2.o} which does not contain a processor 16869reset vector handler. This is suitable for transferring control on a 16870processor reset to the bootloader rather than the application. 16871 16872@item novectors 16873for applications that do not require any of the 16874MicroBlaze vectors. This option may be useful for applications running 16875within a monitoring application. This model uses @file{crt3.o} as a startup file. 16876@end table 16877 16878Option @option{-xl-mode-@var{app-model}} is a deprecated alias for 16879@option{-mxl-mode-@var{app-model}}. 16880 16881@end table 16882 16883@node MIPS Options 16884@subsection MIPS Options 16885@cindex MIPS options 16886 16887@table @gcctabopt 16888 16889@item -EB 16890@opindex EB 16891Generate big-endian code. 16892 16893@item -EL 16894@opindex EL 16895Generate little-endian code. This is the default for @samp{mips*el-*-*} 16896configurations. 16897 16898@item -march=@var{arch} 16899@opindex march 16900Generate code that runs on @var{arch}, which can be the name of a 16901generic MIPS ISA, or the name of a particular processor. 16902The ISA names are: 16903@samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4}, 16904@samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5}, 16905@samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3}, 16906@samp{mips64r5} and @samp{mips64r6}. 16907The processor names are: 16908@samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc}, 16909@samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd}, 16910@samp{5kc}, @samp{5kf}, 16911@samp{20kc}, 16912@samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1}, 16913@samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1}, 16914@samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn}, 16915@samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2}, 16916@samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1}, 16917@samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, 16918@samp{m4k}, 16919@samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec}, 16920@samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3}, 16921@samp{orion}, 16922@samp{p5600}, 16923@samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400}, 16924@samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000}, 16925@samp{rm7000}, @samp{rm9000}, 16926@samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000}, 16927@samp{sb1}, 16928@samp{sr71000}, 16929@samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300}, 16930@samp{vr5000}, @samp{vr5400}, @samp{vr5500}, 16931@samp{xlr} and @samp{xlp}. 16932The special value @samp{from-abi} selects the 16933most compatible architecture for the selected ABI (that is, 16934@samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@. 16935 16936The native Linux/GNU toolchain also supports the value @samp{native}, 16937which selects the best architecture option for the host processor. 16938@option{-march=native} has no effect if GCC does not recognize 16939the processor. 16940 16941In processor names, a final @samp{000} can be abbreviated as @samp{k} 16942(for example, @option{-march=r2k}). Prefixes are optional, and 16943@samp{vr} may be written @samp{r}. 16944 16945Names of the form @samp{@var{n}f2_1} refer to processors with 16946FPUs clocked at half the rate of the core, names of the form 16947@samp{@var{n}f1_1} refer to processors with FPUs clocked at the same 16948rate as the core, and names of the form @samp{@var{n}f3_2} refer to 16949processors with FPUs clocked a ratio of 3:2 with respect to the core. 16950For compatibility reasons, @samp{@var{n}f} is accepted as a synonym 16951for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are 16952accepted as synonyms for @samp{@var{n}f1_1}. 16953 16954GCC defines two macros based on the value of this option. The first 16955is @code{_MIPS_ARCH}, which gives the name of target architecture, as 16956a string. The second has the form @code{_MIPS_ARCH_@var{foo}}, 16957where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@. 16958For example, @option{-march=r2000} sets @code{_MIPS_ARCH} 16959to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}. 16960 16961Note that the @code{_MIPS_ARCH} macro uses the processor names given 16962above. In other words, it has the full prefix and does not 16963abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi}, 16964the macro names the resolved architecture (either @code{"mips1"} or 16965@code{"mips3"}). It names the default architecture when no 16966@option{-march} option is given. 16967 16968@item -mtune=@var{arch} 16969@opindex mtune 16970Optimize for @var{arch}. Among other things, this option controls 16971the way instructions are scheduled, and the perceived cost of arithmetic 16972operations. The list of @var{arch} values is the same as for 16973@option{-march}. 16974 16975When this option is not used, GCC optimizes for the processor 16976specified by @option{-march}. By using @option{-march} and 16977@option{-mtune} together, it is possible to generate code that 16978runs on a family of processors, but optimize the code for one 16979particular member of that family. 16980 16981@option{-mtune} defines the macros @code{_MIPS_TUNE} and 16982@code{_MIPS_TUNE_@var{foo}}, which work in the same way as the 16983@option{-march} ones described above. 16984 16985@item -mips1 16986@opindex mips1 16987Equivalent to @option{-march=mips1}. 16988 16989@item -mips2 16990@opindex mips2 16991Equivalent to @option{-march=mips2}. 16992 16993@item -mips3 16994@opindex mips3 16995Equivalent to @option{-march=mips3}. 16996 16997@item -mips4 16998@opindex mips4 16999Equivalent to @option{-march=mips4}. 17000 17001@item -mips32 17002@opindex mips32 17003Equivalent to @option{-march=mips32}. 17004 17005@item -mips32r3 17006@opindex mips32r3 17007Equivalent to @option{-march=mips32r3}. 17008 17009@item -mips32r5 17010@opindex mips32r5 17011Equivalent to @option{-march=mips32r5}. 17012 17013@item -mips32r6 17014@opindex mips32r6 17015Equivalent to @option{-march=mips32r6}. 17016 17017@item -mips64 17018@opindex mips64 17019Equivalent to @option{-march=mips64}. 17020 17021@item -mips64r2 17022@opindex mips64r2 17023Equivalent to @option{-march=mips64r2}. 17024 17025@item -mips64r3 17026@opindex mips64r3 17027Equivalent to @option{-march=mips64r3}. 17028 17029@item -mips64r5 17030@opindex mips64r5 17031Equivalent to @option{-march=mips64r5}. 17032 17033@item -mips64r6 17034@opindex mips64r6 17035Equivalent to @option{-march=mips64r6}. 17036 17037@item -mips16 17038@itemx -mno-mips16 17039@opindex mips16 17040@opindex mno-mips16 17041Generate (do not generate) MIPS16 code. If GCC is targeting a 17042MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@. 17043 17044MIPS16 code generation can also be controlled on a per-function basis 17045by means of @code{mips16} and @code{nomips16} attributes. 17046@xref{Function Attributes}, for more information. 17047 17048@item -mflip-mips16 17049@opindex mflip-mips16 17050Generate MIPS16 code on alternating functions. This option is provided 17051for regression testing of mixed MIPS16/non-MIPS16 code generation, and is 17052not intended for ordinary use in compiling user code. 17053 17054@item -minterlink-compressed 17055@item -mno-interlink-compressed 17056@opindex minterlink-compressed 17057@opindex mno-interlink-compressed 17058Require (do not require) that code using the standard (uncompressed) MIPS ISA 17059be link-compatible with MIPS16 and microMIPS code, and vice versa. 17060 17061For example, code using the standard ISA encoding cannot jump directly 17062to MIPS16 or microMIPS code; it must either use a call or an indirect jump. 17063@option{-minterlink-compressed} therefore disables direct jumps unless GCC 17064knows that the target of the jump is not compressed. 17065 17066@item -minterlink-mips16 17067@itemx -mno-interlink-mips16 17068@opindex minterlink-mips16 17069@opindex mno-interlink-mips16 17070Aliases of @option{-minterlink-compressed} and 17071@option{-mno-interlink-compressed}. These options predate the microMIPS ASE 17072and are retained for backwards compatibility. 17073 17074@item -mabi=32 17075@itemx -mabi=o64 17076@itemx -mabi=n32 17077@itemx -mabi=64 17078@itemx -mabi=eabi 17079@opindex mabi=32 17080@opindex mabi=o64 17081@opindex mabi=n32 17082@opindex mabi=64 17083@opindex mabi=eabi 17084Generate code for the given ABI@. 17085 17086Note that the EABI has a 32-bit and a 64-bit variant. GCC normally 17087generates 64-bit code when you select a 64-bit architecture, but you 17088can use @option{-mgp32} to get 32-bit code instead. 17089 17090For information about the O64 ABI, see 17091@uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}. 17092 17093GCC supports a variant of the o32 ABI in which floating-point registers 17094are 64 rather than 32 bits wide. You can select this combination with 17095@option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1} 17096and @code{mfhc1} instructions and is therefore only supported for 17097MIPS32R2, MIPS32R3 and MIPS32R5 processors. 17098 17099The register assignments for arguments and return values remain the 17100same, but each scalar value is passed in a single 64-bit register 17101rather than a pair of 32-bit registers. For example, scalar 17102floating-point values are returned in @samp{$f0} only, not a 17103@samp{$f0}/@samp{$f1} pair. The set of call-saved registers also 17104remains the same in that the even-numbered double-precision registers 17105are saved. 17106 17107Two additional variants of the o32 ABI are supported to enable 17108a transition from 32-bit to 64-bit registers. These are FPXX 17109(@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}). 17110The FPXX extension mandates that all code must execute correctly 17111when run using 32-bit or 64-bit registers. The code can be interlinked 17112with either FP32 or FP64, but not both. 17113The FP64A extension is similar to the FP64 extension but forbids the 17114use of odd-numbered single-precision registers. This can be used 17115in conjunction with the @code{FRE} mode of FPUs in MIPS32R5 17116processors and allows both FP32 and FP64A code to interlink and 17117run in the same process without changing FPU modes. 17118 17119@item -mabicalls 17120@itemx -mno-abicalls 17121@opindex mabicalls 17122@opindex mno-abicalls 17123Generate (do not generate) code that is suitable for SVR4-style 17124dynamic objects. @option{-mabicalls} is the default for SVR4-based 17125systems. 17126 17127@item -mshared 17128@itemx -mno-shared 17129Generate (do not generate) code that is fully position-independent, 17130and that can therefore be linked into shared libraries. This option 17131only affects @option{-mabicalls}. 17132 17133All @option{-mabicalls} code has traditionally been position-independent, 17134regardless of options like @option{-fPIC} and @option{-fpic}. However, 17135as an extension, the GNU toolchain allows executables to use absolute 17136accesses for locally-binding symbols. It can also use shorter GP 17137initialization sequences and generate direct calls to locally-defined 17138functions. This mode is selected by @option{-mno-shared}. 17139 17140@option{-mno-shared} depends on binutils 2.16 or higher and generates 17141objects that can only be linked by the GNU linker. However, the option 17142does not affect the ABI of the final executable; it only affects the ABI 17143of relocatable objects. Using @option{-mno-shared} generally makes 17144executables both smaller and quicker. 17145 17146@option{-mshared} is the default. 17147 17148@item -mplt 17149@itemx -mno-plt 17150@opindex mplt 17151@opindex mno-plt 17152Assume (do not assume) that the static and dynamic linkers 17153support PLTs and copy relocations. This option only affects 17154@option{-mno-shared -mabicalls}. For the n64 ABI, this option 17155has no effect without @option{-msym32}. 17156 17157You can make @option{-mplt} the default by configuring 17158GCC with @option{--with-mips-plt}. The default is 17159@option{-mno-plt} otherwise. 17160 17161@item -mxgot 17162@itemx -mno-xgot 17163@opindex mxgot 17164@opindex mno-xgot 17165Lift (do not lift) the usual restrictions on the size of the global 17166offset table. 17167 17168GCC normally uses a single instruction to load values from the GOT@. 17169While this is relatively efficient, it only works if the GOT 17170is smaller than about 64k. Anything larger causes the linker 17171to report an error such as: 17172 17173@cindex relocation truncated to fit (MIPS) 17174@smallexample 17175relocation truncated to fit: R_MIPS_GOT16 foobar 17176@end smallexample 17177 17178If this happens, you should recompile your code with @option{-mxgot}. 17179This works with very large GOTs, although the code is also 17180less efficient, since it takes three instructions to fetch the 17181value of a global symbol. 17182 17183Note that some linkers can create multiple GOTs. If you have such a 17184linker, you should only need to use @option{-mxgot} when a single object 17185file accesses more than 64k's worth of GOT entries. Very few do. 17186 17187These options have no effect unless GCC is generating position 17188independent code. 17189 17190@item -mgp32 17191@opindex mgp32 17192Assume that general-purpose registers are 32 bits wide. 17193 17194@item -mgp64 17195@opindex mgp64 17196Assume that general-purpose registers are 64 bits wide. 17197 17198@item -mfp32 17199@opindex mfp32 17200Assume that floating-point registers are 32 bits wide. 17201 17202@item -mfp64 17203@opindex mfp64 17204Assume that floating-point registers are 64 bits wide. 17205 17206@item -mfpxx 17207@opindex mfpxx 17208Do not assume the width of floating-point registers. 17209 17210@item -mhard-float 17211@opindex mhard-float 17212Use floating-point coprocessor instructions. 17213 17214@item -msoft-float 17215@opindex msoft-float 17216Do not use floating-point coprocessor instructions. Implement 17217floating-point calculations using library calls instead. 17218 17219@item -mno-float 17220@opindex mno-float 17221Equivalent to @option{-msoft-float}, but additionally asserts that the 17222program being compiled does not perform any floating-point operations. 17223This option is presently supported only by some bare-metal MIPS 17224configurations, where it may select a special set of libraries 17225that lack all floating-point support (including, for example, the 17226floating-point @code{printf} formats). 17227If code compiled with @option{-mno-float} accidentally contains 17228floating-point operations, it is likely to suffer a link-time 17229or run-time failure. 17230 17231@item -msingle-float 17232@opindex msingle-float 17233Assume that the floating-point coprocessor only supports single-precision 17234operations. 17235 17236@item -mdouble-float 17237@opindex mdouble-float 17238Assume that the floating-point coprocessor supports double-precision 17239operations. This is the default. 17240 17241@item -modd-spreg 17242@itemx -mno-odd-spreg 17243@opindex modd-spreg 17244@opindex mno-odd-spreg 17245Enable the use of odd-numbered single-precision floating-point registers 17246for the o32 ABI. This is the default for processors that are known to 17247support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg} 17248is set by default. 17249 17250@item -mabs=2008 17251@itemx -mabs=legacy 17252@opindex mabs=2008 17253@opindex mabs=legacy 17254These options control the treatment of the special not-a-number (NaN) 17255IEEE 754 floating-point data with the @code{abs.@i{fmt}} and 17256@code{neg.@i{fmt}} machine instructions. 17257 17258By default or when @option{-mabs=legacy} is used the legacy 17259treatment is selected. In this case these instructions are considered 17260arithmetic and avoided where correct operation is required and the 17261input operand might be a NaN. A longer sequence of instructions that 17262manipulate the sign bit of floating-point datum manually is used 17263instead unless the @option{-ffinite-math-only} option has also been 17264specified. 17265 17266The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In 17267this case these instructions are considered non-arithmetic and therefore 17268operating correctly in all cases, including in particular where the 17269input operand is a NaN. These instructions are therefore always used 17270for the respective operations. 17271 17272@item -mnan=2008 17273@itemx -mnan=legacy 17274@opindex mnan=2008 17275@opindex mnan=legacy 17276These options control the encoding of the special not-a-number (NaN) 17277IEEE 754 floating-point data. 17278 17279The @option{-mnan=legacy} option selects the legacy encoding. In this 17280case quiet NaNs (qNaNs) are denoted by the first bit of their trailing 17281significand field being 0, whereas signalling NaNs (sNaNs) are denoted 17282by the first bit of their trailing significand field being 1. 17283 17284The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In 17285this case qNaNs are denoted by the first bit of their trailing 17286significand field being 1, whereas sNaNs are denoted by the first bit of 17287their trailing significand field being 0. 17288 17289The default is @option{-mnan=legacy} unless GCC has been configured with 17290@option{--with-nan=2008}. 17291 17292@item -mllsc 17293@itemx -mno-llsc 17294@opindex mllsc 17295@opindex mno-llsc 17296Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to 17297implement atomic memory built-in functions. When neither option is 17298specified, GCC uses the instructions if the target architecture 17299supports them. 17300 17301@option{-mllsc} is useful if the runtime environment can emulate the 17302instructions and @option{-mno-llsc} can be useful when compiling for 17303nonstandard ISAs. You can make either option the default by 17304configuring GCC with @option{--with-llsc} and @option{--without-llsc} 17305respectively. @option{--with-llsc} is the default for some 17306configurations; see the installation documentation for details. 17307 17308@item -mdsp 17309@itemx -mno-dsp 17310@opindex mdsp 17311@opindex mno-dsp 17312Use (do not use) revision 1 of the MIPS DSP ASE@. 17313@xref{MIPS DSP Built-in Functions}. This option defines the 17314preprocessor macro @code{__mips_dsp}. It also defines 17315@code{__mips_dsp_rev} to 1. 17316 17317@item -mdspr2 17318@itemx -mno-dspr2 17319@opindex mdspr2 17320@opindex mno-dspr2 17321Use (do not use) revision 2 of the MIPS DSP ASE@. 17322@xref{MIPS DSP Built-in Functions}. This option defines the 17323preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}. 17324It also defines @code{__mips_dsp_rev} to 2. 17325 17326@item -msmartmips 17327@itemx -mno-smartmips 17328@opindex msmartmips 17329@opindex mno-smartmips 17330Use (do not use) the MIPS SmartMIPS ASE. 17331 17332@item -mpaired-single 17333@itemx -mno-paired-single 17334@opindex mpaired-single 17335@opindex mno-paired-single 17336Use (do not use) paired-single floating-point instructions. 17337@xref{MIPS Paired-Single Support}. This option requires 17338hardware floating-point support to be enabled. 17339 17340@item -mdmx 17341@itemx -mno-mdmx 17342@opindex mdmx 17343@opindex mno-mdmx 17344Use (do not use) MIPS Digital Media Extension instructions. 17345This option can only be used when generating 64-bit code and requires 17346hardware floating-point support to be enabled. 17347 17348@item -mips3d 17349@itemx -mno-mips3d 17350@opindex mips3d 17351@opindex mno-mips3d 17352Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}. 17353The option @option{-mips3d} implies @option{-mpaired-single}. 17354 17355@item -mmicromips 17356@itemx -mno-micromips 17357@opindex mmicromips 17358@opindex mno-mmicromips 17359Generate (do not generate) microMIPS code. 17360 17361MicroMIPS code generation can also be controlled on a per-function basis 17362by means of @code{micromips} and @code{nomicromips} attributes. 17363@xref{Function Attributes}, for more information. 17364 17365@item -mmt 17366@itemx -mno-mt 17367@opindex mmt 17368@opindex mno-mt 17369Use (do not use) MT Multithreading instructions. 17370 17371@item -mmcu 17372@itemx -mno-mcu 17373@opindex mmcu 17374@opindex mno-mcu 17375Use (do not use) the MIPS MCU ASE instructions. 17376 17377@item -meva 17378@itemx -mno-eva 17379@opindex meva 17380@opindex mno-eva 17381Use (do not use) the MIPS Enhanced Virtual Addressing instructions. 17382 17383@item -mvirt 17384@itemx -mno-virt 17385@opindex mvirt 17386@opindex mno-virt 17387Use (do not use) the MIPS Virtualization Application Specific instructions. 17388 17389@item -mxpa 17390@itemx -mno-xpa 17391@opindex mxpa 17392@opindex mno-xpa 17393Use (do not use) the MIPS eXtended Physical Address (XPA) instructions. 17394 17395@item -mlong64 17396@opindex mlong64 17397Force @code{long} types to be 64 bits wide. See @option{-mlong32} for 17398an explanation of the default and the way that the pointer size is 17399determined. 17400 17401@item -mlong32 17402@opindex mlong32 17403Force @code{long}, @code{int}, and pointer types to be 32 bits wide. 17404 17405The default size of @code{int}s, @code{long}s and pointers depends on 17406the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI 17407uses 64-bit @code{long}s, as does the 64-bit EABI; the others use 1740832-bit @code{long}s. Pointers are the same size as @code{long}s, 17409or the same size as integer registers, whichever is smaller. 17410 17411@item -msym32 17412@itemx -mno-sym32 17413@opindex msym32 17414@opindex mno-sym32 17415Assume (do not assume) that all symbols have 32-bit values, regardless 17416of the selected ABI@. This option is useful in combination with 17417@option{-mabi=64} and @option{-mno-abicalls} because it allows GCC 17418to generate shorter and faster references to symbolic addresses. 17419 17420@item -G @var{num} 17421@opindex G 17422Put definitions of externally-visible data in a small data section 17423if that data is no bigger than @var{num} bytes. GCC can then generate 17424more efficient accesses to the data; see @option{-mgpopt} for details. 17425 17426The default @option{-G} option depends on the configuration. 17427 17428@item -mlocal-sdata 17429@itemx -mno-local-sdata 17430@opindex mlocal-sdata 17431@opindex mno-local-sdata 17432Extend (do not extend) the @option{-G} behavior to local data too, 17433such as to static variables in C@. @option{-mlocal-sdata} is the 17434default for all configurations. 17435 17436If the linker complains that an application is using too much small data, 17437you might want to try rebuilding the less performance-critical parts with 17438@option{-mno-local-sdata}. You might also want to build large 17439libraries with @option{-mno-local-sdata}, so that the libraries leave 17440more room for the main program. 17441 17442@item -mextern-sdata 17443@itemx -mno-extern-sdata 17444@opindex mextern-sdata 17445@opindex mno-extern-sdata 17446Assume (do not assume) that externally-defined data is in 17447a small data section if the size of that data is within the @option{-G} limit. 17448@option{-mextern-sdata} is the default for all configurations. 17449 17450If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G 17451@var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var} 17452that is no bigger than @var{num} bytes, you must make sure that @var{Var} 17453is placed in a small data section. If @var{Var} is defined by another 17454module, you must either compile that module with a high-enough 17455@option{-G} setting or attach a @code{section} attribute to @var{Var}'s 17456definition. If @var{Var} is common, you must link the application 17457with a high-enough @option{-G} setting. 17458 17459The easiest way of satisfying these restrictions is to compile 17460and link every module with the same @option{-G} option. However, 17461you may wish to build a library that supports several different 17462small data limits. You can do this by compiling the library with 17463the highest supported @option{-G} setting and additionally using 17464@option{-mno-extern-sdata} to stop the library from making assumptions 17465about externally-defined data. 17466 17467@item -mgpopt 17468@itemx -mno-gpopt 17469@opindex mgpopt 17470@opindex mno-gpopt 17471Use (do not use) GP-relative accesses for symbols that are known to be 17472in a small data section; see @option{-G}, @option{-mlocal-sdata} and 17473@option{-mextern-sdata}. @option{-mgpopt} is the default for all 17474configurations. 17475 17476@option{-mno-gpopt} is useful for cases where the @code{$gp} register 17477might not hold the value of @code{_gp}. For example, if the code is 17478part of a library that might be used in a boot monitor, programs that 17479call boot monitor routines pass an unknown value in @code{$gp}. 17480(In such situations, the boot monitor itself is usually compiled 17481with @option{-G0}.) 17482 17483@option{-mno-gpopt} implies @option{-mno-local-sdata} and 17484@option{-mno-extern-sdata}. 17485 17486@item -membedded-data 17487@itemx -mno-embedded-data 17488@opindex membedded-data 17489@opindex mno-embedded-data 17490Allocate variables to the read-only data section first if possible, then 17491next in the small data section if possible, otherwise in data. This gives 17492slightly slower code than the default, but reduces the amount of RAM required 17493when executing, and thus may be preferred for some embedded systems. 17494 17495@item -muninit-const-in-rodata 17496@itemx -mno-uninit-const-in-rodata 17497@opindex muninit-const-in-rodata 17498@opindex mno-uninit-const-in-rodata 17499Put uninitialized @code{const} variables in the read-only data section. 17500This option is only meaningful in conjunction with @option{-membedded-data}. 17501 17502@item -mcode-readable=@var{setting} 17503@opindex mcode-readable 17504Specify whether GCC may generate code that reads from executable sections. 17505There are three possible settings: 17506 17507@table @gcctabopt 17508@item -mcode-readable=yes 17509Instructions may freely access executable sections. This is the 17510default setting. 17511 17512@item -mcode-readable=pcrel 17513MIPS16 PC-relative load instructions can access executable sections, 17514but other instructions must not do so. This option is useful on 4KSc 17515and 4KSd processors when the code TLBs have the Read Inhibit bit set. 17516It is also useful on processors that can be configured to have a dual 17517instruction/data SRAM interface and that, like the M4K, automatically 17518redirect PC-relative loads to the instruction RAM. 17519 17520@item -mcode-readable=no 17521Instructions must not access executable sections. This option can be 17522useful on targets that are configured to have a dual instruction/data 17523SRAM interface but that (unlike the M4K) do not automatically redirect 17524PC-relative loads to the instruction RAM. 17525@end table 17526 17527@item -msplit-addresses 17528@itemx -mno-split-addresses 17529@opindex msplit-addresses 17530@opindex mno-split-addresses 17531Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler 17532relocation operators. This option has been superseded by 17533@option{-mexplicit-relocs} but is retained for backwards compatibility. 17534 17535@item -mexplicit-relocs 17536@itemx -mno-explicit-relocs 17537@opindex mexplicit-relocs 17538@opindex mno-explicit-relocs 17539Use (do not use) assembler relocation operators when dealing with symbolic 17540addresses. The alternative, selected by @option{-mno-explicit-relocs}, 17541is to use assembler macros instead. 17542 17543@option{-mexplicit-relocs} is the default if GCC was configured 17544to use an assembler that supports relocation operators. 17545 17546@item -mcheck-zero-division 17547@itemx -mno-check-zero-division 17548@opindex mcheck-zero-division 17549@opindex mno-check-zero-division 17550Trap (do not trap) on integer division by zero. 17551 17552The default is @option{-mcheck-zero-division}. 17553 17554@item -mdivide-traps 17555@itemx -mdivide-breaks 17556@opindex mdivide-traps 17557@opindex mdivide-breaks 17558MIPS systems check for division by zero by generating either a 17559conditional trap or a break instruction. Using traps results in 17560smaller code, but is only supported on MIPS II and later. Also, some 17561versions of the Linux kernel have a bug that prevents trap from 17562generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to 17563allow conditional traps on architectures that support them and 17564@option{-mdivide-breaks} to force the use of breaks. 17565 17566The default is usually @option{-mdivide-traps}, but this can be 17567overridden at configure time using @option{--with-divide=breaks}. 17568Divide-by-zero checks can be completely disabled using 17569@option{-mno-check-zero-division}. 17570 17571@item -mmemcpy 17572@itemx -mno-memcpy 17573@opindex mmemcpy 17574@opindex mno-memcpy 17575Force (do not force) the use of @code{memcpy} for non-trivial block 17576moves. The default is @option{-mno-memcpy}, which allows GCC to inline 17577most constant-sized copies. 17578 17579@item -mlong-calls 17580@itemx -mno-long-calls 17581@opindex mlong-calls 17582@opindex mno-long-calls 17583Disable (do not disable) use of the @code{jal} instruction. Calling 17584functions using @code{jal} is more efficient but requires the caller 17585and callee to be in the same 256 megabyte segment. 17586 17587This option has no effect on abicalls code. The default is 17588@option{-mno-long-calls}. 17589 17590@item -mmad 17591@itemx -mno-mad 17592@opindex mmad 17593@opindex mno-mad 17594Enable (disable) use of the @code{mad}, @code{madu} and @code{mul} 17595instructions, as provided by the R4650 ISA@. 17596 17597@item -mimadd 17598@itemx -mno-imadd 17599@opindex mimadd 17600@opindex mno-imadd 17601Enable (disable) use of the @code{madd} and @code{msub} integer 17602instructions. The default is @option{-mimadd} on architectures 17603that support @code{madd} and @code{msub} except for the 74k 17604architecture where it was found to generate slower code. 17605 17606@item -mfused-madd 17607@itemx -mno-fused-madd 17608@opindex mfused-madd 17609@opindex mno-fused-madd 17610Enable (disable) use of the floating-point multiply-accumulate 17611instructions, when they are available. The default is 17612@option{-mfused-madd}. 17613 17614On the R8000 CPU when multiply-accumulate instructions are used, 17615the intermediate product is calculated to infinite precision 17616and is not subject to the FCSR Flush to Zero bit. This may be 17617undesirable in some circumstances. On other processors the result 17618is numerically identical to the equivalent computation using 17619separate multiply, add, subtract and negate instructions. 17620 17621@item -nocpp 17622@opindex nocpp 17623Tell the MIPS assembler to not run its preprocessor over user 17624assembler files (with a @samp{.s} suffix) when assembling them. 17625 17626@item -mfix-24k 17627@item -mno-fix-24k 17628@opindex mfix-24k 17629@opindex mno-fix-24k 17630Work around the 24K E48 (lost data on stores during refill) errata. 17631The workarounds are implemented by the assembler rather than by GCC@. 17632 17633@item -mfix-r4000 17634@itemx -mno-fix-r4000 17635@opindex mfix-r4000 17636@opindex mno-fix-r4000 17637Work around certain R4000 CPU errata: 17638@itemize @minus 17639@item 17640A double-word or a variable shift may give an incorrect result if executed 17641immediately after starting an integer division. 17642@item 17643A double-word or a variable shift may give an incorrect result if executed 17644while an integer multiplication is in progress. 17645@item 17646An integer division may give an incorrect result if started in a delay slot 17647of a taken branch or a jump. 17648@end itemize 17649 17650@item -mfix-r4400 17651@itemx -mno-fix-r4400 17652@opindex mfix-r4400 17653@opindex mno-fix-r4400 17654Work around certain R4400 CPU errata: 17655@itemize @minus 17656@item 17657A double-word or a variable shift may give an incorrect result if executed 17658immediately after starting an integer division. 17659@end itemize 17660 17661@item -mfix-r10000 17662@itemx -mno-fix-r10000 17663@opindex mfix-r10000 17664@opindex mno-fix-r10000 17665Work around certain R10000 errata: 17666@itemize @minus 17667@item 17668@code{ll}/@code{sc} sequences may not behave atomically on revisions 17669prior to 3.0. They may deadlock on revisions 2.6 and earlier. 17670@end itemize 17671 17672This option can only be used if the target architecture supports 17673branch-likely instructions. @option{-mfix-r10000} is the default when 17674@option{-march=r10000} is used; @option{-mno-fix-r10000} is the default 17675otherwise. 17676 17677@item -mfix-rm7000 17678@itemx -mno-fix-rm7000 17679@opindex mfix-rm7000 17680Work around the RM7000 @code{dmult}/@code{dmultu} errata. The 17681workarounds are implemented by the assembler rather than by GCC@. 17682 17683@item -mfix-vr4120 17684@itemx -mno-fix-vr4120 17685@opindex mfix-vr4120 17686Work around certain VR4120 errata: 17687@itemize @minus 17688@item 17689@code{dmultu} does not always produce the correct result. 17690@item 17691@code{div} and @code{ddiv} do not always produce the correct result if one 17692of the operands is negative. 17693@end itemize 17694The workarounds for the division errata rely on special functions in 17695@file{libgcc.a}. At present, these functions are only provided by 17696the @code{mips64vr*-elf} configurations. 17697 17698Other VR4120 errata require a NOP to be inserted between certain pairs of 17699instructions. These errata are handled by the assembler, not by GCC itself. 17700 17701@item -mfix-vr4130 17702@opindex mfix-vr4130 17703Work around the VR4130 @code{mflo}/@code{mfhi} errata. The 17704workarounds are implemented by the assembler rather than by GCC, 17705although GCC avoids using @code{mflo} and @code{mfhi} if the 17706VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi} 17707instructions are available instead. 17708 17709@item -mfix-sb1 17710@itemx -mno-fix-sb1 17711@opindex mfix-sb1 17712Work around certain SB-1 CPU core errata. 17713(This flag currently works around the SB-1 revision 2 17714``F1'' and ``F2'' floating-point errata.) 17715 17716@item -mr10k-cache-barrier=@var{setting} 17717@opindex mr10k-cache-barrier 17718Specify whether GCC should insert cache barriers to avoid the 17719side-effects of speculation on R10K processors. 17720 17721In common with many processors, the R10K tries to predict the outcome 17722of a conditional branch and speculatively executes instructions from 17723the ``taken'' branch. It later aborts these instructions if the 17724predicted outcome is wrong. However, on the R10K, even aborted 17725instructions can have side effects. 17726 17727This problem only affects kernel stores and, depending on the system, 17728kernel loads. As an example, a speculatively-executed store may load 17729the target memory into cache and mark the cache line as dirty, even if 17730the store itself is later aborted. If a DMA operation writes to the 17731same area of memory before the ``dirty'' line is flushed, the cached 17732data overwrites the DMA-ed data. See the R10K processor manual 17733for a full description, including other potential problems. 17734 17735One workaround is to insert cache barrier instructions before every memory 17736access that might be speculatively executed and that might have side 17737effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}} 17738controls GCC's implementation of this workaround. It assumes that 17739aborted accesses to any byte in the following regions does not have 17740side effects: 17741 17742@enumerate 17743@item 17744the memory occupied by the current function's stack frame; 17745 17746@item 17747the memory occupied by an incoming stack argument; 17748 17749@item 17750the memory occupied by an object with a link-time-constant address. 17751@end enumerate 17752 17753It is the kernel's responsibility to ensure that speculative 17754accesses to these regions are indeed safe. 17755 17756If the input program contains a function declaration such as: 17757 17758@smallexample 17759void foo (void); 17760@end smallexample 17761 17762then the implementation of @code{foo} must allow @code{j foo} and 17763@code{jal foo} to be executed speculatively. GCC honors this 17764restriction for functions it compiles itself. It expects non-GCC 17765functions (such as hand-written assembly code) to do the same. 17766 17767The option has three forms: 17768 17769@table @gcctabopt 17770@item -mr10k-cache-barrier=load-store 17771Insert a cache barrier before a load or store that might be 17772speculatively executed and that might have side effects even 17773if aborted. 17774 17775@item -mr10k-cache-barrier=store 17776Insert a cache barrier before a store that might be speculatively 17777executed and that might have side effects even if aborted. 17778 17779@item -mr10k-cache-barrier=none 17780Disable the insertion of cache barriers. This is the default setting. 17781@end table 17782 17783@item -mflush-func=@var{func} 17784@itemx -mno-flush-func 17785@opindex mflush-func 17786Specifies the function to call to flush the I and D caches, or to not 17787call any such function. If called, the function must take the same 17788arguments as the common @code{_flush_func}, that is, the address of the 17789memory range for which the cache is being flushed, the size of the 17790memory range, and the number 3 (to flush both caches). The default 17791depends on the target GCC was configured for, but commonly is either 17792@code{_flush_func} or @code{__cpu_flush}. 17793 17794@item mbranch-cost=@var{num} 17795@opindex mbranch-cost 17796Set the cost of branches to roughly @var{num} ``simple'' instructions. 17797This cost is only a heuristic and is not guaranteed to produce 17798consistent results across releases. A zero cost redundantly selects 17799the default, which is based on the @option{-mtune} setting. 17800 17801@item -mbranch-likely 17802@itemx -mno-branch-likely 17803@opindex mbranch-likely 17804@opindex mno-branch-likely 17805Enable or disable use of Branch Likely instructions, regardless of the 17806default for the selected architecture. By default, Branch Likely 17807instructions may be generated if they are supported by the selected 17808architecture. An exception is for the MIPS32 and MIPS64 architectures 17809and processors that implement those architectures; for those, Branch 17810Likely instructions are not be generated by default because the MIPS32 17811and MIPS64 architectures specifically deprecate their use. 17812 17813@item -mfp-exceptions 17814@itemx -mno-fp-exceptions 17815@opindex mfp-exceptions 17816Specifies whether FP exceptions are enabled. This affects how 17817FP instructions are scheduled for some processors. 17818The default is that FP exceptions are 17819enabled. 17820 17821For instance, on the SB-1, if FP exceptions are disabled, and we are emitting 1782264-bit code, then we can use both FP pipes. Otherwise, we can only use one 17823FP pipe. 17824 17825@item -mvr4130-align 17826@itemx -mno-vr4130-align 17827@opindex mvr4130-align 17828The VR4130 pipeline is two-way superscalar, but can only issue two 17829instructions together if the first one is 8-byte aligned. When this 17830option is enabled, GCC aligns pairs of instructions that it 17831thinks should execute in parallel. 17832 17833This option only has an effect when optimizing for the VR4130. 17834It normally makes code faster, but at the expense of making it bigger. 17835It is enabled by default at optimization level @option{-O3}. 17836 17837@item -msynci 17838@itemx -mno-synci 17839@opindex msynci 17840Enable (disable) generation of @code{synci} instructions on 17841architectures that support it. The @code{synci} instructions (if 17842enabled) are generated when @code{__builtin___clear_cache} is 17843compiled. 17844 17845This option defaults to @option{-mno-synci}, but the default can be 17846overridden by configuring GCC with @option{--with-synci}. 17847 17848When compiling code for single processor systems, it is generally safe 17849to use @code{synci}. However, on many multi-core (SMP) systems, it 17850does not invalidate the instruction caches on all cores and may lead 17851to undefined behavior. 17852 17853@item -mrelax-pic-calls 17854@itemx -mno-relax-pic-calls 17855@opindex mrelax-pic-calls 17856Try to turn PIC calls that are normally dispatched via register 17857@code{$25} into direct calls. This is only possible if the linker can 17858resolve the destination at link-time and if the destination is within 17859range for a direct call. 17860 17861@option{-mrelax-pic-calls} is the default if GCC was configured to use 17862an assembler and a linker that support the @code{.reloc} assembly 17863directive and @option{-mexplicit-relocs} is in effect. With 17864@option{-mno-explicit-relocs}, this optimization can be performed by the 17865assembler and the linker alone without help from the compiler. 17866 17867@item -mmcount-ra-address 17868@itemx -mno-mcount-ra-address 17869@opindex mmcount-ra-address 17870@opindex mno-mcount-ra-address 17871Emit (do not emit) code that allows @code{_mcount} to modify the 17872calling function's return address. When enabled, this option extends 17873the usual @code{_mcount} interface with a new @var{ra-address} 17874parameter, which has type @code{intptr_t *} and is passed in register 17875@code{$12}. @code{_mcount} can then modify the return address by 17876doing both of the following: 17877@itemize 17878@item 17879Returning the new address in register @code{$31}. 17880@item 17881Storing the new address in @code{*@var{ra-address}}, 17882if @var{ra-address} is nonnull. 17883@end itemize 17884 17885The default is @option{-mno-mcount-ra-address}. 17886 17887@end table 17888 17889@node MMIX Options 17890@subsection MMIX Options 17891@cindex MMIX Options 17892 17893These options are defined for the MMIX: 17894 17895@table @gcctabopt 17896@item -mlibfuncs 17897@itemx -mno-libfuncs 17898@opindex mlibfuncs 17899@opindex mno-libfuncs 17900Specify that intrinsic library functions are being compiled, passing all 17901values in registers, no matter the size. 17902 17903@item -mepsilon 17904@itemx -mno-epsilon 17905@opindex mepsilon 17906@opindex mno-epsilon 17907Generate floating-point comparison instructions that compare with respect 17908to the @code{rE} epsilon register. 17909 17910@item -mabi=mmixware 17911@itemx -mabi=gnu 17912@opindex mabi=mmixware 17913@opindex mabi=gnu 17914Generate code that passes function parameters and return values that (in 17915the called function) are seen as registers @code{$0} and up, as opposed to 17916the GNU ABI which uses global registers @code{$231} and up. 17917 17918@item -mzero-extend 17919@itemx -mno-zero-extend 17920@opindex mzero-extend 17921@opindex mno-zero-extend 17922When reading data from memory in sizes shorter than 64 bits, use (do not 17923use) zero-extending load instructions by default, rather than 17924sign-extending ones. 17925 17926@item -mknuthdiv 17927@itemx -mno-knuthdiv 17928@opindex mknuthdiv 17929@opindex mno-knuthdiv 17930Make the result of a division yielding a remainder have the same sign as 17931the divisor. With the default, @option{-mno-knuthdiv}, the sign of the 17932remainder follows the sign of the dividend. Both methods are 17933arithmetically valid, the latter being almost exclusively used. 17934 17935@item -mtoplevel-symbols 17936@itemx -mno-toplevel-symbols 17937@opindex mtoplevel-symbols 17938@opindex mno-toplevel-symbols 17939Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly 17940code can be used with the @code{PREFIX} assembly directive. 17941 17942@item -melf 17943@opindex melf 17944Generate an executable in the ELF format, rather than the default 17945@samp{mmo} format used by the @command{mmix} simulator. 17946 17947@item -mbranch-predict 17948@itemx -mno-branch-predict 17949@opindex mbranch-predict 17950@opindex mno-branch-predict 17951Use (do not use) the probable-branch instructions, when static branch 17952prediction indicates a probable branch. 17953 17954@item -mbase-addresses 17955@itemx -mno-base-addresses 17956@opindex mbase-addresses 17957@opindex mno-base-addresses 17958Generate (do not generate) code that uses @emph{base addresses}. Using a 17959base address automatically generates a request (handled by the assembler 17960and the linker) for a constant to be set up in a global register. The 17961register is used for one or more base address requests within the range 0 17962to 255 from the value held in the register. The generally leads to short 17963and fast code, but the number of different data items that can be 17964addressed is limited. This means that a program that uses lots of static 17965data may require @option{-mno-base-addresses}. 17966 17967@item -msingle-exit 17968@itemx -mno-single-exit 17969@opindex msingle-exit 17970@opindex mno-single-exit 17971Force (do not force) generated code to have a single exit point in each 17972function. 17973@end table 17974 17975@node MN10300 Options 17976@subsection MN10300 Options 17977@cindex MN10300 options 17978 17979These @option{-m} options are defined for Matsushita MN10300 architectures: 17980 17981@table @gcctabopt 17982@item -mmult-bug 17983@opindex mmult-bug 17984Generate code to avoid bugs in the multiply instructions for the MN10300 17985processors. This is the default. 17986 17987@item -mno-mult-bug 17988@opindex mno-mult-bug 17989Do not generate code to avoid bugs in the multiply instructions for the 17990MN10300 processors. 17991 17992@item -mam33 17993@opindex mam33 17994Generate code using features specific to the AM33 processor. 17995 17996@item -mno-am33 17997@opindex mno-am33 17998Do not generate code using features specific to the AM33 processor. This 17999is the default. 18000 18001@item -mam33-2 18002@opindex mam33-2 18003Generate code using features specific to the AM33/2.0 processor. 18004 18005@item -mam34 18006@opindex mam34 18007Generate code using features specific to the AM34 processor. 18008 18009@item -mtune=@var{cpu-type} 18010@opindex mtune 18011Use the timing characteristics of the indicated CPU type when 18012scheduling instructions. This does not change the targeted processor 18013type. The CPU type must be one of @samp{mn10300}, @samp{am33}, 18014@samp{am33-2} or @samp{am34}. 18015 18016@item -mreturn-pointer-on-d0 18017@opindex mreturn-pointer-on-d0 18018When generating a function that returns a pointer, return the pointer 18019in both @code{a0} and @code{d0}. Otherwise, the pointer is returned 18020only in @code{a0}, and attempts to call such functions without a prototype 18021result in errors. Note that this option is on by default; use 18022@option{-mno-return-pointer-on-d0} to disable it. 18023 18024@item -mno-crt0 18025@opindex mno-crt0 18026Do not link in the C run-time initialization object file. 18027 18028@item -mrelax 18029@opindex mrelax 18030Indicate to the linker that it should perform a relaxation optimization pass 18031to shorten branches, calls and absolute memory addresses. This option only 18032has an effect when used on the command line for the final link step. 18033 18034This option makes symbolic debugging impossible. 18035 18036@item -mliw 18037@opindex mliw 18038Allow the compiler to generate @emph{Long Instruction Word} 18039instructions if the target is the @samp{AM33} or later. This is the 18040default. This option defines the preprocessor macro @code{__LIW__}. 18041 18042@item -mnoliw 18043@opindex mnoliw 18044Do not allow the compiler to generate @emph{Long Instruction Word} 18045instructions. This option defines the preprocessor macro 18046@code{__NO_LIW__}. 18047 18048@item -msetlb 18049@opindex msetlb 18050Allow the compiler to generate the @emph{SETLB} and @emph{Lcc} 18051instructions if the target is the @samp{AM33} or later. This is the 18052default. This option defines the preprocessor macro @code{__SETLB__}. 18053 18054@item -mnosetlb 18055@opindex mnosetlb 18056Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc} 18057instructions. This option defines the preprocessor macro 18058@code{__NO_SETLB__}. 18059 18060@end table 18061 18062@node Moxie Options 18063@subsection Moxie Options 18064@cindex Moxie Options 18065 18066@table @gcctabopt 18067 18068@item -meb 18069@opindex meb 18070Generate big-endian code. This is the default for @samp{moxie-*-*} 18071configurations. 18072 18073@item -mel 18074@opindex mel 18075Generate little-endian code. 18076 18077@item -mmul.x 18078@opindex mmul.x 18079Generate mul.x and umul.x instructions. This is the default for 18080@samp{moxiebox-*-*} configurations. 18081 18082@item -mno-crt0 18083@opindex mno-crt0 18084Do not link in the C run-time initialization object file. 18085 18086@end table 18087 18088@node MSP430 Options 18089@subsection MSP430 Options 18090@cindex MSP430 Options 18091 18092These options are defined for the MSP430: 18093 18094@table @gcctabopt 18095 18096@item -masm-hex 18097@opindex masm-hex 18098Force assembly output to always use hex constants. Normally such 18099constants are signed decimals, but this option is available for 18100testsuite and/or aesthetic purposes. 18101 18102@item -mmcu= 18103@opindex mmcu= 18104Select the MCU to target. This is used to create a C preprocessor 18105symbol based upon the MCU name, converted to upper case and pre- and 18106post-fixed with @samp{__}. This in turn is used by the 18107@file{msp430.h} header file to select an MCU-specific supplementary 18108header file. 18109 18110The option also sets the ISA to use. If the MCU name is one that is 18111known to only support the 430 ISA then that is selected, otherwise the 18112430X ISA is selected. A generic MCU name of @samp{msp430} can also be 18113used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU 18114name selects the 430X ISA. 18115 18116In addition an MCU-specific linker script is added to the linker 18117command line. The script's name is the name of the MCU with 18118@file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc} 18119command line defines the C preprocessor symbol @code{__XXX__} and 18120cause the linker to search for a script called @file{xxx.ld}. 18121 18122This option is also passed on to the assembler. 18123 18124@item -mcpu= 18125@opindex mcpu= 18126Specifies the ISA to use. Accepted values are @samp{msp430}, 18127@samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The 18128@option{-mmcu=} option should be used to select the ISA. 18129 18130@item -msim 18131@opindex msim 18132Link to the simulator runtime libraries and linker script. Overrides 18133any scripts that would be selected by the @option{-mmcu=} option. 18134 18135@item -mlarge 18136@opindex mlarge 18137Use large-model addressing (20-bit pointers, 32-bit @code{size_t}). 18138 18139@item -msmall 18140@opindex msmall 18141Use small-model addressing (16-bit pointers, 16-bit @code{size_t}). 18142 18143@item -mrelax 18144@opindex mrelax 18145This option is passed to the assembler and linker, and allows the 18146linker to perform certain optimizations that cannot be done until 18147the final link. 18148 18149@item mhwmult= 18150@opindex mhwmult= 18151Describes the type of hardware multiply supported by the target. 18152Accepted values are @samp{none} for no hardware multiply, @samp{16bit} 18153for the original 16-bit-only multiply supported by early MCUs. 18154@samp{32bit} for the 16/32-bit multiply supported by later MCUs and 18155@samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs. 18156A value of @samp{auto} can also be given. This tells GCC to deduce 18157the hardware multiply support based upon the MCU name provided by the 18158@option{-mmcu} option. If no @option{-mmcu} option is specified then 18159@samp{32bit} hardware multiply support is assumed. @samp{auto} is the 18160default setting. 18161 18162Hardware multiplies are normally performed by calling a library 18163routine. This saves space in the generated code. When compiling at 18164@option{-O3} or higher however the hardware multiplier is invoked 18165inline. This makes for bigger, but faster code. 18166 18167The hardware multiply routines disable interrupts whilst running and 18168restore the previous interrupt state when they finish. This makes 18169them safe to use inside interrupt handlers as well as in normal code. 18170 18171@item -minrt 18172@opindex minrt 18173Enable the use of a minimum runtime environment - no static 18174initializers or constructors. This is intended for memory-constrained 18175devices. The compiler includes special symbols in some objects 18176that tell the linker and runtime which code fragments are required. 18177 18178@end table 18179 18180@node NDS32 Options 18181@subsection NDS32 Options 18182@cindex NDS32 Options 18183 18184These options are defined for NDS32 implementations: 18185 18186@table @gcctabopt 18187 18188@item -mbig-endian 18189@opindex mbig-endian 18190Generate code in big-endian mode. 18191 18192@item -mlittle-endian 18193@opindex mlittle-endian 18194Generate code in little-endian mode. 18195 18196@item -mreduced-regs 18197@opindex mreduced-regs 18198Use reduced-set registers for register allocation. 18199 18200@item -mfull-regs 18201@opindex mfull-regs 18202Use full-set registers for register allocation. 18203 18204@item -mcmov 18205@opindex mcmov 18206Generate conditional move instructions. 18207 18208@item -mno-cmov 18209@opindex mno-cmov 18210Do not generate conditional move instructions. 18211 18212@item -mperf-ext 18213@opindex mperf-ext 18214Generate performance extension instructions. 18215 18216@item -mno-perf-ext 18217@opindex mno-perf-ext 18218Do not generate performance extension instructions. 18219 18220@item -mv3push 18221@opindex mv3push 18222Generate v3 push25/pop25 instructions. 18223 18224@item -mno-v3push 18225@opindex mno-v3push 18226Do not generate v3 push25/pop25 instructions. 18227 18228@item -m16-bit 18229@opindex m16-bit 18230Generate 16-bit instructions. 18231 18232@item -mno-16-bit 18233@opindex mno-16-bit 18234Do not generate 16-bit instructions. 18235 18236@item -misr-vector-size=@var{num} 18237@opindex misr-vector-size 18238Specify the size of each interrupt vector, which must be 4 or 16. 18239 18240@item -mcache-block-size=@var{num} 18241@opindex mcache-block-size 18242Specify the size of each cache block, 18243which must be a power of 2 between 4 and 512. 18244 18245@item -march=@var{arch} 18246@opindex march 18247Specify the name of the target architecture. 18248 18249@item -mcmodel=@var{code-model} 18250@opindex mcmodel 18251Set the code model to one of 18252@table @asis 18253@item @samp{small} 18254All the data and read-only data segments must be within 512KB addressing space. 18255The text segment must be within 16MB addressing space. 18256@item @samp{medium} 18257The data segment must be within 512KB while the read-only data segment can be 18258within 4GB addressing space. The text segment should be still within 16MB 18259addressing space. 18260@item @samp{large} 18261All the text and data segments can be within 4GB addressing space. 18262@end table 18263 18264@item -mctor-dtor 18265@opindex mctor-dtor 18266Enable constructor/destructor feature. 18267 18268@item -mrelax 18269@opindex mrelax 18270Guide linker to relax instructions. 18271 18272@end table 18273 18274@node Nios II Options 18275@subsection Nios II Options 18276@cindex Nios II options 18277@cindex Altera Nios II options 18278 18279These are the options defined for the Altera Nios II processor. 18280 18281@table @gcctabopt 18282 18283@item -G @var{num} 18284@opindex G 18285@cindex smaller data references 18286Put global and static objects less than or equal to @var{num} bytes 18287into the small data or BSS sections instead of the normal data or BSS 18288sections. The default value of @var{num} is 8. 18289 18290@item -mgpopt=@var{option} 18291@item -mgpopt 18292@itemx -mno-gpopt 18293@opindex mgpopt 18294@opindex mno-gpopt 18295Generate (do not generate) GP-relative accesses. The following 18296@var{option} names are recognized: 18297 18298@table @samp 18299 18300@item none 18301Do not generate GP-relative accesses. 18302 18303@item local 18304Generate GP-relative accesses for small data objects that are not 18305external or weak. Also use GP-relative addressing for objects that 18306have been explicitly placed in a small data section via a @code{section} 18307attribute. 18308 18309@item global 18310As for @samp{local}, but also generate GP-relative accesses for 18311small data objects that are external or weak. If you use this option, 18312you must ensure that all parts of your program (including libraries) are 18313compiled with the same @option{-G} setting. 18314 18315@item data 18316Generate GP-relative accesses for all data objects in the program. If you 18317use this option, the entire data and BSS segments 18318of your program must fit in 64K of memory and you must use an appropriate 18319linker script to allocate them within the addressible range of the 18320global pointer. 18321 18322@item all 18323Generate GP-relative addresses for function pointers as well as data 18324pointers. If you use this option, the entire text, data, and BSS segments 18325of your program must fit in 64K of memory and you must use an appropriate 18326linker script to allocate them within the addressible range of the 18327global pointer. 18328 18329@end table 18330 18331@option{-mgpopt} is equivalent to @option{-mgpopt=local}, and 18332@option{-mno-gpopt} is equivalent to @option{-mgpopt=none}. 18333 18334The default is @option{-mgpopt} except when @option{-fpic} or 18335@option{-fPIC} is specified to generate position-independent code. 18336Note that the Nios II ABI does not permit GP-relative accesses from 18337shared libraries. 18338 18339You may need to specify @option{-mno-gpopt} explicitly when building 18340programs that include large amounts of small data, including large 18341GOT data sections. In this case, the 16-bit offset for GP-relative 18342addressing may not be large enough to allow access to the entire 18343small data section. 18344 18345@item -mel 18346@itemx -meb 18347@opindex mel 18348@opindex meb 18349Generate little-endian (default) or big-endian (experimental) code, 18350respectively. 18351 18352@item -mbypass-cache 18353@itemx -mno-bypass-cache 18354@opindex mno-bypass-cache 18355@opindex mbypass-cache 18356Force all load and store instructions to always bypass cache by 18357using I/O variants of the instructions. The default is not to 18358bypass the cache. 18359 18360@item -mno-cache-volatile 18361@itemx -mcache-volatile 18362@opindex mcache-volatile 18363@opindex mno-cache-volatile 18364Volatile memory access bypass the cache using the I/O variants of 18365the load and store instructions. The default is not to bypass the cache. 18366 18367@item -mno-fast-sw-div 18368@itemx -mfast-sw-div 18369@opindex mno-fast-sw-div 18370@opindex mfast-sw-div 18371Do not use table-based fast divide for small numbers. The default 18372is to use the fast divide at @option{-O3} and above. 18373 18374@item -mno-hw-mul 18375@itemx -mhw-mul 18376@itemx -mno-hw-mulx 18377@itemx -mhw-mulx 18378@itemx -mno-hw-div 18379@itemx -mhw-div 18380@opindex mno-hw-mul 18381@opindex mhw-mul 18382@opindex mno-hw-mulx 18383@opindex mhw-mulx 18384@opindex mno-hw-div 18385@opindex mhw-div 18386Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of 18387instructions by the compiler. The default is to emit @code{mul} 18388and not emit @code{div} and @code{mulx}. 18389 18390@item -mcustom-@var{insn}=@var{N} 18391@itemx -mno-custom-@var{insn} 18392@opindex mcustom-@var{insn} 18393@opindex mno-custom-@var{insn} 18394Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a 18395custom instruction with encoding @var{N} when generating code that uses 18396@var{insn}. For example, @option{-mcustom-fadds=253} generates custom 18397instruction 253 for single-precision floating-point add operations instead 18398of the default behavior of using a library call. 18399 18400The following values of @var{insn} are supported. Except as otherwise 18401noted, floating-point operations are expected to be implemented with 18402normal IEEE 754 semantics and correspond directly to the C operators or the 18403equivalent GCC built-in functions (@pxref{Other Builtins}). 18404 18405Single-precision floating point: 18406@table @asis 18407 18408@item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls} 18409Binary arithmetic operations. 18410 18411@item @samp{fnegs} 18412Unary negation. 18413 18414@item @samp{fabss} 18415Unary absolute value. 18416 18417@item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes} 18418Comparison operations. 18419 18420@item @samp{fmins}, @samp{fmaxs} 18421Floating-point minimum and maximum. These instructions are only 18422generated if @option{-ffinite-math-only} is specified. 18423 18424@item @samp{fsqrts} 18425Unary square root operation. 18426 18427@item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs} 18428Floating-point trigonometric and exponential functions. These instructions 18429are only generated if @option{-funsafe-math-optimizations} is also specified. 18430 18431@end table 18432 18433Double-precision floating point: 18434@table @asis 18435 18436@item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld} 18437Binary arithmetic operations. 18438 18439@item @samp{fnegd} 18440Unary negation. 18441 18442@item @samp{fabsd} 18443Unary absolute value. 18444 18445@item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned} 18446Comparison operations. 18447 18448@item @samp{fmind}, @samp{fmaxd} 18449Double-precision minimum and maximum. These instructions are only 18450generated if @option{-ffinite-math-only} is specified. 18451 18452@item @samp{fsqrtd} 18453Unary square root operation. 18454 18455@item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd} 18456Double-precision trigonometric and exponential functions. These instructions 18457are only generated if @option{-funsafe-math-optimizations} is also specified. 18458 18459@end table 18460 18461Conversions: 18462@table @asis 18463@item @samp{fextsd} 18464Conversion from single precision to double precision. 18465 18466@item @samp{ftruncds} 18467Conversion from double precision to single precision. 18468 18469@item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu} 18470Conversion from floating point to signed or unsigned integer types, with 18471truncation towards zero. 18472 18473@item @samp{round} 18474Conversion from single-precision floating point to signed integer, 18475rounding to the nearest integer and ties away from zero. 18476This corresponds to the @code{__builtin_lroundf} function when 18477@option{-fno-math-errno} is used. 18478 18479@item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud} 18480Conversion from signed or unsigned integer types to floating-point types. 18481 18482@end table 18483 18484In addition, all of the following transfer instructions for internal 18485registers X and Y must be provided to use any of the double-precision 18486floating-point instructions. Custom instructions taking two 18487double-precision source operands expect the first operand in the 1848864-bit register X. The other operand (or only operand of a unary 18489operation) is given to the custom arithmetic instruction with the 18490least significant half in source register @var{src1} and the most 18491significant half in @var{src2}. A custom instruction that returns a 18492double-precision result returns the most significant 32 bits in the 18493destination register and the other half in 32-bit register Y. 18494GCC automatically generates the necessary code sequences to write 18495register X and/or read register Y when double-precision floating-point 18496instructions are used. 18497 18498@table @asis 18499 18500@item @samp{fwrx} 18501Write @var{src1} into the least significant half of X and @var{src2} into 18502the most significant half of X. 18503 18504@item @samp{fwry} 18505Write @var{src1} into Y. 18506 18507@item @samp{frdxhi}, @samp{frdxlo} 18508Read the most or least (respectively) significant half of X and store it in 18509@var{dest}. 18510 18511@item @samp{frdy} 18512Read the value of Y and store it into @var{dest}. 18513@end table 18514 18515Note that you can gain more local control over generation of Nios II custom 18516instructions by using the @code{target("custom-@var{insn}=@var{N}")} 18517and @code{target("no-custom-@var{insn}")} function attributes 18518(@pxref{Function Attributes}) 18519or pragmas (@pxref{Function Specific Option Pragmas}). 18520 18521@item -mcustom-fpu-cfg=@var{name} 18522@opindex mcustom-fpu-cfg 18523 18524This option enables a predefined, named set of custom instruction encodings 18525(see @option{-mcustom-@var{insn}} above). 18526Currently, the following sets are defined: 18527 18528@option{-mcustom-fpu-cfg=60-1} is equivalent to: 18529@gccoptlist{-mcustom-fmuls=252 @gol 18530-mcustom-fadds=253 @gol 18531-mcustom-fsubs=254 @gol 18532-fsingle-precision-constant} 18533 18534@option{-mcustom-fpu-cfg=60-2} is equivalent to: 18535@gccoptlist{-mcustom-fmuls=252 @gol 18536-mcustom-fadds=253 @gol 18537-mcustom-fsubs=254 @gol 18538-mcustom-fdivs=255 @gol 18539-fsingle-precision-constant} 18540 18541@option{-mcustom-fpu-cfg=72-3} is equivalent to: 18542@gccoptlist{-mcustom-floatus=243 @gol 18543-mcustom-fixsi=244 @gol 18544-mcustom-floatis=245 @gol 18545-mcustom-fcmpgts=246 @gol 18546-mcustom-fcmples=249 @gol 18547-mcustom-fcmpeqs=250 @gol 18548-mcustom-fcmpnes=251 @gol 18549-mcustom-fmuls=252 @gol 18550-mcustom-fadds=253 @gol 18551-mcustom-fsubs=254 @gol 18552-mcustom-fdivs=255 @gol 18553-fsingle-precision-constant} 18554 18555Custom instruction assignments given by individual 18556@option{-mcustom-@var{insn}=} options override those given by 18557@option{-mcustom-fpu-cfg=}, regardless of the 18558order of the options on the command line. 18559 18560Note that you can gain more local control over selection of a FPU 18561configuration by using the @code{target("custom-fpu-cfg=@var{name}")} 18562function attribute (@pxref{Function Attributes}) 18563or pragma (@pxref{Function Specific Option Pragmas}). 18564 18565@end table 18566 18567These additional @samp{-m} options are available for the Altera Nios II 18568ELF (bare-metal) target: 18569 18570@table @gcctabopt 18571 18572@item -mhal 18573@opindex mhal 18574Link with HAL BSP. This suppresses linking with the GCC-provided C runtime 18575startup and termination code, and is typically used in conjunction with 18576@option{-msys-crt0=} to specify the location of the alternate startup code 18577provided by the HAL BSP. 18578 18579@item -msmallc 18580@opindex msmallc 18581Link with a limited version of the C library, @option{-lsmallc}, rather than 18582Newlib. 18583 18584@item -msys-crt0=@var{startfile} 18585@opindex msys-crt0 18586@var{startfile} is the file name of the startfile (crt0) to use 18587when linking. This option is only useful in conjunction with @option{-mhal}. 18588 18589@item -msys-lib=@var{systemlib} 18590@opindex msys-lib 18591@var{systemlib} is the library name of the library that provides 18592low-level system calls required by the C library, 18593e.g. @code{read} and @code{write}. 18594This option is typically used to link with a library provided by a HAL BSP. 18595 18596@end table 18597 18598@node Nvidia PTX Options 18599@subsection Nvidia PTX Options 18600@cindex Nvidia PTX options 18601@cindex nvptx options 18602 18603These options are defined for Nvidia PTX: 18604 18605@table @gcctabopt 18606 18607@item -m32 18608@itemx -m64 18609@opindex m32 18610@opindex m64 18611Generate code for 32-bit or 64-bit ABI. 18612 18613@item -mmainkernel 18614@opindex mmainkernel 18615Link in code for a __main kernel. This is for stand-alone instead of 18616offloading execution. 18617 18618@end table 18619 18620@node PDP-11 Options 18621@subsection PDP-11 Options 18622@cindex PDP-11 Options 18623 18624These options are defined for the PDP-11: 18625 18626@table @gcctabopt 18627@item -mfpu 18628@opindex mfpu 18629Use hardware FPP floating point. This is the default. (FIS floating 18630point on the PDP-11/40 is not supported.) 18631 18632@item -msoft-float 18633@opindex msoft-float 18634Do not use hardware floating point. 18635 18636@item -mac0 18637@opindex mac0 18638Return floating-point results in ac0 (fr0 in Unix assembler syntax). 18639 18640@item -mno-ac0 18641@opindex mno-ac0 18642Return floating-point results in memory. This is the default. 18643 18644@item -m40 18645@opindex m40 18646Generate code for a PDP-11/40. 18647 18648@item -m45 18649@opindex m45 18650Generate code for a PDP-11/45. This is the default. 18651 18652@item -m10 18653@opindex m10 18654Generate code for a PDP-11/10. 18655 18656@item -mbcopy-builtin 18657@opindex mbcopy-builtin 18658Use inline @code{movmemhi} patterns for copying memory. This is the 18659default. 18660 18661@item -mbcopy 18662@opindex mbcopy 18663Do not use inline @code{movmemhi} patterns for copying memory. 18664 18665@item -mint16 18666@itemx -mno-int32 18667@opindex mint16 18668@opindex mno-int32 18669Use 16-bit @code{int}. This is the default. 18670 18671@item -mint32 18672@itemx -mno-int16 18673@opindex mint32 18674@opindex mno-int16 18675Use 32-bit @code{int}. 18676 18677@item -mfloat64 18678@itemx -mno-float32 18679@opindex mfloat64 18680@opindex mno-float32 18681Use 64-bit @code{float}. This is the default. 18682 18683@item -mfloat32 18684@itemx -mno-float64 18685@opindex mfloat32 18686@opindex mno-float64 18687Use 32-bit @code{float}. 18688 18689@item -mabshi 18690@opindex mabshi 18691Use @code{abshi2} pattern. This is the default. 18692 18693@item -mno-abshi 18694@opindex mno-abshi 18695Do not use @code{abshi2} pattern. 18696 18697@item -mbranch-expensive 18698@opindex mbranch-expensive 18699Pretend that branches are expensive. This is for experimenting with 18700code generation only. 18701 18702@item -mbranch-cheap 18703@opindex mbranch-cheap 18704Do not pretend that branches are expensive. This is the default. 18705 18706@item -munix-asm 18707@opindex munix-asm 18708Use Unix assembler syntax. This is the default when configured for 18709@samp{pdp11-*-bsd}. 18710 18711@item -mdec-asm 18712@opindex mdec-asm 18713Use DEC assembler syntax. This is the default when configured for any 18714PDP-11 target other than @samp{pdp11-*-bsd}. 18715@end table 18716 18717@node picoChip Options 18718@subsection picoChip Options 18719@cindex picoChip options 18720 18721These @samp{-m} options are defined for picoChip implementations: 18722 18723@table @gcctabopt 18724 18725@item -mae=@var{ae_type} 18726@opindex mcpu 18727Set the instruction set, register set, and instruction scheduling 18728parameters for array element type @var{ae_type}. Supported values 18729for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}. 18730 18731@option{-mae=ANY} selects a completely generic AE type. Code 18732generated with this option runs on any of the other AE types. The 18733code is not as efficient as it would be if compiled for a specific 18734AE type, and some types of operation (e.g., multiplication) do not 18735work properly on all types of AE. 18736 18737@option{-mae=MUL} selects a MUL AE type. This is the most useful AE type 18738for compiled code, and is the default. 18739 18740@option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this 18741option may suffer from poor performance of byte (char) manipulation, 18742since the DSP AE does not provide hardware support for byte load/stores. 18743 18744@item -msymbol-as-address 18745Enable the compiler to directly use a symbol name as an address in a 18746load/store instruction, without first loading it into a 18747register. Typically, the use of this option generates larger 18748programs, which run faster than when the option isn't used. However, the 18749results vary from program to program, so it is left as a user option, 18750rather than being permanently enabled. 18751 18752@item -mno-inefficient-warnings 18753Disables warnings about the generation of inefficient code. These 18754warnings can be generated, for example, when compiling code that 18755performs byte-level memory operations on the MAC AE type. The MAC AE has 18756no hardware support for byte-level memory operations, so all byte 18757load/stores must be synthesized from word load/store operations. This is 18758inefficient and a warning is generated to indicate 18759that you should rewrite the code to avoid byte operations, or to target 18760an AE type that has the necessary hardware support. This option disables 18761these warnings. 18762 18763@end table 18764 18765@node PowerPC Options 18766@subsection PowerPC Options 18767@cindex PowerPC options 18768 18769These are listed under @xref{RS/6000 and PowerPC Options}. 18770 18771@node RL78 Options 18772@subsection RL78 Options 18773@cindex RL78 Options 18774 18775@table @gcctabopt 18776 18777@item -msim 18778@opindex msim 18779Links in additional target libraries to support operation within a 18780simulator. 18781 18782@item -mmul=none 18783@itemx -mmul=g13 18784@itemx -mmul=rl78 18785@opindex mmul 18786Specifies the type of hardware multiplication support to be used. The 18787default is @samp{none}, which uses software multiplication functions. 18788The @samp{g13} option is for the hardware multiply/divide peripheral 18789only on the RL78/G13 targets. The @samp{rl78} option is for the 18790standard hardware multiplication defined in the RL78 software manual. 18791 18792@item -m64bit-doubles 18793@itemx -m32bit-doubles 18794@opindex m64bit-doubles 18795@opindex m32bit-doubles 18796Make the @code{double} data type be 64 bits (@option{-m64bit-doubles}) 18797or 32 bits (@option{-m32bit-doubles}) in size. The default is 18798@option{-m32bit-doubles}. 18799 18800@end table 18801 18802@node RS/6000 and PowerPC Options 18803@subsection IBM RS/6000 and PowerPC Options 18804@cindex RS/6000 and PowerPC Options 18805@cindex IBM RS/6000 and PowerPC Options 18806 18807These @samp{-m} options are defined for the IBM RS/6000 and PowerPC: 18808@table @gcctabopt 18809@item -mpowerpc-gpopt 18810@itemx -mno-powerpc-gpopt 18811@itemx -mpowerpc-gfxopt 18812@itemx -mno-powerpc-gfxopt 18813@need 800 18814@itemx -mpowerpc64 18815@itemx -mno-powerpc64 18816@itemx -mmfcrf 18817@itemx -mno-mfcrf 18818@itemx -mpopcntb 18819@itemx -mno-popcntb 18820@itemx -mpopcntd 18821@itemx -mno-popcntd 18822@itemx -mfprnd 18823@itemx -mno-fprnd 18824@need 800 18825@itemx -mcmpb 18826@itemx -mno-cmpb 18827@itemx -mmfpgpr 18828@itemx -mno-mfpgpr 18829@itemx -mhard-dfp 18830@itemx -mno-hard-dfp 18831@opindex mpowerpc-gpopt 18832@opindex mno-powerpc-gpopt 18833@opindex mpowerpc-gfxopt 18834@opindex mno-powerpc-gfxopt 18835@opindex mpowerpc64 18836@opindex mno-powerpc64 18837@opindex mmfcrf 18838@opindex mno-mfcrf 18839@opindex mpopcntb 18840@opindex mno-popcntb 18841@opindex mpopcntd 18842@opindex mno-popcntd 18843@opindex mfprnd 18844@opindex mno-fprnd 18845@opindex mcmpb 18846@opindex mno-cmpb 18847@opindex mmfpgpr 18848@opindex mno-mfpgpr 18849@opindex mhard-dfp 18850@opindex mno-hard-dfp 18851You use these options to specify which instructions are available on the 18852processor you are using. The default value of these options is 18853determined when configuring GCC@. Specifying the 18854@option{-mcpu=@var{cpu_type}} overrides the specification of these 18855options. We recommend you use the @option{-mcpu=@var{cpu_type}} option 18856rather than the options listed above. 18857 18858Specifying @option{-mpowerpc-gpopt} allows 18859GCC to use the optional PowerPC architecture instructions in the 18860General Purpose group, including floating-point square root. Specifying 18861@option{-mpowerpc-gfxopt} allows GCC to 18862use the optional PowerPC architecture instructions in the Graphics 18863group, including floating-point select. 18864 18865The @option{-mmfcrf} option allows GCC to generate the move from 18866condition register field instruction implemented on the POWER4 18867processor and other processors that support the PowerPC V2.01 18868architecture. 18869The @option{-mpopcntb} option allows GCC to generate the popcount and 18870double-precision FP reciprocal estimate instruction implemented on the 18871POWER5 processor and other processors that support the PowerPC V2.02 18872architecture. 18873The @option{-mpopcntd} option allows GCC to generate the popcount 18874instruction implemented on the POWER7 processor and other processors 18875that support the PowerPC V2.06 architecture. 18876The @option{-mfprnd} option allows GCC to generate the FP round to 18877integer instructions implemented on the POWER5+ processor and other 18878processors that support the PowerPC V2.03 architecture. 18879The @option{-mcmpb} option allows GCC to generate the compare bytes 18880instruction implemented on the POWER6 processor and other processors 18881that support the PowerPC V2.05 architecture. 18882The @option{-mmfpgpr} option allows GCC to generate the FP move to/from 18883general-purpose register instructions implemented on the POWER6X 18884processor and other processors that support the extended PowerPC V2.05 18885architecture. 18886The @option{-mhard-dfp} option allows GCC to generate the decimal 18887floating-point instructions implemented on some POWER processors. 18888 18889The @option{-mpowerpc64} option allows GCC to generate the additional 1889064-bit instructions that are found in the full PowerPC64 architecture 18891and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to 18892@option{-mno-powerpc64}. 18893 18894@item -mcpu=@var{cpu_type} 18895@opindex mcpu 18896Set architecture type, register usage, and 18897instruction scheduling parameters for machine type @var{cpu_type}. 18898Supported values for @var{cpu_type} are @samp{401}, @samp{403}, 18899@samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp}, 18900@samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603}, 18901@samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740}, 18902@samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823}, 18903@samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2}, 18904@samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500}, 18905@samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5}, 18906@samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+}, 18907@samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8}, @samp{powerpc}, 18908@samp{powerpc64}, @samp{powerpc64le}, and @samp{rs64}. 18909 18910@option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and 18911@option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either 18912endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC 18913architecture machine types, with an appropriate, generic processor 18914model assumed for scheduling purposes. 18915 18916The other options specify a specific processor. Code generated under 18917those options runs best on that processor, and may not run at all on 18918others. 18919 18920The @option{-mcpu} options automatically enable or disable the 18921following options: 18922 18923@gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol 18924-mpopcntb -mpopcntd -mpowerpc64 @gol 18925-mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol 18926-msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx @gol 18927-mcrypto -mdirect-move -mhtm -mpower8-fusion -mpower8-vector @gol 18928-mquad-memory -mquad-memory-atomic} 18929 18930The particular options set for any particular CPU varies between 18931compiler versions, depending on what setting seems to produce optimal 18932code for that CPU; it doesn't necessarily reflect the actual hardware's 18933capabilities. If you wish to set an individual option to a particular 18934value, you may specify it after the @option{-mcpu} option, like 18935@option{-mcpu=970 -mno-altivec}. 18936 18937On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are 18938not enabled or disabled by the @option{-mcpu} option at present because 18939AIX does not have full support for these options. You may still 18940enable or disable them individually if you're sure it'll work in your 18941environment. 18942 18943@item -mtune=@var{cpu_type} 18944@opindex mtune 18945Set the instruction scheduling parameters for machine type 18946@var{cpu_type}, but do not set the architecture type or register usage, 18947as @option{-mcpu=@var{cpu_type}} does. The same 18948values for @var{cpu_type} are used for @option{-mtune} as for 18949@option{-mcpu}. If both are specified, the code generated uses the 18950architecture and registers set by @option{-mcpu}, but the 18951scheduling parameters set by @option{-mtune}. 18952 18953@item -mcmodel=small 18954@opindex mcmodel=small 18955Generate PowerPC64 code for the small model: The TOC is limited to 1895664k. 18957 18958@item -mcmodel=medium 18959@opindex mcmodel=medium 18960Generate PowerPC64 code for the medium model: The TOC and other static 18961data may be up to a total of 4G in size. 18962 18963@item -mcmodel=large 18964@opindex mcmodel=large 18965Generate PowerPC64 code for the large model: The TOC may be up to 4G 18966in size. Other data and code is only limited by the 64-bit address 18967space. 18968 18969@item -maltivec 18970@itemx -mno-altivec 18971@opindex maltivec 18972@opindex mno-altivec 18973Generate code that uses (does not use) AltiVec instructions, and also 18974enable the use of built-in functions that allow more direct access to 18975the AltiVec instruction set. You may also need to set 18976@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI 18977enhancements. 18978 18979When @option{-maltivec} is used, rather than @option{-maltivec=le} or 18980@option{-maltivec=be}, the element order for Altivec intrinsics such 18981as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert} 18982match array element order corresponding to the endianness of the 18983target. That is, element zero identifies the leftmost element in a 18984vector register when targeting a big-endian platform, and identifies 18985the rightmost element in a vector register when targeting a 18986little-endian platform. 18987 18988@item -maltivec=be 18989@opindex maltivec=be 18990Generate Altivec instructions using big-endian element order, 18991regardless of whether the target is big- or little-endian. This is 18992the default when targeting a big-endian platform. 18993 18994The element order is used to interpret element numbers in Altivec 18995intrinsics such as @code{vec_splat}, @code{vec_extract}, and 18996@code{vec_insert}. By default, these match array element order 18997corresponding to the endianness for the target. 18998 18999@item -maltivec=le 19000@opindex maltivec=le 19001Generate Altivec instructions using little-endian element order, 19002regardless of whether the target is big- or little-endian. This is 19003the default when targeting a little-endian platform. This option is 19004currently ignored when targeting a big-endian platform. 19005 19006The element order is used to interpret element numbers in Altivec 19007intrinsics such as @code{vec_splat}, @code{vec_extract}, and 19008@code{vec_insert}. By default, these match array element order 19009corresponding to the endianness for the target. 19010 19011@item -mvrsave 19012@itemx -mno-vrsave 19013@opindex mvrsave 19014@opindex mno-vrsave 19015Generate VRSAVE instructions when generating AltiVec code. 19016 19017@item -mgen-cell-microcode 19018@opindex mgen-cell-microcode 19019Generate Cell microcode instructions. 19020 19021@item -mwarn-cell-microcode 19022@opindex mwarn-cell-microcode 19023Warn when a Cell microcode instruction is emitted. An example 19024of a Cell microcode instruction is a variable shift. 19025 19026@item -msecure-plt 19027@opindex msecure-plt 19028Generate code that allows @command{ld} and @command{ld.so} 19029to build executables and shared 19030libraries with non-executable @code{.plt} and @code{.got} sections. 19031This is a PowerPC 1903232-bit SYSV ABI option. 19033 19034@item -mbss-plt 19035@opindex mbss-plt 19036Generate code that uses a BSS @code{.plt} section that @command{ld.so} 19037fills in, and 19038requires @code{.plt} and @code{.got} 19039sections that are both writable and executable. 19040This is a PowerPC 32-bit SYSV ABI option. 19041 19042@item -misel 19043@itemx -mno-isel 19044@opindex misel 19045@opindex mno-isel 19046This switch enables or disables the generation of ISEL instructions. 19047 19048@item -misel=@var{yes/no} 19049This switch has been deprecated. Use @option{-misel} and 19050@option{-mno-isel} instead. 19051 19052@item -mspe 19053@itemx -mno-spe 19054@opindex mspe 19055@opindex mno-spe 19056This switch enables or disables the generation of SPE simd 19057instructions. 19058 19059@item -mpaired 19060@itemx -mno-paired 19061@opindex mpaired 19062@opindex mno-paired 19063This switch enables or disables the generation of PAIRED simd 19064instructions. 19065 19066@item -mspe=@var{yes/no} 19067This option has been deprecated. Use @option{-mspe} and 19068@option{-mno-spe} instead. 19069 19070@item -mvsx 19071@itemx -mno-vsx 19072@opindex mvsx 19073@opindex mno-vsx 19074Generate code that uses (does not use) vector/scalar (VSX) 19075instructions, and also enable the use of built-in functions that allow 19076more direct access to the VSX instruction set. 19077 19078@item -mcrypto 19079@itemx -mno-crypto 19080@opindex mcrypto 19081@opindex mno-crypto 19082Enable the use (disable) of the built-in functions that allow direct 19083access to the cryptographic instructions that were added in version 190842.07 of the PowerPC ISA. 19085 19086@item -mdirect-move 19087@itemx -mno-direct-move 19088@opindex mdirect-move 19089@opindex mno-direct-move 19090Generate code that uses (does not use) the instructions to move data 19091between the general purpose registers and the vector/scalar (VSX) 19092registers that were added in version 2.07 of the PowerPC ISA. 19093 19094@item -mhtm 19095@itemx -mno-htm 19096@opindex mhtm 19097@opindex mno-htm 19098Enable (disable) the use of the built-in functions that allow direct 19099access to the Hardware Transactional Memory (HTM) instructions that 19100were added in version 2.07 of the PowerPC ISA. 19101 19102@item -mpower8-fusion 19103@itemx -mno-power8-fusion 19104@opindex mpower8-fusion 19105@opindex mno-power8-fusion 19106Generate code that keeps (does not keeps) some integer operations 19107adjacent so that the instructions can be fused together on power8 and 19108later processors. 19109 19110@item -mpower8-vector 19111@itemx -mno-power8-vector 19112@opindex mpower8-vector 19113@opindex mno-power8-vector 19114Generate code that uses (does not use) the vector and scalar 19115instructions that were added in version 2.07 of the PowerPC ISA. Also 19116enable the use of built-in functions that allow more direct access to 19117the vector instructions. 19118 19119@item -mquad-memory 19120@itemx -mno-quad-memory 19121@opindex mquad-memory 19122@opindex mno-quad-memory 19123Generate code that uses (does not use) the non-atomic quad word memory 19124instructions. The @option{-mquad-memory} option requires use of 1912564-bit mode. 19126 19127@item -mquad-memory-atomic 19128@itemx -mno-quad-memory-atomic 19129@opindex mquad-memory-atomic 19130@opindex mno-quad-memory-atomic 19131Generate code that uses (does not use) the atomic quad word memory 19132instructions. The @option{-mquad-memory-atomic} option requires use of 1913364-bit mode. 19134 19135@item -mupper-regs-df 19136@itemx -mno-upper-regs-df 19137@opindex mupper-regs-df 19138@opindex mno-upper-regs-df 19139Generate code that uses (does not use) the scalar double precision 19140instructions that target all 64 registers in the vector/scalar 19141floating point register set that were added in version 2.06 of the 19142PowerPC ISA. @option{-mupper-regs-df} is turned on by default if you 19143use any of the @option{-mcpu=power7}, @option{-mcpu=power8}, or 19144@option{-mvsx} options. 19145 19146@item -mupper-regs-sf 19147@itemx -mno-upper-regs-sf 19148@opindex mupper-regs-sf 19149@opindex mno-upper-regs-sf 19150Generate code that uses (does not use) the scalar single precision 19151instructions that target all 64 registers in the vector/scalar 19152floating point register set that were added in version 2.07 of the 19153PowerPC ISA. @option{-mupper-regs-sf} is turned on by default if you 19154use either of the @option{-mcpu=power8} or @option{-mpower8-vector} 19155options. 19156 19157@item -mupper-regs 19158@itemx -mno-upper-regs 19159@opindex mupper-regs 19160@opindex mno-upper-regs 19161Generate code that uses (does not use) the scalar 19162instructions that target all 64 registers in the vector/scalar 19163floating point register set, depending on the model of the machine. 19164 19165If the @option{-mno-upper-regs} option is used, it turns off both 19166@option{-mupper-regs-sf} and @option{-mupper-regs-df} options. 19167 19168@item -mfloat-gprs=@var{yes/single/double/no} 19169@itemx -mfloat-gprs 19170@opindex mfloat-gprs 19171This switch enables or disables the generation of floating-point 19172operations on the general-purpose registers for architectures that 19173support it. 19174 19175The argument @samp{yes} or @samp{single} enables the use of 19176single-precision floating-point operations. 19177 19178The argument @samp{double} enables the use of single and 19179double-precision floating-point operations. 19180 19181The argument @samp{no} disables floating-point operations on the 19182general-purpose registers. 19183 19184This option is currently only available on the MPC854x. 19185 19186@item -m32 19187@itemx -m64 19188@opindex m32 19189@opindex m64 19190Generate code for 32-bit or 64-bit environments of Darwin and SVR4 19191targets (including GNU/Linux). The 32-bit environment sets int, long 19192and pointer to 32 bits and generates code that runs on any PowerPC 19193variant. The 64-bit environment sets int to 32 bits and long and 19194pointer to 64 bits, and generates code for PowerPC64, as for 19195@option{-mpowerpc64}. 19196 19197@item -mfull-toc 19198@itemx -mno-fp-in-toc 19199@itemx -mno-sum-in-toc 19200@itemx -mminimal-toc 19201@opindex mfull-toc 19202@opindex mno-fp-in-toc 19203@opindex mno-sum-in-toc 19204@opindex mminimal-toc 19205Modify generation of the TOC (Table Of Contents), which is created for 19206every executable file. The @option{-mfull-toc} option is selected by 19207default. In that case, GCC allocates at least one TOC entry for 19208each unique non-automatic variable reference in your program. GCC 19209also places floating-point constants in the TOC@. However, only 1921016,384 entries are available in the TOC@. 19211 19212If you receive a linker error message that saying you have overflowed 19213the available TOC space, you can reduce the amount of TOC space used 19214with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options. 19215@option{-mno-fp-in-toc} prevents GCC from putting floating-point 19216constants in the TOC and @option{-mno-sum-in-toc} forces GCC to 19217generate code to calculate the sum of an address and a constant at 19218run time instead of putting that sum into the TOC@. You may specify one 19219or both of these options. Each causes GCC to produce very slightly 19220slower and larger code at the expense of conserving TOC space. 19221 19222If you still run out of space in the TOC even when you specify both of 19223these options, specify @option{-mminimal-toc} instead. This option causes 19224GCC to make only one TOC entry for every file. When you specify this 19225option, GCC produces code that is slower and larger but which 19226uses extremely little TOC space. You may wish to use this option 19227only on files that contain less frequently-executed code. 19228 19229@item -maix64 19230@itemx -maix32 19231@opindex maix64 19232@opindex maix32 19233Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit 19234@code{long} type, and the infrastructure needed to support them. 19235Specifying @option{-maix64} implies @option{-mpowerpc64}, 19236while @option{-maix32} disables the 64-bit ABI and 19237implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}. 19238 19239@item -mxl-compat 19240@itemx -mno-xl-compat 19241@opindex mxl-compat 19242@opindex mno-xl-compat 19243Produce code that conforms more closely to IBM XL compiler semantics 19244when using AIX-compatible ABI@. Pass floating-point arguments to 19245prototyped functions beyond the register save area (RSA) on the stack 19246in addition to argument FPRs. Do not assume that most significant 19247double in 128-bit long double value is properly rounded when comparing 19248values and converting to double. Use XL symbol names for long double 19249support routines. 19250 19251The AIX calling convention was extended but not initially documented to 19252handle an obscure K&R C case of calling a function that takes the 19253address of its arguments with fewer arguments than declared. IBM XL 19254compilers access floating-point arguments that do not fit in the 19255RSA from the stack when a subroutine is compiled without 19256optimization. Because always storing floating-point arguments on the 19257stack is inefficient and rarely needed, this option is not enabled by 19258default and only is necessary when calling subroutines compiled by IBM 19259XL compilers without optimization. 19260 19261@item -mpe 19262@opindex mpe 19263Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an 19264application written to use message passing with special startup code to 19265enable the application to run. The system must have PE installed in the 19266standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file 19267must be overridden with the @option{-specs=} option to specify the 19268appropriate directory location. The Parallel Environment does not 19269support threads, so the @option{-mpe} option and the @option{-pthread} 19270option are incompatible. 19271 19272@item -malign-natural 19273@itemx -malign-power 19274@opindex malign-natural 19275@opindex malign-power 19276On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option 19277@option{-malign-natural} overrides the ABI-defined alignment of larger 19278types, such as floating-point doubles, on their natural size-based boundary. 19279The option @option{-malign-power} instructs GCC to follow the ABI-specified 19280alignment rules. GCC defaults to the standard alignment defined in the ABI@. 19281 19282On 64-bit Darwin, natural alignment is the default, and @option{-malign-power} 19283is not supported. 19284 19285@item -msoft-float 19286@itemx -mhard-float 19287@opindex msoft-float 19288@opindex mhard-float 19289Generate code that does not use (uses) the floating-point register set. 19290Software floating-point emulation is provided if you use the 19291@option{-msoft-float} option, and pass the option to GCC when linking. 19292 19293@item -msingle-float 19294@itemx -mdouble-float 19295@opindex msingle-float 19296@opindex mdouble-float 19297Generate code for single- or double-precision floating-point operations. 19298@option{-mdouble-float} implies @option{-msingle-float}. 19299 19300@item -msimple-fpu 19301@opindex msimple-fpu 19302Do not generate @code{sqrt} and @code{div} instructions for hardware 19303floating-point unit. 19304 19305@item -mfpu=@var{name} 19306@opindex mfpu 19307Specify type of floating-point unit. Valid values for @var{name} are 19308@samp{sp_lite} (equivalent to @option{-msingle-float -msimple-fpu}), 19309@samp{dp_lite} (equivalent to @option{-mdouble-float -msimple-fpu}), 19310@samp{sp_full} (equivalent to @option{-msingle-float}), 19311and @samp{dp_full} (equivalent to @option{-mdouble-float}). 19312 19313@item -mxilinx-fpu 19314@opindex mxilinx-fpu 19315Perform optimizations for the floating-point unit on Xilinx PPC 405/440. 19316 19317@item -mmultiple 19318@itemx -mno-multiple 19319@opindex mmultiple 19320@opindex mno-multiple 19321Generate code that uses (does not use) the load multiple word 19322instructions and the store multiple word instructions. These 19323instructions are generated by default on POWER systems, and not 19324generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian 19325PowerPC systems, since those instructions do not work when the 19326processor is in little-endian mode. The exceptions are PPC740 and 19327PPC750 which permit these instructions in little-endian mode. 19328 19329@item -mstring 19330@itemx -mno-string 19331@opindex mstring 19332@opindex mno-string 19333Generate code that uses (does not use) the load string instructions 19334and the store string word instructions to save multiple registers and 19335do small block moves. These instructions are generated by default on 19336POWER systems, and not generated on PowerPC systems. Do not use 19337@option{-mstring} on little-endian PowerPC systems, since those 19338instructions do not work when the processor is in little-endian mode. 19339The exceptions are PPC740 and PPC750 which permit these instructions 19340in little-endian mode. 19341 19342@item -mupdate 19343@itemx -mno-update 19344@opindex mupdate 19345@opindex mno-update 19346Generate code that uses (does not use) the load or store instructions 19347that update the base register to the address of the calculated memory 19348location. These instructions are generated by default. If you use 19349@option{-mno-update}, there is a small window between the time that the 19350stack pointer is updated and the address of the previous frame is 19351stored, which means code that walks the stack frame across interrupts or 19352signals may get corrupted data. 19353 19354@item -mavoid-indexed-addresses 19355@itemx -mno-avoid-indexed-addresses 19356@opindex mavoid-indexed-addresses 19357@opindex mno-avoid-indexed-addresses 19358Generate code that tries to avoid (not avoid) the use of indexed load 19359or store instructions. These instructions can incur a performance 19360penalty on Power6 processors in certain situations, such as when 19361stepping through large arrays that cross a 16M boundary. This option 19362is enabled by default when targeting Power6 and disabled otherwise. 19363 19364@item -mfused-madd 19365@itemx -mno-fused-madd 19366@opindex mfused-madd 19367@opindex mno-fused-madd 19368Generate code that uses (does not use) the floating-point multiply and 19369accumulate instructions. These instructions are generated by default 19370if hardware floating point is used. The machine-dependent 19371@option{-mfused-madd} option is now mapped to the machine-independent 19372@option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is 19373mapped to @option{-ffp-contract=off}. 19374 19375@item -mmulhw 19376@itemx -mno-mulhw 19377@opindex mmulhw 19378@opindex mno-mulhw 19379Generate code that uses (does not use) the half-word multiply and 19380multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors. 19381These instructions are generated by default when targeting those 19382processors. 19383 19384@item -mdlmzb 19385@itemx -mno-dlmzb 19386@opindex mdlmzb 19387@opindex mno-dlmzb 19388Generate code that uses (does not use) the string-search @samp{dlmzb} 19389instruction on the IBM 405, 440, 464 and 476 processors. This instruction is 19390generated by default when targeting those processors. 19391 19392@item -mno-bit-align 19393@itemx -mbit-align 19394@opindex mno-bit-align 19395@opindex mbit-align 19396On System V.4 and embedded PowerPC systems do not (do) force structures 19397and unions that contain bit-fields to be aligned to the base type of the 19398bit-field. 19399 19400For example, by default a structure containing nothing but 8 19401@code{unsigned} bit-fields of length 1 is aligned to a 4-byte 19402boundary and has a size of 4 bytes. By using @option{-mno-bit-align}, 19403the structure is aligned to a 1-byte boundary and is 1 byte in 19404size. 19405 19406@item -mno-strict-align 19407@itemx -mstrict-align 19408@opindex mno-strict-align 19409@opindex mstrict-align 19410On System V.4 and embedded PowerPC systems do not (do) assume that 19411unaligned memory references are handled by the system. 19412 19413@item -mrelocatable 19414@itemx -mno-relocatable 19415@opindex mrelocatable 19416@opindex mno-relocatable 19417Generate code that allows (does not allow) a static executable to be 19418relocated to a different address at run time. A simple embedded 19419PowerPC system loader should relocate the entire contents of 19420@code{.got2} and 4-byte locations listed in the @code{.fixup} section, 19421a table of 32-bit addresses generated by this option. For this to 19422work, all objects linked together must be compiled with 19423@option{-mrelocatable} or @option{-mrelocatable-lib}. 19424@option{-mrelocatable} code aligns the stack to an 8-byte boundary. 19425 19426@item -mrelocatable-lib 19427@itemx -mno-relocatable-lib 19428@opindex mrelocatable-lib 19429@opindex mno-relocatable-lib 19430Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a 19431@code{.fixup} section to allow static executables to be relocated at 19432run time, but @option{-mrelocatable-lib} does not use the smaller stack 19433alignment of @option{-mrelocatable}. Objects compiled with 19434@option{-mrelocatable-lib} may be linked with objects compiled with 19435any combination of the @option{-mrelocatable} options. 19436 19437@item -mno-toc 19438@itemx -mtoc 19439@opindex mno-toc 19440@opindex mtoc 19441On System V.4 and embedded PowerPC systems do not (do) assume that 19442register 2 contains a pointer to a global area pointing to the addresses 19443used in the program. 19444 19445@item -mlittle 19446@itemx -mlittle-endian 19447@opindex mlittle 19448@opindex mlittle-endian 19449On System V.4 and embedded PowerPC systems compile code for the 19450processor in little-endian mode. The @option{-mlittle-endian} option is 19451the same as @option{-mlittle}. 19452 19453@item -mbig 19454@itemx -mbig-endian 19455@opindex mbig 19456@opindex mbig-endian 19457On System V.4 and embedded PowerPC systems compile code for the 19458processor in big-endian mode. The @option{-mbig-endian} option is 19459the same as @option{-mbig}. 19460 19461@item -mdynamic-no-pic 19462@opindex mdynamic-no-pic 19463On Darwin and Mac OS X systems, compile code so that it is not 19464relocatable, but that its external references are relocatable. The 19465resulting code is suitable for applications, but not shared 19466libraries. 19467 19468@item -msingle-pic-base 19469@opindex msingle-pic-base 19470Treat the register used for PIC addressing as read-only, rather than 19471loading it in the prologue for each function. The runtime system is 19472responsible for initializing this register with an appropriate value 19473before execution begins. 19474 19475@item -mprioritize-restricted-insns=@var{priority} 19476@opindex mprioritize-restricted-insns 19477This option controls the priority that is assigned to 19478dispatch-slot restricted instructions during the second scheduling 19479pass. The argument @var{priority} takes the value @samp{0}, @samp{1}, 19480or @samp{2} to assign no, highest, or second-highest (respectively) 19481priority to dispatch-slot restricted 19482instructions. 19483 19484@item -msched-costly-dep=@var{dependence_type} 19485@opindex msched-costly-dep 19486This option controls which dependences are considered costly 19487by the target during instruction scheduling. The argument 19488@var{dependence_type} takes one of the following values: 19489 19490@table @asis 19491@item @samp{no} 19492No dependence is costly. 19493 19494@item @samp{all} 19495All dependences are costly. 19496 19497@item @samp{true_store_to_load} 19498A true dependence from store to load is costly. 19499 19500@item @samp{store_to_load} 19501Any dependence from store to load is costly. 19502 19503@item @var{number} 19504Any dependence for which the latency is greater than or equal to 19505@var{number} is costly. 19506@end table 19507 19508@item -minsert-sched-nops=@var{scheme} 19509@opindex minsert-sched-nops 19510This option controls which NOP insertion scheme is used during 19511the second scheduling pass. The argument @var{scheme} takes one of the 19512following values: 19513 19514@table @asis 19515@item @samp{no} 19516Don't insert NOPs. 19517 19518@item @samp{pad} 19519Pad with NOPs any dispatch group that has vacant issue slots, 19520according to the scheduler's grouping. 19521 19522@item @samp{regroup_exact} 19523Insert NOPs to force costly dependent insns into 19524separate groups. Insert exactly as many NOPs as needed to force an insn 19525to a new group, according to the estimated processor grouping. 19526 19527@item @var{number} 19528Insert NOPs to force costly dependent insns into 19529separate groups. Insert @var{number} NOPs to force an insn to a new group. 19530@end table 19531 19532@item -mcall-sysv 19533@opindex mcall-sysv 19534On System V.4 and embedded PowerPC systems compile code using calling 19535conventions that adhere to the March 1995 draft of the System V 19536Application Binary Interface, PowerPC processor supplement. This is the 19537default unless you configured GCC using @samp{powerpc-*-eabiaix}. 19538 19539@item -mcall-sysv-eabi 19540@itemx -mcall-eabi 19541@opindex mcall-sysv-eabi 19542@opindex mcall-eabi 19543Specify both @option{-mcall-sysv} and @option{-meabi} options. 19544 19545@item -mcall-sysv-noeabi 19546@opindex mcall-sysv-noeabi 19547Specify both @option{-mcall-sysv} and @option{-mno-eabi} options. 19548 19549@item -mcall-aixdesc 19550@opindex m 19551On System V.4 and embedded PowerPC systems compile code for the AIX 19552operating system. 19553 19554@item -mcall-linux 19555@opindex mcall-linux 19556On System V.4 and embedded PowerPC systems compile code for the 19557Linux-based GNU system. 19558 19559@item -mcall-freebsd 19560@opindex mcall-freebsd 19561On System V.4 and embedded PowerPC systems compile code for the 19562FreeBSD operating system. 19563 19564@item -mcall-netbsd 19565@opindex mcall-netbsd 19566On System V.4 and embedded PowerPC systems compile code for the 19567NetBSD operating system. 19568 19569@item -mcall-openbsd 19570@opindex mcall-netbsd 19571On System V.4 and embedded PowerPC systems compile code for the 19572OpenBSD operating system. 19573 19574@item -maix-struct-return 19575@opindex maix-struct-return 19576Return all structures in memory (as specified by the AIX ABI)@. 19577 19578@item -msvr4-struct-return 19579@opindex msvr4-struct-return 19580Return structures smaller than 8 bytes in registers (as specified by the 19581SVR4 ABI)@. 19582 19583@item -mabi=@var{abi-type} 19584@opindex mabi 19585Extend the current ABI with a particular extension, or remove such extension. 19586Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe}, 19587@samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble}, 19588@samp{elfv1}, @samp{elfv2}@. 19589 19590@item -mabi=spe 19591@opindex mabi=spe 19592Extend the current ABI with SPE ABI extensions. This does not change 19593the default ABI, instead it adds the SPE ABI extensions to the current 19594ABI@. 19595 19596@item -mabi=no-spe 19597@opindex mabi=no-spe 19598Disable Book-E SPE ABI extensions for the current ABI@. 19599 19600@item -mabi=ibmlongdouble 19601@opindex mabi=ibmlongdouble 19602Change the current ABI to use IBM extended-precision long double. 19603This is a PowerPC 32-bit SYSV ABI option. 19604 19605@item -mabi=ieeelongdouble 19606@opindex mabi=ieeelongdouble 19607Change the current ABI to use IEEE extended-precision long double. 19608This is a PowerPC 32-bit Linux ABI option. 19609 19610@item -mabi=elfv1 19611@opindex mabi=elfv1 19612Change the current ABI to use the ELFv1 ABI. 19613This is the default ABI for big-endian PowerPC 64-bit Linux. 19614Overriding the default ABI requires special system support and is 19615likely to fail in spectacular ways. 19616 19617@item -mabi=elfv2 19618@opindex mabi=elfv2 19619Change the current ABI to use the ELFv2 ABI. 19620This is the default ABI for little-endian PowerPC 64-bit Linux. 19621Overriding the default ABI requires special system support and is 19622likely to fail in spectacular ways. 19623 19624@item -mprototype 19625@itemx -mno-prototype 19626@opindex mprototype 19627@opindex mno-prototype 19628On System V.4 and embedded PowerPC systems assume that all calls to 19629variable argument functions are properly prototyped. Otherwise, the 19630compiler must insert an instruction before every non-prototyped call to 19631set or clear bit 6 of the condition code register (@code{CR}) to 19632indicate whether floating-point values are passed in the floating-point 19633registers in case the function takes variable arguments. With 19634@option{-mprototype}, only calls to prototyped variable argument functions 19635set or clear the bit. 19636 19637@item -msim 19638@opindex msim 19639On embedded PowerPC systems, assume that the startup module is called 19640@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and 19641@file{libc.a}. This is the default for @samp{powerpc-*-eabisim} 19642configurations. 19643 19644@item -mmvme 19645@opindex mmvme 19646On embedded PowerPC systems, assume that the startup module is called 19647@file{crt0.o} and the standard C libraries are @file{libmvme.a} and 19648@file{libc.a}. 19649 19650@item -mads 19651@opindex mads 19652On embedded PowerPC systems, assume that the startup module is called 19653@file{crt0.o} and the standard C libraries are @file{libads.a} and 19654@file{libc.a}. 19655 19656@item -myellowknife 19657@opindex myellowknife 19658On embedded PowerPC systems, assume that the startup module is called 19659@file{crt0.o} and the standard C libraries are @file{libyk.a} and 19660@file{libc.a}. 19661 19662@item -mvxworks 19663@opindex mvxworks 19664On System V.4 and embedded PowerPC systems, specify that you are 19665compiling for a VxWorks system. 19666 19667@item -memb 19668@opindex memb 19669On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags 19670header to indicate that @samp{eabi} extended relocations are used. 19671 19672@item -meabi 19673@itemx -mno-eabi 19674@opindex meabi 19675@opindex mno-eabi 19676On System V.4 and embedded PowerPC systems do (do not) adhere to the 19677Embedded Applications Binary Interface (EABI), which is a set of 19678modifications to the System V.4 specifications. Selecting @option{-meabi} 19679means that the stack is aligned to an 8-byte boundary, a function 19680@code{__eabi} is called from @code{main} to set up the EABI 19681environment, and the @option{-msdata} option can use both @code{r2} and 19682@code{r13} to point to two separate small data areas. Selecting 19683@option{-mno-eabi} means that the stack is aligned to a 16-byte boundary, 19684no EABI initialization function is called from @code{main}, and the 19685@option{-msdata} option only uses @code{r13} to point to a single 19686small data area. The @option{-meabi} option is on by default if you 19687configured GCC using one of the @samp{powerpc*-*-eabi*} options. 19688 19689@item -msdata=eabi 19690@opindex msdata=eabi 19691On System V.4 and embedded PowerPC systems, put small initialized 19692@code{const} global and static data in the @code{.sdata2} section, which 19693is pointed to by register @code{r2}. Put small initialized 19694non-@code{const} global and static data in the @code{.sdata} section, 19695which is pointed to by register @code{r13}. Put small uninitialized 19696global and static data in the @code{.sbss} section, which is adjacent to 19697the @code{.sdata} section. The @option{-msdata=eabi} option is 19698incompatible with the @option{-mrelocatable} option. The 19699@option{-msdata=eabi} option also sets the @option{-memb} option. 19700 19701@item -msdata=sysv 19702@opindex msdata=sysv 19703On System V.4 and embedded PowerPC systems, put small global and static 19704data in the @code{.sdata} section, which is pointed to by register 19705@code{r13}. Put small uninitialized global and static data in the 19706@code{.sbss} section, which is adjacent to the @code{.sdata} section. 19707The @option{-msdata=sysv} option is incompatible with the 19708@option{-mrelocatable} option. 19709 19710@item -msdata=default 19711@itemx -msdata 19712@opindex msdata=default 19713@opindex msdata 19714On System V.4 and embedded PowerPC systems, if @option{-meabi} is used, 19715compile code the same as @option{-msdata=eabi}, otherwise compile code the 19716same as @option{-msdata=sysv}. 19717 19718@item -msdata=data 19719@opindex msdata=data 19720On System V.4 and embedded PowerPC systems, put small global 19721data in the @code{.sdata} section. Put small uninitialized global 19722data in the @code{.sbss} section. Do not use register @code{r13} 19723to address small data however. This is the default behavior unless 19724other @option{-msdata} options are used. 19725 19726@item -msdata=none 19727@itemx -mno-sdata 19728@opindex msdata=none 19729@opindex mno-sdata 19730On embedded PowerPC systems, put all initialized global and static data 19731in the @code{.data} section, and all uninitialized data in the 19732@code{.bss} section. 19733 19734@item -mblock-move-inline-limit=@var{num} 19735@opindex mblock-move-inline-limit 19736Inline all block moves (such as calls to @code{memcpy} or structure 19737copies) less than or equal to @var{num} bytes. The minimum value for 19738@var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit 19739targets. The default value is target-specific. 19740 19741@item -G @var{num} 19742@opindex G 19743@cindex smaller data references (PowerPC) 19744@cindex .sdata/.sdata2 references (PowerPC) 19745On embedded PowerPC systems, put global and static items less than or 19746equal to @var{num} bytes into the small data or BSS sections instead of 19747the normal data or BSS section. By default, @var{num} is 8. The 19748@option{-G @var{num}} switch is also passed to the linker. 19749All modules should be compiled with the same @option{-G @var{num}} value. 19750 19751@item -mregnames 19752@itemx -mno-regnames 19753@opindex mregnames 19754@opindex mno-regnames 19755On System V.4 and embedded PowerPC systems do (do not) emit register 19756names in the assembly language output using symbolic forms. 19757 19758@item -mlongcall 19759@itemx -mno-longcall 19760@opindex mlongcall 19761@opindex mno-longcall 19762By default assume that all calls are far away so that a longer and more 19763expensive calling sequence is required. This is required for calls 19764farther than 32 megabytes (33,554,432 bytes) from the current location. 19765A short call is generated if the compiler knows 19766the call cannot be that far away. This setting can be overridden by 19767the @code{shortcall} function attribute, or by @code{#pragma 19768longcall(0)}. 19769 19770Some linkers are capable of detecting out-of-range calls and generating 19771glue code on the fly. On these systems, long calls are unnecessary and 19772generate slower code. As of this writing, the AIX linker can do this, 19773as can the GNU linker for PowerPC/64. It is planned to add this feature 19774to the GNU linker for 32-bit PowerPC systems as well. 19775 19776On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr 19777callee, L42}, plus a @dfn{branch island} (glue code). The two target 19778addresses represent the callee and the branch island. The 19779Darwin/PPC linker prefers the first address and generates a @code{bl 19780callee} if the PPC @code{bl} instruction reaches the callee directly; 19781otherwise, the linker generates @code{bl L42} to call the branch 19782island. The branch island is appended to the body of the 19783calling function; it computes the full 32-bit address of the callee 19784and jumps to it. 19785 19786On Mach-O (Darwin) systems, this option directs the compiler emit to 19787the glue for every direct call, and the Darwin linker decides whether 19788to use or discard it. 19789 19790In the future, GCC may ignore all longcall specifications 19791when the linker is known to generate glue. 19792 19793@item -mtls-markers 19794@itemx -mno-tls-markers 19795@opindex mtls-markers 19796@opindex mno-tls-markers 19797Mark (do not mark) calls to @code{__tls_get_addr} with a relocation 19798specifying the function argument. The relocation allows the linker to 19799reliably associate function call with argument setup instructions for 19800TLS optimization, which in turn allows GCC to better schedule the 19801sequence. 19802 19803@item -pthread 19804@opindex pthread 19805Adds support for multithreading with the @dfn{pthreads} library. 19806This option sets flags for both the preprocessor and linker. 19807 19808@item -mrecip 19809@itemx -mno-recip 19810@opindex mrecip 19811This option enables use of the reciprocal estimate and 19812reciprocal square root estimate instructions with additional 19813Newton-Raphson steps to increase precision instead of doing a divide or 19814square root and divide for floating-point arguments. You should use 19815the @option{-ffast-math} option when using @option{-mrecip} (or at 19816least @option{-funsafe-math-optimizations}, 19817@option{-finite-math-only}, @option{-freciprocal-math} and 19818@option{-fno-trapping-math}). Note that while the throughput of the 19819sequence is generally higher than the throughput of the non-reciprocal 19820instruction, the precision of the sequence can be decreased by up to 2 19821ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square 19822roots. 19823 19824@item -mrecip=@var{opt} 19825@opindex mrecip=opt 19826This option controls which reciprocal estimate instructions 19827may be used. @var{opt} is a comma-separated list of options, which may 19828be preceded by a @code{!} to invert the option: 19829 19830@table @samp 19831 19832@item all 19833Enable all estimate instructions. 19834 19835@item default 19836Enable the default instructions, equivalent to @option{-mrecip}. 19837 19838@item none 19839Disable all estimate instructions, equivalent to @option{-mno-recip}. 19840 19841@item div 19842Enable the reciprocal approximation instructions for both 19843single and double precision. 19844 19845@item divf 19846Enable the single-precision reciprocal approximation instructions. 19847 19848@item divd 19849Enable the double-precision reciprocal approximation instructions. 19850 19851@item rsqrt 19852Enable the reciprocal square root approximation instructions for both 19853single and double precision. 19854 19855@item rsqrtf 19856Enable the single-precision reciprocal square root approximation instructions. 19857 19858@item rsqrtd 19859Enable the double-precision reciprocal square root approximation instructions. 19860 19861@end table 19862 19863So, for example, @option{-mrecip=all,!rsqrtd} enables 19864all of the reciprocal estimate instructions, except for the 19865@code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions 19866which handle the double-precision reciprocal square root calculations. 19867 19868@item -mrecip-precision 19869@itemx -mno-recip-precision 19870@opindex mrecip-precision 19871Assume (do not assume) that the reciprocal estimate instructions 19872provide higher-precision estimates than is mandated by the PowerPC 19873ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or 19874@option{-mcpu=power8} automatically selects @option{-mrecip-precision}. 19875The double-precision square root estimate instructions are not generated by 19876default on low-precision machines, since they do not provide an 19877estimate that converges after three steps. 19878 19879@item -mveclibabi=@var{type} 19880@opindex mveclibabi 19881Specifies the ABI type to use for vectorizing intrinsics using an 19882external library. The only type supported at present is @samp{mass}, 19883which specifies to use IBM's Mathematical Acceleration Subsystem 19884(MASS) libraries for vectorizing intrinsics using external libraries. 19885GCC currently emits calls to @code{acosd2}, @code{acosf4}, 19886@code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4}, 19887@code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4}, 19888@code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4}, 19889@code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4}, 19890@code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4}, 19891@code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4}, 19892@code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4}, 19893@code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4}, 19894@code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4}, 19895@code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4}, 19896@code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2}, 19897@code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2}, 19898@code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code 19899for power7. Both @option{-ftree-vectorize} and 19900@option{-funsafe-math-optimizations} must also be enabled. The MASS 19901libraries must be specified at link time. 19902 19903@item -mfriz 19904@itemx -mno-friz 19905@opindex mfriz 19906Generate (do not generate) the @code{friz} instruction when the 19907@option{-funsafe-math-optimizations} option is used to optimize 19908rounding of floating-point values to 64-bit integer and back to floating 19909point. The @code{friz} instruction does not return the same value if 19910the floating-point number is too large to fit in an integer. 19911 19912@item -mpointers-to-nested-functions 19913@itemx -mno-pointers-to-nested-functions 19914@opindex mpointers-to-nested-functions 19915Generate (do not generate) code to load up the static chain register 19916(@code{r11}) when calling through a pointer on AIX and 64-bit Linux 19917systems where a function pointer points to a 3-word descriptor giving 19918the function address, TOC value to be loaded in register @code{r2}, and 19919static chain value to be loaded in register @code{r11}. The 19920@option{-mpointers-to-nested-functions} is on by default. You cannot 19921call through pointers to nested functions or pointers 19922to functions compiled in other languages that use the static chain if 19923you use @option{-mno-pointers-to-nested-functions}. 19924 19925@item -msave-toc-indirect 19926@itemx -mno-save-toc-indirect 19927@opindex msave-toc-indirect 19928Generate (do not generate) code to save the TOC value in the reserved 19929stack location in the function prologue if the function calls through 19930a pointer on AIX and 64-bit Linux systems. If the TOC value is not 19931saved in the prologue, it is saved just before the call through the 19932pointer. The @option{-mno-save-toc-indirect} option is the default. 19933 19934@item -mcompat-align-parm 19935@itemx -mno-compat-align-parm 19936@opindex mcompat-align-parm 19937Generate (do not generate) code to pass structure parameters with a 19938maximum alignment of 64 bits, for compatibility with older versions 19939of GCC. 19940 19941Older versions of GCC (prior to 4.9.0) incorrectly did not align a 19942structure parameter on a 128-bit boundary when that structure contained 19943a member requiring 128-bit alignment. This is corrected in more 19944recent versions of GCC. This option may be used to generate code 19945that is compatible with functions compiled with older versions of 19946GCC. 19947 19948The @option{-mno-compat-align-parm} option is the default. 19949@end table 19950 19951@node RX Options 19952@subsection RX Options 19953@cindex RX Options 19954 19955These command-line options are defined for RX targets: 19956 19957@table @gcctabopt 19958@item -m64bit-doubles 19959@itemx -m32bit-doubles 19960@opindex m64bit-doubles 19961@opindex m32bit-doubles 19962Make the @code{double} data type be 64 bits (@option{-m64bit-doubles}) 19963or 32 bits (@option{-m32bit-doubles}) in size. The default is 19964@option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only 19965works on 32-bit values, which is why the default is 19966@option{-m32bit-doubles}. 19967 19968@item -fpu 19969@itemx -nofpu 19970@opindex fpu 19971@opindex nofpu 19972Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX 19973floating-point hardware. The default is enabled for the RX600 19974series and disabled for the RX200 series. 19975 19976Floating-point instructions are only generated for 32-bit floating-point 19977values, however, so the FPU hardware is not used for doubles if the 19978@option{-m64bit-doubles} option is used. 19979 19980@emph{Note} If the @option{-fpu} option is enabled then 19981@option{-funsafe-math-optimizations} is also enabled automatically. 19982This is because the RX FPU instructions are themselves unsafe. 19983 19984@item -mcpu=@var{name} 19985@opindex mcpu 19986Selects the type of RX CPU to be targeted. Currently three types are 19987supported, the generic @samp{RX600} and @samp{RX200} series hardware and 19988the specific @samp{RX610} CPU. The default is @samp{RX600}. 19989 19990The only difference between @samp{RX600} and @samp{RX610} is that the 19991@samp{RX610} does not support the @code{MVTIPL} instruction. 19992 19993The @samp{RX200} series does not have a hardware floating-point unit 19994and so @option{-nofpu} is enabled by default when this type is 19995selected. 19996 19997@item -mbig-endian-data 19998@itemx -mlittle-endian-data 19999@opindex mbig-endian-data 20000@opindex mlittle-endian-data 20001Store data (but not code) in the big-endian format. The default is 20002@option{-mlittle-endian-data}, i.e.@: to store data in the little-endian 20003format. 20004 20005@item -msmall-data-limit=@var{N} 20006@opindex msmall-data-limit 20007Specifies the maximum size in bytes of global and static variables 20008which can be placed into the small data area. Using the small data 20009area can lead to smaller and faster code, but the size of area is 20010limited and it is up to the programmer to ensure that the area does 20011not overflow. Also when the small data area is used one of the RX's 20012registers (usually @code{r13}) is reserved for use pointing to this 20013area, so it is no longer available for use by the compiler. This 20014could result in slower and/or larger code if variables are pushed onto 20015the stack instead of being held in this register. 20016 20017Note, common variables (variables that have not been initialized) and 20018constants are not placed into the small data area as they are assigned 20019to other sections in the output executable. 20020 20021The default value is zero, which disables this feature. Note, this 20022feature is not enabled by default with higher optimization levels 20023(@option{-O2} etc) because of the potentially detrimental effects of 20024reserving a register. It is up to the programmer to experiment and 20025discover whether this feature is of benefit to their program. See the 20026description of the @option{-mpid} option for a description of how the 20027actual register to hold the small data area pointer is chosen. 20028 20029@item -msim 20030@itemx -mno-sim 20031@opindex msim 20032@opindex mno-sim 20033Use the simulator runtime. The default is to use the libgloss 20034board-specific runtime. 20035 20036@item -mas100-syntax 20037@itemx -mno-as100-syntax 20038@opindex mas100-syntax 20039@opindex mno-as100-syntax 20040When generating assembler output use a syntax that is compatible with 20041Renesas's AS100 assembler. This syntax can also be handled by the GAS 20042assembler, but it has some restrictions so it is not generated by default. 20043 20044@item -mmax-constant-size=@var{N} 20045@opindex mmax-constant-size 20046Specifies the maximum size, in bytes, of a constant that can be used as 20047an operand in a RX instruction. Although the RX instruction set does 20048allow constants of up to 4 bytes in length to be used in instructions, 20049a longer value equates to a longer instruction. Thus in some 20050circumstances it can be beneficial to restrict the size of constants 20051that are used in instructions. Constants that are too big are instead 20052placed into a constant pool and referenced via register indirection. 20053 20054The value @var{N} can be between 0 and 4. A value of 0 (the default) 20055or 4 means that constants of any size are allowed. 20056 20057@item -mrelax 20058@opindex mrelax 20059Enable linker relaxation. Linker relaxation is a process whereby the 20060linker attempts to reduce the size of a program by finding shorter 20061versions of various instructions. Disabled by default. 20062 20063@item -mint-register=@var{N} 20064@opindex mint-register 20065Specify the number of registers to reserve for fast interrupt handler 20066functions. The value @var{N} can be between 0 and 4. A value of 1 20067means that register @code{r13} is reserved for the exclusive use 20068of fast interrupt handlers. A value of 2 reserves @code{r13} and 20069@code{r12}. A value of 3 reserves @code{r13}, @code{r12} and 20070@code{r11}, and a value of 4 reserves @code{r13} through @code{r10}. 20071A value of 0, the default, does not reserve any registers. 20072 20073@item -msave-acc-in-interrupts 20074@opindex msave-acc-in-interrupts 20075Specifies that interrupt handler functions should preserve the 20076accumulator register. This is only necessary if normal code might use 20077the accumulator register, for example because it performs 64-bit 20078multiplications. The default is to ignore the accumulator as this 20079makes the interrupt handlers faster. 20080 20081@item -mpid 20082@itemx -mno-pid 20083@opindex mpid 20084@opindex mno-pid 20085Enables the generation of position independent data. When enabled any 20086access to constant data is done via an offset from a base address 20087held in a register. This allows the location of constant data to be 20088determined at run time without requiring the executable to be 20089relocated, which is a benefit to embedded applications with tight 20090memory constraints. Data that can be modified is not affected by this 20091option. 20092 20093Note, using this feature reserves a register, usually @code{r13}, for 20094the constant data base address. This can result in slower and/or 20095larger code, especially in complicated functions. 20096 20097The actual register chosen to hold the constant data base address 20098depends upon whether the @option{-msmall-data-limit} and/or the 20099@option{-mint-register} command-line options are enabled. Starting 20100with register @code{r13} and proceeding downwards, registers are 20101allocated first to satisfy the requirements of @option{-mint-register}, 20102then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it 20103is possible for the small data area register to be @code{r8} if both 20104@option{-mint-register=4} and @option{-mpid} are specified on the 20105command line. 20106 20107By default this feature is not enabled. The default can be restored 20108via the @option{-mno-pid} command-line option. 20109 20110@item -mno-warn-multiple-fast-interrupts 20111@itemx -mwarn-multiple-fast-interrupts 20112@opindex mno-warn-multiple-fast-interrupts 20113@opindex mwarn-multiple-fast-interrupts 20114Prevents GCC from issuing a warning message if it finds more than one 20115fast interrupt handler when it is compiling a file. The default is to 20116issue a warning for each extra fast interrupt handler found, as the RX 20117only supports one such interrupt. 20118 20119@end table 20120 20121@emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}} 20122has special significance to the RX port when used with the 20123@code{interrupt} function attribute. This attribute indicates a 20124function intended to process fast interrupts. GCC ensures 20125that it only uses the registers @code{r10}, @code{r11}, @code{r12} 20126and/or @code{r13} and only provided that the normal use of the 20127corresponding registers have been restricted via the 20128@option{-ffixed-@var{reg}} or @option{-mint-register} command-line 20129options. 20130 20131@node S/390 and zSeries Options 20132@subsection S/390 and zSeries Options 20133@cindex S/390 and zSeries Options 20134 20135These are the @samp{-m} options defined for the S/390 and zSeries architecture. 20136 20137@table @gcctabopt 20138@item -mhard-float 20139@itemx -msoft-float 20140@opindex mhard-float 20141@opindex msoft-float 20142Use (do not use) the hardware floating-point instructions and registers 20143for floating-point operations. When @option{-msoft-float} is specified, 20144functions in @file{libgcc.a} are used to perform floating-point 20145operations. When @option{-mhard-float} is specified, the compiler 20146generates IEEE floating-point instructions. This is the default. 20147 20148@item -mhard-dfp 20149@itemx -mno-hard-dfp 20150@opindex mhard-dfp 20151@opindex mno-hard-dfp 20152Use (do not use) the hardware decimal-floating-point instructions for 20153decimal-floating-point operations. When @option{-mno-hard-dfp} is 20154specified, functions in @file{libgcc.a} are used to perform 20155decimal-floating-point operations. When @option{-mhard-dfp} is 20156specified, the compiler generates decimal-floating-point hardware 20157instructions. This is the default for @option{-march=z9-ec} or higher. 20158 20159@item -mlong-double-64 20160@itemx -mlong-double-128 20161@opindex mlong-double-64 20162@opindex mlong-double-128 20163These switches control the size of @code{long double} type. A size 20164of 64 bits makes the @code{long double} type equivalent to the @code{double} 20165type. This is the default. 20166 20167@item -mbackchain 20168@itemx -mno-backchain 20169@opindex mbackchain 20170@opindex mno-backchain 20171Store (do not store) the address of the caller's frame as backchain pointer 20172into the callee's stack frame. 20173A backchain may be needed to allow debugging using tools that do not understand 20174DWARF 2 call frame information. 20175When @option{-mno-packed-stack} is in effect, the backchain pointer is stored 20176at the bottom of the stack frame; when @option{-mpacked-stack} is in effect, 20177the backchain is placed into the topmost word of the 96/160 byte register 20178save area. 20179 20180In general, code compiled with @option{-mbackchain} is call-compatible with 20181code compiled with @option{-mmo-backchain}; however, use of the backchain 20182for debugging purposes usually requires that the whole binary is built with 20183@option{-mbackchain}. Note that the combination of @option{-mbackchain}, 20184@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order 20185to build a linux kernel use @option{-msoft-float}. 20186 20187The default is to not maintain the backchain. 20188 20189@item -mpacked-stack 20190@itemx -mno-packed-stack 20191@opindex mpacked-stack 20192@opindex mno-packed-stack 20193Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is 20194specified, the compiler uses the all fields of the 96/160 byte register save 20195area only for their default purpose; unused fields still take up stack space. 20196When @option{-mpacked-stack} is specified, register save slots are densely 20197packed at the top of the register save area; unused space is reused for other 20198purposes, allowing for more efficient use of the available stack space. 20199However, when @option{-mbackchain} is also in effect, the topmost word of 20200the save area is always used to store the backchain, and the return address 20201register is always saved two words below the backchain. 20202 20203As long as the stack frame backchain is not used, code generated with 20204@option{-mpacked-stack} is call-compatible with code generated with 20205@option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for 20206S/390 or zSeries generated code that uses the stack frame backchain at run 20207time, not just for debugging purposes. Such code is not call-compatible 20208with code compiled with @option{-mpacked-stack}. Also, note that the 20209combination of @option{-mbackchain}, 20210@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order 20211to build a linux kernel use @option{-msoft-float}. 20212 20213The default is to not use the packed stack layout. 20214 20215@item -msmall-exec 20216@itemx -mno-small-exec 20217@opindex msmall-exec 20218@opindex mno-small-exec 20219Generate (or do not generate) code using the @code{bras} instruction 20220to do subroutine calls. 20221This only works reliably if the total executable size does not 20222exceed 64k. The default is to use the @code{basr} instruction instead, 20223which does not have this limitation. 20224 20225@item -m64 20226@itemx -m31 20227@opindex m64 20228@opindex m31 20229When @option{-m31} is specified, generate code compliant to the 20230GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate 20231code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in 20232particular to generate 64-bit instructions. For the @samp{s390} 20233targets, the default is @option{-m31}, while the @samp{s390x} 20234targets default to @option{-m64}. 20235 20236@item -mzarch 20237@itemx -mesa 20238@opindex mzarch 20239@opindex mesa 20240When @option{-mzarch} is specified, generate code using the 20241instructions available on z/Architecture. 20242When @option{-mesa} is specified, generate code using the 20243instructions available on ESA/390. Note that @option{-mesa} is 20244not possible with @option{-m64}. 20245When generating code compliant to the GNU/Linux for S/390 ABI, 20246the default is @option{-mesa}. When generating code compliant 20247to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}. 20248 20249@item -mmvcle 20250@itemx -mno-mvcle 20251@opindex mmvcle 20252@opindex mno-mvcle 20253Generate (or do not generate) code using the @code{mvcle} instruction 20254to perform block moves. When @option{-mno-mvcle} is specified, 20255use a @code{mvc} loop instead. This is the default unless optimizing for 20256size. 20257 20258@item -mdebug 20259@itemx -mno-debug 20260@opindex mdebug 20261@opindex mno-debug 20262Print (or do not print) additional debug information when compiling. 20263The default is to not print debug information. 20264 20265@item -march=@var{cpu-type} 20266@opindex march 20267Generate code that runs on @var{cpu-type}, which is the name of a system 20268representing a certain processor type. Possible values for 20269@var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, @samp{z990}, 20270@samp{z9-109}, @samp{z9-ec}, @samp{z10}, @samp{z196}, @samp{zEC12}, 20271and @samp{z13}. 20272When generating code using the instructions available on z/Architecture, 20273the default is @option{-march=z900}. Otherwise, the default is 20274@option{-march=g5}. 20275 20276@item -mtune=@var{cpu-type} 20277@opindex mtune 20278Tune to @var{cpu-type} everything applicable about the generated code, 20279except for the ABI and the set of available instructions. 20280The list of @var{cpu-type} values is the same as for @option{-march}. 20281The default is the value used for @option{-march}. 20282 20283@item -mtpf-trace 20284@itemx -mno-tpf-trace 20285@opindex mtpf-trace 20286@opindex mno-tpf-trace 20287Generate code that adds (does not add) in TPF OS specific branches to trace 20288routines in the operating system. This option is off by default, even 20289when compiling for the TPF OS@. 20290 20291@item -mfused-madd 20292@itemx -mno-fused-madd 20293@opindex mfused-madd 20294@opindex mno-fused-madd 20295Generate code that uses (does not use) the floating-point multiply and 20296accumulate instructions. These instructions are generated by default if 20297hardware floating point is used. 20298 20299@item -mwarn-framesize=@var{framesize} 20300@opindex mwarn-framesize 20301Emit a warning if the current function exceeds the given frame size. Because 20302this is a compile-time check it doesn't need to be a real problem when the program 20303runs. It is intended to identify functions that most probably cause 20304a stack overflow. It is useful to be used in an environment with limited stack 20305size e.g.@: the linux kernel. 20306 20307@item -mwarn-dynamicstack 20308@opindex mwarn-dynamicstack 20309Emit a warning if the function calls @code{alloca} or uses dynamically-sized 20310arrays. This is generally a bad idea with a limited stack size. 20311 20312@item -mstack-guard=@var{stack-guard} 20313@itemx -mstack-size=@var{stack-size} 20314@opindex mstack-guard 20315@opindex mstack-size 20316If these options are provided the S/390 back end emits additional instructions in 20317the function prologue that trigger a trap if the stack size is @var{stack-guard} 20318bytes above the @var{stack-size} (remember that the stack on S/390 grows downward). 20319If the @var{stack-guard} option is omitted the smallest power of 2 larger than 20320the frame size of the compiled function is chosen. 20321These options are intended to be used to help debugging stack overflow problems. 20322The additionally emitted code causes only little overhead and hence can also be 20323used in production-like systems without greater performance degradation. The given 20324values have to be exact powers of 2 and @var{stack-size} has to be greater than 20325@var{stack-guard} without exceeding 64k. 20326In order to be efficient the extra code makes the assumption that the stack starts 20327at an address aligned to the value given by @var{stack-size}. 20328The @var{stack-guard} option can only be used in conjunction with @var{stack-size}. 20329 20330@item -mhotpatch=@var{pre-halfwords},@var{post-halfwords} 20331@opindex mhotpatch 20332If the hotpatch option is enabled, a ``hot-patching'' function 20333prologue is generated for all functions in the compilation unit. 20334The funtion label is prepended with the given number of two-byte 20335NOP instructions (@var{pre-halfwords}, maximum 1000000). After 20336the label, 2 * @var{post-halfwords} bytes are appended, using the 20337largest NOP like instructions the architecture allows (maximum 203381000000). 20339 20340If both arguments are zero, hotpatching is disabled. 20341 20342This option can be overridden for individual functions with the 20343@code{hotpatch} attribute. 20344@end table 20345 20346@node Score Options 20347@subsection Score Options 20348@cindex Score Options 20349 20350These options are defined for Score implementations: 20351 20352@table @gcctabopt 20353@item -meb 20354@opindex meb 20355Compile code for big-endian mode. This is the default. 20356 20357@item -mel 20358@opindex mel 20359Compile code for little-endian mode. 20360 20361@item -mnhwloop 20362@opindex mnhwloop 20363Disable generation of @code{bcnz} instructions. 20364 20365@item -muls 20366@opindex muls 20367Enable generation of unaligned load and store instructions. 20368 20369@item -mmac 20370@opindex mmac 20371Enable the use of multiply-accumulate instructions. Disabled by default. 20372 20373@item -mscore5 20374@opindex mscore5 20375Specify the SCORE5 as the target architecture. 20376 20377@item -mscore5u 20378@opindex mscore5u 20379Specify the SCORE5U of the target architecture. 20380 20381@item -mscore7 20382@opindex mscore7 20383Specify the SCORE7 as the target architecture. This is the default. 20384 20385@item -mscore7d 20386@opindex mscore7d 20387Specify the SCORE7D as the target architecture. 20388@end table 20389 20390@node SH Options 20391@subsection SH Options 20392 20393These @samp{-m} options are defined for the SH implementations: 20394 20395@table @gcctabopt 20396@item -m1 20397@opindex m1 20398Generate code for the SH1. 20399 20400@item -m2 20401@opindex m2 20402Generate code for the SH2. 20403 20404@item -m2e 20405Generate code for the SH2e. 20406 20407@item -m2a-nofpu 20408@opindex m2a-nofpu 20409Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way 20410that the floating-point unit is not used. 20411 20412@item -m2a-single-only 20413@opindex m2a-single-only 20414Generate code for the SH2a-FPU, in such a way that no double-precision 20415floating-point operations are used. 20416 20417@item -m2a-single 20418@opindex m2a-single 20419Generate code for the SH2a-FPU assuming the floating-point unit is in 20420single-precision mode by default. 20421 20422@item -m2a 20423@opindex m2a 20424Generate code for the SH2a-FPU assuming the floating-point unit is in 20425double-precision mode by default. 20426 20427@item -m3 20428@opindex m3 20429Generate code for the SH3. 20430 20431@item -m3e 20432@opindex m3e 20433Generate code for the SH3e. 20434 20435@item -m4-nofpu 20436@opindex m4-nofpu 20437Generate code for the SH4 without a floating-point unit. 20438 20439@item -m4-single-only 20440@opindex m4-single-only 20441Generate code for the SH4 with a floating-point unit that only 20442supports single-precision arithmetic. 20443 20444@item -m4-single 20445@opindex m4-single 20446Generate code for the SH4 assuming the floating-point unit is in 20447single-precision mode by default. 20448 20449@item -m4 20450@opindex m4 20451Generate code for the SH4. 20452 20453@item -m4-100 20454@opindex m4-100 20455Generate code for SH4-100. 20456 20457@item -m4-100-nofpu 20458@opindex m4-100-nofpu 20459Generate code for SH4-100 in such a way that the 20460floating-point unit is not used. 20461 20462@item -m4-100-single 20463@opindex m4-100-single 20464Generate code for SH4-100 assuming the floating-point unit is in 20465single-precision mode by default. 20466 20467@item -m4-100-single-only 20468@opindex m4-100-single-only 20469Generate code for SH4-100 in such a way that no double-precision 20470floating-point operations are used. 20471 20472@item -m4-200 20473@opindex m4-200 20474Generate code for SH4-200. 20475 20476@item -m4-200-nofpu 20477@opindex m4-200-nofpu 20478Generate code for SH4-200 without in such a way that the 20479floating-point unit is not used. 20480 20481@item -m4-200-single 20482@opindex m4-200-single 20483Generate code for SH4-200 assuming the floating-point unit is in 20484single-precision mode by default. 20485 20486@item -m4-200-single-only 20487@opindex m4-200-single-only 20488Generate code for SH4-200 in such a way that no double-precision 20489floating-point operations are used. 20490 20491@item -m4-300 20492@opindex m4-300 20493Generate code for SH4-300. 20494 20495@item -m4-300-nofpu 20496@opindex m4-300-nofpu 20497Generate code for SH4-300 without in such a way that the 20498floating-point unit is not used. 20499 20500@item -m4-300-single 20501@opindex m4-300-single 20502Generate code for SH4-300 in such a way that no double-precision 20503floating-point operations are used. 20504 20505@item -m4-300-single-only 20506@opindex m4-300-single-only 20507Generate code for SH4-300 in such a way that no double-precision 20508floating-point operations are used. 20509 20510@item -m4-340 20511@opindex m4-340 20512Generate code for SH4-340 (no MMU, no FPU). 20513 20514@item -m4-500 20515@opindex m4-500 20516Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the 20517assembler. 20518 20519@item -m4a-nofpu 20520@opindex m4a-nofpu 20521Generate code for the SH4al-dsp, or for a SH4a in such a way that the 20522floating-point unit is not used. 20523 20524@item -m4a-single-only 20525@opindex m4a-single-only 20526Generate code for the SH4a, in such a way that no double-precision 20527floating-point operations are used. 20528 20529@item -m4a-single 20530@opindex m4a-single 20531Generate code for the SH4a assuming the floating-point unit is in 20532single-precision mode by default. 20533 20534@item -m4a 20535@opindex m4a 20536Generate code for the SH4a. 20537 20538@item -m4al 20539@opindex m4al 20540Same as @option{-m4a-nofpu}, except that it implicitly passes 20541@option{-dsp} to the assembler. GCC doesn't generate any DSP 20542instructions at the moment. 20543 20544@item -m5-32media 20545@opindex m5-32media 20546Generate 32-bit code for SHmedia. 20547 20548@item -m5-32media-nofpu 20549@opindex m5-32media-nofpu 20550Generate 32-bit code for SHmedia in such a way that the 20551floating-point unit is not used. 20552 20553@item -m5-64media 20554@opindex m5-64media 20555Generate 64-bit code for SHmedia. 20556 20557@item -m5-64media-nofpu 20558@opindex m5-64media-nofpu 20559Generate 64-bit code for SHmedia in such a way that the 20560floating-point unit is not used. 20561 20562@item -m5-compact 20563@opindex m5-compact 20564Generate code for SHcompact. 20565 20566@item -m5-compact-nofpu 20567@opindex m5-compact-nofpu 20568Generate code for SHcompact in such a way that the 20569floating-point unit is not used. 20570 20571@item -mb 20572@opindex mb 20573Compile code for the processor in big-endian mode. 20574 20575@item -ml 20576@opindex ml 20577Compile code for the processor in little-endian mode. 20578 20579@item -mdalign 20580@opindex mdalign 20581Align doubles at 64-bit boundaries. Note that this changes the calling 20582conventions, and thus some functions from the standard C library do 20583not work unless you recompile it first with @option{-mdalign}. 20584 20585@item -mrelax 20586@opindex mrelax 20587Shorten some address references at link time, when possible; uses the 20588linker option @option{-relax}. 20589 20590@item -mbigtable 20591@opindex mbigtable 20592Use 32-bit offsets in @code{switch} tables. The default is to use 2059316-bit offsets. 20594 20595@item -mbitops 20596@opindex mbitops 20597Enable the use of bit manipulation instructions on SH2A. 20598 20599@item -mfmovd 20600@opindex mfmovd 20601Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for 20602alignment constraints. 20603 20604@item -mrenesas 20605@opindex mrenesas 20606Comply with the calling conventions defined by Renesas. 20607 20608@item -mno-renesas 20609@opindex mno-renesas 20610Comply with the calling conventions defined for GCC before the Renesas 20611conventions were available. This option is the default for all 20612targets of the SH toolchain. 20613 20614@item -mnomacsave 20615@opindex mnomacsave 20616Mark the @code{MAC} register as call-clobbered, even if 20617@option{-mrenesas} is given. 20618 20619@item -mieee 20620@itemx -mno-ieee 20621@opindex mieee 20622@opindex mno-ieee 20623Control the IEEE compliance of floating-point comparisons, which affects the 20624handling of cases where the result of a comparison is unordered. By default 20625@option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is 20626enabled @option{-mno-ieee} is implicitly set, which results in faster 20627floating-point greater-equal and less-equal comparisons. The implcit settings 20628can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}. 20629 20630@item -minline-ic_invalidate 20631@opindex minline-ic_invalidate 20632Inline code to invalidate instruction cache entries after setting up 20633nested function trampolines. 20634This option has no effect if @option{-musermode} is in effect and the selected 20635code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi} 20636instruction. 20637If the selected code generation option does not allow the use of the @code{icbi} 20638instruction, and @option{-musermode} is not in effect, the inlined code 20639manipulates the instruction cache address array directly with an associative 20640write. This not only requires privileged mode at run time, but it also 20641fails if the cache line had been mapped via the TLB and has become unmapped. 20642 20643@item -misize 20644@opindex misize 20645Dump instruction size and location in the assembly code. 20646 20647@item -mpadstruct 20648@opindex mpadstruct 20649This option is deprecated. It pads structures to multiple of 4 bytes, 20650which is incompatible with the SH ABI@. 20651 20652@item -matomic-model=@var{model} 20653@opindex matomic-model=@var{model} 20654Sets the model of atomic operations and additional parameters as a comma 20655separated list. For details on the atomic built-in functions see 20656@ref{__atomic Builtins}. The following models and parameters are supported: 20657 20658@table @samp 20659 20660@item none 20661Disable compiler generated atomic sequences and emit library calls for atomic 20662operations. This is the default if the target is not @code{sh*-*-linux*}. 20663 20664@item soft-gusa 20665Generate GNU/Linux compatible gUSA software atomic sequences for the atomic 20666built-in functions. The generated atomic sequences require additional support 20667from the interrupt/exception handling code of the system and are only suitable 20668for SH3* and SH4* single-core systems. This option is enabled by default when 20669the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A, 20670this option also partially utilizes the hardware atomic instructions 20671@code{movli.l} and @code{movco.l} to create more efficient code, unless 20672@samp{strict} is specified. 20673 20674@item soft-tcb 20675Generate software atomic sequences that use a variable in the thread control 20676block. This is a variation of the gUSA sequences which can also be used on 20677SH1* and SH2* targets. The generated atomic sequences require additional 20678support from the interrupt/exception handling code of the system and are only 20679suitable for single-core systems. When using this model, the @samp{gbr-offset=} 20680parameter has to be specified as well. 20681 20682@item soft-imask 20683Generate software atomic sequences that temporarily disable interrupts by 20684setting @code{SR.IMASK = 1111}. This model works only when the program runs 20685in privileged mode and is only suitable for single-core systems. Additional 20686support from the interrupt/exception handling code of the system is not 20687required. This model is enabled by default when the target is 20688@code{sh*-*-linux*} and SH1* or SH2*. 20689 20690@item hard-llcs 20691Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l} 20692instructions only. This is only available on SH4A and is suitable for 20693multi-core systems. Since the hardware instructions support only 32 bit atomic 20694variables access to 8 or 16 bit variables is emulated with 32 bit accesses. 20695Code compiled with this option is also compatible with other software 20696atomic model interrupt/exception handling systems if executed on an SH4A 20697system. Additional support from the interrupt/exception handling code of the 20698system is not required for this model. 20699 20700@item gbr-offset= 20701This parameter specifies the offset in bytes of the variable in the thread 20702control block structure that should be used by the generated atomic sequences 20703when the @samp{soft-tcb} model has been selected. For other models this 20704parameter is ignored. The specified value must be an integer multiple of four 20705and in the range 0-1020. 20706 20707@item strict 20708This parameter prevents mixed usage of multiple atomic models, even if they 20709are compatible, and makes the compiler generate atomic sequences of the 20710specified model only. 20711 20712@end table 20713 20714@item -mtas 20715@opindex mtas 20716Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}. 20717Notice that depending on the particular hardware and software configuration 20718this can degrade overall performance due to the operand cache line flushes 20719that are implied by the @code{tas.b} instruction. On multi-core SH4A 20720processors the @code{tas.b} instruction must be used with caution since it 20721can result in data corruption for certain cache configurations. 20722 20723@item -mprefergot 20724@opindex mprefergot 20725When generating position-independent code, emit function calls using 20726the Global Offset Table instead of the Procedure Linkage Table. 20727 20728@item -musermode 20729@itemx -mno-usermode 20730@opindex musermode 20731@opindex mno-usermode 20732Don't allow (allow) the compiler generating privileged mode code. Specifying 20733@option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the 20734inlined code would not work in user mode. @option{-musermode} is the default 20735when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2* 20736@option{-musermode} has no effect, since there is no user mode. 20737 20738@item -multcost=@var{number} 20739@opindex multcost=@var{number} 20740Set the cost to assume for a multiply insn. 20741 20742@item -mdiv=@var{strategy} 20743@opindex mdiv=@var{strategy} 20744Set the division strategy to be used for integer division operations. 20745For SHmedia @var{strategy} can be one of: 20746 20747@table @samp 20748 20749@item fp 20750Performs the operation in floating point. This has a very high latency, 20751but needs only a few instructions, so it might be a good choice if 20752your code has enough easily-exploitable ILP to allow the compiler to 20753schedule the floating-point instructions together with other instructions. 20754Division by zero causes a floating-point exception. 20755 20756@item inv 20757Uses integer operations to calculate the inverse of the divisor, 20758and then multiplies the dividend with the inverse. This strategy allows 20759CSE and hoisting of the inverse calculation. Division by zero calculates 20760an unspecified result, but does not trap. 20761 20762@item inv:minlat 20763A variant of @samp{inv} where, if no CSE or hoisting opportunities 20764have been found, or if the entire operation has been hoisted to the same 20765place, the last stages of the inverse calculation are intertwined with the 20766final multiply to reduce the overall latency, at the expense of using a few 20767more instructions, and thus offering fewer scheduling opportunities with 20768other code. 20769 20770@item call 20771Calls a library function that usually implements the @samp{inv:minlat} 20772strategy. 20773This gives high code density for @code{m5-*media-nofpu} compilations. 20774 20775@item call2 20776Uses a different entry point of the same library function, where it 20777assumes that a pointer to a lookup table has already been set up, which 20778exposes the pointer load to CSE and code hoisting optimizations. 20779 20780@item inv:call 20781@itemx inv:call2 20782@itemx inv:fp 20783Use the @samp{inv} algorithm for initial 20784code generation, but if the code stays unoptimized, revert to the @samp{call}, 20785@samp{call2}, or @samp{fp} strategies, respectively. Note that the 20786potentially-trapping side effect of division by zero is carried by a 20787separate instruction, so it is possible that all the integer instructions 20788are hoisted out, but the marker for the side effect stays where it is. 20789A recombination to floating-point operations or a call is not possible 20790in that case. 20791 20792@item inv20u 20793@itemx inv20l 20794Variants of the @samp{inv:minlat} strategy. In the case 20795that the inverse calculation is not separated from the multiply, they speed 20796up division where the dividend fits into 20 bits (plus sign where applicable) 20797by inserting a test to skip a number of operations in this case; this test 20798slows down the case of larger dividends. @samp{inv20u} assumes the case of a such 20799a small dividend to be unlikely, and @samp{inv20l} assumes it to be likely. 20800 20801@end table 20802 20803For targets other than SHmedia @var{strategy} can be one of: 20804 20805@table @samp 20806 20807@item call-div1 20808Calls a library function that uses the single-step division instruction 20809@code{div1} to perform the operation. Division by zero calculates an 20810unspecified result and does not trap. This is the default except for SH4, 20811SH2A and SHcompact. 20812 20813@item call-fp 20814Calls a library function that performs the operation in double precision 20815floating point. Division by zero causes a floating-point exception. This is 20816the default for SHcompact with FPU. Specifying this for targets that do not 20817have a double precision FPU defaults to @code{call-div1}. 20818 20819@item call-table 20820Calls a library function that uses a lookup table for small divisors and 20821the @code{div1} instruction with case distinction for larger divisors. Division 20822by zero calculates an unspecified result and does not trap. This is the default 20823for SH4. Specifying this for targets that do not have dynamic shift 20824instructions defaults to @code{call-div1}. 20825 20826@end table 20827 20828When a division strategy has not been specified the default strategy is 20829selected based on the current target. For SH2A the default strategy is to 20830use the @code{divs} and @code{divu} instructions instead of library function 20831calls. 20832 20833@item -maccumulate-outgoing-args 20834@opindex maccumulate-outgoing-args 20835Reserve space once for outgoing arguments in the function prologue rather 20836than around each call. Generally beneficial for performance and size. Also 20837needed for unwinding to avoid changing the stack frame around conditional code. 20838 20839@item -mdivsi3_libfunc=@var{name} 20840@opindex mdivsi3_libfunc=@var{name} 20841Set the name of the library function used for 32-bit signed division to 20842@var{name}. 20843This only affects the name used in the @samp{call} and @samp{inv:call} 20844division strategies, and the compiler still expects the same 20845sets of input/output/clobbered registers as if this option were not present. 20846 20847@item -mfixed-range=@var{register-range} 20848@opindex mfixed-range 20849Generate code treating the given register range as fixed registers. 20850A fixed register is one that the register allocator can not use. This is 20851useful when compiling kernel code. A register range is specified as 20852two registers separated by a dash. Multiple register ranges can be 20853specified separated by a comma. 20854 20855@item -mindexed-addressing 20856@opindex mindexed-addressing 20857Enable the use of the indexed addressing mode for SHmedia32/SHcompact. 20858This is only safe if the hardware and/or OS implement 32-bit wrap-around 20859semantics for the indexed addressing mode. The architecture allows the 20860implementation of processors with 64-bit MMU, which the OS could use to 20861get 32-bit addressing, but since no current hardware implementation supports 20862this or any other way to make the indexed addressing mode safe to use in 20863the 32-bit ABI, the default is @option{-mno-indexed-addressing}. 20864 20865@item -mgettrcost=@var{number} 20866@opindex mgettrcost=@var{number} 20867Set the cost assumed for the @code{gettr} instruction to @var{number}. 20868The default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise. 20869 20870@item -mpt-fixed 20871@opindex mpt-fixed 20872Assume @code{pt*} instructions won't trap. This generally generates 20873better-scheduled code, but is unsafe on current hardware. 20874The current architecture 20875definition says that @code{ptabs} and @code{ptrel} trap when the target 20876anded with 3 is 3. 20877This has the unintentional effect of making it unsafe to schedule these 20878instructions before a branch, or hoist them out of a loop. For example, 20879@code{__do_global_ctors}, a part of @file{libgcc} 20880that runs constructors at program 20881startup, calls functions in a list which is delimited by @minus{}1. With the 20882@option{-mpt-fixed} option, the @code{ptabs} is done before testing against @minus{}1. 20883That means that all the constructors run a bit more quickly, but when 20884the loop comes to the end of the list, the program crashes because @code{ptabs} 20885loads @minus{}1 into a target register. 20886 20887Since this option is unsafe for any 20888hardware implementing the current architecture specification, the default 20889is @option{-mno-pt-fixed}. Unless specified explicitly with 20890@option{-mgettrcost}, @option{-mno-pt-fixed} also implies @option{-mgettrcost=100}; 20891this deters register allocation from using target registers for storing 20892ordinary integers. 20893 20894@item -minvalid-symbols 20895@opindex minvalid-symbols 20896Assume symbols might be invalid. Ordinary function symbols generated by 20897the compiler are always valid to load with 20898@code{movi}/@code{shori}/@code{ptabs} or 20899@code{movi}/@code{shori}/@code{ptrel}, 20900but with assembler and/or linker tricks it is possible 20901to generate symbols that cause @code{ptabs} or @code{ptrel} to trap. 20902This option is only meaningful when @option{-mno-pt-fixed} is in effect. 20903It prevents cross-basic-block CSE, hoisting and most scheduling 20904of symbol loads. The default is @option{-mno-invalid-symbols}. 20905 20906@item -mbranch-cost=@var{num} 20907@opindex mbranch-cost=@var{num} 20908Assume @var{num} to be the cost for a branch instruction. Higher numbers 20909make the compiler try to generate more branch-free code if possible. 20910If not specified the value is selected depending on the processor type that 20911is being compiled for. 20912 20913@item -mzdcbranch 20914@itemx -mno-zdcbranch 20915@opindex mzdcbranch 20916@opindex mno-zdcbranch 20917Assume (do not assume) that zero displacement conditional branch instructions 20918@code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the 20919compiler prefers zero displacement branch code sequences. This is 20920enabled by default when generating code for SH4 and SH4A. It can be explicitly 20921disabled by specifying @option{-mno-zdcbranch}. 20922 20923@item -mcbranch-force-delay-slot 20924@opindex mcbranch-force-delay-slot 20925Force the usage of delay slots for conditional branches, which stuffs the delay 20926slot with a @code{nop} if a suitable instruction can't be found. By default 20927this option is disabled. It can be enabled to work around hardware bugs as 20928found in the original SH7055. 20929 20930@item -mfused-madd 20931@itemx -mno-fused-madd 20932@opindex mfused-madd 20933@opindex mno-fused-madd 20934Generate code that uses (does not use) the floating-point multiply and 20935accumulate instructions. These instructions are generated by default 20936if hardware floating point is used. The machine-dependent 20937@option{-mfused-madd} option is now mapped to the machine-independent 20938@option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is 20939mapped to @option{-ffp-contract=off}. 20940 20941@item -mfsca 20942@itemx -mno-fsca 20943@opindex mfsca 20944@opindex mno-fsca 20945Allow or disallow the compiler to emit the @code{fsca} instruction for sine 20946and cosine approximations. The option @option{-mfsca} must be used in 20947combination with @option{-funsafe-math-optimizations}. It is enabled by default 20948when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine 20949approximations even if @option{-funsafe-math-optimizations} is in effect. 20950 20951@item -mfsrra 20952@itemx -mno-fsrra 20953@opindex mfsrra 20954@opindex mno-fsrra 20955Allow or disallow the compiler to emit the @code{fsrra} instruction for 20956reciprocal square root approximations. The option @option{-mfsrra} must be used 20957in combination with @option{-funsafe-math-optimizations} and 20958@option{-ffinite-math-only}. It is enabled by default when generating code for 20959SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations 20960even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are 20961in effect. 20962 20963@item -mpretend-cmove 20964@opindex mpretend-cmove 20965Prefer zero-displacement conditional branches for conditional move instruction 20966patterns. This can result in faster code on the SH4 processor. 20967 20968@end table 20969 20970@node Solaris 2 Options 20971@subsection Solaris 2 Options 20972@cindex Solaris 2 options 20973 20974These @samp{-m} options are supported on Solaris 2: 20975 20976@table @gcctabopt 20977@item -mclear-hwcap 20978@opindex mclear-hwcap 20979@option{-mclear-hwcap} tells the compiler to remove the hardware 20980capabilities generated by the Solaris assembler. This is only necessary 20981when object files use ISA extensions not supported by the current 20982machine, but check at runtime whether or not to use them. 20983 20984@item -mimpure-text 20985@opindex mimpure-text 20986@option{-mimpure-text}, used in addition to @option{-shared}, tells 20987the compiler to not pass @option{-z text} to the linker when linking a 20988shared object. Using this option, you can link position-dependent 20989code into a shared object. 20990 20991@option{-mimpure-text} suppresses the ``relocations remain against 20992allocatable but non-writable sections'' linker error message. 20993However, the necessary relocations trigger copy-on-write, and the 20994shared object is not actually shared across processes. Instead of 20995using @option{-mimpure-text}, you should compile all source code with 20996@option{-fpic} or @option{-fPIC}. 20997 20998@end table 20999 21000These switches are supported in addition to the above on Solaris 2: 21001 21002@table @gcctabopt 21003@item -pthreads 21004@opindex pthreads 21005Add support for multithreading using the POSIX threads library. This 21006option sets flags for both the preprocessor and linker. This option does 21007not affect the thread safety of object code produced by the compiler or 21008that of libraries supplied with it. 21009 21010@item -pthread 21011@opindex pthread 21012This is a synonym for @option{-pthreads}. 21013@end table 21014 21015@node SPARC Options 21016@subsection SPARC Options 21017@cindex SPARC options 21018 21019These @samp{-m} options are supported on the SPARC: 21020 21021@table @gcctabopt 21022@item -mno-app-regs 21023@itemx -mapp-regs 21024@opindex mno-app-regs 21025@opindex mapp-regs 21026Specify @option{-mapp-regs} to generate output using the global registers 210272 through 4, which the SPARC SVR4 ABI reserves for applications. Like the 21028global register 1, each global register 2 through 4 is then treated as an 21029allocable register that is clobbered by function calls. This is the default. 21030 21031To be fully SVR4 ABI-compliant at the cost of some performance loss, 21032specify @option{-mno-app-regs}. You should compile libraries and system 21033software with this option. 21034 21035@item -mflat 21036@itemx -mno-flat 21037@opindex mflat 21038@opindex mno-flat 21039With @option{-mflat}, the compiler does not generate save/restore instructions 21040and uses a ``flat'' or single register window model. This model is compatible 21041with the regular register window model. The local registers and the input 21042registers (0--5) are still treated as ``call-saved'' registers and are 21043saved on the stack as needed. 21044 21045With @option{-mno-flat} (the default), the compiler generates save/restore 21046instructions (except for leaf functions). This is the normal operating mode. 21047 21048@item -mfpu 21049@itemx -mhard-float 21050@opindex mfpu 21051@opindex mhard-float 21052Generate output containing floating-point instructions. This is the 21053default. 21054 21055@item -mno-fpu 21056@itemx -msoft-float 21057@opindex mno-fpu 21058@opindex msoft-float 21059Generate output containing library calls for floating point. 21060@strong{Warning:} the requisite libraries are not available for all SPARC 21061targets. Normally the facilities of the machine's usual C compiler are 21062used, but this cannot be done directly in cross-compilation. You must make 21063your own arrangements to provide suitable library functions for 21064cross-compilation. The embedded targets @samp{sparc-*-aout} and 21065@samp{sparclite-*-*} do provide software floating-point support. 21066 21067@option{-msoft-float} changes the calling convention in the output file; 21068therefore, it is only useful if you compile @emph{all} of a program with 21069this option. In particular, you need to compile @file{libgcc.a}, the 21070library that comes with GCC, with @option{-msoft-float} in order for 21071this to work. 21072 21073@item -mhard-quad-float 21074@opindex mhard-quad-float 21075Generate output containing quad-word (long double) floating-point 21076instructions. 21077 21078@item -msoft-quad-float 21079@opindex msoft-quad-float 21080Generate output containing library calls for quad-word (long double) 21081floating-point instructions. The functions called are those specified 21082in the SPARC ABI@. This is the default. 21083 21084As of this writing, there are no SPARC implementations that have hardware 21085support for the quad-word floating-point instructions. They all invoke 21086a trap handler for one of these instructions, and then the trap handler 21087emulates the effect of the instruction. Because of the trap handler overhead, 21088this is much slower than calling the ABI library routines. Thus the 21089@option{-msoft-quad-float} option is the default. 21090 21091@item -mno-unaligned-doubles 21092@itemx -munaligned-doubles 21093@opindex mno-unaligned-doubles 21094@opindex munaligned-doubles 21095Assume that doubles have 8-byte alignment. This is the default. 21096 21097With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte 21098alignment only if they are contained in another type, or if they have an 21099absolute address. Otherwise, it assumes they have 4-byte alignment. 21100Specifying this option avoids some rare compatibility problems with code 21101generated by other compilers. It is not the default because it results 21102in a performance loss, especially for floating-point code. 21103 21104@item -muser-mode 21105@itemx -mno-user-mode 21106@opindex muser-mode 21107@opindex mno-user-mode 21108Do not generate code that can only run in supervisor mode. This is relevant 21109only for the @code{casa} instruction emitted for the LEON3 processor. This 21110is the default. 21111 21112@item -mno-faster-structs 21113@itemx -mfaster-structs 21114@opindex mno-faster-structs 21115@opindex mfaster-structs 21116With @option{-mfaster-structs}, the compiler assumes that structures 21117should have 8-byte alignment. This enables the use of pairs of 21118@code{ldd} and @code{std} instructions for copies in structure 21119assignment, in place of twice as many @code{ld} and @code{st} pairs. 21120However, the use of this changed alignment directly violates the SPARC 21121ABI@. Thus, it's intended only for use on targets where the developer 21122acknowledges that their resulting code is not directly in line with 21123the rules of the ABI@. 21124 21125@item -mcpu=@var{cpu_type} 21126@opindex mcpu 21127Set the instruction set, register set, and instruction scheduling parameters 21128for machine type @var{cpu_type}. Supported values for @var{cpu_type} are 21129@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc}, 21130@samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930}, 21131@samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9}, 21132@samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, 21133@samp{niagara3} and @samp{niagara4}. 21134 21135Native Solaris and GNU/Linux toolchains also support the value @samp{native}, 21136which selects the best architecture option for the host processor. 21137@option{-mcpu=native} has no effect if GCC does not recognize 21138the processor. 21139 21140Default instruction scheduling parameters are used for values that select 21141an architecture and not an implementation. These are @samp{v7}, @samp{v8}, 21142@samp{sparclite}, @samp{sparclet}, @samp{v9}. 21143 21144Here is a list of each supported architecture and their supported 21145implementations. 21146 21147@table @asis 21148@item v7 21149cypress, leon3v7 21150 21151@item v8 21152supersparc, hypersparc, leon, leon3 21153 21154@item sparclite 21155f930, f934, sparclite86x 21156 21157@item sparclet 21158tsc701 21159 21160@item v9 21161ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4 21162@end table 21163 21164By default (unless configured otherwise), GCC generates code for the V7 21165variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler 21166additionally optimizes it for the Cypress CY7C602 chip, as used in the 21167SPARCStation/SPARCServer 3xx series. This is also appropriate for the older 21168SPARCStation 1, 2, IPX etc. 21169 21170With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC 21171architecture. The only difference from V7 code is that the compiler emits 21172the integer multiply and integer divide instructions which exist in SPARC-V8 21173but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally 21174optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and 211752000 series. 21176 21177With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of 21178the SPARC architecture. This adds the integer multiply, integer divide step 21179and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7. 21180With @option{-mcpu=f930}, the compiler additionally optimizes it for the 21181Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With 21182@option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu 21183MB86934 chip, which is the more recent SPARClite with FPU@. 21184 21185With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of 21186the SPARC architecture. This adds the integer multiply, multiply/accumulate, 21187integer divide step and scan (@code{ffs}) instructions which exist in SPARClet 21188but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally 21189optimizes it for the TEMIC SPARClet chip. 21190 21191With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC 21192architecture. This adds 64-bit integer and floating-point move instructions, 211933 additional floating-point condition code registers and conditional move 21194instructions. With @option{-mcpu=ultrasparc}, the compiler additionally 21195optimizes it for the Sun UltraSPARC I/II/IIi chips. With 21196@option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the 21197Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With 21198@option{-mcpu=niagara}, the compiler additionally optimizes it for 21199Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler 21200additionally optimizes it for Sun UltraSPARC T2 chips. With 21201@option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun 21202UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler 21203additionally optimizes it for Sun UltraSPARC T4 chips. 21204 21205@item -mtune=@var{cpu_type} 21206@opindex mtune 21207Set the instruction scheduling parameters for machine type 21208@var{cpu_type}, but do not set the instruction set or register set that the 21209option @option{-mcpu=@var{cpu_type}} does. 21210 21211The same values for @option{-mcpu=@var{cpu_type}} can be used for 21212@option{-mtune=@var{cpu_type}}, but the only useful values are those 21213that select a particular CPU implementation. Those are @samp{cypress}, 21214@samp{supersparc}, @samp{hypersparc}, @samp{leon}, @samp{leon3}, 21215@samp{leon3v7}, @samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{tsc701}, 21216@samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, 21217@samp{niagara3} and @samp{niagara4}. With native Solaris and GNU/Linux 21218toolchains, @samp{native} can also be used. 21219 21220@item -mv8plus 21221@itemx -mno-v8plus 21222@opindex mv8plus 21223@opindex mno-v8plus 21224With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The 21225difference from the V8 ABI is that the global and out registers are 21226considered 64 bits wide. This is enabled by default on Solaris in 32-bit 21227mode for all SPARC-V9 processors. 21228 21229@item -mvis 21230@itemx -mno-vis 21231@opindex mvis 21232@opindex mno-vis 21233With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC 21234Visual Instruction Set extensions. The default is @option{-mno-vis}. 21235 21236@item -mvis2 21237@itemx -mno-vis2 21238@opindex mvis2 21239@opindex mno-vis2 21240With @option{-mvis2}, GCC generates code that takes advantage of 21241version 2.0 of the UltraSPARC Visual Instruction Set extensions. The 21242default is @option{-mvis2} when targeting a cpu that supports such 21243instructions, such as UltraSPARC-III and later. Setting @option{-mvis2} 21244also sets @option{-mvis}. 21245 21246@item -mvis3 21247@itemx -mno-vis3 21248@opindex mvis3 21249@opindex mno-vis3 21250With @option{-mvis3}, GCC generates code that takes advantage of 21251version 3.0 of the UltraSPARC Visual Instruction Set extensions. The 21252default is @option{-mvis3} when targeting a cpu that supports such 21253instructions, such as niagara-3 and later. Setting @option{-mvis3} 21254also sets @option{-mvis2} and @option{-mvis}. 21255 21256@item -mcbcond 21257@itemx -mno-cbcond 21258@opindex mcbcond 21259@opindex mno-cbcond 21260With @option{-mcbcond}, GCC generates code that takes advantage of 21261compare-and-branch instructions, as defined in the Sparc Architecture 2011. 21262The default is @option{-mcbcond} when targeting a cpu that supports such 21263instructions, such as niagara-4 and later. 21264 21265@item -mpopc 21266@itemx -mno-popc 21267@opindex mpopc 21268@opindex mno-popc 21269With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC 21270population count instruction. The default is @option{-mpopc} 21271when targeting a cpu that supports such instructions, such as Niagara-2 and 21272later. 21273 21274@item -mfmaf 21275@itemx -mno-fmaf 21276@opindex mfmaf 21277@opindex mno-fmaf 21278With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC 21279Fused Multiply-Add Floating-point extensions. The default is @option{-mfmaf} 21280when targeting a cpu that supports such instructions, such as Niagara-3 and 21281later. 21282 21283@item -mfix-at697f 21284@opindex mfix-at697f 21285Enable the documented workaround for the single erratum of the Atmel AT697F 21286processor (which corresponds to erratum #13 of the AT697E processor). 21287 21288@item -mfix-ut699 21289@opindex mfix-ut699 21290Enable the documented workarounds for the floating-point errata and the data 21291cache nullify errata of the UT699 processor. 21292@end table 21293 21294These @samp{-m} options are supported in addition to the above 21295on SPARC-V9 processors in 64-bit environments: 21296 21297@table @gcctabopt 21298@item -m32 21299@itemx -m64 21300@opindex m32 21301@opindex m64 21302Generate code for a 32-bit or 64-bit environment. 21303The 32-bit environment sets int, long and pointer to 32 bits. 21304The 64-bit environment sets int to 32 bits and long and pointer 21305to 64 bits. 21306 21307@item -mcmodel=@var{which} 21308@opindex mcmodel 21309Set the code model to one of 21310 21311@table @samp 21312@item medlow 21313The Medium/Low code model: 64-bit addresses, programs 21314must be linked in the low 32 bits of memory. Programs can be statically 21315or dynamically linked. 21316 21317@item medmid 21318The Medium/Middle code model: 64-bit addresses, programs 21319must be linked in the low 44 bits of memory, the text and data segments must 21320be less than 2GB in size and the data segment must be located within 2GB of 21321the text segment. 21322 21323@item medany 21324The Medium/Anywhere code model: 64-bit addresses, programs 21325may be linked anywhere in memory, the text and data segments must be less 21326than 2GB in size and the data segment must be located within 2GB of the 21327text segment. 21328 21329@item embmedany 21330The Medium/Anywhere code model for embedded systems: 2133164-bit addresses, the text and data segments must be less than 2GB in 21332size, both starting anywhere in memory (determined at link time). The 21333global register %g4 points to the base of the data segment. Programs 21334are statically linked and PIC is not supported. 21335@end table 21336 21337@item -mmemory-model=@var{mem-model} 21338@opindex mmemory-model 21339Set the memory model in force on the processor to one of 21340 21341@table @samp 21342@item default 21343The default memory model for the processor and operating system. 21344 21345@item rmo 21346Relaxed Memory Order 21347 21348@item pso 21349Partial Store Order 21350 21351@item tso 21352Total Store Order 21353 21354@item sc 21355Sequential Consistency 21356@end table 21357 21358These memory models are formally defined in Appendix D of the Sparc V9 21359architecture manual, as set in the processor's @code{PSTATE.MM} field. 21360 21361@item -mstack-bias 21362@itemx -mno-stack-bias 21363@opindex mstack-bias 21364@opindex mno-stack-bias 21365With @option{-mstack-bias}, GCC assumes that the stack pointer, and 21366frame pointer if present, are offset by @minus{}2047 which must be added back 21367when making stack frame references. This is the default in 64-bit mode. 21368Otherwise, assume no such offset is present. 21369@end table 21370 21371@node SPU Options 21372@subsection SPU Options 21373@cindex SPU options 21374 21375These @samp{-m} options are supported on the SPU: 21376 21377@table @gcctabopt 21378@item -mwarn-reloc 21379@itemx -merror-reloc 21380@opindex mwarn-reloc 21381@opindex merror-reloc 21382 21383The loader for SPU does not handle dynamic relocations. By default, GCC 21384gives an error when it generates code that requires a dynamic 21385relocation. @option{-mno-error-reloc} disables the error, 21386@option{-mwarn-reloc} generates a warning instead. 21387 21388@item -msafe-dma 21389@itemx -munsafe-dma 21390@opindex msafe-dma 21391@opindex munsafe-dma 21392 21393Instructions that initiate or test completion of DMA must not be 21394reordered with respect to loads and stores of the memory that is being 21395accessed. 21396With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect 21397memory accesses, but that can lead to inefficient code in places where the 21398memory is known to not change. Rather than mark the memory as volatile, 21399you can use @option{-msafe-dma} to tell the compiler to treat 21400the DMA instructions as potentially affecting all memory. 21401 21402@item -mbranch-hints 21403@opindex mbranch-hints 21404 21405By default, GCC generates a branch hint instruction to avoid 21406pipeline stalls for always-taken or probably-taken branches. A hint 21407is not generated closer than 8 instructions away from its branch. 21408There is little reason to disable them, except for debugging purposes, 21409or to make an object a little bit smaller. 21410 21411@item -msmall-mem 21412@itemx -mlarge-mem 21413@opindex msmall-mem 21414@opindex mlarge-mem 21415 21416By default, GCC generates code assuming that addresses are never larger 21417than 18 bits. With @option{-mlarge-mem} code is generated that assumes 21418a full 32-bit address. 21419 21420@item -mstdmain 21421@opindex mstdmain 21422 21423By default, GCC links against startup code that assumes the SPU-style 21424main function interface (which has an unconventional parameter list). 21425With @option{-mstdmain}, GCC links your program against startup 21426code that assumes a C99-style interface to @code{main}, including a 21427local copy of @code{argv} strings. 21428 21429@item -mfixed-range=@var{register-range} 21430@opindex mfixed-range 21431Generate code treating the given register range as fixed registers. 21432A fixed register is one that the register allocator cannot use. This is 21433useful when compiling kernel code. A register range is specified as 21434two registers separated by a dash. Multiple register ranges can be 21435specified separated by a comma. 21436 21437@item -mea32 21438@itemx -mea64 21439@opindex mea32 21440@opindex mea64 21441Compile code assuming that pointers to the PPU address space accessed 21442via the @code{__ea} named address space qualifier are either 32 or 64 21443bits wide. The default is 32 bits. As this is an ABI-changing option, 21444all object code in an executable must be compiled with the same setting. 21445 21446@item -maddress-space-conversion 21447@itemx -mno-address-space-conversion 21448@opindex maddress-space-conversion 21449@opindex mno-address-space-conversion 21450Allow/disallow treating the @code{__ea} address space as superset 21451of the generic address space. This enables explicit type casts 21452between @code{__ea} and generic pointer as well as implicit 21453conversions of generic pointers to @code{__ea} pointers. The 21454default is to allow address space pointer conversions. 21455 21456@item -mcache-size=@var{cache-size} 21457@opindex mcache-size 21458This option controls the version of libgcc that the compiler links to an 21459executable and selects a software-managed cache for accessing variables 21460in the @code{__ea} address space with a particular cache size. Possible 21461options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64} 21462and @samp{128}. The default cache size is 64KB. 21463 21464@item -matomic-updates 21465@itemx -mno-atomic-updates 21466@opindex matomic-updates 21467@opindex mno-atomic-updates 21468This option controls the version of libgcc that the compiler links to an 21469executable and selects whether atomic updates to the software-managed 21470cache of PPU-side variables are used. If you use atomic updates, changes 21471to a PPU variable from SPU code using the @code{__ea} named address space 21472qualifier do not interfere with changes to other PPU variables residing 21473in the same cache line from PPU code. If you do not use atomic updates, 21474such interference may occur; however, writing back cache lines is 21475more efficient. The default behavior is to use atomic updates. 21476 21477@item -mdual-nops 21478@itemx -mdual-nops=@var{n} 21479@opindex mdual-nops 21480By default, GCC inserts nops to increase dual issue when it expects 21481it to increase performance. @var{n} can be a value from 0 to 10. A 21482smaller @var{n} inserts fewer nops. 10 is the default, 0 is the 21483same as @option{-mno-dual-nops}. Disabled with @option{-Os}. 21484 21485@item -mhint-max-nops=@var{n} 21486@opindex mhint-max-nops 21487Maximum number of nops to insert for a branch hint. A branch hint must 21488be at least 8 instructions away from the branch it is affecting. GCC 21489inserts up to @var{n} nops to enforce this, otherwise it does not 21490generate the branch hint. 21491 21492@item -mhint-max-distance=@var{n} 21493@opindex mhint-max-distance 21494The encoding of the branch hint instruction limits the hint to be within 21495256 instructions of the branch it is affecting. By default, GCC makes 21496sure it is within 125. 21497 21498@item -msafe-hints 21499@opindex msafe-hints 21500Work around a hardware bug that causes the SPU to stall indefinitely. 21501By default, GCC inserts the @code{hbrp} instruction to make sure 21502this stall won't happen. 21503 21504@end table 21505 21506@node System V Options 21507@subsection Options for System V 21508 21509These additional options are available on System V Release 4 for 21510compatibility with other compilers on those systems: 21511 21512@table @gcctabopt 21513@item -G 21514@opindex G 21515Create a shared object. 21516It is recommended that @option{-symbolic} or @option{-shared} be used instead. 21517 21518@item -Qy 21519@opindex Qy 21520Identify the versions of each tool used by the compiler, in a 21521@code{.ident} assembler directive in the output. 21522 21523@item -Qn 21524@opindex Qn 21525Refrain from adding @code{.ident} directives to the output file (this is 21526the default). 21527 21528@item -YP,@var{dirs} 21529@opindex YP 21530Search the directories @var{dirs}, and no others, for libraries 21531specified with @option{-l}. 21532 21533@item -Ym,@var{dir} 21534@opindex Ym 21535Look in the directory @var{dir} to find the M4 preprocessor. 21536The assembler uses this option. 21537@c This is supposed to go with a -Yd for predefined M4 macro files, but 21538@c the generic assembler that comes with Solaris takes just -Ym. 21539@end table 21540 21541@node TILE-Gx Options 21542@subsection TILE-Gx Options 21543@cindex TILE-Gx options 21544 21545These @samp{-m} options are supported on the TILE-Gx: 21546 21547@table @gcctabopt 21548@item -mcmodel=small 21549@opindex mcmodel=small 21550Generate code for the small model. The distance for direct calls is 21551limited to 500M in either direction. PC-relative addresses are 32 21552bits. Absolute addresses support the full address range. 21553 21554@item -mcmodel=large 21555@opindex mcmodel=large 21556Generate code for the large model. There is no limitation on call 21557distance, pc-relative addresses, or absolute addresses. 21558 21559@item -mcpu=@var{name} 21560@opindex mcpu 21561Selects the type of CPU to be targeted. Currently the only supported 21562type is @samp{tilegx}. 21563 21564@item -m32 21565@itemx -m64 21566@opindex m32 21567@opindex m64 21568Generate code for a 32-bit or 64-bit environment. The 32-bit 21569environment sets int, long, and pointer to 32 bits. The 64-bit 21570environment sets int to 32 bits and long and pointer to 64 bits. 21571 21572@item -mbig-endian 21573@itemx -mlittle-endian 21574@opindex mbig-endian 21575@opindex mlittle-endian 21576Generate code in big/little endian mode, respectively. 21577@end table 21578 21579@node TILEPro Options 21580@subsection TILEPro Options 21581@cindex TILEPro options 21582 21583These @samp{-m} options are supported on the TILEPro: 21584 21585@table @gcctabopt 21586@item -mcpu=@var{name} 21587@opindex mcpu 21588Selects the type of CPU to be targeted. Currently the only supported 21589type is @samp{tilepro}. 21590 21591@item -m32 21592@opindex m32 21593Generate code for a 32-bit environment, which sets int, long, and 21594pointer to 32 bits. This is the only supported behavior so the flag 21595is essentially ignored. 21596@end table 21597 21598@node V850 Options 21599@subsection V850 Options 21600@cindex V850 Options 21601 21602These @samp{-m} options are defined for V850 implementations: 21603 21604@table @gcctabopt 21605@item -mlong-calls 21606@itemx -mno-long-calls 21607@opindex mlong-calls 21608@opindex mno-long-calls 21609Treat all calls as being far away (near). If calls are assumed to be 21610far away, the compiler always loads the function's address into a 21611register, and calls indirect through the pointer. 21612 21613@item -mno-ep 21614@itemx -mep 21615@opindex mno-ep 21616@opindex mep 21617Do not optimize (do optimize) basic blocks that use the same index 21618pointer 4 or more times to copy pointer into the @code{ep} register, and 21619use the shorter @code{sld} and @code{sst} instructions. The @option{-mep} 21620option is on by default if you optimize. 21621 21622@item -mno-prolog-function 21623@itemx -mprolog-function 21624@opindex mno-prolog-function 21625@opindex mprolog-function 21626Do not use (do use) external functions to save and restore registers 21627at the prologue and epilogue of a function. The external functions 21628are slower, but use less code space if more than one function saves 21629the same number of registers. The @option{-mprolog-function} option 21630is on by default if you optimize. 21631 21632@item -mspace 21633@opindex mspace 21634Try to make the code as small as possible. At present, this just turns 21635on the @option{-mep} and @option{-mprolog-function} options. 21636 21637@item -mtda=@var{n} 21638@opindex mtda 21639Put static or global variables whose size is @var{n} bytes or less into 21640the tiny data area that register @code{ep} points to. The tiny data 21641area can hold up to 256 bytes in total (128 bytes for byte references). 21642 21643@item -msda=@var{n} 21644@opindex msda 21645Put static or global variables whose size is @var{n} bytes or less into 21646the small data area that register @code{gp} points to. The small data 21647area can hold up to 64 kilobytes. 21648 21649@item -mzda=@var{n} 21650@opindex mzda 21651Put static or global variables whose size is @var{n} bytes or less into 21652the first 32 kilobytes of memory. 21653 21654@item -mv850 21655@opindex mv850 21656Specify that the target processor is the V850. 21657 21658@item -mv850e3v5 21659@opindex mv850e3v5 21660Specify that the target processor is the V850E3V5. The preprocessor 21661constant @code{__v850e3v5__} is defined if this option is used. 21662 21663@item -mv850e2v4 21664@opindex mv850e2v4 21665Specify that the target processor is the V850E3V5. This is an alias for 21666the @option{-mv850e3v5} option. 21667 21668@item -mv850e2v3 21669@opindex mv850e2v3 21670Specify that the target processor is the V850E2V3. The preprocessor 21671constant @code{__v850e2v3__} is defined if this option is used. 21672 21673@item -mv850e2 21674@opindex mv850e2 21675Specify that the target processor is the V850E2. The preprocessor 21676constant @code{__v850e2__} is defined if this option is used. 21677 21678@item -mv850e1 21679@opindex mv850e1 21680Specify that the target processor is the V850E1. The preprocessor 21681constants @code{__v850e1__} and @code{__v850e__} are defined if 21682this option is used. 21683 21684@item -mv850es 21685@opindex mv850es 21686Specify that the target processor is the V850ES. This is an alias for 21687the @option{-mv850e1} option. 21688 21689@item -mv850e 21690@opindex mv850e 21691Specify that the target processor is the V850E@. The preprocessor 21692constant @code{__v850e__} is defined if this option is used. 21693 21694If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1} 21695nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5} 21696are defined then a default target processor is chosen and the 21697relevant @samp{__v850*__} preprocessor constant is defined. 21698 21699The preprocessor constants @code{__v850} and @code{__v851__} are always 21700defined, regardless of which processor variant is the target. 21701 21702@item -mdisable-callt 21703@itemx -mno-disable-callt 21704@opindex mdisable-callt 21705@opindex mno-disable-callt 21706This option suppresses generation of the @code{CALLT} instruction for the 21707v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850 21708architecture. 21709 21710This option is enabled by default when the RH850 ABI is 21711in use (see @option{-mrh850-abi}), and disabled by default when the 21712GCC ABI is in use. If @code{CALLT} instructions are being generated 21713then the C preprocessor symbol @code{__V850_CALLT__} is defined. 21714 21715@item -mrelax 21716@itemx -mno-relax 21717@opindex mrelax 21718@opindex mno-relax 21719Pass on (or do not pass on) the @option{-mrelax} command-line option 21720to the assembler. 21721 21722@item -mlong-jumps 21723@itemx -mno-long-jumps 21724@opindex mlong-jumps 21725@opindex mno-long-jumps 21726Disable (or re-enable) the generation of PC-relative jump instructions. 21727 21728@item -msoft-float 21729@itemx -mhard-float 21730@opindex msoft-float 21731@opindex mhard-float 21732Disable (or re-enable) the generation of hardware floating point 21733instructions. This option is only significant when the target 21734architecture is @samp{V850E2V3} or higher. If hardware floating point 21735instructions are being generated then the C preprocessor symbol 21736@code{__FPU_OK__} is defined, otherwise the symbol 21737@code{__NO_FPU__} is defined. 21738 21739@item -mloop 21740@opindex mloop 21741Enables the use of the e3v5 LOOP instruction. The use of this 21742instruction is not enabled by default when the e3v5 architecture is 21743selected because its use is still experimental. 21744 21745@item -mrh850-abi 21746@itemx -mghs 21747@opindex mrh850-abi 21748@opindex mghs 21749Enables support for the RH850 version of the V850 ABI. This is the 21750default. With this version of the ABI the following rules apply: 21751 21752@itemize 21753@item 21754Integer sized structures and unions are returned via a memory pointer 21755rather than a register. 21756 21757@item 21758Large structures and unions (more than 8 bytes in size) are passed by 21759value. 21760 21761@item 21762Functions are aligned to 16-bit boundaries. 21763 21764@item 21765The @option{-m8byte-align} command-line option is supported. 21766 21767@item 21768The @option{-mdisable-callt} command-line option is enabled by 21769default. The @option{-mno-disable-callt} command-line option is not 21770supported. 21771@end itemize 21772 21773When this version of the ABI is enabled the C preprocessor symbol 21774@code{__V850_RH850_ABI__} is defined. 21775 21776@item -mgcc-abi 21777@opindex mgcc-abi 21778Enables support for the old GCC version of the V850 ABI. With this 21779version of the ABI the following rules apply: 21780 21781@itemize 21782@item 21783Integer sized structures and unions are returned in register @code{r10}. 21784 21785@item 21786Large structures and unions (more than 8 bytes in size) are passed by 21787reference. 21788 21789@item 21790Functions are aligned to 32-bit boundaries, unless optimizing for 21791size. 21792 21793@item 21794The @option{-m8byte-align} command-line option is not supported. 21795 21796@item 21797The @option{-mdisable-callt} command-line option is supported but not 21798enabled by default. 21799@end itemize 21800 21801When this version of the ABI is enabled the C preprocessor symbol 21802@code{__V850_GCC_ABI__} is defined. 21803 21804@item -m8byte-align 21805@itemx -mno-8byte-align 21806@opindex m8byte-align 21807@opindex mno-8byte-align 21808Enables support for @code{double} and @code{long long} types to be 21809aligned on 8-byte boundaries. The default is to restrict the 21810alignment of all objects to at most 4-bytes. When 21811@option{-m8byte-align} is in effect the C preprocessor symbol 21812@code{__V850_8BYTE_ALIGN__} is defined. 21813 21814@item -mbig-switch 21815@opindex mbig-switch 21816Generate code suitable for big switch tables. Use this option only if 21817the assembler/linker complain about out of range branches within a switch 21818table. 21819 21820@item -mapp-regs 21821@opindex mapp-regs 21822This option causes r2 and r5 to be used in the code generated by 21823the compiler. This setting is the default. 21824 21825@item -mno-app-regs 21826@opindex mno-app-regs 21827This option causes r2 and r5 to be treated as fixed registers. 21828 21829@end table 21830 21831@node VAX Options 21832@subsection VAX Options 21833@cindex VAX options 21834 21835These @samp{-m} options are defined for the VAX: 21836 21837@table @gcctabopt 21838@item -munix 21839@opindex munix 21840Do not output certain jump instructions (@code{aobleq} and so on) 21841that the Unix assembler for the VAX cannot handle across long 21842ranges. 21843 21844@item -mgnu 21845@opindex mgnu 21846Do output those jump instructions, on the assumption that the 21847GNU assembler is being used. 21848 21849@item -mg 21850@opindex mg 21851Output code for G-format floating-point numbers instead of D-format. 21852@end table 21853 21854@node Visium Options 21855@subsection Visium Options 21856@cindex Visium options 21857 21858@table @gcctabopt 21859 21860@item -mdebug 21861@opindex mdebug 21862A program which performs file I/O and is destined to run on an MCM target 21863should be linked with this option. It causes the libraries libc.a and 21864libdebug.a to be linked. The program should be run on the target under 21865the control of the GDB remote debugging stub. 21866 21867@item -msim 21868@opindex msim 21869A program which performs file I/O and is destined to run on the simulator 21870should be linked with option. This causes libraries libc.a and libsim.a to 21871be linked. 21872 21873@item -mfpu 21874@itemx -mhard-float 21875@opindex mfpu 21876@opindex mhard-float 21877Generate code containing floating-point instructions. This is the 21878default. 21879 21880@item -mno-fpu 21881@itemx -msoft-float 21882@opindex mno-fpu 21883@opindex msoft-float 21884Generate code containing library calls for floating-point. 21885 21886@option{-msoft-float} changes the calling convention in the output file; 21887therefore, it is only useful if you compile @emph{all} of a program with 21888this option. In particular, you need to compile @file{libgcc.a}, the 21889library that comes with GCC, with @option{-msoft-float} in order for 21890this to work. 21891 21892@item -mcpu=@var{cpu_type} 21893@opindex mcpu 21894Set the instruction set, register set, and instruction scheduling parameters 21895for machine type @var{cpu_type}. Supported values for @var{cpu_type} are 21896@samp{mcm}, @samp{gr5} and @samp{gr6}. 21897 21898@samp{mcm} is a synonym of @samp{gr5} present for backward compatibility. 21899 21900By default (unless configured otherwise), GCC generates code for the GR5 21901variant of the Visium architecture. 21902 21903With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium 21904architecture. The only difference from GR5 code is that the compiler will 21905generate block move instructions. 21906 21907@item -mtune=@var{cpu_type} 21908@opindex mtune 21909Set the instruction scheduling parameters for machine type @var{cpu_type}, 21910but do not set the instruction set or register set that the option 21911@option{-mcpu=@var{cpu_type}} would. 21912 21913@item -msv-mode 21914@opindex msv-mode 21915Generate code for the supervisor mode, where there are no restrictions on 21916the access to general registers. This is the default. 21917 21918@item -muser-mode 21919@opindex muser-mode 21920Generate code for the user mode, where the access to some general registers 21921is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this 21922mode; on the GR6, only registers r29 to r31 are affected. 21923@end table 21924 21925@node VMS Options 21926@subsection VMS Options 21927 21928These @samp{-m} options are defined for the VMS implementations: 21929 21930@table @gcctabopt 21931@item -mvms-return-codes 21932@opindex mvms-return-codes 21933Return VMS condition codes from @code{main}. The default is to return POSIX-style 21934condition (e.g.@ error) codes. 21935 21936@item -mdebug-main=@var{prefix} 21937@opindex mdebug-main=@var{prefix} 21938Flag the first routine whose name starts with @var{prefix} as the main 21939routine for the debugger. 21940 21941@item -mmalloc64 21942@opindex mmalloc64 21943Default to 64-bit memory allocation routines. 21944 21945@item -mpointer-size=@var{size} 21946@opindex mpointer-size=@var{size} 21947Set the default size of pointers. Possible options for @var{size} are 21948@samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long} 21949for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers. 21950The later option disables @code{pragma pointer_size}. 21951@end table 21952 21953@node VxWorks Options 21954@subsection VxWorks Options 21955@cindex VxWorks Options 21956 21957The options in this section are defined for all VxWorks targets. 21958Options specific to the target hardware are listed with the other 21959options for that target. 21960 21961@table @gcctabopt 21962@item -mrtp 21963@opindex mrtp 21964GCC can generate code for both VxWorks kernels and real time processes 21965(RTPs). This option switches from the former to the latter. It also 21966defines the preprocessor macro @code{__RTP__}. 21967 21968@item -non-static 21969@opindex non-static 21970Link an RTP executable against shared libraries rather than static 21971libraries. The options @option{-static} and @option{-shared} can 21972also be used for RTPs (@pxref{Link Options}); @option{-static} 21973is the default. 21974 21975@item -Bstatic 21976@itemx -Bdynamic 21977@opindex Bstatic 21978@opindex Bdynamic 21979These options are passed down to the linker. They are defined for 21980compatibility with Diab. 21981 21982@item -Xbind-lazy 21983@opindex Xbind-lazy 21984Enable lazy binding of function calls. This option is equivalent to 21985@option{-Wl,-z,now} and is defined for compatibility with Diab. 21986 21987@item -Xbind-now 21988@opindex Xbind-now 21989Disable lazy binding of function calls. This option is the default and 21990is defined for compatibility with Diab. 21991@end table 21992 21993@node x86 Options 21994@subsection x86 Options 21995@cindex x86 Options 21996 21997These @samp{-m} options are defined for the x86 family of computers. 21998 21999@table @gcctabopt 22000 22001@item -march=@var{cpu-type} 22002@opindex march 22003Generate instructions for the machine type @var{cpu-type}. In contrast to 22004@option{-mtune=@var{cpu-type}}, which merely tunes the generated code 22005for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC 22006to generate code that may not run at all on processors other than the one 22007indicated. Specifying @option{-march=@var{cpu-type}} implies 22008@option{-mtune=@var{cpu-type}}. 22009 22010The choices for @var{cpu-type} are: 22011 22012@table @samp 22013@item native 22014This selects the CPU to generate code for at compilation time by determining 22015the processor type of the compiling machine. Using @option{-march=native} 22016enables all instruction subsets supported by the local machine (hence 22017the result might not run on different machines). Using @option{-mtune=native} 22018produces code optimized for the local machine under the constraints 22019of the selected instruction set. 22020 22021@item i386 22022Original Intel i386 CPU@. 22023 22024@item i486 22025Intel i486 CPU@. (No scheduling is implemented for this chip.) 22026 22027@item i586 22028@itemx pentium 22029Intel Pentium CPU with no MMX support. 22030 22031@item pentium-mmx 22032Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support. 22033 22034@item pentiumpro 22035Intel Pentium Pro CPU@. 22036 22037@item i686 22038When used with @option{-march}, the Pentium Pro 22039instruction set is used, so the code runs on all i686 family chips. 22040When used with @option{-mtune}, it has the same meaning as @samp{generic}. 22041 22042@item pentium2 22043Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set 22044support. 22045 22046@item pentium3 22047@itemx pentium3m 22048Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction 22049set support. 22050 22051@item pentium-m 22052Intel Pentium M; low-power version of Intel Pentium III CPU 22053with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks. 22054 22055@item pentium4 22056@itemx pentium4m 22057Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support. 22058 22059@item prescott 22060Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction 22061set support. 22062 22063@item nocona 22064Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE, 22065SSE2 and SSE3 instruction set support. 22066 22067@item core2 22068Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3 22069instruction set support. 22070 22071@item nehalem 22072Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, 22073SSE4.1, SSE4.2 and POPCNT instruction set support. 22074 22075@item westmere 22076Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, 22077SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support. 22078 22079@item sandybridge 22080Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, 22081SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support. 22082 22083@item ivybridge 22084Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, 22085SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C 22086instruction set support. 22087 22088@item haswell 22089Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 22090SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, 22091BMI, BMI2 and F16C instruction set support. 22092 22093@item broadwell 22094Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 22095SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, 22096BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support. 22097 22098@item bonnell 22099Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3 22100instruction set support. 22101 22102@item silvermont 22103Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, 22104SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support. 22105 22106@item knl 22107Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, 22108SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, 22109BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and 22110AVX512CD instruction set support. 22111 22112@item k6 22113AMD K6 CPU with MMX instruction set support. 22114 22115@item k6-2 22116@itemx k6-3 22117Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support. 22118 22119@item athlon 22120@itemx athlon-tbird 22121AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions 22122support. 22123 22124@item athlon-4 22125@itemx athlon-xp 22126@itemx athlon-mp 22127Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE 22128instruction set support. 22129 22130@item k8 22131@itemx opteron 22132@itemx athlon64 22133@itemx athlon-fx 22134Processors based on the AMD K8 core with x86-64 instruction set support, 22135including the AMD Opteron, Athlon 64, and Athlon 64 FX processors. 22136(This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit 22137instruction set extensions.) 22138 22139@item k8-sse3 22140@itemx opteron-sse3 22141@itemx athlon64-sse3 22142Improved versions of AMD K8 cores with SSE3 instruction set support. 22143 22144@item amdfam10 22145@itemx barcelona 22146CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This 22147supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit 22148instruction set extensions.) 22149 22150@item bdver1 22151CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This 22152supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, 22153SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.) 22154@item bdver2 22155AMD Family 15h core based CPUs with x86-64 instruction set support. (This 22156supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, 22157SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set 22158extensions.) 22159@item bdver3 22160AMD Family 15h core based CPUs with x86-64 instruction set support. (This 22161supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES, 22162PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 2216364-bit instruction set extensions. 22164@item bdver4 22165AMD Family 15h core based CPUs with x86-64 instruction set support. (This 22166supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP, 22167AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, 22168SSE4.2, ABM and 64-bit instruction set extensions. 22169 22170@item btver1 22171CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This 22172supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit 22173instruction set extensions.) 22174 22175@item btver2 22176CPUs based on AMD Family 16h cores with x86-64 instruction set support. This 22177includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM, 22178SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions. 22179 22180@item winchip-c6 22181IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction 22182set support. 22183 22184@item winchip2 22185IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@: 22186instruction set support. 22187 22188@item c3 22189VIA C3 CPU with MMX and 3DNow!@: instruction set support. (No scheduling is 22190implemented for this chip.) 22191 22192@item c3-2 22193VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support. 22194(No scheduling is 22195implemented for this chip.) 22196 22197@item geode 22198AMD Geode embedded processor with MMX and 3DNow!@: instruction set support. 22199@end table 22200 22201@item -mtune=@var{cpu-type} 22202@opindex mtune 22203Tune to @var{cpu-type} everything applicable about the generated code, except 22204for the ABI and the set of available instructions. 22205While picking a specific @var{cpu-type} schedules things appropriately 22206for that particular chip, the compiler does not generate any code that 22207cannot run on the default machine type unless you use a 22208@option{-march=@var{cpu-type}} option. 22209For example, if GCC is configured for i686-pc-linux-gnu 22210then @option{-mtune=pentium4} generates code that is tuned for Pentium 4 22211but still runs on i686 machines. 22212 22213The choices for @var{cpu-type} are the same as for @option{-march}. 22214In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}: 22215 22216@table @samp 22217@item generic 22218Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors. 22219If you know the CPU on which your code will run, then you should use 22220the corresponding @option{-mtune} or @option{-march} option instead of 22221@option{-mtune=generic}. But, if you do not know exactly what CPU users 22222of your application will have, then you should use this option. 22223 22224As new processors are deployed in the marketplace, the behavior of this 22225option will change. Therefore, if you upgrade to a newer version of 22226GCC, code generation controlled by this option will change to reflect 22227the processors 22228that are most common at the time that version of GCC is released. 22229 22230There is no @option{-march=generic} option because @option{-march} 22231indicates the instruction set the compiler can use, and there is no 22232generic instruction set applicable to all processors. In contrast, 22233@option{-mtune} indicates the processor (or, in this case, collection of 22234processors) for which the code is optimized. 22235 22236@item intel 22237Produce code optimized for the most current Intel processors, which are 22238Haswell and Silvermont for this version of GCC. If you know the CPU 22239on which your code will run, then you should use the corresponding 22240@option{-mtune} or @option{-march} option instead of @option{-mtune=intel}. 22241But, if you want your application performs better on both Haswell and 22242Silvermont, then you should use this option. 22243 22244As new Intel processors are deployed in the marketplace, the behavior of 22245this option will change. Therefore, if you upgrade to a newer version of 22246GCC, code generation controlled by this option will change to reflect 22247the most current Intel processors at the time that version of GCC is 22248released. 22249 22250There is no @option{-march=intel} option because @option{-march} indicates 22251the instruction set the compiler can use, and there is no common 22252instruction set applicable to all processors. In contrast, 22253@option{-mtune} indicates the processor (or, in this case, collection of 22254processors) for which the code is optimized. 22255@end table 22256 22257@item -mcpu=@var{cpu-type} 22258@opindex mcpu 22259A deprecated synonym for @option{-mtune}. 22260 22261@item -mfpmath=@var{unit} 22262@opindex mfpmath 22263Generate floating-point arithmetic for selected unit @var{unit}. The choices 22264for @var{unit} are: 22265 22266@table @samp 22267@item 387 22268Use the standard 387 floating-point coprocessor present on the majority of chips and 22269emulated otherwise. Code compiled with this option runs almost everywhere. 22270The temporary results are computed in 80-bit precision instead of the precision 22271specified by the type, resulting in slightly different results compared to most 22272of other chips. See @option{-ffloat-store} for more detailed description. 22273 22274This is the default choice for x86-32 targets. 22275 22276@item sse 22277Use scalar floating-point instructions present in the SSE instruction set. 22278This instruction set is supported by Pentium III and newer chips, 22279and in the AMD line 22280by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE 22281instruction set supports only single-precision arithmetic, thus the double and 22282extended-precision arithmetic are still done using 387. A later version, present 22283only in Pentium 4 and AMD x86-64 chips, supports double-precision 22284arithmetic too. 22285 22286For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse} 22287or @option{-msse2} switches to enable SSE extensions and make this option 22288effective. For the x86-64 compiler, these extensions are enabled by default. 22289 22290The resulting code should be considerably faster in the majority of cases and avoid 22291the numerical instability problems of 387 code, but may break some existing 22292code that expects temporaries to be 80 bits. 22293 22294This is the default choice for the x86-64 compiler. 22295 22296@item sse,387 22297@itemx sse+387 22298@itemx both 22299Attempt to utilize both instruction sets at once. This effectively doubles the 22300amount of available registers, and on chips with separate execution units for 22301387 and SSE the execution resources too. Use this option with care, as it is 22302still experimental, because the GCC register allocator does not model separate 22303functional units well, resulting in unstable performance. 22304@end table 22305 22306@item -masm=@var{dialect} 22307@opindex masm=@var{dialect} 22308Output assembly instructions using selected @var{dialect}. Also affects 22309which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and 22310extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect 22311order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does 22312not support @samp{intel}. 22313 22314@item -mieee-fp 22315@itemx -mno-ieee-fp 22316@opindex mieee-fp 22317@opindex mno-ieee-fp 22318Control whether or not the compiler uses IEEE floating-point 22319comparisons. These correctly handle the case where the result of a 22320comparison is unordered. 22321 22322@item -msoft-float 22323@opindex msoft-float 22324Generate output containing library calls for floating point. 22325 22326@strong{Warning:} the requisite libraries are not part of GCC@. 22327Normally the facilities of the machine's usual C compiler are used, but 22328this can't be done directly in cross-compilation. You must make your 22329own arrangements to provide suitable library functions for 22330cross-compilation. 22331 22332On machines where a function returns floating-point results in the 80387 22333register stack, some floating-point opcodes may be emitted even if 22334@option{-msoft-float} is used. 22335 22336@item -mno-fp-ret-in-387 22337@opindex mno-fp-ret-in-387 22338Do not use the FPU registers for return values of functions. 22339 22340The usual calling convention has functions return values of types 22341@code{float} and @code{double} in an FPU register, even if there 22342is no FPU@. The idea is that the operating system should emulate 22343an FPU@. 22344 22345The option @option{-mno-fp-ret-in-387} causes such values to be returned 22346in ordinary CPU registers instead. 22347 22348@item -mno-fancy-math-387 22349@opindex mno-fancy-math-387 22350Some 387 emulators do not support the @code{sin}, @code{cos} and 22351@code{sqrt} instructions for the 387. Specify this option to avoid 22352generating those instructions. This option is the default on 22353OpenBSD and NetBSD@. This option is overridden when @option{-march} 22354indicates that the target CPU always has an FPU and so the 22355instruction does not need emulation. These 22356instructions are not generated unless you also use the 22357@option{-funsafe-math-optimizations} switch. 22358 22359@item -malign-double 22360@itemx -mno-align-double 22361@opindex malign-double 22362@opindex mno-align-double 22363Control whether GCC aligns @code{double}, @code{long double}, and 22364@code{long long} variables on a two-word boundary or a one-word 22365boundary. Aligning @code{double} variables on a two-word boundary 22366produces code that runs somewhat faster on a Pentium at the 22367expense of more memory. 22368 22369On x86-64, @option{-malign-double} is enabled by default. 22370 22371@strong{Warning:} if you use the @option{-malign-double} switch, 22372structures containing the above types are aligned differently than 22373the published application binary interface specifications for the x86-32 22374and are not binary compatible with structures in code compiled 22375without that switch. 22376 22377@item -m96bit-long-double 22378@itemx -m128bit-long-double 22379@opindex m96bit-long-double 22380@opindex m128bit-long-double 22381These switches control the size of @code{long double} type. The x86-32 22382application binary interface specifies the size to be 96 bits, 22383so @option{-m96bit-long-double} is the default in 32-bit mode. 22384 22385Modern architectures (Pentium and newer) prefer @code{long double} 22386to be aligned to an 8- or 16-byte boundary. In arrays or structures 22387conforming to the ABI, this is not possible. So specifying 22388@option{-m128bit-long-double} aligns @code{long double} 22389to a 16-byte boundary by padding the @code{long double} with an additional 2239032-bit zero. 22391 22392In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as 22393its ABI specifies that @code{long double} is aligned on 16-byte boundary. 22394 22395Notice that neither of these options enable any extra precision over the x87 22396standard of 80 bits for a @code{long double}. 22397 22398@strong{Warning:} if you override the default value for your target ABI, this 22399changes the size of 22400structures and arrays containing @code{long double} variables, 22401as well as modifying the function calling convention for functions taking 22402@code{long double}. Hence they are not binary-compatible 22403with code compiled without that switch. 22404 22405@item -mlong-double-64 22406@itemx -mlong-double-80 22407@itemx -mlong-double-128 22408@opindex mlong-double-64 22409@opindex mlong-double-80 22410@opindex mlong-double-128 22411These switches control the size of @code{long double} type. A size 22412of 64 bits makes the @code{long double} type equivalent to the @code{double} 22413type. This is the default for 32-bit Bionic C library. A size 22414of 128 bits makes the @code{long double} type equivalent to the 22415@code{__float128} type. This is the default for 64-bit Bionic C library. 22416 22417@strong{Warning:} if you override the default value for your target ABI, this 22418changes the size of 22419structures and arrays containing @code{long double} variables, 22420as well as modifying the function calling convention for functions taking 22421@code{long double}. Hence they are not binary-compatible 22422with code compiled without that switch. 22423 22424@item -malign-data=@var{type} 22425@opindex malign-data 22426Control how GCC aligns variables. Supported values for @var{type} are 22427@samp{compat} uses increased alignment value compatible uses GCC 4.8 22428and earlier, @samp{abi} uses alignment value as specified by the 22429psABI, and @samp{cacheline} uses increased alignment value to match 22430the cache line size. @samp{compat} is the default. 22431 22432@item -mlarge-data-threshold=@var{threshold} 22433@opindex mlarge-data-threshold 22434When @option{-mcmodel=medium} is specified, data objects larger than 22435@var{threshold} are placed in the large data section. This value must be the 22436same across all objects linked into the binary, and defaults to 65535. 22437 22438@item -mrtd 22439@opindex mrtd 22440Use a different function-calling convention, in which functions that 22441take a fixed number of arguments return with the @code{ret @var{num}} 22442instruction, which pops their arguments while returning. This saves one 22443instruction in the caller since there is no need to pop the arguments 22444there. 22445 22446You can specify that an individual function is called with this calling 22447sequence with the function attribute @code{stdcall}. You can also 22448override the @option{-mrtd} option by using the function attribute 22449@code{cdecl}. @xref{Function Attributes}. 22450 22451@strong{Warning:} this calling convention is incompatible with the one 22452normally used on Unix, so you cannot use it if you need to call 22453libraries compiled with the Unix compiler. 22454 22455Also, you must provide function prototypes for all functions that 22456take variable numbers of arguments (including @code{printf}); 22457otherwise incorrect code is generated for calls to those 22458functions. 22459 22460In addition, seriously incorrect code results if you call a 22461function with too many arguments. (Normally, extra arguments are 22462harmlessly ignored.) 22463 22464@item -mregparm=@var{num} 22465@opindex mregparm 22466Control how many registers are used to pass integer arguments. By 22467default, no registers are used to pass arguments, and at most 3 22468registers can be used. You can control this behavior for a specific 22469function by using the function attribute @code{regparm}. 22470@xref{Function Attributes}. 22471 22472@strong{Warning:} if you use this switch, and 22473@var{num} is nonzero, then you must build all modules with the same 22474value, including any libraries. This includes the system libraries and 22475startup modules. 22476 22477@item -msseregparm 22478@opindex msseregparm 22479Use SSE register passing conventions for float and double arguments 22480and return values. You can control this behavior for a specific 22481function by using the function attribute @code{sseregparm}. 22482@xref{Function Attributes}. 22483 22484@strong{Warning:} if you use this switch then you must build all 22485modules with the same value, including any libraries. This includes 22486the system libraries and startup modules. 22487 22488@item -mvect8-ret-in-mem 22489@opindex mvect8-ret-in-mem 22490Return 8-byte vectors in memory instead of MMX registers. This is the 22491default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun 22492Studio compilers until version 12. Later compiler versions (starting 22493with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which 22494is the default on Solaris@tie{}10 and later. @emph{Only} use this option if 22495you need to remain compatible with existing code produced by those 22496previous compiler versions or older versions of GCC@. 22497 22498@item -mpc32 22499@itemx -mpc64 22500@itemx -mpc80 22501@opindex mpc32 22502@opindex mpc64 22503@opindex mpc80 22504 22505Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32} 22506is specified, the significands of results of floating-point operations are 22507rounded to 24 bits (single precision); @option{-mpc64} rounds the 22508significands of results of floating-point operations to 53 bits (double 22509precision) and @option{-mpc80} rounds the significands of results of 22510floating-point operations to 64 bits (extended double precision), which is 22511the default. When this option is used, floating-point operations in higher 22512precisions are not available to the programmer without setting the FPU 22513control word explicitly. 22514 22515Setting the rounding of floating-point operations to less than the default 2251680 bits can speed some programs by 2% or more. Note that some mathematical 22517libraries assume that extended-precision (80-bit) floating-point operations 22518are enabled by default; routines in such libraries could suffer significant 22519loss of accuracy, typically through so-called ``catastrophic cancellation'', 22520when this option is used to set the precision to less than extended precision. 22521 22522@item -mstackrealign 22523@opindex mstackrealign 22524Realign the stack at entry. On the x86, the @option{-mstackrealign} 22525option generates an alternate prologue and epilogue that realigns the 22526run-time stack if necessary. This supports mixing legacy codes that keep 225274-byte stack alignment with modern codes that keep 16-byte stack alignment for 22528SSE compatibility. See also the attribute @code{force_align_arg_pointer}, 22529applicable to individual functions. 22530 22531@item -mpreferred-stack-boundary=@var{num} 22532@opindex mpreferred-stack-boundary 22533Attempt to keep the stack boundary aligned to a 2 raised to @var{num} 22534byte boundary. If @option{-mpreferred-stack-boundary} is not specified, 22535the default is 4 (16 bytes or 128 bits). 22536 22537@strong{Warning:} When generating code for the x86-64 architecture with 22538SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be 22539used to keep the stack boundary aligned to 8 byte boundary. Since 22540x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and 22541intended to be used in controlled environment where stack space is 22542important limitation. This option leads to wrong code when functions 22543compiled with 16 byte stack alignment (such as functions from a standard 22544library) are called with misaligned stack. In this case, SSE 22545instructions may lead to misaligned memory access traps. In addition, 22546variable arguments are handled incorrectly for 16 byte aligned 22547objects (including x87 long double and __int128), leading to wrong 22548results. You must build all modules with 22549@option{-mpreferred-stack-boundary=3}, including any libraries. This 22550includes the system libraries and startup modules. 22551 22552@item -mincoming-stack-boundary=@var{num} 22553@opindex mincoming-stack-boundary 22554Assume the incoming stack is aligned to a 2 raised to @var{num} byte 22555boundary. If @option{-mincoming-stack-boundary} is not specified, 22556the one specified by @option{-mpreferred-stack-boundary} is used. 22557 22558On Pentium and Pentium Pro, @code{double} and @code{long double} values 22559should be aligned to an 8-byte boundary (see @option{-malign-double}) or 22560suffer significant run time performance penalties. On Pentium III, the 22561Streaming SIMD Extension (SSE) data type @code{__m128} may not work 22562properly if it is not 16-byte aligned. 22563 22564To ensure proper alignment of this values on the stack, the stack boundary 22565must be as aligned as that required by any value stored on the stack. 22566Further, every function must be generated such that it keeps the stack 22567aligned. Thus calling a function compiled with a higher preferred 22568stack boundary from a function compiled with a lower preferred stack 22569boundary most likely misaligns the stack. It is recommended that 22570libraries that use callbacks always use the default setting. 22571 22572This extra alignment does consume extra stack space, and generally 22573increases code size. Code that is sensitive to stack space usage, such 22574as embedded systems and operating system kernels, may want to reduce the 22575preferred alignment to @option{-mpreferred-stack-boundary=2}. 22576 22577@need 200 22578@item -mmmx 22579@opindex mmmx 22580@need 200 22581@itemx -msse 22582@opindex msse 22583@need 200 22584@itemx -msse2 22585@need 200 22586@itemx -msse3 22587@need 200 22588@itemx -mssse3 22589@need 200 22590@itemx -msse4 22591@need 200 22592@itemx -msse4a 22593@need 200 22594@itemx -msse4.1 22595@need 200 22596@itemx -msse4.2 22597@need 200 22598@itemx -mavx 22599@opindex mavx 22600@need 200 22601@itemx -mavx2 22602@need 200 22603@itemx -mavx512f 22604@need 200 22605@itemx -mavx512pf 22606@need 200 22607@itemx -mavx512er 22608@need 200 22609@itemx -mavx512cd 22610@need 200 22611@itemx -msha 22612@opindex msha 22613@need 200 22614@itemx -maes 22615@opindex maes 22616@need 200 22617@itemx -mpclmul 22618@opindex mpclmul 22619@need 200 22620@itemx -mclfushopt 22621@opindex mclfushopt 22622@need 200 22623@itemx -mfsgsbase 22624@opindex mfsgsbase 22625@need 200 22626@itemx -mrdrnd 22627@opindex mrdrnd 22628@need 200 22629@itemx -mf16c 22630@opindex mf16c 22631@need 200 22632@itemx -mfma 22633@opindex mfma 22634@need 200 22635@itemx -mfma4 22636@need 200 22637@itemx -mno-fma4 22638@need 200 22639@itemx -mprefetchwt1 22640@opindex mprefetchwt1 22641@need 200 22642@itemx -mxop 22643@opindex mxop 22644@need 200 22645@itemx -mlwp 22646@opindex mlwp 22647@need 200 22648@itemx -m3dnow 22649@opindex m3dnow 22650@need 200 22651@itemx -mpopcnt 22652@opindex mpopcnt 22653@need 200 22654@itemx -mabm 22655@opindex mabm 22656@need 200 22657@itemx -mbmi 22658@opindex mbmi 22659@need 200 22660@itemx -mbmi2 22661@need 200 22662@itemx -mlzcnt 22663@opindex mlzcnt 22664@need 200 22665@itemx -mfxsr 22666@opindex mfxsr 22667@need 200 22668@itemx -mxsave 22669@opindex mxsave 22670@need 200 22671@itemx -mxsaveopt 22672@opindex mxsaveopt 22673@need 200 22674@itemx -mxsavec 22675@opindex mxsavec 22676@need 200 22677@itemx -mxsaves 22678@opindex mxsaves 22679@need 200 22680@itemx -mrtm 22681@opindex mrtm 22682@need 200 22683@itemx -mtbm 22684@opindex mtbm 22685@need 200 22686@itemx -mmpx 22687@opindex mmpx 22688@need 200 22689@itemx -mmwaitx 22690@opindex mmwaitx 22691These switches enable the use of instructions in the MMX, SSE, 22692SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD, 22693SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM, 22694BMI, BMI2, FXSR, XSAVE, XSAVEOPT, LZCNT, RTM, MPX, MWAITX or 3DNow!@: 22695extended instruction sets. Each has a corresponding @option{-mno-} option 22696to disable use of these instructions. 22697 22698These extensions are also available as built-in functions: see 22699@ref{x86 Built-in Functions}, for details of the functions enabled and 22700disabled by these switches. 22701 22702To generate SSE/SSE2 instructions automatically from floating-point 22703code (as opposed to 387 instructions), see @option{-mfpmath=sse}. 22704 22705GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it 22706generates new AVX instructions or AVX equivalence for all SSEx instructions 22707when needed. 22708 22709These options enable GCC to use these extended instructions in 22710generated code, even without @option{-mfpmath=sse}. Applications that 22711perform run-time CPU detection must compile separate files for each 22712supported architecture, using the appropriate flags. In particular, 22713the file containing the CPU detection code should be compiled without 22714these options. 22715 22716@item -mdump-tune-features 22717@opindex mdump-tune-features 22718This option instructs GCC to dump the names of the x86 performance 22719tuning features and default settings. The names can be used in 22720@option{-mtune-ctrl=@var{feature-list}}. 22721 22722@item -mtune-ctrl=@var{feature-list} 22723@opindex mtune-ctrl=@var{feature-list} 22724This option is used to do fine grain control of x86 code generation features. 22725@var{feature-list} is a comma separated list of @var{feature} names. See also 22726@option{-mdump-tune-features}. When specified, the @var{feature} is turned 22727on if it is not preceded with @samp{^}, otherwise, it is turned off. 22728@option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC 22729developers. Using it may lead to code paths not covered by testing and can 22730potentially result in compiler ICEs or runtime errors. 22731 22732@item -mno-default 22733@opindex mno-default 22734This option instructs GCC to turn off all tunable features. See also 22735@option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}. 22736 22737@item -mcld 22738@opindex mcld 22739This option instructs GCC to emit a @code{cld} instruction in the prologue 22740of functions that use string instructions. String instructions depend on 22741the DF flag to select between autoincrement or autodecrement mode. While the 22742ABI specifies the DF flag to be cleared on function entry, some operating 22743systems violate this specification by not clearing the DF flag in their 22744exception dispatchers. The exception handler can be invoked with the DF flag 22745set, which leads to wrong direction mode when string instructions are used. 22746This option can be enabled by default on 32-bit x86 targets by configuring 22747GCC with the @option{--enable-cld} configure option. Generation of @code{cld} 22748instructions can be suppressed with the @option{-mno-cld} compiler option 22749in this case. 22750 22751@item -mvzeroupper 22752@opindex mvzeroupper 22753This option instructs GCC to emit a @code{vzeroupper} instruction 22754before a transfer of control flow out of the function to minimize 22755the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper} 22756intrinsics. 22757 22758@item -mprefer-avx128 22759@opindex mprefer-avx128 22760This option instructs GCC to use 128-bit AVX instructions instead of 22761256-bit AVX instructions in the auto-vectorizer. 22762 22763@item -mcx16 22764@opindex mcx16 22765This option enables GCC to generate @code{CMPXCHG16B} instructions. 22766@code{CMPXCHG16B} allows for atomic operations on 128-bit double quadword 22767(or oword) data types. 22768This is useful for high-resolution counters that can be updated 22769by multiple processors (or cores). This instruction is generated as part of 22770atomic built-in functions: see @ref{__sync Builtins} or 22771@ref{__atomic Builtins} for details. 22772 22773@item -msahf 22774@opindex msahf 22775This option enables generation of @code{SAHF} instructions in 64-bit code. 22776Early Intel Pentium 4 CPUs with Intel 64 support, 22777prior to the introduction of Pentium 4 G1 step in December 2005, 22778lacked the @code{LAHF} and @code{SAHF} instructions 22779which are supported by AMD64. 22780These are load and store instructions, respectively, for certain status flags. 22781In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod}, 22782@code{drem}, and @code{remainder} built-in functions; 22783see @ref{Other Builtins} for details. 22784 22785@item -mmovbe 22786@opindex mmovbe 22787This option enables use of the @code{movbe} instruction to implement 22788@code{__builtin_bswap32} and @code{__builtin_bswap64}. 22789 22790@item -mcrc32 22791@opindex mcrc32 22792This option enables built-in functions @code{__builtin_ia32_crc32qi}, 22793@code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and 22794@code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction. 22795 22796@item -mrecip 22797@opindex mrecip 22798This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions 22799(and their vectorized variants @code{RCPPS} and @code{RSQRTPS}) 22800with an additional Newton-Raphson step 22801to increase precision instead of @code{DIVSS} and @code{SQRTSS} 22802(and their vectorized 22803variants) for single-precision floating-point arguments. These instructions 22804are generated only when @option{-funsafe-math-optimizations} is enabled 22805together with @option{-finite-math-only} and @option{-fno-trapping-math}. 22806Note that while the throughput of the sequence is higher than the throughput 22807of the non-reciprocal instruction, the precision of the sequence can be 22808decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994). 22809 22810Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS} 22811(or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option 22812combination), and doesn't need @option{-mrecip}. 22813 22814Also note that GCC emits the above sequence with additional Newton-Raphson step 22815for vectorized single-float division and vectorized @code{sqrtf(@var{x})} 22816already with @option{-ffast-math} (or the above option combination), and 22817doesn't need @option{-mrecip}. 22818 22819@item -mrecip=@var{opt} 22820@opindex mrecip=opt 22821This option controls which reciprocal estimate instructions 22822may be used. @var{opt} is a comma-separated list of options, which may 22823be preceded by a @samp{!} to invert the option: 22824 22825@table @samp 22826@item all 22827Enable all estimate instructions. 22828 22829@item default 22830Enable the default instructions, equivalent to @option{-mrecip}. 22831 22832@item none 22833Disable all estimate instructions, equivalent to @option{-mno-recip}. 22834 22835@item div 22836Enable the approximation for scalar division. 22837 22838@item vec-div 22839Enable the approximation for vectorized division. 22840 22841@item sqrt 22842Enable the approximation for scalar square root. 22843 22844@item vec-sqrt 22845Enable the approximation for vectorized square root. 22846@end table 22847 22848So, for example, @option{-mrecip=all,!sqrt} enables 22849all of the reciprocal approximations, except for square root. 22850 22851@item -mveclibabi=@var{type} 22852@opindex mveclibabi 22853Specifies the ABI type to use for vectorizing intrinsics using an 22854external library. Supported values for @var{type} are @samp{svml} 22855for the Intel short 22856vector math library and @samp{acml} for the AMD math core library. 22857To use this option, both @option{-ftree-vectorize} and 22858@option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML 22859ABI-compatible library must be specified at link time. 22860 22861GCC currently emits calls to @code{vmldExp2}, 22862@code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2}, 22863@code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2}, 22864@code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2}, 22865@code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2}, 22866@code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104}, 22867@code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4}, 22868@code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4}, 22869@code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4}, 22870@code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding 22871function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin}, 22872@code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2}, 22873@code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf}, 22874@code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f}, 22875@code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type 22876when @option{-mveclibabi=acml} is used. 22877 22878@item -mabi=@var{name} 22879@opindex mabi 22880Generate code for the specified calling convention. Permissible values 22881are @samp{sysv} for the ABI used on GNU/Linux and other systems, and 22882@samp{ms} for the Microsoft ABI. The default is to use the Microsoft 22883ABI when targeting Microsoft Windows and the SysV ABI on all other systems. 22884You can control this behavior for specific functions by 22885using the function attributes @code{ms_abi} and @code{sysv_abi}. 22886@xref{Function Attributes}. 22887 22888@item -mtls-dialect=@var{type} 22889@opindex mtls-dialect 22890Generate code to access thread-local storage using the @samp{gnu} or 22891@samp{gnu2} conventions. @samp{gnu} is the conservative default; 22892@samp{gnu2} is more efficient, but it may add compile- and run-time 22893requirements that cannot be satisfied on all systems. 22894 22895@item -mpush-args 22896@itemx -mno-push-args 22897@opindex mpush-args 22898@opindex mno-push-args 22899Use PUSH operations to store outgoing parameters. This method is shorter 22900and usually equally fast as method using SUB/MOV operations and is enabled 22901by default. In some cases disabling it may improve performance because of 22902improved scheduling and reduced dependencies. 22903 22904@item -maccumulate-outgoing-args 22905@opindex maccumulate-outgoing-args 22906If enabled, the maximum amount of space required for outgoing arguments is 22907computed in the function prologue. This is faster on most modern CPUs 22908because of reduced dependencies, improved scheduling and reduced stack usage 22909when the preferred stack boundary is not equal to 2. The drawback is a notable 22910increase in code size. This switch implies @option{-mno-push-args}. 22911 22912@item -mthreads 22913@opindex mthreads 22914Support thread-safe exception handling on MinGW. Programs that rely 22915on thread-safe exception handling must compile and link all code with the 22916@option{-mthreads} option. When compiling, @option{-mthreads} defines 22917@option{-D_MT}; when linking, it links in a special thread helper library 22918@option{-lmingwthrd} which cleans up per-thread exception-handling data. 22919 22920@item -mno-align-stringops 22921@opindex mno-align-stringops 22922Do not align the destination of inlined string operations. This switch reduces 22923code size and improves performance in case the destination is already aligned, 22924but GCC doesn't know about it. 22925 22926@item -minline-all-stringops 22927@opindex minline-all-stringops 22928By default GCC inlines string operations only when the destination is 22929known to be aligned to least a 4-byte boundary. 22930This enables more inlining and increases code 22931size, but may improve performance of code that depends on fast 22932@code{memcpy}, @code{strlen}, 22933and @code{memset} for short lengths. 22934 22935@item -minline-stringops-dynamically 22936@opindex minline-stringops-dynamically 22937For string operations of unknown size, use run-time checks with 22938inline code for small blocks and a library call for large blocks. 22939 22940@item -mstringop-strategy=@var{alg} 22941@opindex mstringop-strategy=@var{alg} 22942Override the internal decision heuristic for the particular algorithm to use 22943for inlining string operations. The allowed values for @var{alg} are: 22944 22945@table @samp 22946@item rep_byte 22947@itemx rep_4byte 22948@itemx rep_8byte 22949Expand using i386 @code{rep} prefix of the specified size. 22950 22951@item byte_loop 22952@itemx loop 22953@itemx unrolled_loop 22954Expand into an inline loop. 22955 22956@item libcall 22957Always use a library call. 22958@end table 22959 22960@item -mmemcpy-strategy=@var{strategy} 22961@opindex mmemcpy-strategy=@var{strategy} 22962Override the internal decision heuristic to decide if @code{__builtin_memcpy} 22963should be inlined and what inline algorithm to use when the expected size 22964of the copy operation is known. @var{strategy} 22965is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets. 22966@var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies 22967the max byte size with which inline algorithm @var{alg} is allowed. For the last 22968triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets 22969in the list must be specified in increasing order. The minimal byte size for 22970@var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the 22971preceding range. 22972 22973@item -mmemset-strategy=@var{strategy} 22974@opindex mmemset-strategy=@var{strategy} 22975The option is similar to @option{-mmemcpy-strategy=} except that it is to control 22976@code{__builtin_memset} expansion. 22977 22978@item -momit-leaf-frame-pointer 22979@opindex momit-leaf-frame-pointer 22980Don't keep the frame pointer in a register for leaf functions. This 22981avoids the instructions to save, set up, and restore frame pointers and 22982makes an extra register available in leaf functions. The option 22983@option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions, 22984which might make debugging harder. 22985 22986@item -mtls-direct-seg-refs 22987@itemx -mno-tls-direct-seg-refs 22988@opindex mtls-direct-seg-refs 22989Controls whether TLS variables may be accessed with offsets from the 22990TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit), 22991or whether the thread base pointer must be added. Whether or not this 22992is valid depends on the operating system, and whether it maps the 22993segment to cover the entire TLS area. 22994 22995For systems that use the GNU C Library, the default is on. 22996 22997@item -msse2avx 22998@itemx -mno-sse2avx 22999@opindex msse2avx 23000Specify that the assembler should encode SSE instructions with VEX 23001prefix. The option @option{-mavx} turns this on by default. 23002 23003@item -mfentry 23004@itemx -mno-fentry 23005@opindex mfentry 23006If profiling is active (@option{-pg}), put the profiling 23007counter call before the prologue. 23008Note: On x86 architectures the attribute @code{ms_hook_prologue} 23009isn't possible at the moment for @option{-mfentry} and @option{-pg}. 23010 23011@item -mrecord-mcount 23012@itemx -mno-record-mcount 23013@opindex mrecord-mcount 23014If profiling is active (@option{-pg}), generate a __mcount_loc section 23015that contains pointers to each profiling call. This is useful for 23016automatically patching and out calls. 23017 23018@item -mnop-mcount 23019@itemx -mno-nop-mcount 23020@opindex mnop-mcount 23021If profiling is active (@option{-pg}), generate the calls to 23022the profiling functions as nops. This is useful when they 23023should be patched in later dynamically. This is likely only 23024useful together with @option{-mrecord-mcount}. 23025 23026@item -mskip-rax-setup 23027@itemx -mno-skip-rax-setup 23028@opindex mskip-rax-setup 23029When generating code for the x86-64 architecture with SSE extensions 23030disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX 23031register when there are no variable arguments passed in vector registers. 23032 23033@strong{Warning:} Since RAX register is used to avoid unnecessarily 23034saving vector registers on stack when passing variable arguments, the 23035impacts of this option are callees may waste some stack space, 23036misbehave or jump to a random location. GCC 4.4 or newer don't have 23037those issues, regardless the RAX register value. 23038 23039@item -m8bit-idiv 23040@itemx -mno-8bit-idiv 23041@opindex m8bit-idiv 23042On some processors, like Intel Atom, 8-bit unsigned integer divide is 23043much faster than 32-bit/64-bit integer divide. This option generates a 23044run-time check. If both dividend and divisor are within range of 0 23045to 255, 8-bit unsigned integer divide is used instead of 2304632-bit/64-bit integer divide. 23047 23048@item -mavx256-split-unaligned-load 23049@itemx -mavx256-split-unaligned-store 23050@opindex mavx256-split-unaligned-load 23051@opindex mavx256-split-unaligned-store 23052Split 32-byte AVX unaligned load and store. 23053 23054@item -mstack-protector-guard=@var{guard} 23055@opindex mstack-protector-guard=@var{guard} 23056Generate stack protection code using canary at @var{guard}. Supported 23057locations are @samp{global} for global canary or @samp{tls} for per-thread 23058canary in the TLS block (the default). This option has effect only when 23059@option{-fstack-protector} or @option{-fstack-protector-all} is specified. 23060 23061@end table 23062 23063These @samp{-m} switches are supported in addition to the above 23064on x86-64 processors in 64-bit environments. 23065 23066@table @gcctabopt 23067@item -m32 23068@itemx -m64 23069@itemx -mx32 23070@itemx -m16 23071@opindex m32 23072@opindex m64 23073@opindex mx32 23074@opindex m16 23075Generate code for a 16-bit, 32-bit or 64-bit environment. 23076The @option{-m32} option sets @code{int}, @code{long}, and pointer types 23077to 32 bits, and 23078generates code that runs on any i386 system. 23079 23080The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer 23081types to 64 bits, and generates code for the x86-64 architecture. 23082For Darwin only the @option{-m64} option also turns off the @option{-fno-pic} 23083and @option{-mdynamic-no-pic} options. 23084 23085The @option{-mx32} option sets @code{int}, @code{long}, and pointer types 23086to 32 bits, and 23087generates code for the x86-64 architecture. 23088 23089The @option{-m16} option is the same as @option{-m32}, except for that 23090it outputs the @code{.code16gcc} assembly directive at the beginning of 23091the assembly output so that the binary can run in 16-bit mode. 23092 23093@item -mno-red-zone 23094@opindex mno-red-zone 23095Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated 23096by the x86-64 ABI; it is a 128-byte area beyond the location of the 23097stack pointer that is not modified by signal or interrupt handlers 23098and therefore can be used for temporary data without adjusting the stack 23099pointer. The flag @option{-mno-red-zone} disables this red zone. 23100 23101@item -mcmodel=small 23102@opindex mcmodel=small 23103Generate code for the small code model: the program and its symbols must 23104be linked in the lower 2 GB of the address space. Pointers are 64 bits. 23105Programs can be statically or dynamically linked. This is the default 23106code model. 23107 23108@item -mcmodel=kernel 23109@opindex mcmodel=kernel 23110Generate code for the kernel code model. The kernel runs in the 23111negative 2 GB of the address space. 23112This model has to be used for Linux kernel code. 23113 23114@item -mcmodel=medium 23115@opindex mcmodel=medium 23116Generate code for the medium model: the program is linked in the lower 2 23117GB of the address space. Small symbols are also placed there. Symbols 23118with sizes larger than @option{-mlarge-data-threshold} are put into 23119large data or BSS sections and can be located above 2GB. Programs can 23120be statically or dynamically linked. 23121 23122@item -mcmodel=large 23123@opindex mcmodel=large 23124Generate code for the large model. This model makes no assumptions 23125about addresses and sizes of sections. 23126 23127@item -maddress-mode=long 23128@opindex maddress-mode=long 23129Generate code for long address mode. This is only supported for 64-bit 23130and x32 environments. It is the default address mode for 64-bit 23131environments. 23132 23133@item -maddress-mode=short 23134@opindex maddress-mode=short 23135Generate code for short address mode. This is only supported for 32-bit 23136and x32 environments. It is the default address mode for 32-bit and 23137x32 environments. 23138@end table 23139 23140@node x86 Windows Options 23141@subsection x86 Windows Options 23142@cindex x86 Windows Options 23143@cindex Windows Options for x86 23144 23145These additional options are available for Microsoft Windows targets: 23146 23147@table @gcctabopt 23148@item -mconsole 23149@opindex mconsole 23150This option 23151specifies that a console application is to be generated, by 23152instructing the linker to set the PE header subsystem type 23153required for console applications. 23154This option is available for Cygwin and MinGW targets and is 23155enabled by default on those targets. 23156 23157@item -mdll 23158@opindex mdll 23159This option is available for Cygwin and MinGW targets. It 23160specifies that a DLL---a dynamic link library---is to be 23161generated, enabling the selection of the required runtime 23162startup object and entry point. 23163 23164@item -mnop-fun-dllimport 23165@opindex mnop-fun-dllimport 23166This option is available for Cygwin and MinGW targets. It 23167specifies that the @code{dllimport} attribute should be ignored. 23168 23169@item -mthread 23170@opindex mthread 23171This option is available for MinGW targets. It specifies 23172that MinGW-specific thread support is to be used. 23173 23174@item -municode 23175@opindex municode 23176This option is available for MinGW-w64 targets. It causes 23177the @code{UNICODE} preprocessor macro to be predefined, and 23178chooses Unicode-capable runtime startup code. 23179 23180@item -mwin32 23181@opindex mwin32 23182This option is available for Cygwin and MinGW targets. It 23183specifies that the typical Microsoft Windows predefined macros are to 23184be set in the pre-processor, but does not influence the choice 23185of runtime library/startup code. 23186 23187@item -mwindows 23188@opindex mwindows 23189This option is available for Cygwin and MinGW targets. It 23190specifies that a GUI application is to be generated by 23191instructing the linker to set the PE header subsystem type 23192appropriately. 23193 23194@item -fno-set-stack-executable 23195@opindex fno-set-stack-executable 23196This option is available for MinGW targets. It specifies that 23197the executable flag for the stack used by nested functions isn't 23198set. This is necessary for binaries running in kernel mode of 23199Microsoft Windows, as there the User32 API, which is used to set executable 23200privileges, isn't available. 23201 23202@item -fwritable-relocated-rdata 23203@opindex fno-writable-relocated-rdata 23204This option is available for MinGW and Cygwin targets. It specifies 23205that relocated-data in read-only section is put into .data 23206section. This is a necessary for older runtimes not supporting 23207modification of .rdata sections for pseudo-relocation. 23208 23209@item -mpe-aligned-commons 23210@opindex mpe-aligned-commons 23211This option is available for Cygwin and MinGW targets. It 23212specifies that the GNU extension to the PE file format that 23213permits the correct alignment of COMMON variables should be 23214used when generating code. It is enabled by default if 23215GCC detects that the target assembler found during configuration 23216supports the feature. 23217 23218@item -mindirect-branch=@var{choice} 23219@opindex -mindirect-branch 23220Convert indirect call and jump with @var{choice}. The default is 23221@samp{keep}, which keeps indirect call and jump unmodified. 23222@samp{thunk} converts indirect call and jump to call and return thunk. 23223@samp{thunk-inline} converts indirect call and jump to inlined call 23224and return thunk. @samp{thunk-extern} converts indirect call and jump 23225to external call and return thunk provided in a separate object file. 23226You can control this behavior for a specific function by using the 23227function attribute @code{indirect_branch}. @xref{Function Attributes}. 23228 23229Note that @option{-mcmodel=large} is incompatible with 23230@option{-mindirect-branch=thunk} nor 23231@option{-mindirect-branch=thunk-extern} since the thunk function may 23232not be reachable in large code model. 23233 23234@item -mfunction-return=@var{choice} 23235@opindex -mfunction-return 23236Convert function return with @var{choice}. The default is @samp{keep}, 23237which keeps function return unmodified. @samp{thunk} converts function 23238return to call and return thunk. @samp{thunk-inline} converts function 23239return to inlined call and return thunk. @samp{thunk-extern} converts 23240function return to external call and return thunk provided in a separate 23241object file. You can control this behavior for a specific function by 23242using the function attribute @code{function_return}. 23243@xref{Function Attributes}. 23244 23245Note that @option{-mcmodel=large} is incompatible with 23246@option{-mfunction-return=thunk} nor 23247@option{-mfunction-return=thunk-extern} since the thunk function may 23248not be reachable in large code model. 23249 23250@item -mindirect-branch-register 23251@opindex -mindirect-branch-register 23252Force indirect call and jump via register. 23253@end table 23254 23255See also under @ref{x86 Options} for standard options. 23256 23257@node Xstormy16 Options 23258@subsection Xstormy16 Options 23259@cindex Xstormy16 Options 23260 23261These options are defined for Xstormy16: 23262 23263@table @gcctabopt 23264@item -msim 23265@opindex msim 23266Choose startup files and linker script suitable for the simulator. 23267@end table 23268 23269@node Xtensa Options 23270@subsection Xtensa Options 23271@cindex Xtensa Options 23272 23273These options are supported for Xtensa targets: 23274 23275@table @gcctabopt 23276@item -mconst16 23277@itemx -mno-const16 23278@opindex mconst16 23279@opindex mno-const16 23280Enable or disable use of @code{CONST16} instructions for loading 23281constant values. The @code{CONST16} instruction is currently not a 23282standard option from Tensilica. When enabled, @code{CONST16} 23283instructions are always used in place of the standard @code{L32R} 23284instructions. The use of @code{CONST16} is enabled by default only if 23285the @code{L32R} instruction is not available. 23286 23287@item -mfused-madd 23288@itemx -mno-fused-madd 23289@opindex mfused-madd 23290@opindex mno-fused-madd 23291Enable or disable use of fused multiply/add and multiply/subtract 23292instructions in the floating-point option. This has no effect if the 23293floating-point option is not also enabled. Disabling fused multiply/add 23294and multiply/subtract instructions forces the compiler to use separate 23295instructions for the multiply and add/subtract operations. This may be 23296desirable in some cases where strict IEEE 754-compliant results are 23297required: the fused multiply add/subtract instructions do not round the 23298intermediate result, thereby producing results with @emph{more} bits of 23299precision than specified by the IEEE standard. Disabling fused multiply 23300add/subtract instructions also ensures that the program output is not 23301sensitive to the compiler's ability to combine multiply and add/subtract 23302operations. 23303 23304@item -mserialize-volatile 23305@itemx -mno-serialize-volatile 23306@opindex mserialize-volatile 23307@opindex mno-serialize-volatile 23308When this option is enabled, GCC inserts @code{MEMW} instructions before 23309@code{volatile} memory references to guarantee sequential consistency. 23310The default is @option{-mserialize-volatile}. Use 23311@option{-mno-serialize-volatile} to omit the @code{MEMW} instructions. 23312 23313@item -mforce-no-pic 23314@opindex mforce-no-pic 23315For targets, like GNU/Linux, where all user-mode Xtensa code must be 23316position-independent code (PIC), this option disables PIC for compiling 23317kernel code. 23318 23319@item -mtext-section-literals 23320@itemx -mno-text-section-literals 23321@opindex mtext-section-literals 23322@opindex mno-text-section-literals 23323These options control the treatment of literal pools. The default is 23324@option{-mno-text-section-literals}, which places literals in a separate 23325section in the output file. This allows the literal pool to be placed 23326in a data RAM/ROM, and it also allows the linker to combine literal 23327pools from separate object files to remove redundant literals and 23328improve code size. With @option{-mtext-section-literals}, the literals 23329are interspersed in the text section in order to keep them as close as 23330possible to their references. This may be necessary for large assembly 23331files. 23332 23333@item -mtarget-align 23334@itemx -mno-target-align 23335@opindex mtarget-align 23336@opindex mno-target-align 23337When this option is enabled, GCC instructs the assembler to 23338automatically align instructions to reduce branch penalties at the 23339expense of some code density. The assembler attempts to widen density 23340instructions to align branch targets and the instructions following call 23341instructions. If there are not enough preceding safe density 23342instructions to align a target, no widening is performed. The 23343default is @option{-mtarget-align}. These options do not affect the 23344treatment of auto-aligned instructions like @code{LOOP}, which the 23345assembler always aligns, either by widening density instructions or 23346by inserting NOP instructions. 23347 23348@item -mlongcalls 23349@itemx -mno-longcalls 23350@opindex mlongcalls 23351@opindex mno-longcalls 23352When this option is enabled, GCC instructs the assembler to translate 23353direct calls to indirect calls unless it can determine that the target 23354of a direct call is in the range allowed by the call instruction. This 23355translation typically occurs for calls to functions in other source 23356files. Specifically, the assembler translates a direct @code{CALL} 23357instruction into an @code{L32R} followed by a @code{CALLX} instruction. 23358The default is @option{-mno-longcalls}. This option should be used in 23359programs where the call target can potentially be out of range. This 23360option is implemented in the assembler, not the compiler, so the 23361assembly code generated by GCC still shows direct call 23362instructions---look at the disassembled object code to see the actual 23363instructions. Note that the assembler uses an indirect call for 23364every cross-file call, not just those that really are out of range. 23365@end table 23366 23367@node zSeries Options 23368@subsection zSeries Options 23369@cindex zSeries options 23370 23371These are listed under @xref{S/390 and zSeries Options}. 23372 23373@node Code Gen Options 23374@section Options for Code Generation Conventions 23375@cindex code generation conventions 23376@cindex options, code generation 23377@cindex run-time options 23378 23379These machine-independent options control the interface conventions 23380used in code generation. 23381 23382Most of them have both positive and negative forms; the negative form 23383of @option{-ffoo} is @option{-fno-foo}. In the table below, only 23384one of the forms is listed---the one that is not the default. You 23385can figure out the other form by either removing @samp{no-} or adding 23386it. 23387 23388@table @gcctabopt 23389@item -fbounds-check 23390@opindex fbounds-check 23391For front ends that support it, generate additional code to check that 23392indices used to access arrays are within the declared range. This is 23393currently only supported by the Java and Fortran front ends, where 23394this option defaults to true and false respectively. 23395 23396@item -fstack-reuse=@var{reuse-level} 23397@opindex fstack_reuse 23398This option controls stack space reuse for user declared local/auto variables 23399and compiler generated temporaries. @var{reuse_level} can be @samp{all}, 23400@samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all 23401local variables and temporaries, @samp{named_vars} enables the reuse only for 23402user defined local variables with names, and @samp{none} disables stack reuse 23403completely. The default value is @samp{all}. The option is needed when the 23404program extends the lifetime of a scoped local variable or a compiler generated 23405temporary beyond the end point defined by the language. When a lifetime of 23406a variable ends, and if the variable lives in memory, the optimizing compiler 23407has the freedom to reuse its stack space with other temporaries or scoped 23408local variables whose live range does not overlap with it. Legacy code extending 23409local lifetime is likely to break with the stack reuse optimization. 23410 23411For example, 23412 23413@smallexample 23414 int *p; 23415 @{ 23416 int local1; 23417 23418 p = &local1; 23419 local1 = 10; 23420 .... 23421 @} 23422 @{ 23423 int local2; 23424 local2 = 20; 23425 ... 23426 @} 23427 23428 if (*p == 10) // out of scope use of local1 23429 @{ 23430 23431 @} 23432@end smallexample 23433 23434Another example: 23435@smallexample 23436 23437 struct A 23438 @{ 23439 A(int k) : i(k), j(k) @{ @} 23440 int i; 23441 int j; 23442 @}; 23443 23444 A *ap; 23445 23446 void foo(const A& ar) 23447 @{ 23448 ap = &ar; 23449 @} 23450 23451 void bar() 23452 @{ 23453 foo(A(10)); // temp object's lifetime ends when foo returns 23454 23455 @{ 23456 A a(20); 23457 .... 23458 @} 23459 ap->i+= 10; // ap references out of scope temp whose space 23460 // is reused with a. What is the value of ap->i? 23461 @} 23462 23463@end smallexample 23464 23465The lifetime of a compiler generated temporary is well defined by the C++ 23466standard. When a lifetime of a temporary ends, and if the temporary lives 23467in memory, the optimizing compiler has the freedom to reuse its stack 23468space with other temporaries or scoped local variables whose live range 23469does not overlap with it. However some of the legacy code relies on 23470the behavior of older compilers in which temporaries' stack space is 23471not reused, the aggressive stack reuse can lead to runtime errors. This 23472option is used to control the temporary stack reuse optimization. 23473 23474@item -ftrapv 23475@opindex ftrapv 23476This option generates traps for signed overflow on addition, subtraction, 23477multiplication operations. 23478 23479@item -fwrapv 23480@opindex fwrapv 23481This option instructs the compiler to assume that signed arithmetic 23482overflow of addition, subtraction and multiplication wraps around 23483using twos-complement representation. This flag enables some optimizations 23484and disables others. This option is enabled by default for the Java 23485front end, as required by the Java language specification. 23486 23487@item -fexceptions 23488@opindex fexceptions 23489Enable exception handling. Generates extra code needed to propagate 23490exceptions. For some targets, this implies GCC generates frame 23491unwind information for all functions, which can produce significant data 23492size overhead, although it does not affect execution. If you do not 23493specify this option, GCC enables it by default for languages like 23494C++ that normally require exception handling, and disables it for 23495languages like C that do not normally require it. However, you may need 23496to enable this option when compiling C code that needs to interoperate 23497properly with exception handlers written in C++. You may also wish to 23498disable this option if you are compiling older C++ programs that don't 23499use exception handling. 23500 23501@item -fnon-call-exceptions 23502@opindex fnon-call-exceptions 23503Generate code that allows trapping instructions to throw exceptions. 23504Note that this requires platform-specific runtime support that does 23505not exist everywhere. Moreover, it only allows @emph{trapping} 23506instructions to throw exceptions, i.e.@: memory references or floating-point 23507instructions. It does not allow exceptions to be thrown from 23508arbitrary signal handlers such as @code{SIGALRM}. 23509 23510@item -fdelete-dead-exceptions 23511@opindex fdelete-dead-exceptions 23512Consider that instructions that may throw exceptions but don't otherwise 23513contribute to the execution of the program can be optimized away. 23514This option is enabled by default for the Ada front end, as permitted by 23515the Ada language specification. 23516Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels. 23517 23518@item -funwind-tables 23519@opindex funwind-tables 23520Similar to @option{-fexceptions}, except that it just generates any needed 23521static data, but does not affect the generated code in any other way. 23522You normally do not need to enable this option; instead, a language processor 23523that needs this handling enables it on your behalf. 23524 23525@item -fasynchronous-unwind-tables 23526@opindex fasynchronous-unwind-tables 23527Generate unwind table in DWARF 2 format, if supported by target machine. The 23528table is exact at each instruction boundary, so it can be used for stack 23529unwinding from asynchronous events (such as debugger or garbage collector). 23530 23531@item -fno-gnu-unique 23532@opindex fno-gnu-unique 23533On systems with recent GNU assembler and C library, the C++ compiler 23534uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions 23535of template static data members and static local variables in inline 23536functions are unique even in the presence of @code{RTLD_LOCAL}; this 23537is necessary to avoid problems with a library used by two different 23538@code{RTLD_LOCAL} plugins depending on a definition in one of them and 23539therefore disagreeing with the other one about the binding of the 23540symbol. But this causes @code{dlclose} to be ignored for affected 23541DSOs; if your program relies on reinitialization of a DSO via 23542@code{dlclose} and @code{dlopen}, you can use 23543@option{-fno-gnu-unique}. 23544 23545@item -fpcc-struct-return 23546@opindex fpcc-struct-return 23547Return ``short'' @code{struct} and @code{union} values in memory like 23548longer ones, rather than in registers. This convention is less 23549efficient, but it has the advantage of allowing intercallability between 23550GCC-compiled files and files compiled with other compilers, particularly 23551the Portable C Compiler (pcc). 23552 23553The precise convention for returning structures in memory depends 23554on the target configuration macros. 23555 23556Short structures and unions are those whose size and alignment match 23557that of some integer type. 23558 23559@strong{Warning:} code compiled with the @option{-fpcc-struct-return} 23560switch is not binary compatible with code compiled with the 23561@option{-freg-struct-return} switch. 23562Use it to conform to a non-default application binary interface. 23563 23564@item -freg-struct-return 23565@opindex freg-struct-return 23566Return @code{struct} and @code{union} values in registers when possible. 23567This is more efficient for small structures than 23568@option{-fpcc-struct-return}. 23569 23570If you specify neither @option{-fpcc-struct-return} nor 23571@option{-freg-struct-return}, GCC defaults to whichever convention is 23572standard for the target. If there is no standard convention, GCC 23573defaults to @option{-fpcc-struct-return}, except on targets where GCC is 23574the principal compiler. In those cases, we can choose the standard, and 23575we chose the more efficient register return alternative. 23576 23577@strong{Warning:} code compiled with the @option{-freg-struct-return} 23578switch is not binary compatible with code compiled with the 23579@option{-fpcc-struct-return} switch. 23580Use it to conform to a non-default application binary interface. 23581 23582@item -fshort-enums 23583@opindex fshort-enums 23584Allocate to an @code{enum} type only as many bytes as it needs for the 23585declared range of possible values. Specifically, the @code{enum} type 23586is equivalent to the smallest integer type that has enough room. 23587 23588@strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate 23589code that is not binary compatible with code generated without that switch. 23590Use it to conform to a non-default application binary interface. 23591 23592@item -fshort-double 23593@opindex fshort-double 23594Use the same size for @code{double} as for @code{float}. 23595 23596@strong{Warning:} the @option{-fshort-double} switch causes GCC to generate 23597code that is not binary compatible with code generated without that switch. 23598Use it to conform to a non-default application binary interface. 23599 23600@item -fshort-wchar 23601@opindex fshort-wchar 23602Override the underlying type for @code{wchar_t} to be @code{short 23603unsigned int} instead of the default for the target. This option is 23604useful for building programs to run under WINE@. 23605 23606@strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate 23607code that is not binary compatible with code generated without that switch. 23608Use it to conform to a non-default application binary interface. 23609 23610@item -fno-common 23611@opindex fno-common 23612In C code, controls the placement of uninitialized global variables. 23613Unix C compilers have traditionally permitted multiple definitions of 23614such variables in different compilation units by placing the variables 23615in a common block. 23616This is the behavior specified by @option{-fcommon}, and is the default 23617for GCC on most targets. 23618On the other hand, this behavior is not required by ISO C, and on some 23619targets may carry a speed or code size penalty on variable references. 23620The @option{-fno-common} option specifies that the compiler should place 23621uninitialized global variables in the data section of the object file, 23622rather than generating them as common blocks. 23623This has the effect that if the same variable is declared 23624(without @code{extern}) in two different compilations, 23625you get a multiple-definition error when you link them. 23626In this case, you must compile with @option{-fcommon} instead. 23627Compiling with @option{-fno-common} is useful on targets for which 23628it provides better performance, or if you wish to verify that the 23629program will work on other systems that always treat uninitialized 23630variable declarations this way. 23631 23632@item -fno-ident 23633@opindex fno-ident 23634Ignore the @code{#ident} directive. 23635 23636@item -finhibit-size-directive 23637@opindex finhibit-size-directive 23638Don't output a @code{.size} assembler directive, or anything else that 23639would cause trouble if the function is split in the middle, and the 23640two halves are placed at locations far apart in memory. This option is 23641used when compiling @file{crtstuff.c}; you should not need to use it 23642for anything else. 23643 23644@item -fverbose-asm 23645@opindex fverbose-asm 23646Put extra commentary information in the generated assembly code to 23647make it more readable. This option is generally only of use to those 23648who actually need to read the generated assembly code (perhaps while 23649debugging the compiler itself). 23650 23651@option{-fno-verbose-asm}, the default, causes the 23652extra information to be omitted and is useful when comparing two assembler 23653files. 23654 23655@item -frecord-gcc-switches 23656@opindex frecord-gcc-switches 23657This switch causes the command line used to invoke the 23658compiler to be recorded into the object file that is being created. 23659This switch is only implemented on some targets and the exact format 23660of the recording is target and binary file format dependent, but it 23661usually takes the form of a section containing ASCII text. This 23662switch is related to the @option{-fverbose-asm} switch, but that 23663switch only records information in the assembler output file as 23664comments, so it never reaches the object file. 23665See also @option{-grecord-gcc-switches} for another 23666way of storing compiler options into the object file. 23667 23668@item -fpic 23669@opindex fpic 23670@cindex global offset table 23671@cindex PIC 23672Generate position-independent code (PIC) suitable for use in a shared 23673library, if supported for the target machine. Such code accesses all 23674constant addresses through a global offset table (GOT)@. The dynamic 23675loader resolves the GOT entries when the program starts (the dynamic 23676loader is not part of GCC; it is part of the operating system). If 23677the GOT size for the linked executable exceeds a machine-specific 23678maximum size, you get an error message from the linker indicating that 23679@option{-fpic} does not work; in that case, recompile with @option{-fPIC} 23680instead. (These maximums are 8k on the SPARC and 32k 23681on the m68k and RS/6000. The x86 has no such limit.) 23682 23683Position-independent code requires special support, and therefore works 23684only on certain machines. For the x86, GCC supports PIC for System V 23685but not for the Sun 386i. Code generated for the IBM RS/6000 is always 23686position-independent. 23687 23688When this flag is set, the macros @code{__pic__} and @code{__PIC__} 23689are defined to 1. 23690 23691@item -fPIC 23692@opindex fPIC 23693If supported for the target machine, emit position-independent code, 23694suitable for dynamic linking and avoiding any limit on the size of the 23695global offset table. This option makes a difference on the m68k, 23696PowerPC and SPARC@. 23697 23698Position-independent code requires special support, and therefore works 23699only on certain machines. 23700 23701When this flag is set, the macros @code{__pic__} and @code{__PIC__} 23702are defined to 2. 23703 23704@item -fpie 23705@itemx -fPIE 23706@opindex fpie 23707@opindex fPIE 23708These options are similar to @option{-fpic} and @option{-fPIC}, but 23709generated position independent code can be only linked into executables. 23710Usually these options are used when @option{-pie} GCC option is 23711used during linking. 23712 23713@option{-fpie} and @option{-fPIE} both define the macros 23714@code{__pie__} and @code{__PIE__}. The macros have the value 1 23715for @option{-fpie} and 2 for @option{-fPIE}. 23716 23717@item -fno-jump-tables 23718@opindex fno-jump-tables 23719Do not use jump tables for switch statements even where it would be 23720more efficient than other code generation strategies. This option is 23721of use in conjunction with @option{-fpic} or @option{-fPIC} for 23722building code that forms part of a dynamic linker and cannot 23723reference the address of a jump table. On some targets, jump tables 23724do not require a GOT and this option is not needed. 23725 23726@item -ffixed-@var{reg} 23727@opindex ffixed 23728Treat the register named @var{reg} as a fixed register; generated code 23729should never refer to it (except perhaps as a stack pointer, frame 23730pointer or in some other fixed role). 23731 23732@var{reg} must be the name of a register. The register names accepted 23733are machine-specific and are defined in the @code{REGISTER_NAMES} 23734macro in the machine description macro file. 23735 23736This flag does not have a negative form, because it specifies a 23737three-way choice. 23738 23739@item -fcall-used-@var{reg} 23740@opindex fcall-used 23741Treat the register named @var{reg} as an allocable register that is 23742clobbered by function calls. It may be allocated for temporaries or 23743variables that do not live across a call. Functions compiled this way 23744do not save and restore the register @var{reg}. 23745 23746It is an error to use this flag with the frame pointer or stack pointer. 23747Use of this flag for other registers that have fixed pervasive roles in 23748the machine's execution model produces disastrous results. 23749 23750This flag does not have a negative form, because it specifies a 23751three-way choice. 23752 23753@item -fcall-saved-@var{reg} 23754@opindex fcall-saved 23755Treat the register named @var{reg} as an allocable register saved by 23756functions. It may be allocated even for temporaries or variables that 23757live across a call. Functions compiled this way save and restore 23758the register @var{reg} if they use it. 23759 23760It is an error to use this flag with the frame pointer or stack pointer. 23761Use of this flag for other registers that have fixed pervasive roles in 23762the machine's execution model produces disastrous results. 23763 23764A different sort of disaster results from the use of this flag for 23765a register in which function values may be returned. 23766 23767This flag does not have a negative form, because it specifies a 23768three-way choice. 23769 23770@item -fpack-struct[=@var{n}] 23771@opindex fpack-struct 23772Without a value specified, pack all structure members together without 23773holes. When a value is specified (which must be a small power of two), pack 23774structure members according to this value, representing the maximum 23775alignment (that is, objects with default alignment requirements larger than 23776this are output potentially unaligned at the next fitting location. 23777 23778@strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate 23779code that is not binary compatible with code generated without that switch. 23780Additionally, it makes the code suboptimal. 23781Use it to conform to a non-default application binary interface. 23782 23783@item -finstrument-functions 23784@opindex finstrument-functions 23785Generate instrumentation calls for entry and exit to functions. Just 23786after function entry and just before function exit, the following 23787profiling functions are called with the address of the current 23788function and its call site. (On some platforms, 23789@code{__builtin_return_address} does not work beyond the current 23790function, so the call site information may not be available to the 23791profiling functions otherwise.) 23792 23793@smallexample 23794void __cyg_profile_func_enter (void *this_fn, 23795 void *call_site); 23796void __cyg_profile_func_exit (void *this_fn, 23797 void *call_site); 23798@end smallexample 23799 23800The first argument is the address of the start of the current function, 23801which may be looked up exactly in the symbol table. 23802 23803This instrumentation is also done for functions expanded inline in other 23804functions. The profiling calls indicate where, conceptually, the 23805inline function is entered and exited. This means that addressable 23806versions of such functions must be available. If all your uses of a 23807function are expanded inline, this may mean an additional expansion of 23808code size. If you use @code{extern inline} in your C code, an 23809addressable version of such functions must be provided. (This is 23810normally the case anyway, but if you get lucky and the optimizer always 23811expands the functions inline, you might have gotten away without 23812providing static copies.) 23813 23814A function may be given the attribute @code{no_instrument_function}, in 23815which case this instrumentation is not done. This can be used, for 23816example, for the profiling functions listed above, high-priority 23817interrupt routines, and any functions from which the profiling functions 23818cannot safely be called (perhaps signal handlers, if the profiling 23819routines generate output or allocate memory). 23820 23821@item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} 23822@opindex finstrument-functions-exclude-file-list 23823 23824Set the list of functions that are excluded from instrumentation (see 23825the description of @option{-finstrument-functions}). If the file that 23826contains a function definition matches with one of @var{file}, then 23827that function is not instrumented. The match is done on substrings: 23828if the @var{file} parameter is a substring of the file name, it is 23829considered to be a match. 23830 23831For example: 23832 23833@smallexample 23834-finstrument-functions-exclude-file-list=/bits/stl,include/sys 23835@end smallexample 23836 23837@noindent 23838excludes any inline function defined in files whose pathnames 23839contain @file{/bits/stl} or @file{include/sys}. 23840 23841If, for some reason, you want to include letter @samp{,} in one of 23842@var{sym}, write @samp{\,}. For example, 23843@option{-finstrument-functions-exclude-file-list='\,\,tmp'} 23844(note the single quote surrounding the option). 23845 23846@item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} 23847@opindex finstrument-functions-exclude-function-list 23848 23849This is similar to @option{-finstrument-functions-exclude-file-list}, 23850but this option sets the list of function names to be excluded from 23851instrumentation. The function name to be matched is its user-visible 23852name, such as @code{vector<int> blah(const vector<int> &)}, not the 23853internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The 23854match is done on substrings: if the @var{sym} parameter is a substring 23855of the function name, it is considered to be a match. For C99 and C++ 23856extended identifiers, the function name must be given in UTF-8, not 23857using universal character names. 23858 23859@item -fstack-check 23860@opindex fstack-check 23861Generate code to verify that you do not go beyond the boundary of the 23862stack. You should specify this flag if you are running in an 23863environment with multiple threads, but you only rarely need to specify it in 23864a single-threaded environment since stack overflow is automatically 23865detected on nearly all systems if there is only one stack. 23866 23867Note that this switch does not actually cause checking to be done; the 23868operating system or the language runtime must do that. The switch causes 23869generation of code to ensure that they see the stack being extended. 23870 23871You can additionally specify a string parameter: @samp{no} means no 23872checking, @samp{generic} means force the use of old-style checking, 23873@samp{specific} means use the best checking method and is equivalent 23874to bare @option{-fstack-check}. 23875 23876Old-style checking is a generic mechanism that requires no specific 23877target support in the compiler but comes with the following drawbacks: 23878 23879@enumerate 23880@item 23881Modified allocation strategy for large objects: they are always 23882allocated dynamically if their size exceeds a fixed threshold. 23883 23884@item 23885Fixed limit on the size of the static frame of functions: when it is 23886topped by a particular function, stack checking is not reliable and 23887a warning is issued by the compiler. 23888 23889@item 23890Inefficiency: because of both the modified allocation strategy and the 23891generic implementation, code performance is hampered. 23892@end enumerate 23893 23894Note that old-style stack checking is also the fallback method for 23895@samp{specific} if no target support has been added in the compiler. 23896 23897@item -fstack-limit-register=@var{reg} 23898@itemx -fstack-limit-symbol=@var{sym} 23899@itemx -fno-stack-limit 23900@opindex fstack-limit-register 23901@opindex fstack-limit-symbol 23902@opindex fno-stack-limit 23903Generate code to ensure that the stack does not grow beyond a certain value, 23904either the value of a register or the address of a symbol. If a larger 23905stack is required, a signal is raised at run time. For most targets, 23906the signal is raised before the stack overruns the boundary, so 23907it is possible to catch the signal without taking special precautions. 23908 23909For instance, if the stack starts at absolute address @samp{0x80000000} 23910and grows downwards, you can use the flags 23911@option{-fstack-limit-symbol=__stack_limit} and 23912@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit 23913of 128KB@. Note that this may only work with the GNU linker. 23914 23915@item -fsplit-stack 23916@opindex fsplit-stack 23917Generate code to automatically split the stack before it overflows. 23918The resulting program has a discontiguous stack which can only 23919overflow if the program is unable to allocate any more memory. This 23920is most useful when running threaded programs, as it is no longer 23921necessary to calculate a good stack size to use for each thread. This 23922is currently only implemented for the x86 targets running 23923GNU/Linux. 23924 23925When code compiled with @option{-fsplit-stack} calls code compiled 23926without @option{-fsplit-stack}, there may not be much stack space 23927available for the latter code to run. If compiling all code, 23928including library code, with @option{-fsplit-stack} is not an option, 23929then the linker can fix up these calls so that the code compiled 23930without @option{-fsplit-stack} always has a large stack. Support for 23931this is implemented in the gold linker in GNU binutils release 2.21 23932and later. 23933 23934@item -fleading-underscore 23935@opindex fleading-underscore 23936This option and its counterpart, @option{-fno-leading-underscore}, forcibly 23937change the way C symbols are represented in the object file. One use 23938is to help link with legacy assembly code. 23939 23940@strong{Warning:} the @option{-fleading-underscore} switch causes GCC to 23941generate code that is not binary compatible with code generated without that 23942switch. Use it to conform to a non-default application binary interface. 23943Not all targets provide complete support for this switch. 23944 23945@item -ftls-model=@var{model} 23946@opindex ftls-model 23947Alter the thread-local storage model to be used (@pxref{Thread-Local}). 23948The @var{model} argument should be one of @samp{global-dynamic}, 23949@samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}. 23950Note that the choice is subject to optimization: the compiler may use 23951a more efficient model for symbols not visible outside of the translation 23952unit, or if @option{-fpic} is not given on the command line. 23953 23954The default without @option{-fpic} is @samp{initial-exec}; with 23955@option{-fpic} the default is @samp{global-dynamic}. 23956 23957@item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} 23958@opindex fvisibility 23959Set the default ELF image symbol visibility to the specified option---all 23960symbols are marked with this unless overridden within the code. 23961Using this feature can very substantially improve linking and 23962load times of shared object libraries, produce more optimized 23963code, provide near-perfect API export and prevent symbol clashes. 23964It is @strong{strongly} recommended that you use this in any shared objects 23965you distribute. 23966 23967Despite the nomenclature, @samp{default} always means public; i.e., 23968available to be linked against from outside the shared object. 23969@samp{protected} and @samp{internal} are pretty useless in real-world 23970usage so the only other commonly used option is @samp{hidden}. 23971The default if @option{-fvisibility} isn't specified is 23972@samp{default}, i.e., make every symbol public. 23973 23974A good explanation of the benefits offered by ensuring ELF 23975symbols have the correct visibility is given by ``How To Write 23976Shared Libraries'' by Ulrich Drepper (which can be found at 23977@w{@uref{http://www.akkadia.org/drepper/}})---however a superior 23978solution made possible by this option to marking things hidden when 23979the default is public is to make the default hidden and mark things 23980public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden} 23981and @code{__attribute__ ((visibility("default")))} instead of 23982@code{__declspec(dllexport)} you get almost identical semantics with 23983identical syntax. This is a great boon to those working with 23984cross-platform projects. 23985 23986For those adding visibility support to existing code, you may find 23987@code{#pragma GCC visibility} of use. This works by you enclosing 23988the declarations you wish to set visibility for with (for example) 23989@code{#pragma GCC visibility push(hidden)} and 23990@code{#pragma GCC visibility pop}. 23991Bear in mind that symbol visibility should be viewed @strong{as 23992part of the API interface contract} and thus all new code should 23993always specify visibility when it is not the default; i.e., declarations 23994only for use within the local DSO should @strong{always} be marked explicitly 23995as hidden as so to avoid PLT indirection overheads---making this 23996abundantly clear also aids readability and self-documentation of the code. 23997Note that due to ISO C++ specification requirements, @code{operator new} and 23998@code{operator delete} must always be of default visibility. 23999 24000Be aware that headers from outside your project, in particular system 24001headers and headers from any other library you use, may not be 24002expecting to be compiled with visibility other than the default. You 24003may need to explicitly say @code{#pragma GCC visibility push(default)} 24004before including any such headers. 24005 24006@code{extern} declarations are not affected by @option{-fvisibility}, so 24007a lot of code can be recompiled with @option{-fvisibility=hidden} with 24008no modifications. However, this means that calls to @code{extern} 24009functions with no explicit visibility use the PLT, so it is more 24010effective to use @code{__attribute ((visibility))} and/or 24011@code{#pragma GCC visibility} to tell the compiler which @code{extern} 24012declarations should be treated as hidden. 24013 24014Note that @option{-fvisibility} does affect C++ vague linkage 24015entities. This means that, for instance, an exception class that is 24016be thrown between DSOs must be explicitly marked with default 24017visibility so that the @samp{type_info} nodes are unified between 24018the DSOs. 24019 24020An overview of these techniques, their benefits and how to use them 24021is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}. 24022 24023@item -fstrict-volatile-bitfields 24024@opindex fstrict-volatile-bitfields 24025This option should be used if accesses to volatile bit-fields (or other 24026structure fields, although the compiler usually honors those types 24027anyway) should use a single access of the width of the 24028field's type, aligned to a natural alignment if possible. For 24029example, targets with memory-mapped peripheral registers might require 24030all such accesses to be 16 bits wide; with this flag you can 24031declare all peripheral bit-fields as @code{unsigned short} (assuming short 24032is 16 bits on these targets) to force GCC to use 16-bit accesses 24033instead of, perhaps, a more efficient 32-bit access. 24034 24035If this option is disabled, the compiler uses the most efficient 24036instruction. In the previous example, that might be a 32-bit load 24037instruction, even though that accesses bytes that do not contain 24038any portion of the bit-field, or memory-mapped registers unrelated to 24039the one being updated. 24040 24041In some cases, such as when the @code{packed} attribute is applied to a 24042structure field, it may not be possible to access the field with a single 24043read or write that is correctly aligned for the target machine. In this 24044case GCC falls back to generating multiple accesses rather than code that 24045will fault or truncate the result at run time. 24046 24047Note: Due to restrictions of the C/C++11 memory model, write accesses are 24048not allowed to touch non bit-field members. It is therefore recommended 24049to define all bits of the field's type as bit-field members. 24050 24051The default value of this option is determined by the application binary 24052interface for the target processor. 24053 24054@item -fsync-libcalls 24055@opindex fsync-libcalls 24056This option controls whether any out-of-line instance of the @code{__sync} 24057family of functions may be used to implement the C++11 @code{__atomic} 24058family of functions. 24059 24060The default value of this option is enabled, thus the only useful form 24061of the option is @option{-fno-sync-libcalls}. This option is used in 24062the implementation of the @file{libatomic} runtime library. 24063 24064@end table 24065 24066@c man end 24067 24068@node Environment Variables 24069@section Environment Variables Affecting GCC 24070@cindex environment variables 24071 24072@c man begin ENVIRONMENT 24073This section describes several environment variables that affect how GCC 24074operates. Some of them work by specifying directories or prefixes to use 24075when searching for various kinds of files. Some are used to specify other 24076aspects of the compilation environment. 24077 24078Note that you can also specify places to search using options such as 24079@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These 24080take precedence over places specified using environment variables, which 24081in turn take precedence over those specified by the configuration of GCC@. 24082@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint, 24083GNU Compiler Collection (GCC) Internals}. 24084 24085@table @env 24086@item LANG 24087@itemx LC_CTYPE 24088@c @itemx LC_COLLATE 24089@itemx LC_MESSAGES 24090@c @itemx LC_MONETARY 24091@c @itemx LC_NUMERIC 24092@c @itemx LC_TIME 24093@itemx LC_ALL 24094@findex LANG 24095@findex LC_CTYPE 24096@c @findex LC_COLLATE 24097@findex LC_MESSAGES 24098@c @findex LC_MONETARY 24099@c @findex LC_NUMERIC 24100@c @findex LC_TIME 24101@findex LC_ALL 24102@cindex locale 24103These environment variables control the way that GCC uses 24104localization information which allows GCC to work with different 24105national conventions. GCC inspects the locale categories 24106@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do 24107so. These locale categories can be set to any value supported by your 24108installation. A typical value is @samp{en_GB.UTF-8} for English in the United 24109Kingdom encoded in UTF-8. 24110 24111The @env{LC_CTYPE} environment variable specifies character 24112classification. GCC uses it to determine the character boundaries in 24113a string; this is needed for some multibyte encodings that contain quote 24114and escape characters that are otherwise interpreted as a string 24115end or escape. 24116 24117The @env{LC_MESSAGES} environment variable specifies the language to 24118use in diagnostic messages. 24119 24120If the @env{LC_ALL} environment variable is set, it overrides the value 24121of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE} 24122and @env{LC_MESSAGES} default to the value of the @env{LANG} 24123environment variable. If none of these variables are set, GCC 24124defaults to traditional C English behavior. 24125 24126@item TMPDIR 24127@findex TMPDIR 24128If @env{TMPDIR} is set, it specifies the directory to use for temporary 24129files. GCC uses temporary files to hold the output of one stage of 24130compilation which is to be used as input to the next stage: for example, 24131the output of the preprocessor, which is the input to the compiler 24132proper. 24133 24134@item GCC_COMPARE_DEBUG 24135@findex GCC_COMPARE_DEBUG 24136Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing 24137@option{-fcompare-debug} to the compiler driver. See the documentation 24138of this option for more details. 24139 24140@item GCC_EXEC_PREFIX 24141@findex GCC_EXEC_PREFIX 24142If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the 24143names of the subprograms executed by the compiler. No slash is added 24144when this prefix is combined with the name of a subprogram, but you can 24145specify a prefix that ends with a slash if you wish. 24146 24147If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out 24148an appropriate prefix to use based on the pathname it is invoked with. 24149 24150If GCC cannot find the subprogram using the specified prefix, it 24151tries looking in the usual places for the subprogram. 24152 24153The default value of @env{GCC_EXEC_PREFIX} is 24154@file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to 24155the installed compiler. In many cases @var{prefix} is the value 24156of @code{prefix} when you ran the @file{configure} script. 24157 24158Other prefixes specified with @option{-B} take precedence over this prefix. 24159 24160This prefix is also used for finding files such as @file{crt0.o} that are 24161used for linking. 24162 24163In addition, the prefix is used in an unusual way in finding the 24164directories to search for header files. For each of the standard 24165directories whose name normally begins with @samp{/usr/local/lib/gcc} 24166(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries 24167replacing that beginning with the specified prefix to produce an 24168alternate directory name. Thus, with @option{-Bfoo/}, GCC searches 24169@file{foo/bar} just before it searches the standard directory 24170@file{/usr/local/lib/bar}. 24171If a standard directory begins with the configured 24172@var{prefix} then the value of @var{prefix} is replaced by 24173@env{GCC_EXEC_PREFIX} when looking for header files. 24174 24175@item COMPILER_PATH 24176@findex COMPILER_PATH 24177The value of @env{COMPILER_PATH} is a colon-separated list of 24178directories, much like @env{PATH}. GCC tries the directories thus 24179specified when searching for subprograms, if it can't find the 24180subprograms using @env{GCC_EXEC_PREFIX}. 24181 24182@item LIBRARY_PATH 24183@findex LIBRARY_PATH 24184The value of @env{LIBRARY_PATH} is a colon-separated list of 24185directories, much like @env{PATH}. When configured as a native compiler, 24186GCC tries the directories thus specified when searching for special 24187linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking 24188using GCC also uses these directories when searching for ordinary 24189libraries for the @option{-l} option (but directories specified with 24190@option{-L} come first). 24191 24192@item LANG 24193@findex LANG 24194@cindex locale definition 24195This variable is used to pass locale information to the compiler. One way in 24196which this information is used is to determine the character set to be used 24197when character literals, string literals and comments are parsed in C and C++. 24198When the compiler is configured to allow multibyte characters, 24199the following values for @env{LANG} are recognized: 24200 24201@table @samp 24202@item C-JIS 24203Recognize JIS characters. 24204@item C-SJIS 24205Recognize SJIS characters. 24206@item C-EUCJP 24207Recognize EUCJP characters. 24208@end table 24209 24210If @env{LANG} is not defined, or if it has some other value, then the 24211compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to 24212recognize and translate multibyte characters. 24213@end table 24214 24215@noindent 24216Some additional environment variables affect the behavior of the 24217preprocessor. 24218 24219@include cppenv.texi 24220 24221@c man end 24222 24223@node Precompiled Headers 24224@section Using Precompiled Headers 24225@cindex precompiled headers 24226@cindex speed of compilation 24227 24228Often large projects have many header files that are included in every 24229source file. The time the compiler takes to process these header files 24230over and over again can account for nearly all of the time required to 24231build the project. To make builds faster, GCC allows you to 24232@dfn{precompile} a header file. 24233 24234To create a precompiled header file, simply compile it as you would any 24235other file, if necessary using the @option{-x} option to make the driver 24236treat it as a C or C++ header file. You may want to use a 24237tool like @command{make} to keep the precompiled header up-to-date when 24238the headers it contains change. 24239 24240A precompiled header file is searched for when @code{#include} is 24241seen in the compilation. As it searches for the included file 24242(@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the 24243compiler looks for a precompiled header in each directory just before it 24244looks for the include file in that directory. The name searched for is 24245the name specified in the @code{#include} with @samp{.gch} appended. If 24246the precompiled header file can't be used, it is ignored. 24247 24248For instance, if you have @code{#include "all.h"}, and you have 24249@file{all.h.gch} in the same directory as @file{all.h}, then the 24250precompiled header file is used if possible, and the original 24251header is used otherwise. 24252 24253Alternatively, you might decide to put the precompiled header file in a 24254directory and use @option{-I} to ensure that directory is searched 24255before (or instead of) the directory containing the original header. 24256Then, if you want to check that the precompiled header file is always 24257used, you can put a file of the same name as the original header in this 24258directory containing an @code{#error} command. 24259 24260This also works with @option{-include}. So yet another way to use 24261precompiled headers, good for projects not designed with precompiled 24262header files in mind, is to simply take most of the header files used by 24263a project, include them from another header file, precompile that header 24264file, and @option{-include} the precompiled header. If the header files 24265have guards against multiple inclusion, they are skipped because 24266they've already been included (in the precompiled header). 24267 24268If you need to precompile the same header file for different 24269languages, targets, or compiler options, you can instead make a 24270@emph{directory} named like @file{all.h.gch}, and put each precompiled 24271header in the directory, perhaps using @option{-o}. It doesn't matter 24272what you call the files in the directory; every precompiled header in 24273the directory is considered. The first precompiled header 24274encountered in the directory that is valid for this compilation is 24275used; they're searched in no particular order. 24276 24277There are many other possibilities, limited only by your imagination, 24278good sense, and the constraints of your build system. 24279 24280A precompiled header file can be used only when these conditions apply: 24281 24282@itemize 24283@item 24284Only one precompiled header can be used in a particular compilation. 24285 24286@item 24287A precompiled header can't be used once the first C token is seen. You 24288can have preprocessor directives before a precompiled header; you cannot 24289include a precompiled header from inside another header. 24290 24291@item 24292The precompiled header file must be produced for the same language as 24293the current compilation. You can't use a C precompiled header for a C++ 24294compilation. 24295 24296@item 24297The precompiled header file must have been produced by the same compiler 24298binary as the current compilation is using. 24299 24300@item 24301Any macros defined before the precompiled header is included must 24302either be defined in the same way as when the precompiled header was 24303generated, or must not affect the precompiled header, which usually 24304means that they don't appear in the precompiled header at all. 24305 24306The @option{-D} option is one way to define a macro before a 24307precompiled header is included; using a @code{#define} can also do it. 24308There are also some options that define macros implicitly, like 24309@option{-O} and @option{-Wdeprecated}; the same rule applies to macros 24310defined this way. 24311 24312@item If debugging information is output when using the precompiled 24313header, using @option{-g} or similar, the same kind of debugging information 24314must have been output when building the precompiled header. However, 24315a precompiled header built using @option{-g} can be used in a compilation 24316when no debugging information is being output. 24317 24318@item The same @option{-m} options must generally be used when building 24319and using the precompiled header. @xref{Submodel Options}, 24320for any cases where this rule is relaxed. 24321 24322@item Each of the following options must be the same when building and using 24323the precompiled header: 24324 24325@gccoptlist{-fexceptions} 24326 24327@item 24328Some other command-line options starting with @option{-f}, 24329@option{-p}, or @option{-O} must be defined in the same way as when 24330the precompiled header was generated. At present, it's not clear 24331which options are safe to change and which are not; the safest choice 24332is to use exactly the same options when generating and using the 24333precompiled header. The following are known to be safe: 24334 24335@gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol 24336-fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol 24337-fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol 24338-pedantic-errors} 24339 24340@end itemize 24341 24342For all of these except the last, the compiler automatically 24343ignores the precompiled header if the conditions aren't met. If you 24344find an option combination that doesn't work and doesn't cause the 24345precompiled header to be ignored, please consider filing a bug report, 24346see @ref{Bugs}. 24347 24348If you do use differing options when generating and using the 24349precompiled header, the actual behavior is a mixture of the 24350behavior for the options. For instance, if you use @option{-g} to 24351generate the precompiled header but not when using it, you may or may 24352not get debugging information for routines in the precompiled header. 24353